薪酬系统-福利档案结构改造,档案列表接口返回结果优化

This commit is contained in:
sy 2022-10-14 16:34:10 +08:00
parent 4701c4de5c
commit 8a0e72f99c
6 changed files with 224 additions and 6 deletions

View File

@ -981,6 +981,7 @@ public class SIArchivesBiz {
map.put("fundSchemeId", item.getFundSchemeId());
map.put("otherSchemeId", item.getOtherSchemeId());
map.put("status", item.getUserStatus() != null ? UserStatusEnum.values()[item.getUserStatus()].getDefaultLabel() : "");
map.put("baseInfo", item.getBaseInfoId());
if (socialItem != null) {
map.put("socialName", insuranceSchemeMapper.querySchemeName(socialItem.getSocialSchemeId()));
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {

View File

@ -51,4 +51,6 @@ public class InsuranceArchivesEmployeePO {
private Long fundSchemeId;
private Long otherSchemeId;
private Long baseInfoId;
}

View File

@ -306,7 +306,7 @@
<select id="queryEmployeeList" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO">
SELECT e.ID AS employeeId, e.lastname AS userName, e.departmentid AS departmentId, e.workcode AS jobNum, e.MOBILE AS telephone,
SELECT base.id AS baseInfoId, e.ID AS employeeId, e.lastname AS userName, e.departmentid AS departmentId, e.workcode AS jobNum, e.MOBILE AS telephone,
d.departmentname AS departmentName, e.jobtitle AS position, e.STATUS AS userStatus,e.companystartdate AS hiredate,
e.enddate as dimissionDate,
social.siSchemeId,

View File

@ -69,4 +69,19 @@ public interface SIArchivesService {
* 批量减员
*/
String stayDelToStop(List<InsuranceArchivesBaseInfoPO> baseInfoPOList);
/**
* 全量减员
*/
String allStayDelToStop();
/**
* 全量增员
*/
String allStayAddToPay();
/**
* 批量增员
*/
String stayAddToPay(List<InsuranceArchivesBaseInfoPO> baseInfoPOList);
}

View File

@ -494,10 +494,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
}
result.put("1", stayAddTotal);
result.put("2", payTotal);
result.put("3", stayDelTotal);
result.put("4", stopTotal);
result.put("stayAdd", stayAddTotal);
result.put("paying", payTotal);
result.put("stayDel", stayDelTotal);
result.put("stopPay", stopTotal);
return result;
}
@ -632,4 +632,171 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
}
/**
* 全量减员
*/
@Override
public String allStayDelToStop() {
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
if (allBaseInfoList.size() > 0) {
List<InsuranceArchivesBaseInfoPO> stayDelList = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())).collect(Collectors.toList());
if (stayDelList.size() > 0) {
return stayDelToStop(stayDelList);
} else {
return "当前无待减员数据";
}
} else {
return "当前无待减员数据";
}
}
/**
* 批量增员
*/
@Override
public String stayAddToPay(List<InsuranceArchivesBaseInfoPO> baseInfoPOList) {
//分别新建福利档案基础信息相关的社保公积金其他福利档案列表
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
//分别新建福利档案基础信息相关的社保公积金其他福利档案可以进行增员的人员列表
List<Long> toPaySocialEmployeeIdList = new ArrayList<>();
List<Long> toPayFundEmployeeIdList = new ArrayList<>();
List<Long> toPayOtherEmployeeIdList = new ArrayList<>();
//分别新建福利档案基础信息相关的社保公积金其他福利档案不可以进行增员的人员列表
List<Long> noPaySocialEmployeeIdList = new ArrayList<>();
List<Long> noPayFundEmployeeIdList = new ArrayList<>();
List<Long> noPayOtherEmployeeIdList = new ArrayList<>();
//新建最终可以进行增员的人员列表
List<Long> toPayEmployeeIdList = new ArrayList<>();
//新建最终不可以进行增员的人员列表
List<Long> noPayEmployeeIds = new ArrayList<>();
//获取待处理的员工id列表
List<Long> employeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
//设置最后缴纳月的比较月份
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
String todayMonth = simpleDateFormat.format(new Date());
//分别获取福利档案基础信息相关的社保公积金其他福利档案id列表
List<Long> socialIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList());
List<Long> fundIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList());
List<Long> otherIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList());
//获取可进行增员的社保档案相关人员数据
if (socialIds.size() > 0) {
//获取社保档案
socialList = getSocialSchemeMapper().getSocialById(socialIds);
//筛选可增员的社保档案相关人员信息
toPaySocialEmployeeIdList = socialList.stream().filter(f->
{
boolean flag = true;
if (f.getSocialStartTime() == null || f.getSocialStartTime().length() == 0 || f.getSocialSchemeId() == null) {
flag = false;
}
if (f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0 && (f.getSocialEndTime().compareTo(todayMonth)) <= 0) {
flag = false;
}
return flag;
})
.map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
//获取不可增员的社保档案相关人员信息
if (toPaySocialEmployeeIdList.size() != baseInfoPOList.size()) {
noPaySocialEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPaySocialEmployeeIdList);
}
}
if (fundIds.size() > 0) {
fundList = getFundSchemeMapper().getFundById(fundIds);
toPayFundEmployeeIdList = fundList.stream().filter(f->
{
boolean flag = true;
if (f.getFundStartTime() == null || f.getFundStartTime().length() == 0 || f.getFundSchemeId() == null) {
flag = false;
}
if (f.getFundEndTime() != null && f.getFundEndTime().length() > 0 && (f.getFundEndTime().compareTo(todayMonth)) <= 0) {
flag = false;
}
return flag;
})
.map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
if (toPayFundEmployeeIdList.size() != baseInfoPOList.size()) {
noPayFundEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPayFundEmployeeIdList);
}
}
if (otherIds.size() > 0) {
otherList = getOtherSchemeMapper().getOtherById(otherIds);
toPayOtherEmployeeIdList = otherList.stream().filter(f->
{
boolean flag = true;
if (f.getOtherStartTime() == null || f.getOtherStartTime().length() == 0 || f.getOtherSchemeId() == null) {
flag = false;
}
if (f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0 && (f.getOtherEndTime().compareTo(todayMonth)) <= 0) {
flag = false;
}
return flag;
})
.map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
if (toPayOtherEmployeeIdList.size() != baseInfoPOList.size()) {
noPayOtherEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPayOtherEmployeeIdList);
}
}
//获取最终基础信息表中的可增员数据
if (noPaySocialEmployeeIdList.size() == 0 && noPayFundEmployeeIdList.size() == 0 && noPayOtherEmployeeIdList.size() ==0) {
//社保公积金其他福利档案的可增员的人员信息与入参中的人员信息一致时
toPayEmployeeIdList = employeeIds;
} else {
//社保公积金其他福利档案的可增员的人员信息与入参中的人员信息不一致时取三类档案可增员的人员并集作为最终可增员的人员信息
toPayEmployeeIdList = (List<Long>) CollectionUtils.union(CollectionUtils.union(toPaySocialEmployeeIdList, toPayFundEmployeeIdList), toPayOtherEmployeeIdList);
//入参人员信息和最终可增员的人员信息做差集获得最终不可增员的人员信息
noPayEmployeeIds = (List<Long>) CollectionUtils.subtract(employeeIds, toPayEmployeeIdList);
}
//其他的个税扣缴义务人下的在缴员工中存在该员工在缴员工未进入停缴员工时不可进行增员
//进行增员操作
if (toPayEmployeeIdList.size() > 0) {
getInsuranceBaseInfoMapper().updateRunStatusByEmployeeIds(InsuranceArchivesBaseInfoPO.builder()
.employeeIds(toPayEmployeeIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
}
//输出结果此处需区分单一增员和批量增员
if (baseInfoPOList.size() == toPayEmployeeIdList.size()) {
//增员成功
if (baseInfoPOList.size() == 1) {
return "增员成功";
} else {
return "批量增员成功";
}
} else {
//增员失败
if (baseInfoPOList.size() == 1) {
return "增员失败,失败原因:数据未正常维护";
} else {
return "部分或全部失败:【共提交增员数据"
+ employeeIds.size()
+"条,成功" + toPayEmployeeIdList.size()
+"条,失败" + noPayEmployeeIds.size()
+"条,失败原因:数据未正常维护】";
}
}
}
/**
* 全量增员
*/
@Override
public String allStayAddToPay() {
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
if (allBaseInfoList.size() > 0) {
List<InsuranceArchivesBaseInfoPO> stayAddList = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())).collect(Collectors.toList());
if (stayAddList.size() > 0) {
return stayAddToPay(stayAddList);
} else {
return "当前无待增员数据";
}
} else {
return "当前无待增员数据";
}
}
}

View File

@ -147,7 +147,8 @@ public class SIArchivesController {
}
/**
* 批量变更档案列表的runStatus
* 删除待办
* 入参runStatus来区分待增员和待减员页面的删除待办
*/
@POST
@Path("/updateRunStatus")
@ -179,4 +180,36 @@ public class SIArchivesController {
return new ResponseResult<List<InsuranceArchivesBaseInfoPO>, String>(user).run(getService(user)::stayDelToStop, insuranceArchivesBaseInfoPOList);
}
/**
* 全量减员
*/
@GET
@Path("/allStayDelToStop")
@Produces(MediaType.APPLICATION_JSON)
public String allStayDelToStop(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, String>(user).run(getService(user)::allStayDelToStop);
}
/**
* 批量增员
*/
@POST
@Path("/stayAddToPay")
@Produces(MediaType.APPLICATION_JSON)
public String stayAddToPay(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody List<InsuranceArchivesBaseInfoPO> insuranceArchivesBaseInfoPOList) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<List<InsuranceArchivesBaseInfoPO>, String>(user).run(getService(user)::stayAddToPay, insuranceArchivesBaseInfoPOList);
}
/**
* 全量增员
*/
@GET
@Path("/allStayAddToPay")
@Produces(MediaType.APPLICATION_JSON)
public String allStayAddToPay(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, String>(user).run(getService(user)::allStayAddToPay);
}
}