Iterator用法例子

<%--
中软万维网络技术有限公司,版权所有。
文件名:UserMgrList.jsp
描  述:人员管理列表
创建者:Lixiang(lixiang@cssweb.com.cn)
创建日期:2006-5-10
--%>
<%request.setCharacterEncoding("GBK");%>
<%@ page contentType="text/html;charset=GBK"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/display-tag" prefix="display" %>
<%@ taglib uri="/tags/css-paging" prefix="paging"%>

<%@ page import="java.net.URLEncoder"%>
<%@ page import="java.text.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.css.security.*"%>
<%@ page import="com.css.security.org.*"%>
<%@ page import="com.css.security.user.*"%>
<%@ page import="com.css.core.category.*"%>
<%@ page import="com.tebon.hr.leavermanage.model.*"%>

<%
 long id = 1766 ;
 Department dept = null ;
 Organization org = null ;
 java.util.Iterator iteDept = null;
 java.util.Iterator iteChildDept = null;
 java.util.Iterator iteUser = null;
 
 com.css.security.SecurityManager sm = SecurityManagerFactory.getSecurityManager() ;
 org = sm.getDefaultOrganization() ;
 dept = org.getDepartment(id) ;//root department
 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
%>
<html>
<head>
<title>德邦证券办公自动化系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link href="/css/style.css" rel="stylesheet" type="text/css">
<SCRIPT src="/js/allchk.js"></SCRIPT>
<script language="javascript">
function submitDelete(oSrc){
 isCheck = isChecked(oSrc);
 if(isCheck == true){
  if (confirm ("是否确认删除已选定信息!"))
  {
   oSrc = eval(oSrc);
   oSrc.action = "/delEstateCompetence.do";
   oSrc.submit();
  }
 }else{
  alert("请先选择要删除的对象.");
 }
}
function isChecked(oSrc){
 oSrc = eval(oSrc).chBox;
 if(oSrc!=null)
 {
  for (i=oSrc.length-1;i>=0;i--){
   if (oSrc[i].checked){return true;}
  }
  if (oSrc.checked){return true;}
 }
 return false;
}
</script>
</head>

<body leftmargin="0">
<table width="95%" height="35" border="0" align="center" cellpadding="0" cellspacing="0" class="table-border1">
  <tr>
    <td width="5" class="table-header"></td>
    <td width="480" class="table-header"><img src="/pic/icon/header_icon.gif" width="17" height="18" align="absmiddle">
      人员管理</td>
  </tr>
</table>
<table width="95%" height="3" border="0" align="center" cellpadding="0" cellspacing="0" class="table-border2">
  <tr>
    <td background="/pic/share/header_linebg.jpg"></td>
  </tr>
</table>
<table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0" class="table-border2">
  <tr>
    <td colspan="2" align="center" valign="top"><br>
      <table width="90%" border="0" cellspacing="1" cellpadding="1">
       
        <tr>
          <td height="28"> <a href="AddFileCommit.jsp">使用 </a>
            <a href="FileCommitList.jsp">文件提交历史</a> </td>
        </tr>
      </table>
<form action="" method=post name="selfrm">

      <table width="90%" id=tb border="0" cellpadding="1" cellspacing="1" class="subtable">
        <%--form action="" method=post name=selfrm--%>
  
  <%
  //先显示投行总部的人
  iteUser=dept.getOrderUsers();
  if(iteUser.hasNext())//显示投行总部的人
    {
     %>
  <%--tr class="subtable-alternate1">
            <td height="22" align="left" colspan="7"><font size="2"><%//=dept.getDeptName()%></font></td>
  </tr--%>
   <tr align="center" class="subtable-th">
            <td>姓名</td>
            <td height="25">部门</td>
            <td height="25">职务</td>
            <td>入职时间</td>
            <td>离职时间</td>
            <td>在职时间(月)</td>
            <td>部门调动情况</td>
    </tr>
    <%  
       while(iteUser.hasNext())
       { long userId = 0;
        User userTemp = (User)iteUser.next();
        userId = userTemp.getUserId();
     Object oduty = userTemp.getAttrValue("duty") ;
     Object obegin_work_time = userTemp.getAttrValue("begin_work_time") ;
     Date lssj = null;
     String strlssj = "";
     LeaverManage leaverManage = new LeaverManage();
     //leaverManage.setUserId(userId);
     leaverManage = LeaverManageController.selectById1(" user_id="+userId+" and delete_state=0");
     if(leaverManage!=null&&leaverManage.getLeaveTime()!=null)
     {
      lssj = leaverManage.getLeaveTime();
      if(leaverManage.getDeleteState()==0)
      {
       strlssj = formatter.format(lssj);
      }
     //System.out.println("date="+strlssj);
     }
     Date today = new Date();
     
        
      %>
       <tr class="subtable-alternate1">
            <td height="22" align="center"><%=userTemp.getRealName()%></td>
            <td height="22" align="center"><%=dept.getDeptName()%></td>
            <td height="22" align="center"><%=(""+oduty).equals("null")?"":oduty%></td>
            <td align="center"><%=(""+obegin_work_time).equals("null")?"":obegin_work_time%></td>
            <td align="center"><%=strlssj%></td>
            <td align="center"><%
   //计算在职时间算法
   String zaizhimonth = "";
   String start = ""+obegin_work_time;
   String end = strlssj;
   //System.out.println("start="+start);
   //System.out.println("lengh="+start.length());
   if(start.length()>6)
   {
   
    if(end.length()>0)
    {
     String endyear = end.substring(0,4);
     //System.out.println("endyear="+endyear);
     String startyear = start.substring(0,4);
     long year = Long.parseLong(endyear)-Long.parseLong(startyear);
     //System.out.println("year="+year);
     String endmonth = end.substring(5,7);
     //System.out.println("endmonth="+endmonth);
     String startmonth = start.substring(5,7);
     /*if(endmonth.startsWith("0"))
     {
      endmonth = endmonth.substring(1,2);
     }
     if(startmonth.startsWith("0"))
     {
      startmonth = startmonth.substring(1,2);
     }*/
     //System.out.println("endmonth1="+endmonth);
     //System.out.println("startmonth1="+startmonth);
     long month = Long.parseLong(endmonth)-Long.parseLong(startmonth);
     //System.out.println("month="+month);
     zaizhimonth = ""+(year*12+month);
    }else
    {
     end = formatter.format(today);
     String endyear = end.substring(0,4);
     //System.out.println("endyear="+endyear);
     String startyear = start.substring(0,4);
     //System.out.println("startyear="+startyear);
     long year = Long.parseLong(endyear)-Long.parseLong(startyear);
     //System.out.println("year="+year);
     String endmonth = end.substring(5,7);
     //System.out.println("endmonth="+endmonth);
     String startmonth = start.substring(5,7);
     /*if(endmonth.startsWith("0"))
     {
      endmonth = endmonth.substring(1,2);
     }
     if(startmonth.startsWith("0"))
     {
      startmonth = startmonth.substring(1,2);
     }*/
     //System.out.println("endmonth1="+endmonth);
     //System.out.println("startmonth1="+startmonth);
     long month = Long.parseLong(endmonth)-Long.parseLong(startmonth);
     //System.out.println("month="+month);
     zaizhimonth = ""+(year*12+month);
    }
   
   }
   %><%=zaizhimonth%></td>
            <td align="center">
   <%//从StationLogList.jsp取出部门调动的数据和方法%>
    <paging:page provider="<%=new com.tebon.hr.postadjust.view.model.PostAdjustListProvider(userId)%>"  blankLine="false" alterColor="#cccccc" tableId="tb">
    <paging:pageRow id="pa" type="com.tebon.hr.postadjust.model.PostAdjust">
    <%
               String olddeptName = "" ;
        String newdeptName = "" ;
        Organization org1 = sm.getDefaultOrganization() ;
        Department d = null ;
        d = org1.getDepartment(pa.getFormerDept()) ;
        if(d!=null)
         olddeptName = d.getDeptName();
        d = org1.getDepartment(pa.getNewDept()) ;
        if(d!=null)
         newdeptName = d.getDeptName();
           %>
    <%=olddeptName%>-><%=newdeptName%><br>
     </paging:pageRow>
     </paging:page></td>
    </tr>
    <%
      }
  }
    %>

 
 
 
 
 
 
   <%
   //投行总部下一级部门的人
    iteDept = dept.getChildren();//一级部门
    
    while(iteDept.hasNext())
    { Department depTemp = null;
     depTemp = (Department)iteDept.next();
       %>
     <%--tr class="subtable-alternate1">
            <td height="22" align="left" colspan="7"><font size="2"><%//=depTemp.getDeptName()%></font></td>
  </tr--%>
   <%
     iteUser = depTemp.getOrderUsers();
     if(iteUser.hasNext())//一级部门下面先显示本部门用户
     {
     %>
          <%--tr align="center" class="subtable-th">
            <td height="25">姓名</td>
            <td height="25">部门</td>
            <td>职务</td>
            <td>入职时间</td>
            <td>离职时间</td>
            <td>在职时间(月)</td>
            <td>部门调动情况</td>
    </tr--%>
    <%  
      
       while(iteUser.hasNext())
       { long userId = 0;
        
        
        User userTemp = (User)iteUser.next();
        userId = userTemp.getUserId();
     Object oduty = userTemp.getAttrValue("duty") ;
     Object obegin_work_time = userTemp.getAttrValue("begin_work_time") ;
     Date lssj = null;
     String strlssj = "";
     LeaverManage leaverManage = new LeaverManage();
     //leaverManage.setUserId(userId);
     leaverManage = LeaverManageController.selectById1(" user_id="+userId+" and delete_state=0");
     if(leaverManage!=null&&leaverManage.getLeaveTime()!=null)
     {
      lssj = leaverManage.getLeaveTime();
      //System.out.println("state="+leaverManage.getDeleteState());
      if(leaverManage.getDeleteState()==0)
      {
       strlssj = formatter.format(lssj);
      }
     //System.out.println("date="+strlssj);
     }
     Date today = new Date();
     
        
      %>
          <tr class="subtable-alternate1">
            <td height="22" align="center"><%=userTemp.getRealName()%></td>
            <td height="22" align="center"><%=depTemp.getDeptName()%></td>
            <td height="22" align="center"><%=(""+oduty).equals("null")?"":oduty%></td>
            <td align="center"><%=(""+obegin_work_time).equals("null")?"":obegin_work_time%></td>
            <td align="center"><%=strlssj%></td>
            <td align="center">
   <%
   //计算在职时间算法
   String zaizhimonth = "";
   String start = ""+obegin_work_time;
   String end = strlssj;
   if(start.length()>6)
   {
   //System.out.println("start="+start);
   //System.out.println("lengh="+start.length());
    if(end.length()>0)
    {
     String endyear = end.substring(0,4);
     //System.out.println("endyear="+endyear);
     String startyear = start.substring(0,4);
     long year = Long.parseLong(endyear)-Long.parseLong(startyear);
     //System.out.println("year="+year);
     String endmonth = end.substring(5,7);
     //System.out.println("endmonth="+endmonth);
     String startmonth = start.substring(5,7);
     /*if(endmonth.startsWith("0"))
     {
      endmonth = endmonth.substring(1,2);
     }
     if(startmonth.startsWith("0"))
     {
      startmonth = startmonth.substring(1,2);
     }*/
     //System.out.println("endmonth1="+endmonth);
     //System.out.println("startmonth1="+startmonth);
     long month = Long.parseLong(endmonth)-Long.parseLong(startmonth);
     //System.out.println("month="+month);
     zaizhimonth = ""+(year*12+month);
    }else
    {
     end = formatter.format(today);
     String endyear = end.substring(0,4);
     //System.out.println("endyear="+endyear);
     String startyear = start.substring(0,4);
     //System.out.println("startyear="+startyear);
     long year = Long.parseLong(endyear)-Long.parseLong(startyear);
     //System.out.println("year="+year);
     String endmonth = end.substring(5,7);
     //System.out.println("endmonth="+endmonth);
     String startmonth = start.substring(5,7);
     /*if(endmonth.startsWith("0"))
     {
      endmonth = endmonth.substring(1,2);
     }
     if(startmonth.startsWith("0"))
     {
      startmonth = startmonth.substring(1,2);
     }*/
     //System.out.println("endmonth1="+endmonth);
     //System.out.println("startmonth1="+startmonth);
     long month = Long.parseLong(endmonth)-Long.parseLong(startmonth);
     //System.out.println("month="+month);
     zaizhimonth = ""+(year*12+month);
    }
   
   }
   %><%=zaizhimonth%></td>
            <td align="center"><%//从StationLogList.jsp取出部门调动的数据和方法%>
    <paging:page provider="<%=new com.tebon.hr.postadjust.view.model.PostAdjustListProvider(userId)%>"  blankLine="false" alterColor="#cccccc" tableId="tb">
    <paging:pageRow id="pa" type="com.tebon.hr.postadjust.model.PostAdjust">
    <%
               String olddeptName = "" ;
        String newdeptName = "" ;
        Organization org1 = sm.getDefaultOrganization() ;
        Department d = null ;
        d = org1.getDepartment(pa.getFormerDept()) ;
        if(d!=null)
         olddeptName = d.getDeptName();
        d = org1.getDepartment(pa.getNewDept()) ;
        if(d!=null)
         newdeptName = d.getDeptName();
           %>
    <%=olddeptName%>-><%=newdeptName%><br>
     </paging:pageRow>
     </paging:page></td>
    </tr>
      <%    }//while
         }//end if
        }//end while
 %>
</table>
<table width="94%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td  align="center" height="30">
   <table width="95%">
            <tr>
             <td align="left"></td>
             <td align="right"></td>
            </tr>
           </table>
 </td>
  </tr>
 </table>
 </form></td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-border3">
  <tr>
    <td width="277">&nbsp;</td>
  </tr>
</table>
</body>
</html>
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值