serveltService2

原创
2013/12/22 20:59
阅读数 132

package com.luojin.service;


import java.io.IOException;

import java.util.List;


import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;


import com.luojin.dao.UserBeanDao;

import com.luojin.model.landAssist;


public class examinMain extends HttpServlet{

private static final long serialVersionUID = 1L;

   protected void doPost(HttpServletRequest req, HttpServletResponse resp)

           throws ServletException, IOException {

      doGet(req,resp);

   }

   protected void doGet(HttpServletRequest req, HttpServletResponse resp)

           throws ServletException, IOException {

       String pNow=req.getParameter("pageNow");

    int pageNows=1;

       if (pNow!=null) {

pageNows=Integer.parseInt(pNow);

}

    int pageSize=3;//显示几行记录

int pageNow=1;//显示第几页

int pageCount=0;

UserBeanDao dao=new UserBeanDao();

//统计有多少行记录

   int rowCount= dao.CountAuter();

   if(rowCount%pageSize==0)

    {

     pageCount=rowCount/pageSize;

    }else 

    { 

     pageCount=rowCount/pageSize+1; 

    }

   if(pageNows<pageCount)

   {

    if(pageNows==0)

    {

    pageNow=1;

    }

    else

    {

    pageNow=pageNows;

    }

   }else {

    pageNow=pageCount;

}

HttpSession session=req.getSession();

List<landAssist> Item =dao.ExaimineCount(pageSize, pageNow);//用来分页的

System.out.println("集合长度"+Item.size()+"daxiao"+pageSize+"sklhsl"+pageNow);

System.out.println("当前页数"+pageNow);

req.setAttribute("pageSize", pageSize);

req.setAttribute("pagenow", pageNow);

req.setAttribute("Pagecount", pageCount);

req.setAttribute("allItem", Item);

req.setAttribute("rowCount", rowCount);

req.getRequestDispatcher("/ExamineShlt.jsp").forward(req, resp);

   }

}



package com.luojin.service;


import java.io.IOException;

import java.sql.Date;

import java.util.List;


import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;


import com.luojin.dao.UserBeanDao;

import com.luojin.model.CustomEerter;

import com.luojin.model.sysUser;

import com.luojin.tools.CormpysignName;

import com.luojin.tools.HanZiToPinYin;

import com.luojin.tools.QRCodeEncoderHandler;


public class FisthTwo extends HttpServlet{

private static final long serialVersionUID = 1L;

    protected void service(HttpServletRequest req, HttpServletResponse resp)

           throws ServletException, IOException {

     //循环更新审核

     String str[]=req.getParameterValues("delid");

     sysUser usere=(sysUser)req.getSession().getAttribute("user");

         String user=usere.getUserAccount();

    if(str!=null)

     {

    for (int i = 0; i < str.length; i++) 

        {

    Date update=Date.valueOf(req.getParameter("date1"));

    UserBeanDao dao=new UserBeanDao();

    String copayName=null;

    String copayNames=req.getParameter(""+str[i]+"b");

    if(copayNames.equals(""))

    {

    copayName="行政服务管理系统";

    }

    else if(copayNames!=null)

    {

    copayName=copayNames;

    }

    String audRemark=req.getParameter(""+str[i]+"b");

    System.err.println("yyyy"+audRemark);

           int rows = dao.FistfinshOne(update,str[i],audRemark);

         //生成证件开始

       List<CustomEerter> lists =dao.checkCustomEerter(str[i]);

       System.out.println(lists.size()+"++");

       String etrName=null;

       String appAddress=null;

       String ertJuridical=null;

       String etrType=null;

       String paper_name=null;

       String etrBslicence=null;

       String fund=null;

       Date stateTime=null;

       Date endTiem=null;

       String ertIdcode=null;

       String idOrder=null;

       String PyUser=null;

       String paths= req.getServletContext().getRealPath("/");

       for (CustomEerter Item:lists)

    {

        etrName=Item.getEtrName();

        appAddress=Item.getAppAddress();//用户职位

        ertJuridical=Item.getErtJuridical();

        PyUser=HanZiToPinYin.toPinYin(ertJuridical);

        etrType=Item.getEtrType();

        paper_name=Item.getPaper_name();

        etrBslicence=Item.getEtrBslicence();

        fund=Item.getFund();

        stateTime=Item.getStateTime();

        endTiem=Item.getEndTiem();

        ertIdcode=Item.getErtIdcode();

        idOrder=Item.getIdOrder();

       //得到用户头像

      /*  strpath=req.getServletContext().getRealPath("/oglimg/"+PyUser+".jpg");

    dao.cteImg(jobId,strpath);*/

    }

       //得到入职时间:

       //创建二维码

       String imgPath = req.getServletContext().getRealPath("/oglimg/"+PyUser+"CP"+".jpg"); 

           String content = "姓名:"+ertJuridical

                        + "\n身份证:"+ertIdcode + "\n编号:"+idOrder+"\n创建时间:"+stateTime; 

       QRCodeEncoderHandler handler = new QRCodeEncoderHandler(); 

           handler.encoderQRCode(content,etrName,imgPath); 

           //生成经营许可证 要传给中文吧 给工号 职位 姓名

           String backImage=paths+"defaultimg/jy.jpg";

           CustomEerter useInfo=new CustomEerter( etrName ,appAddress,ertJuridical,etrType,paper_name,etrBslicence,fund,stateTime,endTiem ,ertIdcode,idOrder);

           CormpysignName createCopmay=new CormpysignName(useInfo, copayName, backImage, imgPath);

    }  

      

           //循环后查询

           UserBeanDao  dao=new UserBeanDao();

           req.getRequestDispatcher("examMainHangOn").forward(req, resp);

       }else{

           resp.sendRedirect("ErrorWebin.jsp");  

       }

   

   }

 

}



展开阅读全文
打赏
0
1 收藏
分享
加载中
更多评论
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部