@RequestMapping("/update") public ModelAndView updatePaytype( String id, HttpServletResponse response, HttpServletRequest request) throws Exception { ModelAndView view = new ModelAndView(); Report report = reportLogService.findById(id); User user = SessionUtils.getUser(request); if (user != null && user.getCompany() != null) { List<PayGroup> payGroups = tmsService.findAllPageGroups(user.getCompany().getId()); view.getModelMap().put("payGroupList", payGroups); } view.getModelMap().put("reportTypeList", ReportType.values()); List<String> pagings = new ArrayList<String>(); pagings.add("Postion"); pagings.add("Employee"); view.getModelMap().put("pagingList", pagings); List<String> sorts = new ArrayList<String>(); sorts.add("surname"); sorts.add("Firstname"); sorts.add("Employee No"); view.getModelMap().put("sortList", sorts); view.getModel().put("report", new ReportVo(report)); view.setViewName("admin/report/savereport"); return view; }
@RequestMapping("/delete") public ModelAndView deleteReport( String ids, HttpServletResponse response, HttpServletRequest request) throws Exception { ModelAndView view = new ModelAndView(); if (StringUtils.isEmpty(ids)) { view.getModel().put("message", "error"); return view; } String[] paytypeIds = ProcessSignUtils.getInstance().processComma(ids); for (String id : paytypeIds) { reportLogService.remove(id); } return view; }
@RequestMapping("/save") public ModelAndView saveReport( ReportVo reportVo, HttpServletResponse response, HttpServletRequest request) throws Exception { User user = SessionUtils.getUser(request); ModelAndView view = new ModelAndView(); Report report = new Report(); if (StringUtils.isNotEmpty(reportVo.getId())) { report = reportLogService.findById(reportVo.getId()); } if (StringUtils.isNotEmpty(reportVo.getPaging())) { report.setPaging(reportVo.getPaging()); } if (StringUtils.isNotEmpty(reportVo.getSort())) { report.setSort(reportVo.getSort()); } if (StringUtils.isNotEmpty(reportVo.getPayGroupId())) { PayGroup payGroup = tmsService.findPayGroupById(reportVo.getPayGroupId()); if (payGroup != null) { report.setPayGroup(payGroup); } } if (StringUtils.isNotEmpty(reportVo.getReportType())) { report.setReportType(ReportType.valueOf(reportVo.getReportType())); } report.setUpdateTime(new Date()); if (StringUtils.isNotEmpty(reportVo.getId())) { reportLogService.update(report); } else { report.setUser(user); report.setCompany(user.getCompany()); reportLogService.save(report); } view.getModel().put("message", "success"); return view; }
@RequestMapping("/list_nd") public ModelAndView reportlistValue(HttpServletResponse response, HttpServletRequest request) throws Exception { ModelAndView view = new ModelAndView(); User user = SessionUtils.getUser(request); if (user != null && user.getCompany() != null) { List<Report> reports = reportLogService.findAllReport(user.getCompany().getId()); if (reports != null) { List<ReportVo> reportVos = new ArrayList<ReportVo>(); for (Report report : reports) { reportVos.add(new ReportVo(report)); } view.getModelMap().put("reports", reportVos); } } view.setViewName("admin/report/reportlisttable"); return view; }