コード例 #1
0
ファイル: JcglAction.java プロジェクト: crabeye/jjjw2008
 /**
  * 保存评优信息
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  */
 public ActionForward saveXs0931(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   String xsbh = request.getParameter("xsbh");
   String pylb = request.getParameter("zzdPylb");
   String rych = request.getParameter("zzdRych");
   String jlfsm = request.getParameter("zzdJlfs");
   String xnxqh = request.getParameter("jx12");
   String bjdw = request.getParameter("bjdw");
   String bz = request.getParameter("bz");
   String[] xsbhs = xsbh.split(",");
   for (int i = 0; i < xsbhs.length; i++) {
     Xs0931 xs0931 = new Xs0931();
     xs0931.setXs0101(this.getPjpytjServiceImpl().findXs0101ByXsbh(xsbhs[i]));
     xs0931.setZzdPylb(
         (ZzdPylb)
             ZzdSingleton.getInstance(request.getSession().getServletContext())
                 .getZdByNameKey("ZzdPylb", pylb));
     xs0931.setZzdRych(
         (ZzdRych)
             ZzdSingleton.getInstance(request.getSession().getServletContext())
                 .getZdByNameKey("ZzdRych", rych));
     xs0931.setZzdJlfs(
         (ZzdJlfs)
             ZzdSingleton.getInstance(request.getSession().getServletContext())
                 .getZdByNameKey("ZzdJlfs", jlfsm));
     xs0931.setXnxqh(xnxqh);
     xs0931.setBjdw(bjdw);
     xs0931.setBz(bz);
     Map map = new HashMap();
     map.put("Xs0931", xs0931);
     this.getStzzServiceImpl().saveOrUpdateObject(map, request);
   }
   this.writeJsMessage(response, "alert('数据保存成功');window.parent.returnValue='ok';window.close();");
   return null;
 }
コード例 #2
0
ファイル: JcglAction.java プロジェクト: crabeye/jjjw2008
 /**
  * 保存评优信息
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  */
 public ActionForward updateXs0931(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   String zdbh = request.getParameter("zdbh");
   String pylb = request.getParameter("zzdPylb");
   String rych = request.getParameter("zzdRych");
   String jlfsm = request.getParameter("zzdJlfs");
   String xnxqh = request.getParameter("jx12");
   String bjdw = request.getParameter("bjdw");
   String bz = request.getParameter("bz");
   List list =
       this.getStzzServiceImpl()
           .findObjectByPrimaryKey("com.qzdatasoft.xgxt.bean.jcgl.Xs0931", "xh", zdbh);
   Xs0931 xs0931 = (Xs0931) list.get(0);
   xs0931.setZzdPylb(
       (ZzdPylb)
           ZzdSingleton.getInstance(request.getSession().getServletContext())
               .getZdByNameKey("ZzdPylb", pylb));
   xs0931.setZzdRych(
       (ZzdRych)
           ZzdSingleton.getInstance(request.getSession().getServletContext())
               .getZdByNameKey("ZzdRych", rych));
   xs0931.setZzdJlfs(
       (ZzdJlfs)
           ZzdSingleton.getInstance(request.getSession().getServletContext())
               .getZdByNameKey("ZzdJlfs", jlfsm));
   xs0931.setXnxqh(xnxqh);
   xs0931.setBjdw(bjdw);
   xs0931.setBz(bz);
   Map map = new HashMap();
   map.put("Xs0931", xs0931);
   this.getStzzServiceImpl().saveOrUpdateObject(map, request);
   this.writeJsMessage(response, "alert('数据保存成功');window.parent.returnValue='ok';window.close();");
   return null;
 }
コード例 #3
0
ファイル: JcglAction.java プロジェクト: crabeye/jjjw2008
 /**
  * 导入学生评优信息
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  */
 public ActionForward impxspygl(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   DynaActionForm dynaForm = (DynaActionForm) form;
   FormFile formFile = (FormFile) dynaForm.get("objExcel");
   try {
     InputStream excelStream = formFile.getInputStream();
     Workbook workbook = Workbook.getWorkbook(excelStream);
     Sheet sheet = workbook.getSheet(0);
     Xs0931 xs0931 = new Xs0931();
     int rows = sheet.getRows();
     for (int i = 13; i < rows; i++) {
       if (rows < 10) {
         this.writeJsMessage(
             response, "alert('请输入信息');window.parent.returnValue='ok';window.parent.close();");
       }
       String xh = sheet.getCell(0, i).getContents().trim();
       if (xh == null || "".equals(xh)) continue;
       String pylb = sheet.getCell(3, i).getContents().trim();
       String pyfs = sheet.getCell(4, i).getContents().trim();
       String rych = sheet.getCell(5, i).getContents().trim();
       String xnxqh = sheet.getCell(6, i).getContents().trim();
       String bz = sheet.getCell(7, i).getContents().trim();
       Xs0101 xs0101 = this.getStzzServiceImpl().findXs0101ByXh(xh);
       int j = i + 1;
       if (xs0101 == null) {
         this.writeJsMessage(
             response,
             "alert('导入失败,第"
                 + j
                 + "行,‘学号’列的值:"
                 + xh
                 + ",在系统中不存在,请确认后再导入');window.parent.returnValue='ok';window.parent.close();");
         return null;
       }
       xs0931.setXnxqh(xnxqh);
       xs0931.setZzdJlfs(new ZzdJlfs(pyfs));
       xs0931.setZzdPylb(new ZzdPylb(pylb));
       xs0931.setZzdRych(new ZzdRych(rych));
       xs0931.setBz(bz);
       xs0931.setXs0101(xs0101);
       Map map = new HashMap();
       map.put("Xs0931", xs0931);
       this.getStzzServiceImpl().saveOrUpdateObject(map, request);
     }
     int num = rows - 13;
     this.writeJsMessage(
         response,
         "window.parent.creating.style.visibility='hidden';alert('数据导入成功,总共导入"
             + num
             + "个学生入住信息')");
   } catch (FileNotFoundException e) {
     this.writeJsMessage(
         response, "alert('文件找不到!');window.parent.returnValue='ok';window.parent.close();");
   } catch (IOException e) {
     this.writeJsMessage(
         response, "alert('输入输出错误!');window.parent.returnValue='ok';window.parent.close();");
   } catch (BiffException e) {
     this.writeJsMessage(
         response, "alert('模板格式错误!');window.parent.returnValue='ok';window.parent.close();");
   }
   return null;
 }