diff --git a/resource/sql/薪资还原脚本.sql b/resource/sql/薪酬还原脚本.sql similarity index 99% rename from resource/sql/薪资还原脚本.sql rename to resource/sql/薪酬还原脚本.sql index f3846763f..ffeefcc0b 100644 --- a/resource/sql/薪资还原脚本.sql +++ b/resource/sql/薪酬还原脚本.sql @@ -119,6 +119,9 @@ delete from hrsa_tax_rate_detail where 1=1 delete from hrsa_salary_acct_result_report where 1=1 ; +delete from hrsa_insurance_base_info where 1=1 +; + INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9001, '养老保险', 1, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') ; diff --git a/src/com/engine/salary/encrypt/AESEncryptUtil.java b/src/com/engine/salary/encrypt/AESEncryptUtil.java index 7b2ad3449..952a440b6 100644 --- a/src/com/engine/salary/encrypt/AESEncryptUtil.java +++ b/src/com/engine/salary/encrypt/AESEncryptUtil.java @@ -61,7 +61,8 @@ public class AESEncryptUtil { encryptStr = encryptStr.substring(4, encryptStr.length()); return AES.decrypt(encryptStr, aesEncryptScrect); } - //未配置加密设置时需要解密 + //第一版没有加AES_前缀为加密标识,所以初始解密时,需要根据是否有配置判断是否需要解密 + //未配置加密设置时,需要解密 if (ObjectUtils.isEmpty(sysConfPo)) { return AES.decrypt(encryptStr, aesEncryptScrect); } 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..867798b79 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1950,12 +1950,12 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe public Map queryTabTotal() { long currentEmployeeId = user.getUID(); - // 1.历史数据处理 - handleHistory(currentEmployeeId); - // 2.待停薪自动处理 - handleSuspendData(currentEmployeeId); - // 3.增量数据处理 - handleChangeData(currentEmployeeId); +// // 1.历史数据处理 +// handleHistory(currentEmployeeId); +// // 2.待停薪自动处理 +// handleSuspendData(currentEmployeeId); +// // 3.增量数据处理 +// handleChangeData(currentEmployeeId); // tab页签数量 @@ -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..b5b5f7209 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 { } - /** * 保存发薪设置 * @@ -439,6 +440,10 @@ public class SalaryArchiveController { if (StringUtils.isNotBlank(archiveStatus)) { param.setArchiveStatus(archiveStatus); } + String runStatusLists = request.getParameter("runStatusList"); + if (StringUtils.isNotBlank(runStatusLists)) { + param.setRunStatusList(Arrays.stream(runStatusLists.split(",")).collect(Collectors.toList())); + } return param; } 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); // 获取所有可被引用的薪资项目