/** * 批量生成工资条 * * @param year * @param month * @param workDays * @return */ @RequestMapping(value = "/makeSaralyClips.do", produces = "application/json;charset=UTF-8") @ResponseBody public String makeSaralyClips(Integer year, Integer month, double workDays) { // 如果已经存在了当月的工资条 if (saralyClipService.getSaralyClipCountByMonth(year, month) > 0) { // 返回提示信息 return StatusUtil.statusInfo(StatusConst.ISFAIL).toJSONString(); } else { // 批量计算并插入当月工资条 try { // 获取员工的薪资信息 List<EmployeeSaralyVo> list = employeeDetailService.getEmployeeSaralyVoList(); // 批量计算出员工工资条 List<SaralyClip> saralyClipList = SaralyUtil.batchCaculateSaraly( list, year, month, workDays, vacationService, allowanceService); // 批量存储员工工资条 if (saralyClipList.size() != 0) { saralyClipService.batchSave(saralyClipList); } } catch (Exception e) { return StatusUtil.statusInfo(e.toString()).toJSONString(); } } return StatusUtil.statusInfo(StatusConst.ISSUCCESSFULL).toJSONString(); }
/** * 更新个人工资条 * * @param id * @param employeeId * @param year * @param month * @param workDays * @return */ @RequestMapping( value = "/updateSaralyClipByPerson.do", produces = "application/json;charset=UTF-8") @ResponseBody public String updateSaralyClipByPerson( Integer id, Integer employeeId, Integer year, Integer month, double workDays) { try { // 根据employeeId获取雇员的薪资信息 EmployeeSaralyVo employeeSaralyVo = employeeDetailService.getEmployeeSaralyVoByEmployeeId(employeeId); // 根据薪资信息重新生成雇员的工资条 SaralyClip saralyClip = SaralyUtil.updateSaralyClipByPerson( id, employeeSaralyVo, year, month, workDays, vacationService, allowanceService); // 用新生成的工资条去更新数据库中的工资条 saralyClipService.updateByPerson(saralyClip); } catch (Exception e) { e.printStackTrace(); return StatusUtil.statusInfo(e.toString()).toJSONString(); } return StatusUtil.statusInfo(StatusConst.ISSUCCESSFULL).toJSONString(); }