获取员工信息方法

This commit is contained in:
钱涛 2022-09-21 11:52:06 +08:00
parent 0045a0dd59
commit 19ea334d57
4 changed files with 70 additions and 3 deletions

View File

@ -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<DataCollectionEmployee> matchImportEmployee(List<DataCollectionEmployee> employeeList, String userName, String deparmentName, String mobile, String workcode,Long uid);
}

View File

@ -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<DataCollectionEmployee> emps = getSalaryAcctEmployeeService(user).matchImportEmployee(importHandleParam.getEmployees(), userName, deparmentName, mobile, workcode);
List<DataCollectionEmployee> emps = getSalaryEmployeeService(user).matchImportEmployee(importHandleParam.getEmployees(), userName, deparmentName, mobile, workcode, SalaryEntityUtil.string2Long(uid));
List<Long> employeeSameIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {

View File

@ -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<DataCollectionEmployee> listAll() {
return employBiz.listEmployee();
@ -120,4 +127,31 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
return employeeSameIds;
}
@Override
public List<DataCollectionEmployee> matchImportEmployee(List<DataCollectionEmployee> employeeList, String userName, String deparmentName, String mobile, String workcode, Long uid) {
if (uid != null) {
List<Long> 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<DataCollectionEmployee> 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;
}
}

View File

@ -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 <T>
* @return
*/
public static <T> boolean judgeIntersection(List<T> list1,List<T> list2){
public static <T> boolean judgeIntersection(List<T> list1, List<T> list2) {
boolean flag = false;
List<T> 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;
}
}