薪酬系统-福利档案,开启开关时,档案列表展示,区分个人和公司福利基数

This commit is contained in:
sy 2023-12-06 15:38:19 +08:00
parent ec8cb6214d
commit 6dca2a4380
2 changed files with 241 additions and 43 deletions

View File

@ -13,6 +13,7 @@ import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.common.SalaryContext;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -1383,6 +1384,7 @@ public class SIArchivesBiz {
* @return
*/
public List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, long operateId) {
Map<Integer, Map<String, String>> titleMap = buildColumnTitle(insuranceArchivesEmployeePOS, operateId);
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn nameColumn = new WeaTableColumn("100px", "姓名", "employeeName");
@ -1422,6 +1424,9 @@ public class SIArchivesBiz {
* @return
*/
public Map<Integer, Map<String, String>> buildColumnTitle(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, long operateId) {
boolean welBaseDiffSign = isDiffWelBase();
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
Map<Integer, Map<String, String>> result = new HashMap<>();
@ -1437,16 +1442,17 @@ public class SIArchivesBiz {
Set<String> fundSet = new HashSet<>();
Set<String> otherSet = new HashSet<>();
Set<String> socialComSet = new HashSet<>();
Set<String> fundComSet = new HashSet<>();
Set<String> otherComSet = new HashSet<>();
insuranceArchivesEmployeePOS.forEach(item -> {
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(item.getEmployeeId()));
encryptUtil.decryptList(socialList, InsuranceArchivesSocialSchemePO.class);
// InsuranceArchivesSocialSchemePO socialItem = socialList.size() != 0 ? socialList.get(0) : null;
List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(item.getEmployeeId()));
encryptUtil.decryptList(fundList, InsuranceArchivesFundSchemePO.class);
// InsuranceArchivesFundSchemePO fundItem = fundList.size() != 0 ? fundList.get(0) : null;
List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(item.getEmployeeId()));
encryptUtil.decryptList(otherList, InsuranceArchivesOtherSchemePO.class);
// InsuranceArchivesOtherSchemePO otherItem = otherList.size() != 0 ? otherList.get(0) : null;
if (socialList.size() > 0) {
for (InsuranceArchivesSocialSchemePO socialSchemePO : socialList) {
@ -1455,6 +1461,14 @@ public class SIArchivesBiz {
if (socialJson != null) {
socialJson.forEach((k, v) -> socialSet.add(k));
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> socialComJson = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialComJson != null) {
socialComJson.forEach((k, v) -> socialComSet.add(k));
}
}
}
}
@ -1465,6 +1479,14 @@ public class SIArchivesBiz {
if (fundJson != null) {
fundJson.forEach((k, v) -> fundSet.add(k));
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> fundComJson = JSON.parseObject(fundSchemePO.getFundPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundComJson != null) {
fundComJson.forEach((k, v) -> fundComSet.add(k));
}
}
}
}
@ -1475,11 +1497,20 @@ public class SIArchivesBiz {
if (otherJson != null) {
otherJson.forEach((k, v) -> otherSet.add(k));
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> otherComJson = JSON.parseObject(otherSchemePO.getOtherPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (otherComJson != null) {
otherComJson.forEach((k, v) -> otherComSet.add(k));
}
}
}
}
});
Map<String, String> socialMap = new HashMap<>();
Map<String, String> socialComMap = new HashMap<>();
Map<Long, ICategoryPO> socialCollect = new HashMap<>();
Map<Long, ICategoryPO> customSocial = iCategoryMapper.listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), null)
.stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
@ -1489,34 +1520,89 @@ public class SIArchivesBiz {
socialCollect.putAll(customSocial);
socialCollect.putAll(sysSocial);
socialSet.forEach(item -> {
if (socialCollect.containsKey(Long.valueOf(item))) {
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
}
});
// socialSet.forEach(item -> {
// if (socialCollect.containsKey(Long.valueOf(item))) {
// socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
// }
// });
if (welBaseDiffSign) {
socialSet.forEach(item -> {
if (socialCollect.containsKey(Long.valueOf(item))) {
socialMap.put(item + "per", socialCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数" + "个人");
}
});
socialComSet.forEach(item -> {
if (socialCollect.containsKey(Long.valueOf(item))) {
socialComMap.put(item + "com", socialCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数" + "单位");
}
});
} else {
socialSet.forEach(item -> {
if (socialCollect.containsKey(Long.valueOf(item))) {
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
}
});
}
Map<String, String> fundMap = new HashMap<>();
Map<String, String> fundComMap = new HashMap<>();
Map<Long, ICategoryPO> fundCollect = new HashMap<>();
Map<Long, ICategoryPO> customFund = iCategoryMapper.listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
Map<Long, ICategoryPO> sysFund = iCategoryMapper.listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
fundCollect.putAll(customFund);
fundCollect.putAll(sysFund);
fundSet.forEach(item -> {
if (fundCollect.containsKey(Long.valueOf(item))) {
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
}
});
// fundSet.forEach(item -> {
// if (fundCollect.containsKey(Long.valueOf(item))) {
// fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
// }
// });
if (welBaseDiffSign) {
fundSet.forEach(item -> {
if (fundCollect.containsKey(Long.valueOf(item))) {
fundMap.put(item + "per", fundCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数" + "个人");
}
});
fundComSet.forEach(item -> {
if (fundCollect.containsKey(Long.valueOf(item))) {
fundComMap.put(item + "com", fundCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数" + "单位");
}
});
} else {
fundSet.forEach(item -> {
if (fundCollect.containsKey(Long.valueOf(item))) {
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
}
});
}
Map<String, String> otherMap = new HashMap<>();
Map<String, String> otherComMap = new HashMap<>();
Map<Long, ICategoryPO> otherCollect = new HashMap<>();
Map<Long, ICategoryPO> customOther = iCategoryMapper.listByWelfareType(WelfareTypeEnum.OTHER.getValue(), null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
Map<Long, ICategoryPO> sysOther = iCategoryMapper.listByWelfareType(WelfareTypeEnum.OTHER.getValue(), DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
otherCollect.putAll(customOther);
otherCollect.putAll(sysOther);
otherSet.forEach(item -> {
if (otherCollect.containsKey(Long.valueOf(item))) {
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
}
});
// otherSet.forEach(item -> {
// if (otherCollect.containsKey(Long.valueOf(item))) {
// otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
// }
// });
if (welBaseDiffSign) {
otherSet.forEach(item -> {
if (otherCollect.containsKey(Long.valueOf(item))) {
otherMap.put(item + "per", otherCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数" + "个人");
}
});
otherComSet.forEach(item -> {
if (otherCollect.containsKey(Long.valueOf(item))) {
otherComMap.put(item + "com", otherCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数" + "单位");
}
});
} else {
otherSet.forEach(item -> {
if (otherCollect.containsKey(Long.valueOf(item))) {
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + "申报基数");
}
});
}
// map根据key排序
LinkedHashMap<String, String> socialMapWithAscKey = socialMap.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
@ -1530,6 +1616,23 @@ public class SIArchivesBiz {
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
if (welBaseDiffSign) {
LinkedHashMap<String, String> socialComMapWithAscKey = socialComMap.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundComMapWithAscKey = fundComMap.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> otherComMapWithAscKey = otherComMap.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
socialMapWithAscKey.putAll(socialComMapWithAscKey);
fundMapWithAscKey.putAll(fundComMapWithAscKey);
otherMapWithAscKey.putAll(otherComMapWithAscKey);
}
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialMapWithAscKey);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundMapWithAscKey);
@ -1552,6 +1655,9 @@ public class SIArchivesBiz {
* @return
*/
public List<Map<String, Object>> buildTableData(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, boolean export) {
boolean welBaseDiffSign = isDiffWelBase();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listAll();
Map<Long, TaxAgentPO> longTaxAgentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId);
@ -1599,16 +1705,39 @@ public class SIArchivesBiz {
map.put("socialName", insuranceSchemeMapper.querySchemeName(socialItem.getSocialSchemeId()));
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(socialItem.getSocialSchemeId());
socialJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
if (welBaseDiffSign) {
if (socialJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(socialItem.getSocialSchemeId(), PaymentScopeEnum.SCOPE_PERSON.getValue());
socialJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k + "per", v);
}
});
}
Map<String, Object> socialComJson = JSON.parseObject(socialItem.getSocialPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
// map.putAll(socialJson);
if (socialComJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(socialItem.getSocialSchemeId(),PaymentScopeEnum.SCOPE_COMPANY.getValue());
socialComJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k + "com", v);
}
});
}
} else {
if (socialJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(socialItem.getSocialSchemeId());
socialJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
}
}
map.put("socialAccount", socialItem.getSocialAccount());
map.put("socialStartTime", socialItem.getSocialStartTime());
map.put("socialEndTime", socialItem.getSocialEndTime());
@ -1618,16 +1747,39 @@ public class SIArchivesBiz {
map.put("fundAccount", fundItem.getFundAccount());
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(fundItem.getFundSchemeId());
fundJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
if (welBaseDiffSign) {
if (fundJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(fundItem.getFundSchemeId(),PaymentScopeEnum.SCOPE_PERSON.getValue());
fundJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k + "per", v);
}
});
}
Map<String, Object> fundComJson = JSON.parseObject(fundItem.getFundPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
// map.putAll(fundJson);
if (fundComJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(fundItem.getFundSchemeId(),PaymentScopeEnum.SCOPE_COMPANY.getValue());
fundComJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k + "com", v);
}
});
}
} else {
if (fundJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(fundItem.getFundSchemeId());
fundJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
}
}
map.put("supplementFundAccount", fundItem.getSupplementFundAccount());
map.put("fundStartTime", fundItem.getFundStartTime());
map.put("fundEndTime", fundItem.getFundEndTime());
@ -1637,16 +1789,39 @@ public class SIArchivesBiz {
map.put("otherName", insuranceSchemeMapper.querySchemeName(otherItem.getOtherSchemeId()));
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (otherJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(otherItem.getOtherSchemeId());
otherJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
if (welBaseDiffSign) {
if (otherJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(otherItem.getOtherSchemeId(),PaymentScopeEnum.SCOPE_PERSON.getValue());
otherJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k + "per", v);
}
});
}
Map<String, Object> otherComJson = JSON.parseObject(otherItem.getOtherPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
// map.putAll(otherJson);
if (otherComJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(otherItem.getOtherSchemeId(),PaymentScopeEnum.SCOPE_COMPANY.getValue());
otherComJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k + "com", v);
}
});
}
} else {
if (otherJson != null) {
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(otherItem.getOtherSchemeId());
otherJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
}
}
map.put("otherStartTime", otherItem.getOtherStartTime());
map.put("otherEndTime", otherItem.getOtherEndTime());
}
@ -1669,6 +1844,19 @@ public class SIArchivesBiz {
}
return insuranceIdList;
}
public List<Long> payInsuranceIds(Long socialSchemeId, Integer paymentScope) {
//查询该福利方案下开启缴纳的福利项
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialSchemeId);
List<Long> insuranceIdList = new ArrayList<>();
if (detailPOS != null && detailPOS.size() > 0) {
//开启缴纳的
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue()) && f.getPaymentScope().equals(paymentScope))
.map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
}
return insuranceIdList;
}
/**
* 获取信息提示
*/
@ -2296,4 +2484,12 @@ public class SIArchivesBiz {
list.add(new WeaTableColumn("150px", "操作时间", "operatorTime"));
return list;
}
public boolean isDiffWelBase() {
User user = (User) SalaryContext.get().getValue("user");
//判断是否要区分个人和单位福利基数
SalarySysConfPO welBaseDiff = getSalarySysConfService(user).getOneByCode(WEL_BASE_DIFF_BY_PER_AND_COM);
return welBaseDiff != null && welBaseDiff.getConfValue().equals(OpenEnum.OPEN.getValue());
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.common.SalaryContext;
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam;
@ -33,6 +34,7 @@ import java.util.Map;
public class SIArchivesController {
private SIArchivesService getService(User user) {
SalaryContext.get().setValue("user",user);
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}