/** * 保存违纪处分信息 * * @param mapping * @param form * @param request * @param response * @return */ public ActionForward saveXs0709( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String xsbh = request.getParameter("xsbh"); String wjrq = request.getParameter("wjrq"); String wjjk = request.getParameter("wjjk"); String gycfdw = request.getParameter("gycfdw"); String szzdWjlb = request.getParameter("zzdWjlb"); String szzdCfmc = request.getParameter("zzdCfmc"); String cfyy = request.getParameter("cfyy"); String cfrq = request.getParameter("cfrq"); String cfwh = request.getParameter("cfwh"); String bz = request.getParameter("bz"); User user = (User) (request.getSession().getAttribute(GlobalNames.USER_SESSION_KEY)); String[] xsbhs = xsbh.split(","); for (int i = 0; i < xsbhs.length; i++) { Xs0709 xs0709 = new Xs0709(); xs0709.setXs0101(this.getPjpytjServiceImpl().findXs0101ByXsbh(xsbhs[i])); if (szzdWjlb != null && !"".equals(szzdWjlb)) { xs0709.setZzdWjlb( (ZzdWjlb) ZzdSingleton.getInstance(request.getSession().getServletContext()) .getZdByNameKey("ZzdWjlb", szzdWjlb)); } if (szzdCfmc != null && !"".equals(szzdCfmc)) { xs0709.setZzdCfmc( (ZzdCfmc) ZzdSingleton.getInstance(request.getSession().getServletContext()) .getZdByNameKey("ZzdCfmc", szzdCfmc)); } if (wjjk != null && !"".equals(wjjk)) xs0709.setWjjk(wjjk); if (wjrq != null && !"".equals(wjrq)) xs0709.setWjrq(wjrq); if (gycfdw != null && !"".equals(gycfdw)) xs0709.setGycfdw(gycfdw); if (cfyy != null && !"".equals(cfyy)) xs0709.setCfyy(cfyy); if (bz != null && !"".equals(bz)) xs0709.setBz(bz); if (cfrq != null && !"".equals(cfrq)) xs0709.setCfrq(cfrq); if (cfwh != null && !"".equals(cfwh)) { xs0709.setCfwh(cfwh); xs0709.setShr(this.getIFdyxxglService().findJg0101ByJgh(user.getAccount())); } this.getIWjglService().saveXs0709(xs0709, request); } this.writeJsMessage(response, "alert('数据保存成功');window.parent.returnValue='ok';window.close();"); return null; }
/** * 违纪信息审批 * * @param mapping * @param form * @param request * @param response * @return */ public ActionForward updateSPXs0709( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String zdbh = request.getParameter("zdbh32"); String gycfdw = request.getParameter("gycfdw"); String szzdCfmc = request.getParameter("zzdCfmc"); String cfrq = request.getParameter("cfrq"); String cfwh = request.getParameter("cfwh"); String cfyy = request.getParameter("cfyy"); String ssjg = request.getParameter("ssjg"); String cfcxwh = request.getParameter("cfcxwh"); String cfcxrq = request.getParameter("cfcxrq"); User user = (User) (request.getSession().getAttribute(GlobalNames.USER_SESSION_KEY)); Xs0709 xs0709 = this.getIWjglService().findXs0709ByZdbh(zdbh); xs0709.setZzdCfmc( (ZzdCfmc) ZzdSingleton.getInstance(request.getSession().getServletContext()) .getZdByNameKey("ZzdCfmc", szzdCfmc)); xs0709.setCxr(this.getIFdyxxglService().findJg0101ByJgh(user.getAccount())); xs0709.setGycfdw(gycfdw); xs0709.setCfrq(cfrq); xs0709.setCfwh(cfwh); xs0709.setCfyy(cfyy); xs0709.setSsjg(ssjg); xs0709.setCfcxwh(cfcxwh); xs0709.setCfcxrq(cfcxrq); this.getIWjglService().updateXs0709(xs0709, request); if (cfcxwh != null && !"".equals(cfcxwh)) { this.writeJsMessage( response, "alert('处分撤销成功!');window.parent.returnValue='ok';window.close();"); } else { this.writeJsMessage( response, "alert('处分审批成功!');window.parent.returnValue='ok';window.close();"); } return null; }
/** * 读取奖惩管理EXCEL内容 * * @param mapping * @param form * @param request * @param response * @return */ public ActionForward readJcglExcl( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { DynaActionForm fileForm = (DynaActionForm) form; FormFile formFile = (FormFile) fileForm.get("objExcel"); List list = new ArrayList(); try { InputStream excelInput = formFile.getInputStream(); Workbook workbook = Workbook.getWorkbook(excelInput); Sheet sheet = workbook.getSheet(0); int rows = sheet.getRows(); Xs0709 xs0709 = null; for (int i = 9; i < rows; i++) { try { String xh = sheet.getCell(0, i).getContents().trim(); String wjrq = sheet.getCell(2, i).getContents().trim(); String wjlb = sheet.getCell(3, i).getContents().trim(); String cfmc = sheet.getCell(4, i).getContents().trim(); String cfdw = sheet.getCell(5, i).getContents().trim(); String wjjj = sheet.getCell(6, i).getContents().trim(); String cfwh = sheet.getCell(7, i).getContents().trim(); String cfrq = sheet.getCell(8, i).getContents().trim(); xs0709 = new Xs0709(); Xs0101 xs0101 = this.getJeffglServiceImpl().findXs0101Byxh(xh); if (xs0101 == null) { this.writeJsMessage( response, "alert('导入失败,第" + i + "行,‘学号’列的值:" + xh + ",在系统中不存在,请确认后再导入');window.parent.returnValue='ok';window.parent.close();"); return null; } xs0709.setXs0101(xs0101); if (wjrq != null && !wjrq.equals("")) { xs0709.setWjrq(wjrq); } else { this.writeJsMessage( response, "alert('导入失败,第" + i + "行,‘违纪日期’列的值为空,请确认后再导入');window.parent.returnValue='ok';window.parent.close();"); return null; } ZzdWjlb zdwjlb = null; if (wjlb != null && !wjlb.equals("")) { zdwjlb = (ZzdWjlb) ZzdSingleton.getInstance(request.getSession().getServletContext()) .getZdByNameKey("ZzdWjlb", wjlb); } else { this.writeJsMessage( response, "alert('导入失败,第" + i + "行,‘违纪类别’列的值为空,请确认后再导入');window.parent.returnValue='ok';window.parent.close();"); return null; } if (zdwjlb == null) { this.writeJsMessage( response, "alert('导入失败,第" + i + "行,‘违纪类别’列的值在系统中不存在,请确认后再导入');window.parent.returnValue='ok';window.parent.close();"); return null; } else { xs0709.setZzdWjlb(zdwjlb); } ZzdCfmc zdwjmc = null; if (cfmc != null && !cfmc.equals("")) { zdwjmc = (ZzdCfmc) ZzdSingleton.getInstance(request.getSession().getServletContext()) .getZdByNameKey("ZzdCfmc", cfmc); } else { this.writeJsMessage( response, "alert('导入失败,第" + i + "行,‘处分名称’列的值为空,请确认后再导入');window.parent.returnValue='ok';window.parent.close();"); return null; } if (zdwjmc == null) { this.writeJsMessage( response, "alert('导入失败,第" + i + "行,‘处分名称’列的值在系统中不存在,请确认后再导入');window.parent.returnValue='ok';window.parent.close();"); return null; } else { xs0709.setZzdCfmc(zdwjmc); } if (cfdw != null && !cfdw.equals("")) { xs0709.setGycfdw(cfdw); } if (wjjj != null && !wjjj.equals("")) { xs0709.setWjjk(wjjj); } if (cfwh != null && !cfwh.equals("")) { xs0709.setCfwh(cfwh); } if (cfrq != null && !cfrq.equals("")) { xs0709.setCfrq(cfrq); } list.add(xs0709); } catch (Exception e) { e.printStackTrace(); return null; } } workbook.close(); } catch (FileNotFoundException e) { this.writeJsMessage( response, "alert('数据导入失败,请检查EXCEL文件是否存在!');window.parent.returnValue='ok';window.parent.close();"); e.printStackTrace(); return null; } catch (IOException e) { this.writeJsMessage( response, "alert('数据导入失败,请检查EXCEL格式是否符合要求!');window.parent.returnValue='ok';window.parent.close();"); e.printStackTrace(); return null; } catch (BiffException e) { e.printStackTrace(); this.writeJsMessage( response, "alert('数据导入失败,请检查EXCEL格式是否符合要求!');window.parent.returnValue='ok';window.parent.close();"); return null; } catch (Exception e) { e.printStackTrace(); this.writeJsMessage( response, "alert('数据导入失败,系统没有检测到的错误!');window.parent.returnValue='ok';window.parent.close();"); return null; } try { if (list.size() != 0) { Iterator it = list.iterator(); Xs0709 xs0709 = null; while (it.hasNext()) { xs0709 = (Xs0709) it.next(); this.getIWjglService().saveXs0709(xs0709, request); } } this.writeJsMessage( response, "alert('数据导入成功!');window.parent.returnValue='ok';window.parent.close();"); } catch (Exception e) { this.writeJsMessage( response, "alert('数据导入失败,一般是由于数据不符合格式引起,请检查数据!');window.parent.returnValue='ok';window.parent.close();"); } return null; }