⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 down_result_hq.jsp

📁 《jsp案例开发》这本书的源代码。包括源代码和相关的具体配置操作步骤。非常不错
💻 JSP
字号:
<%@ page    language="java"    contentType="text/html; charset=GBK"    import="imis.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.util.*,java.sql.*,java.io.*"%><%    request.setCharacterEncoding("GBK");    session=request.getSession();    Integer whichyear = (Integer)session.getAttribute("whichyear");;    session.setAttribute("whichyear",whichyear);    userStruct session_us=(userStruct)session.getAttribute("user");    if(session_us==null)      response.sendRedirect("../../login.html");    /*    else if(session_us.userAccess.intValue() == 6)//海区      response.sendRedirect("down_query_hq.jsp");    else if(session_us.userAccess.intValue() == 3)//航标处      response.sendRedirect("down_query_hbc");    else if(session_us.userAccess.intValue() == 11)//航标站      response.sendRedirect("down_query_hbz.jsp");    else if(session_us.userAccess.intValue() == 12)//海测大队      response.sendRedirect("down_query_zh.jsp");    */    else{       try{        Context ctx = new InitialContext();        Object ref = ctx.lookup("SchemeplanController");        SchemeplanControllerHome schemeplanControllerHome = (SchemeplanControllerHome) PortableRemoteObject.narrow(ref, SchemeplanControllerHome.class);        SchemeplanController schemeplancontroller = schemeplanControllerHome.create();        Context psctx=new InitialContext();        Object psref=psctx.lookup("OfficeUnitController");        OfficeUnitControllerHome officeUnitControllerHome=(OfficeUnitControllerHome) PortableRemoteObject.narrow(psref,OfficeUnitControllerHome.class);        OfficeUnitController officeUnitController=officeUnitControllerHome.create();/*        Collection plan_collect = schemeplancontroller.getPlanByPlanyear(whichyear);//根据年度取得数据        Iterator ii = plan_collect.iterator();        Vector rongqi = new Vector(); //存放设备名称        Vector vector = new Vector(); //存放符合下达条件的schemeplan        Vector danwei = new Vector(); //存放单位id        Collection detail_coll = new ArrayList();        Judge judge = new Judge();        officeUnitStruct ous=new officeUnitStruct();        while(ii.hasNext())        {          SchemeplanStruct schplanstruct = new SchemeplanStruct();          schplanstruct = (SchemeplanStruct)ii.next();          ////符合下达条件的          if(schplanstruct.downstatus.intValue()==0&&schplanstruct.planstatus.intValue()==0&&schplanstruct.upstatus.intValue()==3)          {            Collection ttt = new ArrayList();                ttt = officeUnitController.getUnitid(schplanstruct.unitid);            Iterator it = ttt.iterator();            if(it.hasNext())              ous = (officeUnitStruct)it.next();            if(ous.upunitid.intValue()==session_us.unitid.intValue())            {              danwei.addElement(schplanstruct.unitid);              vector.addElement(schplanstruct);//符合下达条件的plan的集合              Integer nTemp = schplanstruct.planid;              Collection devicecollect1 = new ArrayList();              devicecollect1 = schemeplancontroller.getPlandetailsByPlanid(nTemp);              Iterator jj = devicecollect1.iterator();              while(jj.hasNext())              {                 PlandetailsStruct str = new PlandetailsStruct();                 str = (PlandetailsStruct)jj.next();                 detail_coll.add(str);                 String aa = str.devicename;                 rongqi.addElement(aa);              }            }          }        }*/        Collection myunit_Coll = officeUnitController.getUnitid(session_us.unitid);/////得到登录人所在单位名称        Iterator iterator_unit = myunit_Coll.iterator();        officeUnitStruct danweiStruct = new officeUnitStruct();        if(iterator_unit.hasNext())        danweiStruct = (officeUnitStruct)iterator_unit.next();        String UnitName = danweiStruct.getProcessname();//////////////////////单位名称Vector danwei = new Vector();danwei = (Vector)session.getAttribute("unitCollection_hq");Vector vector = new Vector(); //存放符合下达条件的schemeplanvector = (Vector)session.getAttribute("planCollection_hq");Collection detail_coll = new ArrayList();detail_coll = (Collection)session.getAttribute("plandetailCol_hq");Vector rongqi = new Vector();rongqi = (Vector)session.getAttribute("subunitColl_hq");        for(int l=0;l<rongqi.size()-1;l++)         for(int k=l+1;k<rongqi.size();k++)         {           if(rongqi.elementAt(l).equals(rongqi.elementAt(k)))           {              rongqi.remove(k);              k--;           }          }///////////得到名称不相同设备集        int nRow = rongqi.size();  /*        for(int l=0;l<danwei.size()-1;l++)         for(int k=l+1;k<danwei.size();k++)         {            if(danwei.elementAt(l).equals(danwei.elementAt(k)))            {              danwei.remove(k);              k--;             }         }//////////得到下属单位集*/officeUnitStruct ous=new officeUnitStruct();%><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=gb_2312-80"><link rel="stylesheet" href="../../css/stii.css" type="text/css"></HEAD><BODY>             <form name="form2" method="post" action="">              <table class=title cellspacing=1 cellpadding=2 width="100%" border=1>            <caption align=right><%=UnitName%><%=whichyear.toString()%>年度下达表 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<font style="font-size:12px">单位:万元(人民币)</font></caption>                  <tr align=middle>                    <td rowspan="2"><div align="center"><font  class="strong">设备名称</font></div></td>                    <td rowspan="2"><div align="center"><font  class="strong">设备规格</font></div></td>          <%for(int ll = 0;ll<danwei.size();ll++){                    Integer aaa = (Integer)danwei.elementAt(ll);                    Collection tempcoll=officeUnitController.getUnitid(aaa);                    Iterator kk = tempcoll.iterator();                    if(kk.hasNext())                      ous = (officeUnitStruct)kk.next();                    String processname = ous.getProcessname();%>                    <td colspan="2">                          <%=processname%><%}%>                  <td rowspan="2"><div align="center"><font  class="strong">合计</font></div></td>                  </tr>                   <tr align=middle>                  <%for(int c=0;c<danwei.size();c++){%>                  <td >申请数量                  <td >申请金额                <%}%>                   </tr>                <%for(int nn=0;nn<nRow;nn++){%>                  <tr align=middle>                   <%String dname = (String)rongqi.elementAt(nn);%>                  <td><%=dname%></td>                  <%                  Iterator iter = detail_coll.iterator();                  PlandetailsStruct detail = new PlandetailsStruct();                  if (iter.hasNext())                    detail = (PlandetailsStruct)iter.next();                  String guige = detail.devicetype;  %>                  <td><%=guige%></td>                  <%                    Iterator myit = detail_coll.iterator();                  Vector detailvec = new Vector();                    PlandetailsStruct ppdetail = new PlandetailsStruct();                    while(myit.hasNext())                    {                      ppdetail = (PlandetailsStruct)myit.next();                      if(ppdetail.devicename.equals(dname))                        detailvec.addElement(ppdetail);//得到该名字的记录集合                    }                    Integer shuliang=new Integer(0);                    Double jine = new Double(0);                    Double total_row = new Double(0);                   // for(int m_m = 0;m_m<detailvec.size();m_m++)                    //{                      PlandetailsStruct pp = new PlandetailsStruct();                      Judge myjudge = new Judge();                      for(int m=0;m<danwei.size();m++)                      {                        Integer int_danwei = (Integer)danwei.elementAt(m);                       for(int m_m = 0;m_m<detailvec.size();m_m++)                       {                         pp = (PlandetailsStruct)detailvec.elementAt(m_m);                         //if(pp.unitid.intValue() == int_danwei.intValue())                         if(myjudge.decide(int_danwei,pp.unitid))                         {                           shuliang = new Integer(pp.appamount.intValue()+shuliang.intValue());                           jine = new Double(pp.deviceprice.doubleValue()+jine.doubleValue());                         }                       }                        %>                        <td><%=shuliang.toString()%></td>                        <td><%=jine.toString()%>                        <%                      total_row = new Double(total_row.doubleValue()+jine.doubleValue());                        shuliang = new Integer(0);                        jine = new Double(0);                      }                     //total_row = new Double(total_row.doubleValue()+pp.deviceprice.doubleValue());                    //}%>                  <td><%=total_row.doubleValue()%></td>                  </tr>                  <%}%>                  <%  Double total_all = new Double(0); %>            <tr align=middle>                   <td>合计</td>                   <td>&nbsp;</td>                   <%for(int b = 0;b<danwei.size();b++)                     {                     Double total_col = new Double(0);                       Integer gg = (Integer)danwei.elementAt(b);                       Iterator xulie = detail_coll.iterator();                       PlandetailsStruct hh = new PlandetailsStruct();                       Judge ju = new Judge();                       while(xulie.hasNext())                       {                         hh = (PlandetailsStruct)xulie.next();                         //if(hh.unitid.intValue()==gg.intValue())                         if(ju.decide(gg,hh.unitid))                           total_col = new Double(total_col.doubleValue()+hh.deviceprice.doubleValue());                       }                       total_all = new Double(total_all.doubleValue()+total_col.doubleValue());                       %>                       <td>&nbsp;</td>                       <td><%=total_col%></td><%                     }%>                     <td><%=total_all.doubleValue()%></td>                  <tr align=middle>                  <td>实际</td>                  <td>&nbsp;</td>                    <%Double all = new Double(0);                      for(int b = 0;b<danwei.size();b++)                     {                       Integer gg = (Integer)danwei.elementAt(b);                       //total_all = new Double(total_all.doubleValue()+total_col.doubleValue());                       Double vb = (Double)session.getAttribute(gg.toString());                       all = new Double(all.doubleValue()+vb.doubleValue());                       %>                       <td>&nbsp;</td>                       <td><%=vb%></td><%                     }%>                   <td><%=all%></td>                  </tr>           </table>          </form>              </td>            </tr>          </table></BODY></HTML><%session.removeAttribute("unitCollection_hq");session.removeAttribute("planCollection_hq");session.removeAttribute("plandetailCol_hq");session.removeAttribute("subunitColl_hq");      }  catch(Exception e)  {    e.printStackTrace();  }}%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -