2022-12-27 17:34:46 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.encrypt.EncryptUtil;
|
|
|
|
|
import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam;
|
|
|
|
|
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
|
2024-03-19 17:23:53 +08:00
|
|
|
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
|
|
|
|
|
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
|
|
|
|
|
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
|
|
|
|
|
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
|
2022-12-27 17:34:46 +08:00
|
|
|
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
2023-11-24 14:05:03 +08:00
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
2022-12-27 17:34:46 +08:00
|
|
|
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
|
|
|
|
|
import com.engine.salary.enums.sicategory.DataTypeEnum;
|
2023-11-24 14:05:03 +08:00
|
|
|
import com.engine.salary.enums.sicategory.IsPaymentEnum;
|
|
|
|
|
import com.engine.salary.enums.sicategory.PaymentScopeEnum;
|
2022-12-27 17:34:46 +08:00
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
|
|
|
|
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
|
2022-12-28 17:01:15 +08:00
|
|
|
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
|
|
|
|
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
|
|
|
|
|
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
2022-12-27 17:34:46 +08:00
|
|
|
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
2023-11-24 14:05:03 +08:00
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
2022-12-27 17:34:46 +08:00
|
|
|
import com.engine.salary.service.SIRepairService;
|
|
|
|
|
import com.engine.salary.util.SalaryEntityUtil;
|
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2023-01-03 10:09:14 +08:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-12-27 17:34:46 +08:00
|
|
|
|
2024-06-05 15:30:57 +08:00
|
|
|
import java.util.*;
|
2022-12-27 17:34:46 +08:00
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author: sy
|
|
|
|
|
* @Description: 福利台账-补缴实现类
|
|
|
|
|
* @Date: 2022/12/27
|
|
|
|
|
**/
|
|
|
|
|
public class SIRepairServiceImpl extends Service implements SIRepairService {
|
|
|
|
|
|
|
|
|
|
private EncryptUtil encryptUtil = new EncryptUtil();
|
|
|
|
|
|
|
|
|
|
private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 17:01:15 +08:00
|
|
|
private SocialSchemeMapper getSocialSchemeMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private FundSchemeMapper getFundSchemeMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private OtherSchemeMapper getOtherSchemeMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
private ICategoryMapper getICategoryMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(ICategoryMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-24 14:05:03 +08:00
|
|
|
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-27 17:34:46 +08:00
|
|
|
/**
|
|
|
|
|
* 获取指定月份的福利缴纳基数作为补缴基数
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, String>> getSupplementPaymentForm(SupplementAccountBaseParam param) {
|
|
|
|
|
|
|
|
|
|
Long paymentOrganization = param.getPaymentOrganization();
|
|
|
|
|
String billMonth = param.getBillMonth();
|
|
|
|
|
List<Integer> projects = param.getProjects();
|
|
|
|
|
Long employeeId = param.getEmployeeId();
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> detailPOList = getInsuranceAccountDetailMapper().queryNormalList(billMonth, paymentOrganization, employeeId);
|
|
|
|
|
|
|
|
|
|
if (detailPOList.size() > 1) {
|
|
|
|
|
throw new SalaryRunTimeException("该人员本次核算出现多组数据,请删除数据库中多余核算项");
|
|
|
|
|
} else if (detailPOList.size() == 0) {
|
|
|
|
|
throw new SalaryRunTimeException("数据不存在");
|
|
|
|
|
} else {
|
|
|
|
|
InsuranceAccountDetailPO targetDetailPO = detailPOList.get(0);
|
|
|
|
|
encryptUtil.decrypt(targetDetailPO, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
|
|
|
|
String socialBaseString = targetDetailPO.getSocialPaymentBaseString();
|
|
|
|
|
String fundBaseString = targetDetailPO.getFundPaymentBaseString();
|
|
|
|
|
String otherBaseString = targetDetailPO.getOtherPaymentBaseString();
|
|
|
|
|
|
|
|
|
|
Map<String, String> socialBaseMap = JSON.parseObject(socialBaseString, HashMap.class);
|
|
|
|
|
Map<String, String> fundBaseMap = JSON.parseObject(fundBaseString, HashMap.class);
|
|
|
|
|
Map<String, String> otherBaseMap = JSON.parseObject(otherBaseString, HashMap.class);
|
|
|
|
|
|
|
|
|
|
Map<String, String> targetBaseMap = new HashMap<>();
|
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
List<ICategoryPO> allCategoryList = getICategoryMapper().listAll();
|
2022-12-27 17:34:46 +08:00
|
|
|
Map<Long, String> categoryNameMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getInsuranceName);
|
2023-01-03 10:09:14 +08:00
|
|
|
Map<Long, Integer> welfareTypeMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getWelfareType);
|
2022-12-27 17:34:46 +08:00
|
|
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.ALL.getValue())) {
|
2022-12-30 18:20:10 +08:00
|
|
|
if (socialBaseMap != null) {
|
|
|
|
|
targetBaseMap.putAll(socialBaseMap);
|
|
|
|
|
}
|
|
|
|
|
if (fundBaseMap != null) {
|
|
|
|
|
targetBaseMap.putAll(fundBaseMap);
|
|
|
|
|
}
|
|
|
|
|
if (otherBaseMap != null) {
|
|
|
|
|
targetBaseMap.putAll(otherBaseMap);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-27 17:34:46 +08:00
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
|
2022-12-30 18:20:10 +08:00
|
|
|
if (socialBaseMap != null) {
|
|
|
|
|
targetBaseMap.putAll(socialBaseMap);
|
|
|
|
|
}
|
2022-12-27 17:34:46 +08:00
|
|
|
}
|
|
|
|
|
if (!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
|
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
List<ICategoryPO> list = getICategoryMapper().listByDataType(DataTypeEnum.SYSTEM.getValue());
|
2022-12-27 17:34:46 +08:00
|
|
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) {
|
|
|
|
|
ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(93113, "养老保险").equals(item.getInsuranceName())).findFirst()
|
|
|
|
|
.get();
|
2022-12-30 18:20:10 +08:00
|
|
|
|
2023-01-05 17:21:31 +08:00
|
|
|
if (socialBaseMap != null && socialBaseMap.containsKey(insuranceCategoryPO.getId().toString())) {
|
|
|
|
|
targetBaseMap.put(insuranceCategoryPO.getId().toString(), socialBaseMap.get(insuranceCategoryPO.getId().toString()));
|
2022-12-30 18:20:10 +08:00
|
|
|
}
|
|
|
|
|
|
2022-12-27 17:34:46 +08:00
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue())) {
|
|
|
|
|
ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(93114, "医疗保险").equals(item.getInsuranceName())).findFirst()
|
|
|
|
|
.get();
|
2023-01-05 17:21:31 +08:00
|
|
|
if (socialBaseMap != null && socialBaseMap.containsKey(insuranceCategoryPO.getId().toString())) {
|
|
|
|
|
targetBaseMap.put(insuranceCategoryPO.getId().toString(), socialBaseMap.get(insuranceCategoryPO.getId().toString()));
|
2022-12-30 18:20:10 +08:00
|
|
|
}
|
2022-12-27 17:34:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.FUND.getValue())) {
|
2022-12-30 18:20:10 +08:00
|
|
|
if (fundBaseMap != null) {
|
|
|
|
|
targetBaseMap.putAll(fundBaseMap);
|
|
|
|
|
}
|
2022-12-27 17:34:46 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.OTHER.getValue())) {
|
|
|
|
|
|
2022-12-30 18:20:10 +08:00
|
|
|
if (otherBaseMap != null) {
|
|
|
|
|
targetBaseMap.putAll(otherBaseMap);
|
|
|
|
|
}
|
2022-12-27 17:34:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> resulit = new ArrayList();
|
|
|
|
|
if (targetBaseMap.size() > 0) {
|
|
|
|
|
for (Map.Entry<String, String> entry : targetBaseMap.entrySet()) {
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("insuranceId", entry.getKey());
|
|
|
|
|
map.put("insuranceName", categoryNameMap.get(Long.valueOf(entry.getKey())));
|
|
|
|
|
map.put("insuranceBase", entry.getValue());
|
|
|
|
|
|
2023-01-03 10:09:14 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(entry.getKey())) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(entry.getKey())) == 2 ? "公积金" : "企业年金及其它福利" );
|
2023-11-29 11:04:14 +08:00
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(entry.getKey())) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(entry.getKey())) == 2 ? "fund" : "other" );
|
2023-01-03 10:09:14 +08:00
|
|
|
map.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
map.put("titleSign", welfareTypeSign);
|
2022-12-27 17:34:46 +08:00
|
|
|
resulit.add(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resulit;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 17:01:15 +08:00
|
|
|
/**
|
|
|
|
|
* 获取待编辑的补缴费用相关福利项
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, String>> getPaymentGroup(SupplementAccountBaseParam param) {
|
|
|
|
|
|
|
|
|
|
Long paymentOrganization = param.getPaymentOrganization();
|
|
|
|
|
List<Integer> projects = param.getProjects();
|
|
|
|
|
Long employeeId = param.getEmployeeId();
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialSchemePO = new InsuranceArchivesSocialSchemePO();
|
|
|
|
|
InsuranceArchivesFundSchemePO fundSchemePO = new InsuranceArchivesFundSchemePO();
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherSchemePO = new InsuranceArchivesOtherSchemePO();
|
|
|
|
|
|
|
|
|
|
List<InsuranceArchivesSocialSchemePO> socialSchemePOList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
|
|
|
|
.employeeId(employeeId)
|
|
|
|
|
.paymentOrganization(paymentOrganization)
|
|
|
|
|
.build());
|
|
|
|
|
if (socialSchemePOList.size() > 0) {
|
|
|
|
|
encryptUtil.decryptList(socialSchemePOList, InsuranceArchivesSocialSchemePO.class);
|
|
|
|
|
socialSchemePO = socialSchemePOList.get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<InsuranceArchivesFundSchemePO> fundSchemePOList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
|
|
|
|
.employeeId(employeeId)
|
|
|
|
|
.paymentOrganization(paymentOrganization)
|
|
|
|
|
.build());
|
|
|
|
|
if (fundSchemePOList.size() > 0) {
|
|
|
|
|
encryptUtil.decryptList(fundSchemePOList, InsuranceArchivesFundSchemePO.class);
|
|
|
|
|
fundSchemePO = fundSchemePOList.get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<InsuranceArchivesOtherSchemePO> otherSchemePOList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
|
|
|
|
.employeeId(employeeId)
|
|
|
|
|
.paymentOrganization(paymentOrganization)
|
|
|
|
|
.build());
|
|
|
|
|
if (otherSchemePOList.size() > 0) {
|
|
|
|
|
encryptUtil.decryptList(otherSchemePOList, InsuranceArchivesOtherSchemePO.class);
|
|
|
|
|
otherSchemePO = otherSchemePOList.get(0);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
List<ICategoryPO> allCategoryList = getICategoryMapper().listAll();
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<Long, String> categoryNameMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getInsuranceName);
|
2023-01-03 10:09:14 +08:00
|
|
|
Map<Long, Integer> welfareTypeMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getWelfareType);
|
2022-12-28 17:01:15 +08:00
|
|
|
|
|
|
|
|
List<Map<String, String>> resultList = new ArrayList<>();
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.ALL.getValue())) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (socialSchemePO != null && (StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString()) || StringUtils.isNotBlank(socialSchemePO.getSocialPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> socialComMap = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
List<String> socialIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
socialIds.addAll(socialMap == null ? Collections.emptyList() : socialMap.keySet());
|
|
|
|
|
socialIds.addAll(socialComMap == null ? Collections.emptyList() : socialComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds = socialIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
2024-11-11 14:06:15 +08:00
|
|
|
if (fundSchemePO != null && (StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString()) || StringUtils.isNotBlank(fundSchemePO.getFundPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> fundComMap = JSON.parseObject(fundSchemePO.getFundPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
List<String> fundIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
fundIds.addAll(fundMap == null ? Collections.emptyList() : fundMap.keySet());
|
|
|
|
|
fundIds.addAll(fundComMap == null ? Collections.emptyList() : fundComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
fundIds = fundIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(fundSchemePO.getFundSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
fundIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
2024-11-11 14:06:15 +08:00
|
|
|
if (otherSchemePO != null && (StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString()) || StringUtils.isNotBlank(otherSchemePO.getOtherPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> otherComMap = JSON.parseObject(otherSchemePO.getOtherPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
List<String> otherIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
otherIds.addAll(otherMap == null ? Collections.emptyList() : otherMap.keySet());
|
|
|
|
|
otherIds.addAll(otherComMap == null ? Collections.emptyList() : otherComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
otherIds = otherIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(otherSchemePO.getOtherSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
otherIds.forEach(k -> {
|
2023-01-03 10:09:14 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
2023-11-29 11:04:14 +08:00
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (socialSchemePO != null && (StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString()) || StringUtils.isNotBlank(socialSchemePO.getSocialPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> socialComMap = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
List<String> socialIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
socialIds.addAll(socialMap == null ? Collections.emptyList() : socialMap.keySet());
|
|
|
|
|
socialIds.addAll(socialComMap == null ? Collections.emptyList() : socialComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds = socialIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((!projects.contains(ProjectTypeEnum.SOCIAL.getValue()))
|
|
|
|
|
&& (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue()))
|
|
|
|
|
&& (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()))) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (socialSchemePO != null && (StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString()) || StringUtils.isNotBlank(socialSchemePO.getSocialPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
socialMap = socialMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()) || "9002".equals(e.getKey()))
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> socialComMap = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
socialComMap = socialComMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()) || "9002".equals(e.getKey()))
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
|
|
List<String> socialIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
socialIds.addAll(socialMap == null ? Collections.emptyList() : socialMap.keySet());
|
|
|
|
|
socialIds.addAll(socialComMap == null ? Collections.emptyList() : socialMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds = socialIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds.forEach( k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((!projects.contains(ProjectTypeEnum.SOCIAL.getValue()))
|
|
|
|
|
&& (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue()))
|
|
|
|
|
&& (!projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()))) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (socialSchemePO != null && (StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString()) || StringUtils.isNotBlank(socialSchemePO.getSocialPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
socialMap = socialMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()))
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
2024-11-11 14:06:15 +08:00
|
|
|
|
|
|
|
|
Map<String, String> socialComMap = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
socialComMap = socialComMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()))
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
|
|
List<String> socialIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
socialIds.addAll(socialMap == null ? Collections.emptyList() : socialMap.keySet());
|
|
|
|
|
socialIds.addAll(socialComMap == null ? Collections.emptyList() :socialComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds = socialIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((!projects.contains(ProjectTypeEnum.SOCIAL.getValue()))
|
|
|
|
|
&& (!projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue()))
|
|
|
|
|
&& (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()))) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (socialSchemePO != null && (StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString()) || StringUtils.isNotBlank(socialSchemePO.getSocialPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
socialMap = socialMap.entrySet().stream().filter(e -> "9002".equals(e.getKey()))
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> socialComMap = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
socialComMap = socialComMap.entrySet().stream().filter(e -> "9002".equals(e.getKey()))
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
|
|
List<String> socialIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
socialIds.addAll(socialMap == null ? Collections.emptyList() : socialMap.keySet());
|
|
|
|
|
socialIds.addAll(socialComMap == null ? Collections.emptyList() : socialComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds = socialIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(socialSchemePO.getSocialSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
socialIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.FUND.getValue())) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (fundSchemePO != null && (StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString()) || StringUtils.isNotBlank(fundSchemePO.getFundPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> fundComMap = JSON.parseObject(fundSchemePO.getFundPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
List<String> fundIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
fundIds.addAll(fundMap == null ? Collections.emptyList() : fundMap.keySet());
|
|
|
|
|
fundIds.addAll(fundComMap == null ? Collections.emptyList() : fundComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
fundIds = fundIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(fundSchemePO.getFundSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
fundIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.OTHER.getValue())) {
|
2024-11-11 14:06:15 +08:00
|
|
|
if (otherSchemePO != null && (StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString()) || StringUtils.isNotBlank(otherSchemePO.getOtherPaymentComBaseString()))) {
|
2022-12-28 17:01:15 +08:00
|
|
|
Map<String, String> otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
|
2024-11-11 14:06:15 +08:00
|
|
|
Map<String, String> otherComMap = JSON.parseObject(otherSchemePO.getOtherPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
List<String> otherIds = new ArrayList<>();
|
2024-11-12 16:21:56 +08:00
|
|
|
otherIds.addAll(otherMap == null ? Collections.emptyList() : otherMap.keySet());
|
|
|
|
|
otherIds.addAll(otherComMap == null ? Collections.emptyList() : otherComMap.keySet());
|
2024-11-11 14:06:15 +08:00
|
|
|
otherIds = otherIds.stream().distinct().collect(Collectors.toList());
|
2023-11-24 14:05:03 +08:00
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
|
2024-06-05 15:30:57 +08:00
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(Collections.singletonList(otherSchemePO.getOtherSchemeId()));
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2024-11-11 14:06:15 +08:00
|
|
|
otherIds.forEach(k -> {
|
2024-03-19 17:23:53 +08:00
|
|
|
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
|
|
|
|
|
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
|
2023-11-24 14:05:03 +08:00
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
|
|
|
|
|
Map<String, String> comMap = new HashMap<>();
|
|
|
|
|
comMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
comMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
comMap.put("insuranceId", k);
|
|
|
|
|
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
comMap.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
comMap.put("paymentScopeSign", "com");
|
2024-06-05 15:30:57 +08:00
|
|
|
comMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(comMap);
|
|
|
|
|
}
|
|
|
|
|
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
|
|
|
|
|
Map<String, String> perMap = new HashMap<>();
|
|
|
|
|
perMap.put("title", welfareTypeName);
|
2023-11-29 11:04:14 +08:00
|
|
|
perMap.put("titleSign", welfareTypeSign);
|
2023-11-24 14:05:03 +08:00
|
|
|
perMap.put("insuranceId", k);
|
|
|
|
|
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
|
|
|
|
|
perMap.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
perMap.put("paymentScopeSign", "per");
|
2024-06-05 15:30:57 +08:00
|
|
|
perMap.put("validNum",schemeValidNumMap.getOrDefault(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue(), 2).toString());
|
2023-11-24 14:05:03 +08:00
|
|
|
resultList.add(perMap);
|
|
|
|
|
}
|
2022-12-28 17:01:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-24 14:05:03 +08:00
|
|
|
public List<String> payInsuranceIdAndScopeList(Long socialSchemeId) {
|
|
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialSchemeId);
|
|
|
|
|
List<String> insuranceIdList = new ArrayList<>();
|
|
|
|
|
if (detailPOS != null && detailPOS.size() > 0) {
|
|
|
|
|
//开启缴纳的
|
|
|
|
|
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(m -> {
|
|
|
|
|
return m.getInsuranceId() .toString() + "-" + m.getPaymentScope().toString();
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
return insuranceIdList;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-27 17:34:46 +08:00
|
|
|
|
|
|
|
|
}
|