薪酬系统-福利档案,档案导入功能优化,增加基数自动调整逻辑
This commit is contained in:
parent
8164660ebf
commit
3b761341fc
|
|
@ -1217,6 +1217,64 @@ public class SIArchivesBiz {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验福利基数是否符合上下限要求,并返回符合要求的数据
|
||||
* @param primaryId
|
||||
* @param paymentBaseString
|
||||
* @return
|
||||
*/
|
||||
public String checkAndBuildWelBaseWithLimit(Long primaryId, String paymentBaseString, Integer paymentScope) {
|
||||
|
||||
if (primaryId ==null || paymentBaseString == null) {
|
||||
return paymentBaseString;
|
||||
}
|
||||
Map<String, String> paymentBaseJson = JSON.parseObject(paymentBaseString, HashMap.class);
|
||||
Map<String, String> newPaymentBaseJson = JSON.parseObject(paymentBaseString, HashMap.class);
|
||||
if (paymentBaseJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry : paymentBaseJson.entrySet()) {
|
||||
|
||||
//判断福利值是否为空/数字
|
||||
if (entry.getValue() == null || entry.getValue().length() == 0) {
|
||||
continue;
|
||||
} else if (!isNumeric(entry.getValue())) {
|
||||
log.info("福利值非数字!");
|
||||
newPaymentBaseJson.remove(entry.getKey());
|
||||
continue;
|
||||
}
|
||||
//根据福利方案id、险种id
|
||||
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOList = getInsuranceSchemeDetailMapper().getByPI(primaryId, Long.valueOf(entry.getKey()));
|
||||
log.info("福利方案id: {},, 福利明细项id:{}", primaryId, Long.valueOf(entry.getKey()));
|
||||
if (insuranceSchemeDetailPOList.size() == 0) {
|
||||
log.info("根据福利方案id、险种id、缴纳对象查询明细为null!福利方案id: {}, 福利明细项id:{}", primaryId, Long.valueOf(entry.getKey()));
|
||||
newPaymentBaseJson.remove(entry.getKey());
|
||||
continue;
|
||||
}
|
||||
List<InsuranceSchemeDetailPO> checkList = insuranceSchemeDetailPOList.stream()
|
||||
.filter(f -> f.getPaymentScope().equals(paymentScope)).collect(Collectors.toList());
|
||||
if (checkList.size() > 0) {
|
||||
InsuranceSchemeDetailPO insuranceSchemeDetailPO = checkList.get(0);
|
||||
encryptUtil.decrypt(insuranceSchemeDetailPO, InsuranceSchemeDetailPO.class);
|
||||
String lowerLimit = "0.000".equals(insuranceSchemeDetailPO.getLowerLimit()) ? null : insuranceSchemeDetailPO.getLowerLimit();
|
||||
String upperLimit = "0.000".equals(insuranceSchemeDetailPO.getUpperLimit()) ? null : insuranceSchemeDetailPO.getUpperLimit();
|
||||
if (lowerLimit != null && lowerLimit.length() > 0 && Double.parseDouble(entry.getValue()) < Double.parseDouble(lowerLimit)) {
|
||||
//数值低于对应福利明细下限
|
||||
log.info("社保基数 {} 数值 {} 低于对应福利明细下限 {}!", entry.getKey(), entry.getValue(), lowerLimit);
|
||||
newPaymentBaseJson.put(entry.getKey(), lowerLimit);
|
||||
}
|
||||
if (upperLimit != null && upperLimit.length() > 0 && Double.parseDouble(entry.getValue()) > Double.parseDouble(upperLimit)) {
|
||||
//数值高于对应福利明细上限
|
||||
log.info("社保基数 {} 数值 {} 高于对应福利明细上限 {} !", entry.getKey(), entry.getValue(), upperLimit);
|
||||
newPaymentBaseJson.put(entry.getKey(), upperLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
return JSON.toJSONString(newPaymentBaseJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 档案列表
|
||||
* <p>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
|||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.OpenEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.*;
|
||||
|
|
@ -74,6 +75,7 @@ import java.util.*;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.engine.salary.sys.constant.SalarySysConstant.WEL_BASE_AUTO_ADJUST;
|
||||
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
|
||||
|
||||
/**
|
||||
|
|
@ -1263,7 +1265,12 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
|
||||
//生成福利档案基础信息数据
|
||||
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = buildBaseInfoPO(employeeId, singleAccount, paymentNameIdMap, creator, runStatus, employees.get(0).isExtEmp());
|
||||
if (!isError) {
|
||||
|
||||
//判断是否福利档案导入时,不符合上下限的基数调整为上限/下限
|
||||
SalarySysConfPO welBaseAutoAdjust = getSalarySysConfService(user).getOneByCode(WEL_BASE_AUTO_ADJUST);
|
||||
boolean welBaseAutoAdjustSign = welBaseAutoAdjust != null && welBaseAutoAdjust.getConfValue().equals(OpenEnum.OPEN.getValue());
|
||||
|
||||
if (!isError && !welBaseAutoAdjustSign) {
|
||||
insuranceArchivesAccountPO.setSocial(insuranceArchivesSocialSchemePO);
|
||||
insuranceArchivesAccountPO.setFund(insuranceArchivesFundSchemePO);
|
||||
insuranceArchivesAccountPO.setOther(insuranceArchivesOtherSchemePO);
|
||||
|
|
@ -1304,6 +1311,32 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
isError = true;
|
||||
}
|
||||
|
||||
} else if (!isError) {
|
||||
//校验福利基数是否符合上下限要求,不符合上下限的基数调整为上限 /下限
|
||||
String newSocialPaymentBaseString = siArchivesBiz.checkAndBuildWelBaseWithLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue());
|
||||
String newFundPaymentBaseString = siArchivesBiz.checkAndBuildWelBaseWithLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue());
|
||||
String newOtherPaymentBaseString = siArchivesBiz.checkAndBuildWelBaseWithLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue());
|
||||
|
||||
insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(newSocialPaymentBaseString);
|
||||
insuranceArchivesFundSchemePO.setFundPaymentBaseString(newFundPaymentBaseString);
|
||||
insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(newOtherPaymentBaseString);
|
||||
|
||||
if (welBaseDiffSign) {
|
||||
String newSocialPaymentComBaseString = siArchivesBiz.checkAndBuildWelBaseWithLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
|
||||
String newFundPaymentComBaseString = siArchivesBiz.checkAndBuildWelBaseWithLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
|
||||
String newOtherPaymentComBaseString = siArchivesBiz.checkAndBuildWelBaseWithLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
|
||||
|
||||
insuranceArchivesSocialSchemePO.setSocialPaymentComBaseString(newSocialPaymentComBaseString);
|
||||
insuranceArchivesFundSchemePO.setFundPaymentComBaseString(newFundPaymentComBaseString);
|
||||
insuranceArchivesOtherSchemePO.setOtherPaymentComBaseString(newOtherPaymentComBaseString);
|
||||
}
|
||||
|
||||
insuranceArchivesAccountPO.setSocial(insuranceArchivesSocialSchemePO);
|
||||
insuranceArchivesAccountPO.setFund(insuranceArchivesFundSchemePO);
|
||||
insuranceArchivesAccountPO.setOther(insuranceArchivesOtherSchemePO);
|
||||
insuranceArchivesAccountPO.setBaseInfo(insuranceArchivesBaseInfoPO);
|
||||
|
||||
insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO);
|
||||
}
|
||||
return isError;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,4 +110,9 @@ public class SalarySysConstant {
|
|||
* 应用设置是否福利档案基数区分个人和单位
|
||||
*/
|
||||
public static final String WEL_BASE_DIFF_BY_PER_AND_COM = "welBaseDiffByPerAndCom";
|
||||
|
||||
/**
|
||||
* 应用设置是否福利档案导入时,不符合上下限的基数调整为上限 /下限
|
||||
*/
|
||||
public static final String WEL_BASE_AUTO_ADJUST = "welBaseAutoAdjust";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue