From ace15ca7a15bb043bc7322cee2af72ab125202b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 15 Mar 2023 18:03:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E7=B3=BB=E7=BB=9F=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataCollectionEmployee.java | 3 + .../salaryacct/bo/SalaryAcctEmployeeBO.java | 39 ++++++ .../salaryacct/po/SalaryAcctEmployeePO.java | 8 ++ .../bo/SalaryArchiveExcelBO.java | 48 +++---- .../param/SalaryArchiveImportHandleParam.java | 14 +- .../SalaryArchiveListTypeEnum.java | 3 +- .../mapper/archive/SalaryArchiveMapper.xml | 12 +- .../mapper/taxagent/TaxAgentEmpMapper.xml | 3 + .../salary/service/SalaryEmployeeService.java | 2 + .../service/SalarySobExtRangeService.java | 54 ++++++++ .../salary/service/SalarySobRangeService.java | 17 --- .../service/impl/ExtEmpServiceImpl.java | 2 + .../impl/SalaryAcctEmployeeServiceImpl.java | 2 +- .../impl/SalaryArchiveExcelServiceImpl.java | 10 +- .../impl/SalaryArchiveServiceImpl.java | 1 - .../impl/SalaryEmployeeServiceImpl.java | 79 +++++++---- .../impl/SalarySobExtRangeServiceImpl.java | 131 ++++++++++++++++++ .../impl/SalarySobRangeServiceImpl.java | 52 ------- .../service/impl/TaxAgentEmpServiceImpl.java | 9 +- .../salary/web/SalaryArchiveController.java | 2 +- .../salary/wrapper/SalaryArchiveWrapper.java | 13 ++ .../salary/wrapper/SalarySobRangeWrapper.java | 12 +- 22 files changed, 371 insertions(+), 145 deletions(-) create mode 100644 src/com/engine/salary/service/SalarySobExtRangeService.java create mode 100644 src/com/engine/salary/service/impl/SalarySobExtRangeServiceImpl.java diff --git a/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java b/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java index 4be37e92f..d9d021fa5 100644 --- a/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java +++ b/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java @@ -99,5 +99,8 @@ public class DataCollectionEmployee { //是否是系统管理员 private Boolean isAdmin; + //是否外部人员 + private boolean extEmp; + } diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java index 6ce040fed..39499174c 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java @@ -120,6 +120,45 @@ public class SalaryAcctEmployeeBO { return resultList; } + public static List convert2Employee(Collection employee, + SalaryAcctRecordPO salaryAcctRecord, + List salaryArchiveTaxAgentData, + Long employeeId) { + if (CollectionUtils.isEmpty(employee)) { + return Collections.emptyList(); + } + List resultList = Lists.newArrayList(); + Map>> empIdKeyTaxAgentMap = SalaryEntityUtil.group2Map(salaryArchiveTaxAgentData, SalaryArchiveDataDTO::getEmployeeId, SalaryArchiveDataDTO::getTaxAgents); + Date now = new Date(); + for (DataCollectionEmployee emp : employee) { + Set taxAgentIds = Sets.newHashSet(); + Set> taxAgentSet = empIdKeyTaxAgentMap.getOrDefault(emp.getEmployeeId(), Collections.emptySet()); + for (List taxAgents : taxAgentSet) { + taxAgentIds.addAll(SalaryEntityUtil.properties(taxAgents, SalaryArchiveTaxAgentDataDTO::getTaxAgentId)); + } + if (CollectionUtils.isEmpty(taxAgentIds)) { + taxAgentIds.add(0L); + } + for (Long taxAgentId : taxAgentIds) { + SalaryAcctEmployeePO salaryAcctEmployee = SalaryAcctEmployeePO.builder() + .salaryAcctRecordId(salaryAcctRecord.getId()) + .salarySobId(salaryAcctRecord.getSalarySobId()) + .salaryMonth(salaryAcctRecord.getSalaryMonth()) + .employeeId(emp.getEmployeeId()) + .employeeType(emp.isExtEmp() ? 1 : 0) + .taxAgentId(taxAgentId) + .creator(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(0) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); + resultList.add(salaryAcctEmployee); + } + } + return resultList; + } + public static List> partitionByEmployeeId(List salaryAcctEmployees) { if (CollectionUtils.isEmpty(salaryAcctEmployees)) { diff --git a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java index fdea4f715..f9c1d68e6 100644 --- a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java +++ b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.salaryacct.po; import com.engine.salary.annotation.SalaryFormulaVar; +import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -49,6 +50,13 @@ public class SalaryAcctEmployeePO { @SalaryFormulaVar(defaultLabel = "人员id", labelId = 86321, dataType = "number") private Long employeeId; + /** + * 人员类型,0或null组织架构,1非系统人员 + * + * @see DataCollectionEmployeeTypeEnum + */ + private Integer employeeType; + /** * 个税扣缴义务人id */ diff --git a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java index 7674039d9..1ac1bc242 100644 --- a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java +++ b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.salaryarchive.bo; -import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.constant.SalaryArchiveConstant; import com.engine.salary.constant.SalaryDefaultTenantConstant; @@ -18,10 +17,6 @@ import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salaryarchive.*; import com.engine.salary.enums.salarysob.TargetTypeEnum; -import com.engine.salary.service.SalaryEmployeeService; -import com.engine.salary.service.TaxAgentManageRangeService; -import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; -import com.engine.salary.service.impl.TaxAgentManageRangeServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.excel.ExcelComment; @@ -46,15 +41,6 @@ import java.util.stream.Collectors; */ public class SalaryArchiveExcelBO extends Service { - - private SalaryEmployeeService getSalaryEmployeeService() { - return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); - } - - public TaxAgentManageRangeService getTaxAgentManageRangeService() { - return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user); - } - public static String userNameI18n; public static String departmentI18n; public static String jobNumI18n; @@ -360,20 +346,28 @@ public class SalaryArchiveExcelBO extends Service { String userName = Optional.ofNullable(map.get(userNameI18n)).orElse("").toString(); String deparmentName = Optional.ofNullable(map.get(departmentI18n)).orElse("").toString(); String mobileName = Optional.ofNullable(map.get("手机号")).orElse("").toString(); - String jobNum = Optional.ofNullable(map.get(jobNumI18n)).orElse("").toString(); - String hrmStatus = Optional.ofNullable(map.get(hrStatusI18n)).orElse("").toString(); -// Optional optionalStatus = importHandleParam.getHrmStatusList().stream().filter(s -> s.getName().equals(hrmStatus)).findFirst(); -// String codeId = optionalStatus.map(status -> status.getCodeId() + "").orElse(""); + String workcode = Optional.ofNullable(map.get("工号")).orElse("").toString(); - List emps = importHandleParam.getEmployees().stream().filter(e -> - (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) - && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)) - && (StringUtils.isBlank(mobileName) || Objects.equals(e.getMobile(), mobileName)) -// && (StringUtils.isBlank(jobNum) || Objects.equals(e.getWorkcode(), jobNum)) - ) -// && (StringUtils.isBlank(hrmStatus) || Objects.equals(e.getPersonnelStatus(), codeId)) -// .map(DataCollectionEmployee::getEmployeeId) - .collect(Collectors.toList()); + String validType = importHandleParam.getEmpValidType(); + List emps = new ArrayList<>(); + //外部人员 + if(importHandleParam.isExtEmp()){ + emps = importHandleParam.getEmployees().stream().filter(e -> + (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) + && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)) + && (StringUtils.isBlank(mobileName) || Objects.equals(e.getMobile(), mobileName))).collect(Collectors.toList()); + }else { + if ("0".equals(validType)) { + //“0”代表姓名+部门+手机号的匹配原则,“1”代表工号为唯一匹配原则 + emps = importHandleParam.getEmployees().stream().filter(e -> + (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) + && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)) + && (StringUtils.isBlank(mobileName) || Objects.equals(e.getMobile(), mobileName))).collect(Collectors.toList()); + } else if ("1".equals(validType)) { + emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(workcode) || Objects.equals(e.getWorkcode(), workcode))) + .collect(Collectors.toList()); + } + } List employeeSameIds = new ArrayList<>(); if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) { diff --git a/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java b/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java index cf5173288..17b552ca6 100644 --- a/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java +++ b/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java @@ -62,6 +62,11 @@ public class SalaryArchiveImportHandleParam { */ boolean isProcess; + /** + * 是否是外部人员 + */ + boolean isExtEmp; + /** * 说明 */ @@ -72,6 +77,11 @@ public class SalaryArchiveImportHandleParam { Long currentEmployeeId; String tenantKey; + /** + * 人员验证方式 + */ + String empValidType; + // 待定薪列表 boolean isPendingList; // 定薪列表 @@ -86,10 +96,6 @@ public class SalaryArchiveImportHandleParam { */ List employees; - /** - * 租户下的人员状态 - */ -// List hrmStatusList; /** * 获取所有个税扣缴义务人 diff --git a/src/com/engine/salary/enums/salaryarchive/SalaryArchiveListTypeEnum.java b/src/com/engine/salary/enums/salaryarchive/SalaryArchiveListTypeEnum.java index 2b04a2336..014bb4052 100644 --- a/src/com/engine/salary/enums/salaryarchive/SalaryArchiveListTypeEnum.java +++ b/src/com/engine/salary/enums/salaryarchive/SalaryArchiveListTypeEnum.java @@ -15,7 +15,8 @@ public enum SalaryArchiveListTypeEnum { PENDING("PENDING", "待定薪", 107875), FIXED("FIXED", "发薪", 109713), SUSPEND("SUSPEND", "待停薪", 107879), - STOP("STOP", "停薪", 109348); + STOP("STOP", "停薪", 109348), + EXT("EXT", "非系统人员", 109348); private String value; diff --git a/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml b/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml index 1257dfe61..7fe3768fd 100644 --- a/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml +++ b/src/com/engine/salary/mapper/archive/SalaryArchiveMapper.xml @@ -408,12 +408,12 @@ - - AND t.run_status IN - - #{runStatus} - - + + + + + + diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml index bae6797bf..d418e242d 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml @@ -82,6 +82,9 @@ AND employee_type = #{employeeType} + + AND (employee_type is null or employee_type = 0) + AND tax_agent_id IN diff --git a/src/com/engine/salary/service/SalaryEmployeeService.java b/src/com/engine/salary/service/SalaryEmployeeService.java index 7cb496957..eb7d56277 100644 --- a/src/com/engine/salary/service/SalaryEmployeeService.java +++ b/src/com/engine/salary/service/SalaryEmployeeService.java @@ -78,6 +78,8 @@ public interface SalaryEmployeeService { */ List matchImportEmployee(List employeeList, String userName, String deparmentName, String mobile, String workcode, Long uid); + String empValidType(); + List getDeptInfoList(List departmentIds); List getSubCompanyInfoList(List subDepartmentIds); diff --git a/src/com/engine/salary/service/SalarySobExtRangeService.java b/src/com/engine/salary/service/SalarySobExtRangeService.java new file mode 100644 index 000000000..0fd6d5bb1 --- /dev/null +++ b/src/com/engine/salary/service/SalarySobExtRangeService.java @@ -0,0 +1,54 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.SalarySobExtRangePO; +import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam; +import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; +import com.engine.salary.util.page.PageInfo; + +import java.util.Collection; +import java.util.List; + +/** + * 薪资账套人员范围 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface SalarySobExtRangeService { + + /** + * 根据主键id查询薪资账套的人员范围 + * + * @param ids 薪资账套的人员范围的主键id + * @return + */ + List listByIds(Collection ids); + + /** + * 根据薪资账套ID和类型查询薪资账套的人员范围 + * + * @param salarySobId 薪资账套id + * @return + */ + List listBySalarySobId(Long salarySobId); + + + /** + * 保存外部人员 + * @param saveParam + */ + void saveExtRange(SalarySobRangeExtSaveParam saveParam); + + /** + * 外部人员列表 + * @param param + * @return + */ + PageInfo listPage4Ext(SalarySobRangeQueryParam param); + + + void deleteSalarySobExtRange(Collection ids); + +} diff --git a/src/com/engine/salary/service/SalarySobRangeService.java b/src/com/engine/salary/service/SalarySobRangeService.java index 91e2c3430..3bfb8172a 100644 --- a/src/com/engine/salary/service/SalarySobRangeService.java +++ b/src/com/engine/salary/service/SalarySobRangeService.java @@ -1,8 +1,6 @@ package com.engine.salary.service; -import com.engine.salary.entity.SalarySobExtRangePO; import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; -import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam; @@ -65,19 +63,6 @@ public interface SalarySobRangeService { */ void save(SalarySobRangeSaveParam saveParam); - /** - * 保存外部人员 - * @param saveParam - */ - void saveExtRange(SalarySobRangeExtSaveParam saveParam); - - /** - * 外部人员列表 - * @param param - * @return - */ - PageInfo listPage4Ext(SalarySobRangeQueryParam param); - /** * 根据主键id删除薪资账套的人员范围 * @@ -85,8 +70,6 @@ public interface SalarySobRangeService { */ void deleteByIds(Collection ids); - void deleteSalarySobExtRange(Collection ids); - /** * 根据薪资账套id删除薪资账套的人员范围 * diff --git a/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java b/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java index 4a3693f90..5c9a1be10 100644 --- a/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java +++ b/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java @@ -147,6 +147,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService { DataCollectionEmployee employee = new DataCollectionEmployee(); BeanUtils.copyProperties(extPo, employee); employee.setEmployeeId(extPo.getId()); + employee.setExtEmp(true); return employee; } @@ -159,6 +160,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService { DataCollectionEmployee employee = new DataCollectionEmployee(); BeanUtils.copyProperties(emp, employee); employee.setEmployeeId(emp.getId()); + employee.setExtEmp(true); return employee; }).collect(Collectors.toList()); } diff --git a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java index 0016a4526..07e1eee68 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java @@ -492,7 +492,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct List employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId,Collectors.toList()); List salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId); // 转换成薪资核算人员po - List salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2EmployeePO(employeeIds, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID()); + List salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2Employee(salaryEmployees, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID()); //过滤掉不属于当前账套扣缴义务人的人员 salaryAcctEmployeePOS = salaryAcctEmployeePOS.stream().filter(po -> Objects.equals(taxAgentId, po.getTaxAgentId())).collect(Collectors.toList()); diff --git a/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java index b0c89ffa9..5260bf10f 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java @@ -17,7 +17,6 @@ import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; -import com.engine.salary.entity.taxagent.po.TaxAgentEmployeePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveListTypeEnum; @@ -696,11 +695,6 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch List salaryArchiveIds = salaryArchiveList.stream().map(SalaryArchivePO::getId).collect(Collectors.toList()); Map salaryArchivesMap = SalaryEntityUtil.convert2Map(salaryArchiveList, k -> k.getEmployeeId() + "-" + k.getTaxAgentId()); - List employees = getTaxAgentService(user).listEmployees(); - - // 查询人员状态 -// List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); - return SalaryArchiveImportHandleParam.builder() .isProcess(param.isProcess()) .description(param.getDescription()) @@ -708,12 +702,16 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch .importType(importType) .currentEmployeeId((long) user.getUID()) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + //人员定位方式 + .empValidType(getSalaryEmployeeService(user).empValidType()) // 待定薪列表 .isPendingList(isPendingList) // 定薪列表 .isFixedList(isFixedList) // 待停薪列表 .isSuspendList(isSuspendList) + //外部人员 + .isExtEmp(param.isExtEmp()) // 初始化导入 .isInit(isInit) // 调薪导入 diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 36d9f521f..a016c3f48 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -190,7 +190,6 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe //排序配置 OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); queryParam.setOrderRule(orderRule); - queryParam.setExtSalaryArchiveList(true); List list = getSalaryArchiveList(queryParam); list = list.stream() //过滤档案状态 diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index 284efe857..1f61ac4a6 100644 --- a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java @@ -4,6 +4,7 @@ import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.EmployBiz; +import com.engine.salary.entity.SalarySobExtRangePO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.PositionInfo; @@ -15,6 +16,7 @@ import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.service.ExtEmpService; import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.SalarySobExtRangeService; import com.engine.salary.service.SalarySobRangeService; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.util.SalaryEntityUtil; @@ -43,6 +45,10 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user); } + private SalarySobExtRangeService getSalarySobExtRangeService(User user) { + return ServiceUtil.getService(SalarySobExtRangeServiceImpl.class, user); + } + private SalarySysConfMapper getSalarySysConfMapper() { return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } @@ -74,34 +80,47 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee @Override public List listBySalarySobId(Long salarySobId) { + + List includeSalaryEmployees = new ArrayList<>(); + // 查询薪资账套的人员范围 List includeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ONE); - if (CollectionUtils.isEmpty(includeSalarySobRangePOS)) { - return Collections.emptyList(); - } - // 将薪资账套的人员范围转换成人员查询参数 - List includeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(includeSalarySobRangePOS); - // 根据上一步的查询参数查询人员 - List includeSalaryEmployees = listByParams(includeQueryParams); - if (CollectionUtils.isEmpty(includeSalaryEmployees)) { - return Collections.emptyList(); - } - //去重 - includeSalaryEmployees = includeSalaryEmployees.stream().distinct().collect(Collectors.toList()); - // 查询薪资账套的人员范围(从范围中排除) - List excludeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ZERO); - if (CollectionUtils.isNotEmpty(excludeSalarySobRangePOS)) { + if (CollectionUtils.isNotEmpty(includeSalarySobRangePOS)) { // 将薪资账套的人员范围转换成人员查询参数 - List excludeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(excludeSalarySobRangePOS); + List includeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(includeSalarySobRangePOS); // 根据上一步的查询参数查询人员 - List excludeSalaryEmployees = listByParams(excludeQueryParams); - // 需要排除的人员范围 - Set excludeEmployeeIds = SalaryEntityUtil.properties(excludeSalaryEmployees, DataCollectionEmployee::getEmployeeId); - // 过滤人员 - includeSalaryEmployees = includeSalaryEmployees.stream() - .filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId())) - .collect(Collectors.toList()); + includeSalaryEmployees = listByParams(includeQueryParams); + if (CollectionUtils.isEmpty(includeSalaryEmployees)) { + return Collections.emptyList(); + } + //去重 + includeSalaryEmployees = includeSalaryEmployees.stream().distinct().collect(Collectors.toList()); + // 查询薪资账套的人员范围(从范围中排除) + List excludeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ZERO); + if (CollectionUtils.isNotEmpty(excludeSalarySobRangePOS)) { + // 将薪资账套的人员范围转换成人员查询参数 + List excludeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(excludeSalarySobRangePOS); + // 根据上一步的查询参数查询人员 + List excludeSalaryEmployees = listByParams(excludeQueryParams); + // 需要排除的人员范围 + Set excludeEmployeeIds = SalaryEntityUtil.properties(excludeSalaryEmployees, DataCollectionEmployee::getEmployeeId); + // 过滤人员 + includeSalaryEmployees = includeSalaryEmployees.stream() + .filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId())) + .collect(Collectors.toList()); + } } + + //外部人员 + List salarySobExtRangePOS = getSalarySobExtRangeService(user).listBySalarySobId(salarySobId); + if(CollectionUtils.isNotEmpty(salarySobExtRangePOS)){ + List ids = SalaryEntityUtil.properties(salarySobExtRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList()); + List extEmps = getExtEmpService(user).getEmployeeByIds(ids); + extEmps = extEmps.stream().distinct().collect(Collectors.toList()); + + includeSalaryEmployees.addAll(extEmps); + } + return includeSalaryEmployees; } @@ -166,8 +185,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee } //查询对于人员信息导入筛选的全局配置 - SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); - String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; + String confValue = empValidType(); List employees = new ArrayList<>(); //“0”代表姓名+部门+手机号的匹配原则,“1”代表工号为唯一匹配原则 if ("0".equals(confValue)) { @@ -184,6 +202,17 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee } + /** + * 人员定位方式 + * “0”代表姓名+部门+手机号的匹配原则,“1”代表工号为唯一匹配原则 + * @return + */ + @Override + public String empValidType() { + SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); + return (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; + } + @Override public List getDeptInfoList(List departmentIds) { return employBiz.getDeptInfoList(departmentIds); diff --git a/src/com/engine/salary/service/impl/SalarySobExtRangeServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobExtRangeServiceImpl.java new file mode 100644 index 000000000..54808736d --- /dev/null +++ b/src/com/engine/salary/service/impl/SalarySobExtRangeServiceImpl.java @@ -0,0 +1,131 @@ +package com.engine.salary.service.impl; + +import com.api.formmode.mybatis.util.SqlProxyHandle; +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.SalarySobExtRangePO; +import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam; +import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; +import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.salarysob.SalarySobExtRangeMapper; +import com.engine.salary.mapper.sys.SalarySysConfMapper; +import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.SalarySobExtRangeService; +import com.engine.salary.service.SalarySobService; +import com.engine.salary.service.TaxAgentService; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; +import com.engine.salary.util.valid.ValidUtil; +import dm.jdbc.util.IdGenerator; +import org.apache.commons.collections4.CollectionUtils; +import weaver.hrm.User; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 薪资账套人员范围 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class SalarySobExtRangeServiceImpl extends Service implements SalarySobExtRangeService { + + + + private SalarySobService getSalarySobService(User user) { + return ServiceUtil.getService(SalarySobServiceImpl.class, user); + } + + private TaxAgentService getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + } + + private SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } + + private SalarySysConfMapper getSalarySysConfMapper() { + return SqlProxyHandle.getProxy(SalarySysConfMapper.class); + } + + private SalarySobExtRangeMapper getSalarySobExtRangeMapper() { + return SqlProxyHandle.getProxy(SalarySobExtRangeMapper.class); + } + +// private ComInfoCache comInfoCache; +// private LoggerTemplate salarySobLoggerTemplate; + + @Override + public List listByIds(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + return Collections.emptyList(); + } + return getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().ids(ids).build()); + } + + @Override + public List listBySalarySobId(Long salarySobId) { + if (salarySobId ==null) { + return Collections.emptyList(); + } + return getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().salarySobId(salarySobId).build()); + } + + + @Override + public void saveExtRange(SalarySobRangeExtSaveParam saveParam) { + ValidUtil.doValidator(saveParam); + + // 查询薪资账套 + SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId()); + if (Objects.isNull(salarySobPO)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); + } + // 查询已有的人员范围 + List salarySobRangePOS = getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().salarySobId(saveParam.getSalarySobId()).build()); + // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) + List oldTargetIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList()); + + List targetIds = saveParam.getTargetIds(); + Date date = new Date(); + if (CollectionUtils.isNotEmpty(targetIds)) { + targetIds.stream().filter(targetId -> !oldTargetIds.contains(targetId)).forEach(targetId -> { + SalarySobExtRangePO po = SalarySobExtRangePO.builder() + .id(IdGenerator.generate()) + .targetType(1) + .salarySobId(saveParam.getSalarySobId()) + .targetId(targetId) + .createTime(date) + .updateTime(date) + .creator((long) user.getUID()) + .deleteType(0) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); + getSalarySobExtRangeMapper().insertIgnoreNull(po); + }); + } + } + + @Override + public PageInfo listPage4Ext(SalarySobRangeQueryParam param) { + List salarySobRangePOS = getSalarySobExtRangeMapper().listPage4Ext(SalarySobExtRangePO.builder().salarySobId(param.getSalarySobId()).build()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class); + } + + + @Override + public void deleteSalarySobExtRange(Collection ids) { + if(CollectionUtils.isEmpty(ids)){ + return; + } + getSalarySobExtRangeMapper().deleteByIds(ids); + } + +} diff --git a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java index 3da01f5b0..257ab6d72 100644 --- a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java @@ -6,8 +6,6 @@ import com.engine.core.impl.Service; import com.engine.hrm.biz.OrganizationShowSetBiz; import com.engine.salary.biz.SalarySobRangeBiz; import com.engine.salary.biz.SpecialAddDeductionBiz; -import com.engine.salary.constant.SalaryDefaultTenantConstant; -import com.engine.salary.entity.SalarySobExtRangePO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.PositionInfo; @@ -16,7 +14,6 @@ import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO; import com.engine.salary.entity.salarysob.bo.SalarySobRangeSaveBO; import com.engine.salary.entity.salarysob.dto.SalarySobRangeImportListDTO; import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; -import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam; @@ -44,7 +41,6 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -202,46 +198,6 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange // salarySobLoggerTemplate.write(loggerContext); } - @Override - public void saveExtRange(SalarySobRangeExtSaveParam saveParam) { - ValidUtil.doValidator(saveParam); - - // 查询薪资账套 - SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId()); - if (Objects.isNull(salarySobPO)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); - } - // 查询已有的人员范围 - List salarySobRangePOS = getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().salarySobId(saveParam.getSalarySobId()).build()); - // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) - List oldTargetIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList()); - - List targetIds = saveParam.getTargetIds(); - Date date = new Date(); - if (CollectionUtils.isNotEmpty(targetIds)) { - targetIds.stream().filter(targetId -> !oldTargetIds.contains(targetId)).forEach(targetId -> { - SalarySobExtRangePO po = SalarySobExtRangePO.builder() - .id(IdGenerator.generate()) - .targetType(1) - .salarySobId(saveParam.getSalarySobId()) - .targetId(targetId) - .createTime(date) - .updateTime(date) - .creator((long) user.getUID()) - .deleteType(0) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build(); - getSalarySobExtRangeMapper().insertIgnoreNull(po); - }); - } - } - - @Override - public PageInfo listPage4Ext(SalarySobRangeQueryParam param) { - List salarySobRangePOS = getSalarySobExtRangeMapper().listPage4Ext(SalarySobExtRangePO.builder().salarySobId(param.getSalarySobId()).build()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class); - } - @Override public void deleteByIds(Collection ids) { // 查询薪资账套的人员范围 @@ -270,14 +226,6 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange // }); } - @Override - public void deleteSalarySobExtRange(Collection ids) { - if(CollectionUtils.isEmpty(ids)){ - return; - } - getSalarySobExtRangeMapper().deleteByIds(ids); - } - @Override public void deleteBySalarySobIds(Collection salarySobIds) { salarySobRangeBiz.deleteBySalarySobIds(salarySobIds); diff --git a/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java index a5847783f..84ed0b59d 100644 --- a/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java @@ -162,7 +162,7 @@ public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpServic return; } List taxAgentIds = taxAgentEmpSaveParamList.stream().map(TaxAgentEmpSaveParam::getTaxAgentId).collect(Collectors.toList()); - List taxAgentEmployeeExistList = this.listByTaxAgentIds(taxAgentIds); + List taxAgentEmployeeExistList = this.listExtByTaxAgentIds(taxAgentIds); Date now = new Date(); // 关联表 List taxAgentEmployeeAddList = Lists.newArrayList(); @@ -251,4 +251,11 @@ public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpServic getTaxAgentEmpChangeService(user).batchInsert(taxAgentEmpChangeList); } } + + private List listExtByTaxAgentIds(List taxAgentIds) { + if (CollectionUtils.isEmpty(taxAgentIds)) { + return Lists.newArrayList(); + } + return getTaxAgentEmpMapper().listSome(TaxAgentEmpPO.builder().employeeType(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue()).taxAgentIds(taxAgentIds).build()); + } } diff --git a/src/com/engine/salary/web/SalaryArchiveController.java b/src/com/engine/salary/web/SalaryArchiveController.java index 7dab8f6d0..226e72c65 100644 --- a/src/com/engine/salary/web/SalaryArchiveController.java +++ b/src/com/engine/salary/web/SalaryArchiveController.java @@ -235,7 +235,7 @@ public class SalaryArchiveController { @Produces(MediaType.APPLICATION_JSON) public String extList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getSalaryArchiveWrapper(user)::listPage, queryParam); + return new ResponseResult>(user).run(getSalaryArchiveWrapper(user)::extList, queryParam); } diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java index 9994e12e7..59c1d2da1 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java @@ -304,6 +304,19 @@ public class SalaryArchiveWrapper extends Service { } + /** + * 外部人员 + * @param queryParam + * @return + */ + public Map extList(SalaryArchiveQueryParam queryParam) { + queryParam.setRunStatusList(Arrays.asList(SalaryArchiveStatusEnum.FIXED.getValue())); + queryParam.setExtSalaryArchiveList(true); + return list(queryParam, SalaryArchiveListTypeEnum.EXT); + } + + + /** * 获取薪资档案详情表单 * diff --git a/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java b/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java index c5484135a..e85253543 100644 --- a/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java @@ -8,7 +8,9 @@ import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam; +import com.engine.salary.service.SalarySobExtRangeService; import com.engine.salary.service.SalarySobRangeService; +import com.engine.salary.service.impl.SalarySobExtRangeServiceImpl; import com.engine.salary.service.impl.SalarySobRangeServiceImpl; import com.engine.salary.util.page.PageInfo; import org.apache.commons.lang.math.NumberUtils; @@ -32,6 +34,10 @@ public class SalarySobRangeWrapper extends Service { return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user); } + private SalarySobExtRangeService getSalarySobExtRangeService(User user) { + return ServiceUtil.getService(SalarySobExtRangeServiceImpl.class, user); + } + /** * 薪资账套的人员范围列表(关联人员范围) * @@ -76,11 +82,11 @@ public class SalarySobRangeWrapper extends Service { * @param saveParam 保存参数 */ public void saveExtRange(SalarySobRangeExtSaveParam saveParam) { - getSalarySobRangeService(user).saveExtRange(saveParam); + getSalarySobExtRangeService(user).saveExtRange(saveParam); } public PageInfo listPage4Ext(SalarySobRangeQueryParam param) { - return getSalarySobRangeService(user).listPage4Ext(param); + return getSalarySobExtRangeService(user).listPage4Ext(param); } /** @@ -93,7 +99,7 @@ public class SalarySobRangeWrapper extends Service { } public void deleteSalarySobExtRange(Collection ids) { - getSalarySobRangeService(user).deleteSalarySobExtRange(ids); + getSalarySobExtRangeService(user).deleteSalarySobExtRange(ids); } /***