diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 30d2d2d85..a0e5dc2fe 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1,6 +1,6 @@ package com.engine.salary.service.impl; -import com.api.formmode.mybatis.util.SqlProxyHandle; +import com.cloudstore.dev.api.util.Util_DataCache; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.*; @@ -26,9 +26,9 @@ import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.archive.SalaryArchiveItemMapper; import com.engine.salary.mapper.archive.SalaryArchiveMapper; -import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.service.*; import com.engine.salary.sys.entity.vo.OrderRuleVO; +import com.engine.salary.sys.enums.OpenEnum; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryDateUtil; @@ -118,11 +118,6 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe return ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user); } - - private SalarySysConfMapper getSalarySysConfMapper() { - return SqlProxyHandle.getProxy(SalarySysConfMapper.class); - } - @Override public SalaryArchivePO getById(Long salaryArchiveId) { return salaryArchiveMapper.getById(salaryArchiveId); @@ -131,10 +126,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe @Override public List listSome(SalaryArchivePO po) { Collection ids = po.getIds(); - if(CollectionUtils.isNotEmpty(ids)){ + if (CollectionUtils.isNotEmpty(ids)) { List list = new ArrayList<>(); List> partition = Lists.partition((List) ids, 1000); - partition.forEach(idss->{ + partition.forEach(idss -> { po.setIds(idss); list.addAll(getSalaryArchiveMapper().listSome(po)); }); @@ -142,10 +137,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } Collection employeeIds = po.getEmployeeIds(); - if(CollectionUtils.isNotEmpty(employeeIds)){ + if (CollectionUtils.isNotEmpty(employeeIds)) { List list = new ArrayList<>(); List> partition = Lists.partition((List) employeeIds, 1000); - partition.forEach(emps->{ + partition.forEach(emps -> { po.setEmployeeIds(emps); list.addAll(getSalaryArchiveMapper().listSome(po)); }); @@ -160,13 +155,24 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe public PageInfo listPage(SalaryArchiveQueryParam queryParam) { long currentEmployeeId = user.getUID(); - - // 1.历史数据处理 - handleHistory(currentEmployeeId); - // 2.待停薪自动处理 - handleSuspendData(currentEmployeeId); - // 3.增量数据处理 - handleChangeData(currentEmployeeId); + /** + * 异步处理档案数据 + */ + String handleable = Util.null2String(Util_DataCache.getObjVal("salaryArchiveHandleable")); + if (StringUtils.isBlank(handleable) || OpenEnum.OPEN.getValue().equals(handleable)) { + new Thread() { + public void run() { + Util_DataCache.setObjVal("salaryArchiveHandleable", "0"); + // 1.历史数据处理 + handleHistory(currentEmployeeId); + // 2.待停薪自动处理 + handleSuspendData(currentEmployeeId); + // 3.增量数据处理 + handleChangeData(currentEmployeeId); + Util_DataCache.setObjVal("salaryArchiveHandleable", "1"); + } + }.start(); + } Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId); @@ -1107,9 +1113,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } List oldList = listSome(SalaryArchivePO.builder() - .ids(ids) - .runStatus(SalaryArchiveStatusEnum.PENDING.getValue()) - .build()); + .ids(ids) + .runStatus(SalaryArchiveStatusEnum.PENDING.getValue()) + .build()); if (CollectionUtils.isEmpty(oldList)) { @@ -1192,9 +1198,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录")); } List oldList = listSome(SalaryArchivePO.builder() - .ids(ids) - .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue()) - .build()); + .ids(ids) + .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue()) + .build()); if (CollectionUtils.isEmpty(oldList)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "档案不存在!")); @@ -1241,9 +1247,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } List oldList = listSome(SalaryArchivePO.builder() - .ids(ids) - .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue()) - .build()); + .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, "最后发薪日必须晚于今天")); diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java index 596808e3a..d50b8de03 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java @@ -15,7 +15,6 @@ import com.engine.salary.entity.salaryarchive.param.*; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; -import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; @@ -323,16 +322,8 @@ public class SalaryArchiveWrapper extends Service { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100465, "薪资档案员工信息不存在")); } - // 获取当前已生效个税扣缴义务人 - List taxAgentList = getSalaryArchiveService(user).getCurrentEffectiveTaxAgentList(Collections.singletonList(salaryArchiveId)); - // 获取所有个税扣缴义务人 - Collection taxAgentLists = getTaxAgentService(user).findAll(); - String taxAgent = ""; - if (CollectionUtils.isNotEmpty(taxAgentList)) { - SalaryArchiveTaxAgentPO salaryArchiveTaxAgent = taxAgentList.get(0); - Optional taxAgentOptional = taxAgentLists.stream().filter(f -> f.getId().equals(salaryArchiveTaxAgent.getTaxAgentId())).findFirst(); - taxAgent = taxAgentOptional.isPresent() ? taxAgentOptional.get().getName() : taxAgent; - } + Long taxAgentId = po.getTaxAgentId(); + TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxAgentId); // 1.基本信息表单 Map baseInfo = new HashMap<>(); @@ -343,7 +334,7 @@ public class SalaryArchiveWrapper extends Service { .position(employee.getJobtitleName() == null ? "" : employee.getJobtitleName()) .hiredate(employee.getCompanystartdate()) .mobile(employee.getMobile()) - .taxAgent(taxAgent) + .taxAgent(taxAgent.getName()) .build(); baseInfo.put("employee", build); @@ -422,31 +413,6 @@ public class SalaryArchiveWrapper extends Service { return importTypes; } -// /** -// * 导出薪资档案 -// * -// * @param queryParam -// * @param employeeId -// * @param tenantKey -// * @return -// */ -// public Map exportList(SalaryArchiveQueryParam queryParam, Long employeeId, String tenantKey) { -// // 构建异步导出参数 -// Map map = salaryBatchService.buildeExportParam("exportSalaryArchive"); -// String username = UserContext.getCurrentUser().getUsername(); -// String eteamsId = TenantRpcContext.getEteamsId(); -// taskExecutor.execute(() -> { -// try { -// DSTenantKeyThreadVar.tenantKey.set(tenantKey); -// getSalaryArchiveService(user).exportList(map, username, eteamsId, queryParam, employeeId, tenantKey); -// } finally { -// DSTenantKeyThreadVar.tenantKey.remove(); -// } -// }); -// -// return map; -// } -// /** * 下载导入模板 @@ -561,15 +527,6 @@ public class SalaryArchiveWrapper extends Service { return getSalaryArchiveExcelService(user).processInit(importData); } - -// public Map importSalaryArchiveSalaryItemAdjust(SalaryArchiveImportActionParam importData) { -// importData.setListType("FIXED"); -// importData.setImportType("salaryItemAdjust"); -// importData.setAddData(true); -// return getSalaryArchiveExcelService(user).processInit(importData); -// } - - /** * 停薪 *