address_list_export.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:8k
源码类别:

电子政务应用

开发平台:

Java

  1. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  2. <%@ page import="com.vnex.intranet.addresslist.value.*"%>
  3. <%@ page import="com.vnex.intranet.addresslist.proxy.*"%>
  4. <%@ page import="com.vnex.intranet.system.loader.ConfigParaLoader"%>
  5. <%@ page import="com.vnex.intranet.util.*"%>
  6. <%@ page import="java.util.*" %>
  7. <%@ page import="java.sql.*" %>
  8. <%@ page import="java.io.*" %>
  9. <jsp:useBean id="addressProxy" class="com.vnex.intranet.addresslist.proxy.AddressProxyBean" scope="application" />
  10. <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
  11. <%
  12.   String contactName = "";
  13.   String nickName = "";
  14.   String birthday = "";
  15.   String gender = "";
  16.   String emailAddress = "";
  17.   String anotherEmail = "";
  18.   String personalUrl = "";
  19.   String oicqNum = "";
  20.   String pagerNum = "";
  21.   String mobileNum = "";
  22.   String homeAddress = "";
  23.   String homePC = "";
  24.   String homeTeleNum = "";
  25.   String unit = "";
  26.   String position = "";
  27.   String unitAddress = "";
  28.   String unitTeleNum = "";
  29.   String unitPC = "";
  30.   String unitFaxNum = "";
  31.   String notes = "";
  32.   
  33.   FileWriter resultsFile = null;
  34.   String root = ConfigParaLoader.getParameter("rootUrl");
  35.       
  36.   if( request.getParameter("export")!=null && request.getParameter("export").equals("ok") )
  37.   {
  38.     
  39.     try
  40.     {
  41.       int empId = BusinessName.getEmpId();
  42.       Collection coll = null;
  43.       String condition = " where emp_id="+empId;;
  44.       coll = addressProxy.getContactList(condition);
  45.       AddresslistValueBean alvb = null;
  46.       
  47.       //是否目录存在
  48.       File f = new File(root+"\CSVFile\");
  49.       if(!f.isDirectory())
  50.       {
  51.         f.mkdir();
  52.       }
  53.       
  54.       resultsFile = new FileWriter(root+"\CSVFile\NetOffice"+BusinessName.getEmpId()+".csv");
  55.       PrintWriter toFile = new PrintWriter(resultsFile);
  56.       toFile.println(""姓名","昵称","生日","性别","电子邮件地址","备用邮件地址","个人 Web 页","OICQ","寻呼机","移动电话","家庭地址","家庭所在地的邮政编码","家庭电话","工作单位","职务","单位地址","单位电话","单位邮编","单位传真","备注"");
  57.       
  58.       if(coll != null && coll.size() != 0)
  59.       {
  60.         Iterator it = coll.iterator();
  61.         while( it.hasNext() )
  62.         {
  63.           alvb = (AddresslistValueBean)it.next();
  64.           
  65.           if(alvb.getContactName()!=null)
  66.             contactName = alvb.getContactName();
  67.           if(alvb.getNickName()!=null)
  68.             nickName = alvb.getNickName();
  69.           if(alvb.getBirthday()!=null)
  70.           {
  71.             Timestamp tt = TimeStamp.convertCalendarToTimestamp(alvb.getBirthday());
  72.             birthday = MyDateFormat.myDate(tt);
  73.           }
  74.           if(alvb.getGender()==0)
  75.             gender = "男";
  76.           if(alvb.getGender()==1)
  77.             gender = "女";
  78.           if(alvb.getEmailAddress()!=null)
  79.             emailAddress = alvb.getEmailAddress();
  80.           if(alvb.getAnotherEmail()!=null)
  81.             anotherEmail = alvb.getAnotherEmail();
  82.           if(alvb.getPersonalUrl()!=null)
  83.             personalUrl = alvb.getPersonalUrl();
  84.           if(alvb.getOicqNum()!=null)
  85.             oicqNum = alvb.getOicqNum();
  86.           if(alvb.getPagerNum()!=null)
  87.             pagerNum = alvb.getPagerNum();
  88.           if(alvb.getMobileNum()!=null)
  89.             mobileNum = alvb.getMobileNum();
  90.           if(alvb.getHomeAddress()!=null)
  91.             homeAddress = alvb.getHomeAddress();
  92.           if(alvb.getHomePC()!=null)
  93.             homePC = alvb.getHomePC();
  94.           if(alvb.getHomeTeleNum()!=null)
  95.             homeTeleNum = alvb.getHomeTeleNum();
  96.           if(alvb.getUnit()!=null)
  97.             unit = alvb.getUnit();
  98.           if(alvb.getPosition()!=null)
  99.             position = alvb.getPosition();
  100.           if(alvb.getUnitAddress()!=null)
  101.             unitAddress = alvb.getUnitAddress();
  102.           if(alvb.getUnitTeleNum()!=null)
  103.             unitTeleNum = alvb.getUnitTeleNum();
  104.           if(alvb.getUnitPC()!=null)
  105.             unitPC = alvb.getUnitPC();
  106.           if(alvb.getUnitFaxNum()!=null)
  107.             unitFaxNum = alvb.getUnitFaxNum();
  108.           if(alvb.getNotes()!=null)
  109.             notes = alvb.getNotes();
  110.         
  111.           toFile.println("""+contactName+"",""+nickName+"","+
  112.                          """+birthday+"",""+gender+"","+
  113.                          """+emailAddress+"",""+anotherEmail+"","+
  114.                          """+personalUrl+"",""+oicqNum+"","+
  115.                          """+pagerNum+"",""+mobileNum+"","+
  116.                          """+homeAddress+"",""+homePC+"","+
  117.                          """+homeTeleNum+"",""+unit+"","+
  118.                          """+position+"",""+unitAddress+"","+
  119.                          """+unitTeleNum+"",""+unitPC+"","+
  120.                          """+unitFaxNum+"",""+notes+""");
  121.           
  122.           contactName = "";
  123.           nickName = "";
  124.           birthday = "";
  125.           gender = "";
  126.           emailAddress = "";
  127.           anotherEmail = "";
  128.           personalUrl = "";
  129.           oicqNum = "";
  130.           pagerNum = "";
  131.           mobileNum = "";
  132.           homeAddress = "";
  133.           homePC = "";
  134.           homeTeleNum = "";
  135.           unit = "";
  136.           position = "";
  137.           unitAddress = "";
  138.           unitTeleNum = "";
  139.           unitPC = "";
  140.           unitFaxNum = "";
  141.           notes = "";
  142.         }
  143.       }
  144.       resultsFile.close();
  145.       
  146.     }
  147.     catch(Exception e)
  148.     {
  149.       System.out.println("e:"+e);
  150.     }
  151.   }
  152. %>
  153. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  154. <HTML>
  155. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  156. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  157. <script language="javascript" src="/vnex/validate.js" ></script>
  158. <script language="JavaScript">
  159. function exportt()
  160. {
  161.   document.myform.action = "/mainctrl/addressbook/export?export=ok";
  162.   document.myform.submit();
  163. }
  164. </script>
  165. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_person.js"></script>
  166. <script language="JavaScript" src="/vnex/menu/dockmenu.js"></script>
  167. <DIV align=center>
  168. <form name="myform" method="post" action="">
  169.   <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  170.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  171.     <TR>
  172.         <TD colSpan=3 align="center"><br>
  173.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  174.             <tr> 
  175.               <td align="center" colspan="2" bgcolor="#FFFFFF"> 
  176.                 <table width="600" border="0" cellspacing="0" cellpadding="0">
  177.                   <tr bgcolor="#666666"> 
  178.                       <td colspan="2"><font class="strongw"><a href="/mainctrl/home/index"><font color="#ffffff">主页</font></a>&gt;&gt;<a href="/mainctrl/personal/main"><font color="#ffffff">个人办公</font></a>&gt;&gt;<a href="/mainctrl/addressbook/home"><font color="#ffffff">个人通讯录</font></a>&gt;&gt;导出</font>
  179.                       </td>
  180.                   </tr>
  181.                 </table>
  182.                 <table class=title border="0" cellpadding="2" cellspacing="1" width="600">
  183.               <tr bgcolor="#e0e0e0">
  184.                 <td width="15%"><strong>&nbsp;说明:</strong></td> 
  185.                 <td> 
  186.                 <a href="/mainctrl/addressbook/help"><font color="#0000FF">导入导出说明</font></a>
  187. <%
  188.   if( request.getParameter("export")!=null && request.getParameter("export").equals("ok") )
  189.   {
  190. %>
  191. <a href="/CSVFile/NetOffice<%= BusinessName.getEmpId()%>.csv" target="_blank"><font color="#0000FF">NetOffice.csv</font></a>
  192. <%
  193.   }
  194. %>
  195.              </td>
  196.              <tr bgcolor="#fafafa" height="30">
  197.                <td colspan="2" align="center">
  198.                  <input type="button" name="Button2" value="导出" onClick="exportt()" class="text">&nbsp;&nbsp;
  199.                  <input type="button" name="Button3" value="返回" onClick="location='/mainctrl/addressbook/home'" class="text">     
  200.                  </td>
  201.               </tr>
  202.            </table>
  203.                </td>
  204.             </tr>
  205.           </table>
  206.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  207.        </TD>
  208.       </TR>
  209.       <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  210.    </TABLE>
  211.     <br>
  212.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  213. </form></DIV>
  214. </BODY></HTML>