From 1f48539e1ca3298b31b498996dd9da3cb45fe0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 18 Oct 2022 16:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=BE=85=E5=AE=9A=E8=96=AA?= =?UTF-8?q?=E4=BB=A3=E5=8A=9E=20=E5=88=A0=E9=99=A4=E5=BE=85=E5=81=9C?= =?UTF-8?q?=E8=96=AA=E4=BB=A3=E5=8A=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/archive/SalaryArchiveMapper.java | 4 + .../mapper/archive/SalaryArchiveMapper.xml | 24 ++++++ .../salary/service/SalaryArchiveService.java | 24 ++++-- .../impl/SalaryArchiveServiceImpl.java | 75 +++++++++++-------- .../salary/web/SalaryArchiveController.java | 53 ++++++------- .../salary/wrapper/SalaryArchiveWrapper.java | 45 ++++++----- 6 files changed, 136 insertions(+), 89 deletions(-) diff --git a/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.java b/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.java index ce2bd1414..1775995f3 100644 --- a/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.java +++ b/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.java @@ -118,4 +118,8 @@ public interface SalaryArchiveMapper { void gotoPendingFromStop(@Param("ids") Collection ids); void gotoFixedFromStop(@Param("ids") Collection ids); + + void deletePendingTodo(@Param("ids") Collection ids); + + void deleteSuspendTodo(@Param("ids") Collection ids); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml b/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml index 27d22f85d..9ff3290a2 100644 --- a/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml +++ b/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml @@ -586,4 +586,28 @@ + + UPDATE hrsa_salary_archive + + run_status='STOP_FROM_PENDING' + + WHERE run_status = 'PENDING' + and id IN + + #{id} + + + + + UPDATE hrsa_salary_archive + + run_status='FIXED' + + WHERE run_status = 'SUSPEND' + and id IN + + #{id} + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryArchiveService.java b/src/com/engine/salary/service/SalaryArchiveService.java index 9649605cd..33db0ce63 100644 --- a/src/com/engine/salary/service/SalaryArchiveService.java +++ b/src/com/engine/salary/service/SalaryArchiveService.java @@ -180,6 +180,15 @@ public interface SalaryArchiveService { */ Map queryTabTotal(); + + /** + * 删除待定薪待办 + * + * @param ids + * @return + */ + String deletePendingTodo(Collection ids); + /** * 设为定薪员工 * @@ -220,13 +229,13 @@ public interface SalaryArchiveService { */ Map allGotoStop(SalaryArchiveQueryParam queryParam); -// /** -// * 删除待停薪待办 -// * -// * @param ids -// * @return -// */ -// String deleteSuspendTodo(Collection ids); + /** + * 删除待停薪待办 + * + * @param ids + * @return + */ + String deleteSuspendTodo(Collection ids); /** * 取消停薪 @@ -236,4 +245,5 @@ public interface SalaryArchiveService { */ String cancelStop(Collection ids); + } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 761424269..fef44987f 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -2012,6 +2012,29 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe return result; } + @Override + public String deletePendingTodo(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + } + + List oldList = getSalaryArchiveMapper() + .listSome(SalaryArchivePO.builder() + .ids(ids) + .runStatus(SalaryArchiveStatusEnum.PENDING.getValue()) + .build()); + + + if (CollectionUtils.isEmpty(oldList)) { + return StringUtils.EMPTY; + } + // 从待定薪到停薪 + getSalaryArchiveMapper().deletePendingTodo(ids); + + return StringUtils.EMPTY; + } + + @Override public Map gotoFixed(Collection ids) { if (CollectionUtils.isEmpty(ids)) { @@ -2155,38 +2178,26 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe return this.gotoStop(salaryArchiveIds); } -// @Override -// public String deleteSuspendTodo(Collection ids) { -// if (org.springframework.util.CollectionUtils.isEmpty(ids)) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); -// } -// List oldList = new LambdaQueryChainWrapper<>(salaryArchiveMapper) -// .eq(SalaryArchivePO::getDeleteType, 0) -// .eq(SalaryArchivePO::getTenantKey, currentTenantKey) -// .in(SalaryArchivePO::getId, ids) -// .eq(SalaryArchivePO::getRunStatus, SalaryArchiveStatusEnum.SUSPEND.getValue()) -// .list(); -// List unableList = oldList.stream().filter(f->Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().isAfter(LocalDate.now())).collect(Collectors.toList()); -// if (CollectionUtils.isNotEmpty(unableList)) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 115789, "最后发薪日必须晚于今天")); -// } -// -// // 从待停薪到定薪 -// new LambdaUpdateChainWrapper<>(salaryArchiveMapper) -// .eq(SalaryArchivePO::getDeleteType, 0) -// .eq(SalaryArchivePO::getTenantKey, currentTenantKey) -// .in(SalaryArchivePO::getId, ids) -// .eq(SalaryArchivePO::getRunStatus, SalaryArchiveStatusEnum.SUSPEND.getValue()) -// .set(SalaryArchivePO::getRunStatus, SalaryArchiveStatusEnum.FIXED.getValue()) -// .set(SalaryArchivePO::getModifier, currentEmployeeId) -// .update(); -// // 记录日志 -// List newList = this.listByIds(ids); -// String operatedesc = SalaryI18nUtil.getI18nLabel( 106839, "删除待办"); -// recordLog(oldList, newList, operatedesc, currentTenantKey); -// -// return StringUtils.EMPTY; -// } + @Override + public String deleteSuspendTodo(Collection ids) { + if (org.springframework.util.CollectionUtils.isEmpty(ids)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); + } + + List oldList = getSalaryArchiveMapper() + .listSome(SalaryArchivePO.builder() + .ids(ids) + .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue()) + .build()); + List unableList = oldList.stream().filter(f->Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().after(new Date())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(unableList)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 115789, "最后发薪日必须晚于今天")); + } + + // 从待停薪到定薪 + getSalaryArchiveMapper().deleteSuspendTodo(ids); + return StringUtils.EMPTY; + } @Override public String cancelStop(Collection ids) { diff --git a/src/com/engine/salary/web/SalaryArchiveController.java b/src/com/engine/salary/web/SalaryArchiveController.java index 20011d61f..f9342be27 100644 --- a/src/com/engine/salary/web/SalaryArchiveController.java +++ b/src/com/engine/salary/web/SalaryArchiveController.java @@ -118,18 +118,20 @@ public class SalaryArchiveController { } -// /** -// * 删除待定薪待办 -// * -// * @param ids -// * @return -// */ -// @PostMapping("/deletePendingTodo") -// @ApiOperation("删除待定薪待办") -// @WeaPermission -// public WeaResult deletePendingTodo(@RequestBody Collection ids) { -// return WeaResult.success(salaryArchiveWrapper.deletePendingTodo(ids, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); -// } + /** + * 删除待定薪待办 + * + * @param ids + * @return + */ + @POST + @Path("/deletePendingTodo") + @Produces(MediaType.APPLICATION_JSON) + public String deletePendingTodo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>(user).run(getSalaryArchiveWrapper(user)::deletePendingTodo, ids); + } + /** * 发薪列表 @@ -190,18 +192,19 @@ public class SalaryArchiveController { } -// /** -// * 删除待停薪待办 -// * -// * @param ids -// * @return -// */ -// @PostMapping("/deleteSuspendTodo") -// @ApiOperation("删除待停薪待办") -// @WeaPermission -// public WeaResult deleteSuspendTodo(@RequestBody Collection ids) { -// return WeaResult.success(salaryArchiveWrapper.deleteSuspendTodo(ids, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); -// } + /** + * 删除待停薪待办 + * + * @param ids + * @return + */ + @POST + @Path("/deleteSuspendTodo") + @Produces(MediaType.APPLICATION_JSON) + public String stopList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>(user).run(getSalaryArchiveWrapper(user)::deleteSuspendTodo, ids); + } /** * 停薪列表 @@ -233,7 +236,6 @@ public class SalaryArchiveController { } - /** * 薪资档案列表 * @@ -303,7 +305,6 @@ public class SalaryArchiveController { } - /** * 保存发薪设置 * diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java index 88228c667..e361dbfdb 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java @@ -190,6 +190,16 @@ public class SalaryArchiveWrapper extends Service { return list(queryParam, SalaryArchiveListTypeEnum.PENDING); } + /** + * 删除待定薪待办 + * + * @param ids + * @return + */ + public String deletePendingTodo(Collection ids) { + return getSalaryArchiveService(user).deletePendingTodo(ids); + } + /** * 定薪列表 * @@ -243,17 +253,6 @@ public class SalaryArchiveWrapper extends Service { return getSalaryArchiveService(user).allGotoFixed(queryParam); } -// /** -// * 删除待定薪待办 -// * -// * @param ids -// * @param currentEmployeeId -// * @param currentTenantKey -// * @return -// */ -// public String deletePendingTodo(Collection ids) { -// return getSalaryArchiveService(user).deletePendingTodo(ids); -// } /** * 停薪 @@ -275,17 +274,15 @@ public class SalaryArchiveWrapper extends Service { return getSalaryArchiveService(user).allGotoStop(queryParam); } -// /** -// * 删除待停薪待办 -// * -// * @param ids -// * @param currentEmployeeId -// * @param currentTenantKey -// * @return -// */ -// public String deleteSuspendTodo(Collection ids) { -// return getSalaryArchiveService(user).deleteSuspendTodo(ids); -// } + /** + * 删除待停薪待办 + * + * @param ids + * @return + */ + public String deleteSuspendTodo(Collection ids) { + return getSalaryArchiveService(user).deleteSuspendTodo(ids); + } /** * 取消停薪 @@ -345,8 +342,8 @@ public class SalaryArchiveWrapper extends Service { List> salaryItems = Lists.newArrayList(); // 2.发薪设置表单 - Map paySetForm = new HashMap<>(); - paySetForm.put("data",po); + Map paySetForm = new HashMap<>(); + paySetForm.put("data", po); // 获取所有可被引用的薪资项目