From 19ea334d57b5ad3d67319bbbd98b7d48cfdece9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 21 Sep 2022 11:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=91=98=E5=B7=A5=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/SalaryEmployeeService.java | 11 ++++++ .../impl/SalaryArchiveServiceImpl.java | 9 ++++- .../impl/SalaryEmployeeServiceImpl.java | 34 +++++++++++++++++++ .../engine/salary/util/SalaryEntityUtil.java | 19 +++++++++-- 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/com/engine/salary/service/SalaryEmployeeService.java b/src/com/engine/salary/service/SalaryEmployeeService.java index d5bf2f191..1acc05e9b 100644 --- a/src/com/engine/salary/service/SalaryEmployeeService.java +++ b/src/com/engine/salary/service/SalaryEmployeeService.java @@ -62,4 +62,15 @@ public interface SalaryEmployeeService { * @return */ // DataCollectionEmployee getLoginEmployeeById(Long employeeId); + + /** + * 筛选导入人员信息可以在人力资源池中匹配到的人员信息 + * @param employeeList 人力资源池 + * @param userName 姓名 + * @param deparmentName 部门 + * @param mobile 手机号 + * @param workcode 工号 + * @param uid 人员id + */ + List matchImportEmployee(List employeeList, String userName, String deparmentName, String mobile, String workcode,Long uid); } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index afe35218e..c736bda71 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -33,6 +33,7 @@ import com.engine.salary.mapper.archive.SalaryArchiveMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.service.SalaryAcctEmployeeService; import com.engine.salary.service.SalaryArchiveService; +import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.TaxAgentService; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; @@ -113,6 +114,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } + private SalarySysConfMapper getSalarySysConfMapper() { return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } @@ -954,6 +959,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe boolean isTaxAgentAdjust = importType.equals(SalaryArchiveImportTypeEnum.TAXAGENTADJUST.getValue()); boolean isSalaryItemAdjust = importType.equals(SalaryArchiveImportTypeEnum.SALARYITEMADJUST.getValue()); + String uidI18n = SalaryI18nUtil.getI18nLabel(85429, "uid"); String userNameI18n = SalaryI18nUtil.getI18nLabel(85429, "姓名"); String taxAgentI18n = SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"); String effectiveTimeI18n = SalaryI18nUtil.getI18nLabel(85904, "生效日期"); @@ -962,6 +968,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe String adjustReasonI18n = SalaryI18nUtil.getI18nLabel(85431, "调整原因"); String rowindex = "第" + map.get("index") + "行"; // 1.姓名 + String uid = Optional.ofNullable(map.get(uidI18n)).orElse("").toString(); String userName = Optional.ofNullable(map.get(userNameI18n)).orElse("").toString(); String deparmentName = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86185, "部门"))).orElse("").toString(); String mobile = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86186, "手机号"))).orElse("").toString(); @@ -972,7 +979,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; //筛选导入人员信息可以在人力资源池中匹配到的人员信息 - List emps = getSalaryAcctEmployeeService(user).matchImportEmployee(importHandleParam.getEmployees(), userName, deparmentName, mobile, workcode); + List emps = getSalaryEmployeeService(user).matchImportEmployee(importHandleParam.getEmployees(), userName, deparmentName, mobile, workcode, SalaryEntityUtil.string2Long(uid)); List employeeSameIds = new ArrayList<>(); if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) { diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index c54eb9688..5eab234d8 100644 --- a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java @@ -1,5 +1,6 @@ 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.biz.EmployBiz; @@ -9,8 +10,10 @@ import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobRangePO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.mapper.datacollection.EmployMapper; +import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.SalarySobRangeService; +import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; @@ -42,6 +45,10 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee return MapperProxyFactory.getProxy(EmployMapper.class); } + private SalarySysConfMapper getSalarySysConfMapper() { + return SqlProxyHandle.getProxy(SalarySysConfMapper.class); + } + @Override public List listAll() { return employBiz.listEmployee(); @@ -120,4 +127,31 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee return employeeSameIds; } + + @Override + public List matchImportEmployee(List employeeList, String userName, String deparmentName, String mobile, String workcode, Long uid) { + if (uid != null) { + List ids = new ArrayList<>(); + ids.add(uid); + return getEmployeeByIds(ids); + } + + //查询对于人员信息导入筛选的全局配置 + SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); + String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; + List employees = new ArrayList<>(); + //“0”代表姓名+部门+手机号的匹配原则,“1”代表工号为唯一匹配原则 + if ("0".equals(confValue)) { + employees = employeeList.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) + && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)) + && (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile))) + .collect(Collectors.toList()); + } else if ("1".equals(confValue)) { + employees = employeeList.stream().filter(e -> (StringUtils.isBlank(workcode) || Objects.equals(e.getWorkcode(), workcode))) + .collect(Collectors.toList()); + } + + return employees; + + } } diff --git a/src/com/engine/salary/util/SalaryEntityUtil.java b/src/com/engine/salary/util/SalaryEntityUtil.java index 5fddd121e..307defe96 100644 --- a/src/com/engine/salary/util/SalaryEntityUtil.java +++ b/src/com/engine/salary/util/SalaryEntityUtil.java @@ -6,6 +6,7 @@ import com.google.common.collect.Sets; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import java.math.BigDecimal; import java.math.RoundingMode; @@ -203,19 +204,33 @@ public class SalaryEntityUtil { /** * 两个集合是否有交集 + * * @param list1 * @param list2 * @param * @return */ - public static boolean judgeIntersection(List list1,List list2){ + public static boolean judgeIntersection(List list1, List list2) { boolean flag = false; List origin = new ArrayList<>(); origin.addAll(list1); origin.retainAll(list2); - if(origin.size()>0){ + if (origin.size() > 0) { flag = true; } return flag; } + + /** + * String转Long + * @param obj + * @return + */ + public static Long string2Long(String obj) { + if (NumberUtils.isCreatable(obj)) { + return Long.valueOf(obj); + } + return null; + } + }