薪酬系统-福利档案,档案编辑页详情接口增加返回缺失福利项数值

This commit is contained in:
sy 2024-01-19 17:32:52 +08:00
parent a3aa0f5ca1
commit e8aee9ab64
1 changed files with 85 additions and 18 deletions

View File

@ -1,5 +1,6 @@
package com.engine.salary.biz;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
@ -69,6 +70,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.engine.salary.sys.constant.SalarySysConstant.WEL_BASE_AUTO_ADJUST;
import static com.engine.salary.sys.constant.SalarySysConstant.WEL_BASE_DIFF_BY_PER_AND_COM;
@ -279,15 +281,19 @@ public class SIArchivesBiz {
//判断是否要区分个人和单位福利基数
SalarySysConfPO welBaseDiff = getSalarySysConfService(user).getOneByCode(WEL_BASE_DIFF_BY_PER_AND_COM);
boolean welBaseDiffSign = welBaseDiff != null && welBaseDiff.getConfValue().equals(OpenEnum.OPEN.getValue());
//判断是否要自动调整基数
SalarySysConfPO welBaseAutoAdjust = getSalarySysConfService(user).getOneByCode(WEL_BASE_AUTO_ADJUST);
boolean welBaseAutoAdjustSign = welBaseAutoAdjust != null && welBaseAutoAdjust.getConfValue().equals(OpenEnum.OPEN.getValue());
switch (welfareType) {
case SOCIAL_SECURITY:
data = buildSocialPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization, welBaseDiffSign);
data = buildSocialPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign);
break;
case ACCUMULATION_FUND:
data = buildFundPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization, welBaseDiffSign);
data = buildFundPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign);
break;
case OTHER:
data = buildOtherPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization, welBaseDiffSign);
data = buildOtherPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign);
break;
default:
}
@ -302,19 +308,30 @@ public class SIArchivesBiz {
* @param operateId
* @return
*/
public Map<String, Object> buildOtherPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign) {
public Map<String, Object> buildOtherPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign, boolean welBaseAutoAdjustSign) {
Map<String, Object> dataMap = new HashMap<>();
InsuranceArchivesOtherSchemeDTO data = buildOtherForm(employeeId, operateId, paymentOrganization);
Map<String, Object> insuranceValueMap = new HashMap<>();
Map<String, Object> insuranceComValueMap = new HashMap<>();
if (data != null) {
dataMap.put("data", JSONObject.parseObject(data.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
}));
insuranceValueMap = StrUtil.isNotBlank(data.getOtherPaymentBaseString())
? JSONObject.parseObject(data.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {}) : new HashMap<>();
if (welBaseDiffSign) {
dataMap.put("comData", JSONObject.parseObject(data.getOtherPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
}));
insuranceComValueMap = StrUtil.isNotBlank(data.getOtherPaymentComBaseString())
? JSONObject.parseObject(data.getOtherPaymentComBaseString(), new TypeReference<Map<String, Object>>() {}) : new HashMap<>();
}
}
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> inputItems = buildPaymentBase(user, schemeId, welfareType);
//如果查询结果中存在 方案中缺失福利险种的值设置初始值
for (SearchConditionItem item : inputItems) {
String insuranceId = item.getDomkey().length > 0 ? item.getDomkey()[0] : null;
if (StrUtil.isNotBlank(insuranceId) && insuranceValueMap.get(insuranceId) == null) {
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceValueMap.put(insuranceId, basicValue);
}
}
dataMap.put("data", insuranceValueMap);
addGroups.add(new SearchConditionGroup("其它福利缴纳基数", true, inputItems));
dataMap.put("items", addGroups);
if (welBaseDiffSign) {
@ -322,6 +339,15 @@ public class SIArchivesBiz {
List<SearchConditionItem> inputComItems = buildPaymentComBase(user, schemeId, welfareType);
addComGroups.add(new SearchConditionGroup("其它福利缴纳基数", true, inputComItems));
dataMap.put("comItems", addComGroups);
for (SearchConditionItem item : inputComItems) {
String insuranceId = item.getDomkey().length > 0 ? item.getDomkey()[0] : null;
if (StrUtil.isNotBlank(insuranceId) && insuranceComValueMap.get(insuranceId) == null) {
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceComValueMap.put(insuranceId, basicValue);
}
}
dataMap.put("comData", insuranceComValueMap);
}
return dataMap;
}
@ -334,20 +360,32 @@ public class SIArchivesBiz {
* @param operateId
* @return
*/
public Map<String, Object> buildFundPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign) {
public Map<String, Object> buildFundPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign, boolean welBaseAutoAdjustSign) {
Map<String, Object> dataMap = new HashMap<>();
InsuranceArchivesFundSchemeDTO data = buildFundForm(employeeId, operateId, paymentOrganization);
Map<String, Object> insuranceValueMap = new HashMap<>();
Map<String, Object> insuranceComValueMap = new HashMap<>();
if (data != null) {
dataMap.put("data", JSONObject.parseObject(data.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
}));
insuranceValueMap = StrUtil.isNotBlank(data.getFundPaymentBaseString())
? JSONObject.parseObject(data.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {}) : new HashMap<>();
if (welBaseDiffSign) {
dataMap.put("comData", JSONObject.parseObject(data.getFundPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
}));
insuranceComValueMap = StrUtil.isNotBlank(data.getFundPaymentComBaseString())
? JSONObject.parseObject(data.getFundPaymentComBaseString(), new TypeReference<Map<String, Object>>() {}) : new HashMap<>();
}
}
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> inputItems = buildPaymentBase(user, schemeId, welfareType);
//如果查询结果中存在 方案中缺失福利险种的值设置初始值
for (SearchConditionItem item : inputItems) {
String insuranceId = item.getDomkey().length > 0 ? item.getDomkey()[0] : null;
if (StrUtil.isNotBlank(insuranceId) && insuranceValueMap.get(insuranceId) == null) {
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceValueMap.put(insuranceId, basicValue);
}
}
dataMap.put("data", insuranceValueMap);
addGroups.add(new SearchConditionGroup("公积金缴纳基数", true, inputItems));
dataMap.put("items", addGroups);
if (welBaseDiffSign) {
@ -355,6 +393,15 @@ public class SIArchivesBiz {
List<SearchConditionItem> inputComItems = buildPaymentComBase(user, schemeId, welfareType);
addComGroups.add(new SearchConditionGroup("公积金缴纳基数", true, inputComItems));
dataMap.put("comItems", addComGroups);
for (SearchConditionItem item : inputComItems) {
String insuranceId = item.getDomkey().length > 0 ? item.getDomkey()[0] : null;
if (StrUtil.isNotBlank(insuranceId) && insuranceComValueMap.get(insuranceId) == null) {
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceComValueMap.put(insuranceId, basicValue);
}
}
dataMap.put("comData", insuranceComValueMap);
}
return dataMap;
}
@ -367,20 +414,31 @@ public class SIArchivesBiz {
* @param operateId
* @return
*/
public Map<String, Object> buildSocialPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign) {
public Map<String, Object> buildSocialPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign, boolean welBaseAutoAdjustSign) {
Map<String, Object> dataMap = new HashMap<>();
InsuranceArchivesSocialSchemeDTO data = buildSocialForm(employeeId, operateId, paymentOrganization);
Map<String, Object> insuranceValueMap = new HashMap<>();
Map<String, Object> insuranceComValueMap = new HashMap<>();
if (data != null) {
dataMap.put("data", JSONObject.parseObject(data.getSchemePaymentBaseString(), new TypeReference<Map<String, Object>>() {
}));
insuranceValueMap = StrUtil.isNotBlank(data.getSchemePaymentBaseString())
? JSONObject.parseObject(data.getSchemePaymentBaseString(), new TypeReference<Map<String, Object>>() {}) : new HashMap<>();
if (welBaseDiffSign) {
dataMap.put("comData", JSONObject.parseObject(data.getSchemePaymentComBaseString(), new TypeReference<Map<String, Object>>() {
}));
insuranceComValueMap = StrUtil.isNotBlank(data.getSchemePaymentComBaseString())
? JSONObject.parseObject(data.getSchemePaymentComBaseString(), new TypeReference<Map<String, Object>>() {}) : new HashMap<>();
}
}
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> inputItems = buildPaymentBase(user, schemeId, welfareType);
//如果查询结果中存在 方案中缺失福利险种的值设置初始值
for (SearchConditionItem item : inputItems) {
String insuranceId = item.getDomkey().length > 0 ? item.getDomkey()[0] : null;
if (StrUtil.isNotBlank(insuranceId) && insuranceValueMap.get(insuranceId) == null) {
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceValueMap.put(insuranceId, basicValue);
}
}
dataMap.put("data", insuranceValueMap);
addGroups.add(new SearchConditionGroup("社保缴纳基数", true, inputItems));
dataMap.put("items", addGroups);
if (welBaseDiffSign) {
@ -388,6 +446,15 @@ public class SIArchivesBiz {
List<SearchConditionItem> inputComItems = buildPaymentComBase(user, schemeId, welfareType);
addComGroups.add(new SearchConditionGroup("社保缴纳基数", true, inputComItems));
dataMap.put("comItems", addComGroups);
for (SearchConditionItem item : inputComItems) {
String insuranceId = item.getDomkey().length > 0 ? item.getDomkey()[0] : null;
if (StrUtil.isNotBlank(insuranceId) && insuranceComValueMap.get(insuranceId) == null) {
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceComValueMap.put(insuranceId, basicValue);
}
}
dataMap.put("comData", insuranceComValueMap);
}
return dataMap;