Пример #1
0
 /** Excel导入 */
 public ActionForward importExcel(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm actionForm = (BaseActionForm) form;
   Dto dto = actionForm.getParamAsDto(request);
   FormFile theFile = actionForm.getTheFile();
   String metaData =
       "id,code,name,days_normal,hours_normal,days_weekend,hours_weekend,days_holiday,hours_holiday";
   ExcelReader excelReader = new ExcelReader(metaData, theFile.getInputStream());
   List list = excelReader.read(4, 0);
   dto.setDefaultAList(list);
   dto.put("operator", getSessionContainer(request).getUserInfo().getUserid());
   dto.put("operate_time", G4Utils.getCurrentTimestamp());
   dto.put("rpt_state", "1");
   Dto outDto = adcOvertimeService.importFromExcel(dto);
   if (outDto.getAsBoolean("success")) {
     setOkTipMsg("导入成功", response);
   } else {
     this.setErrTipMsg(outDto.getAsString("msg"), response);
   }
   return mapping.findForward(null);
 }
Пример #2
0
 /** 新建 */
 public ActionForward saveAdcOvertimeItem(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm aForm = (BaseActionForm) form;
   Dto inDto = aForm.getParamAsDto(request);
   inDto.put("operator", getSessionContainer(request).getUserInfo().getUserid());
   inDto.put("operate_time", G4Utils.getCurrentTimestamp());
   inDto.put("rpt_state", "1");
   List aList = aForm.getGridDirtyData(request);
   inDto.setDefaultAList(aList);
   adcOvertimeService.saveAdcOvertimeItem(inDto);
   setOkTipMsg("加班表保存成功!", response);
   return mapping.findForward(null);
 }