非系统人员

This commit is contained in:
钱涛 2023-03-15 18:03:46 +08:00
parent 50c15989c6
commit ace15ca7a1
22 changed files with 371 additions and 145 deletions

View File

@ -99,5 +99,8 @@ public class DataCollectionEmployee {
//是否是系统管理员
private Boolean isAdmin;
//是否外部人员
private boolean extEmp;
}

View File

@ -120,6 +120,45 @@ public class SalaryAcctEmployeeBO {
return resultList;
}
public static List<SalaryAcctEmployeePO> convert2Employee(Collection<DataCollectionEmployee> employee,
SalaryAcctRecordPO salaryAcctRecord,
List<SalaryArchiveDataDTO> salaryArchiveTaxAgentData,
Long employeeId) {
if (CollectionUtils.isEmpty(employee)) {
return Collections.emptyList();
}
List<SalaryAcctEmployeePO> resultList = Lists.newArrayList();
Map<Long, Set<List<SalaryArchiveTaxAgentDataDTO>>> empIdKeyTaxAgentMap = SalaryEntityUtil.group2Map(salaryArchiveTaxAgentData, SalaryArchiveDataDTO::getEmployeeId, SalaryArchiveDataDTO::getTaxAgents);
Date now = new Date();
for (DataCollectionEmployee emp : employee) {
Set<Long> taxAgentIds = Sets.newHashSet();
Set<List<SalaryArchiveTaxAgentDataDTO>> taxAgentSet = empIdKeyTaxAgentMap.getOrDefault(emp.getEmployeeId(), Collections.emptySet());
for (List<SalaryArchiveTaxAgentDataDTO> 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<List<SalaryAcctEmployeePO>> partitionByEmployeeId(List<SalaryAcctEmployeePO> salaryAcctEmployees) {
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {

View File

@ -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
*/

View File

@ -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<HrmStatus> 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<DataCollectionEmployee> 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<DataCollectionEmployee> 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<Long> employeeSameIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {

View File

@ -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<DataCollectionEmployee> employees;
/**
* 租户下的人员状态
*/
// List<HrmStatus> hrmStatusList;
/**
* 获取所有个税扣缴义务人

View File

@ -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;

View File

@ -408,12 +408,12 @@
</foreach>
</if>
<!-- 档案状态 -->
<if test="param.runStatusList != null and param.runStatusList.size()>0">
AND t.run_status IN
<foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">
#{runStatus}
</foreach>
</if>
<!-- <if test="param.runStatusList != null and param.runStatusList.size()>0">-->
<!-- AND t.run_status IN-->
<!-- <foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">-->
<!-- #{runStatus}-->
<!-- </foreach>-->
<!-- </if>-->
</select>
<insert id="batchInsert">

View File

@ -82,6 +82,9 @@
<if test="employeeType != null">
AND employee_type = #{employeeType}
</if>
<if test="employeeType == null">
AND (employee_type is null or employee_type = 0)
</if>
<if test="taxAgentIds != null and taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">

View File

@ -78,6 +78,8 @@ public interface SalaryEmployeeService {
*/
List<DataCollectionEmployee> matchImportEmployee(List<DataCollectionEmployee> employeeList, String userName, String deparmentName, String mobile, String workcode, Long uid);
String empValidType();
List<DeptInfo> getDeptInfoList(List<Long> departmentIds);
List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds);

View File

@ -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;
/**
* 薪资账套人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobExtRangeService {
/**
* 根据主键id查询薪资账套的人员范围
*
* @param ids 薪资账套的人员范围的主键id
* @return
*/
List<SalarySobExtRangePO> listByIds(Collection<Long> ids);
/**
* 根据薪资账套ID和类型查询薪资账套的人员范围
*
* @param salarySobId 薪资账套id
* @return
*/
List<SalarySobExtRangePO> listBySalarySobId(Long salarySobId);
/**
* 保存外部人员
* @param saveParam
*/
void saveExtRange(SalarySobRangeExtSaveParam saveParam);
/**
* 外部人员列表
* @param param
* @return
*/
PageInfo<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param);
void deleteSalarySobExtRange(Collection<Long> ids);
}

View File

@ -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<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param);
/**
* 根据主键id删除薪资账套的人员范围
*
@ -85,8 +70,6 @@ public interface SalarySobRangeService {
*/
void deleteByIds(Collection<Long> ids);
void deleteSalarySobExtRange(Collection<Long> ids);
/**
* 根据薪资账套id删除薪资账套的人员范围
*

View File

@ -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());
}

View File

@ -492,7 +492,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
List<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId,Collectors.toList());
List<SalaryArchiveDataDTO> salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
// 转换成薪资核算人员po
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2EmployeePO(employeeIds, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID());
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2Employee(salaryEmployees, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID());
//过滤掉不属于当前账套扣缴义务人的人员
salaryAcctEmployeePOS = salaryAcctEmployeePOS.stream().filter(po -> Objects.equals(taxAgentId, po.getTaxAgentId())).collect(Collectors.toList());

View File

@ -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<Long> salaryArchiveIds = salaryArchiveList.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
Map<String, SalaryArchivePO> salaryArchivesMap = SalaryEntityUtil.convert2Map(salaryArchiveList, k -> k.getEmployeeId() + "-" + k.getTaxAgentId());
List<TaxAgentEmployeePO> employees = getTaxAgentService(user).listEmployees();
// 查询人员状态
// List<HrmStatus> 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)
// 调薪导入

View File

@ -190,7 +190,6 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
queryParam.setExtSalaryArchiveList(true);
List<SalaryArchiveListDTO> list = getSalaryArchiveList(queryParam);
list = list.stream()
//过滤档案状态

View File

@ -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<DataCollectionEmployee> listBySalarySobId(Long salarySobId) {
List<DataCollectionEmployee> includeSalaryEmployees = new ArrayList<>();
// 查询薪资账套的人员范围
List<SalarySobRangePO> includeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ONE);
if (CollectionUtils.isEmpty(includeSalarySobRangePOS)) {
return Collections.emptyList();
}
// 将薪资账套的人员范围转换成人员查询参数
List<SalarySobRangeEmpQueryParam> includeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(includeSalarySobRangePOS);
// 根据上一步的查询参数查询人员
List<DataCollectionEmployee> includeSalaryEmployees = listByParams(includeQueryParams);
if (CollectionUtils.isEmpty(includeSalaryEmployees)) {
return Collections.emptyList();
}
//去重
includeSalaryEmployees = includeSalaryEmployees.stream().distinct().collect(Collectors.toList());
// 查询薪资账套的人员范围从范围中排除
List<SalarySobRangePO> excludeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ZERO);
if (CollectionUtils.isNotEmpty(excludeSalarySobRangePOS)) {
if (CollectionUtils.isNotEmpty(includeSalarySobRangePOS)) {
// 将薪资账套的人员范围转换成人员查询参数
List<SalarySobRangeEmpQueryParam> excludeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(excludeSalarySobRangePOS);
List<SalarySobRangeEmpQueryParam> includeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(includeSalarySobRangePOS);
// 根据上一步的查询参数查询人员
List<DataCollectionEmployee> excludeSalaryEmployees = listByParams(excludeQueryParams);
// 需要排除的人员范围
Set<Long> 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<SalarySobRangePO> excludeSalarySobRangePOS = getSalarySobRangeService(user).listBySalarySobIdAndIncludeType(salarySobId, NumberUtils.INTEGER_ZERO);
if (CollectionUtils.isNotEmpty(excludeSalarySobRangePOS)) {
// 将薪资账套的人员范围转换成人员查询参数
List<SalarySobRangeEmpQueryParam> excludeQueryParams = SalarySobRangeBO.convert2EmployeeQueryParam(excludeSalarySobRangePOS);
// 根据上一步的查询参数查询人员
List<DataCollectionEmployee> excludeSalaryEmployees = listByParams(excludeQueryParams);
// 需要排除的人员范围
Set<Long> excludeEmployeeIds = SalaryEntityUtil.properties(excludeSalaryEmployees, DataCollectionEmployee::getEmployeeId);
// 过滤人员
includeSalaryEmployees = includeSalaryEmployees.stream()
.filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId()))
.collect(Collectors.toList());
}
}
//外部人员
List<SalarySobExtRangePO> salarySobExtRangePOS = getSalarySobExtRangeService(user).listBySalarySobId(salarySobId);
if(CollectionUtils.isNotEmpty(salarySobExtRangePOS)){
List<Long> ids = SalaryEntityUtil.properties(salarySobExtRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList());
List<DataCollectionEmployee> 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<DataCollectionEmployee> 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<DeptInfo> getDeptInfoList(List<Long> departmentIds) {
return employBiz.getDeptInfoList(departmentIds);

View File

@ -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;
/**
* 薪资账套人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<SalarySobExtRangePO> listByIds(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Collections.emptyList();
}
return getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().ids(ids).build());
}
@Override
public List<SalarySobExtRangePO> 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<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().salarySobId(saveParam.getSalarySobId()).build());
// 处理一下本次的保存参数如果原来添加过对应的人员/部门/岗位那么本次不需要新增只需要更新
List<Long> oldTargetIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList());
List<Long> 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<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param) {
List<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listPage4Ext(SalarySobExtRangePO.builder().salarySobId(param.getSalarySobId()).build());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class);
}
@Override
public void deleteSalarySobExtRange(Collection<Long> ids) {
if(CollectionUtils.isEmpty(ids)){
return;
}
getSalarySobExtRangeMapper().deleteByIds(ids);
}
}

View File

@ -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<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().salarySobId(saveParam.getSalarySobId()).build());
// 处理一下本次的保存参数如果原来添加过对应的人员/部门/岗位那么本次不需要新增只需要更新
List<Long> oldTargetIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList());
List<Long> 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<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param) {
List<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listPage4Ext(SalarySobExtRangePO.builder().salarySobId(param.getSalarySobId()).build());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class);
}
@Override
public void deleteByIds(Collection<Long> ids) {
// 查询薪资账套的人员范围
@ -270,14 +226,6 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
// });
}
@Override
public void deleteSalarySobExtRange(Collection<Long> ids) {
if(CollectionUtils.isEmpty(ids)){
return;
}
getSalarySobExtRangeMapper().deleteByIds(ids);
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobRangeBiz.deleteBySalarySobIds(salarySobIds);

View File

@ -162,7 +162,7 @@ public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpServic
return;
}
List<Long> taxAgentIds = taxAgentEmpSaveParamList.stream().map(TaxAgentEmpSaveParam::getTaxAgentId).collect(Collectors.toList());
List<TaxAgentEmpPO> taxAgentEmployeeExistList = this.listByTaxAgentIds(taxAgentIds);
List<TaxAgentEmpPO> taxAgentEmployeeExistList = this.listExtByTaxAgentIds(taxAgentIds);
Date now = new Date();
// 关联表
List<TaxAgentEmpPO> taxAgentEmployeeAddList = Lists.newArrayList();
@ -251,4 +251,11 @@ public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpServic
getTaxAgentEmpChangeService(user).batchInsert(taxAgentEmpChangeList);
}
}
private List<TaxAgentEmpPO> listExtByTaxAgentIds(List<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return Lists.newArrayList();
}
return getTaxAgentEmpMapper().listSome(TaxAgentEmpPO.builder().employeeType(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue()).taxAgentIds(taxAgentIds).build());
}
}

View File

@ -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<SalaryArchiveQueryParam, Map<String, Object>>(user).run(getSalaryArchiveWrapper(user)::listPage, queryParam);
return new ResponseResult<SalaryArchiveQueryParam, Map<String, Object>>(user).run(getSalaryArchiveWrapper(user)::extList, queryParam);
}

View File

@ -304,6 +304,19 @@ public class SalaryArchiveWrapper extends Service {
}
/**
* 外部人员
* @param queryParam
* @return
*/
public Map<String, Object> extList(SalaryArchiveQueryParam queryParam) {
queryParam.setRunStatusList(Arrays.asList(SalaryArchiveStatusEnum.FIXED.getValue()));
queryParam.setExtSalaryArchiveList(true);
return list(queryParam, SalaryArchiveListTypeEnum.EXT);
}
/**
* 获取薪资档案详情表单
*

View File

@ -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<SalarySobExtRangePO> 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<Long> ids) {
getSalarySobRangeService(user).deleteSalarySobExtRange(ids);
getSalarySobExtRangeService(user).deleteSalarySobExtRange(ids);
}
/***