薪酬系统-福利档案基数上下限相关逻辑

This commit is contained in:
sy 2022-11-01 17:17:33 +08:00
parent b28887bde9
commit 51412603e5
5 changed files with 83 additions and 18 deletions

View File

@ -86,6 +86,10 @@ public class SIArchivesBiz {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
/**
* @param welfareType
* @param employeeId
@ -563,7 +567,7 @@ public class SIArchivesBiz {
InsuranceArchivesOtherSchemePO updateOtherInfo =
InsuranceArchivesOtherSchemePO.builder()
.id(oldOtherInfo.getId())
.otherSchemeId(param.getOtherName())
.otherSchemeId(param.getOtherSchemeId())
.otherStartTime(param.getOtherStartTime())
.underTake(param.getUnderTake())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
@ -577,8 +581,10 @@ public class SIArchivesBiz {
.paymentOrganization(param.getPaymentOrganization())
.otherPaymentBaseString(paramReq.getPaymentForm())
.build();
//校验福利基数是否符合上下限要求todo
//校验福利基数是否符合上下限要求
if (!checkWelBaseLimit(updateOtherInfo.getOtherSchemeId(),updateOtherInfo.getOtherPaymentBaseString())) {
throw new SalaryRunTimeException("其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!");
}
InsuranceArchivesOtherSchemePOEncrypt.encryptItem(updateOtherInfo);
otherSchemeMapper.updateById(updateOtherInfo);
sqlSession.commit();
@ -607,7 +613,7 @@ public class SIArchivesBiz {
InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0);
InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder()
.id(oldFundInfo.getId())
.fundSchemeId(param.getFundName())
.fundSchemeId(param.getFundSchemeId())
.fundAccount(param.getFundAccount())
.fundEndTime(param.getFundEndTime())
.fundStartTime(param.getFundStartTime())
@ -623,8 +629,10 @@ public class SIArchivesBiz {
.welfareType(paramReq.getWelfareType().getValue())
.employeeId(param.getEmployeeId())
.build();
//校验福利基数是否符合上下限要求todo
//校验福利基数是否符合上下限要求
if (!checkWelBaseLimit(updateFundInfo.getFundSchemeId(),updateFundInfo.getFundPaymentBaseString())) {
throw new SalaryRunTimeException("公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!");
}
InsuranceArchivesFundSchemePOEncrypt.encryptItem(updateFundInfo);
fundSchemeMapper.updateById(updateFundInfo);
@ -666,7 +674,7 @@ public class SIArchivesBiz {
.welfareType(paramReq.getWelfareType().getValue())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.socialPaymentBaseString(paramReq.getPaymentForm())
.socialSchemeId(param.getSocialName())
.socialSchemeId(param.getSocialSchemeId())
.socialEndTime(param.getSocialEndTime())
.socialStartTime(param.getSocialStartTime())
.creator(employeeId)
@ -678,8 +686,10 @@ public class SIArchivesBiz {
.socialAccount(param.getSchemeAccount())
.paymentOrganization(param.getPaymentOrganization())
.build();
//校验福利基数是否符合上下限要求todo
//校验福利基数是否符合上下限要求
if (!checkWelBaseLimit(updateSocialInfo.getSocialSchemeId(),updateSocialInfo.getSocialPaymentBaseString())) {
throw new SalaryRunTimeException("社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!");
}
InsuranceArchivesSocialSchemePOEncrypt.encryptItem(updateSocialInfo);
socialSchemeMapper.updateById(updateSocialInfo);
@ -693,6 +703,39 @@ public class SIArchivesBiz {
}
}
/**
* 校验福利基数是否符合上下限要求
* @param primaryId
* @param paymentBaseString
* @return
*/
public Boolean checkWelBaseLimit(Long primaryId, String paymentBaseString) {
//设置缴纳对象
Integer paymentScope = 2;
Map<String, String> paymentBaseJson = JSON.parseObject(paymentBaseString, new HashMap<String, String>().getClass());
for (Map.Entry<String, String> entry : paymentBaseJson.entrySet()) {
//根据福利方案id险种id缴纳对象查询明细
InsuranceSchemeDetailPO insuranceSchemeDetailPO = getInsuranceSchemeDetailMapper().getByPPI(primaryId, paymentScope, Long.valueOf(entry.getKey()));
if (insuranceSchemeDetailPO == null) {
return false;
}
InsuranceSchemeDetailPOEncrypt.decryptItem(insuranceSchemeDetailPO);
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)) {
//数值低于对应福利明细下限
return false;
}
if (upperLimit != null && upperLimit.length() > 0 && Double.parseDouble(entry.getValue()) > Double.parseDouble(upperLimit)) {
//数值高于对应福利明细上限
return false;
}
}
return true;
}
/**
* 档案列表
* <p>

View File

@ -38,8 +38,8 @@ public class InsuranceArchivesFundSaveParam {
//公积金方案id
private Long fundSchemeId;
//公积金方案id
private Long fundName;
//公积金方案名称
private String fundName;
//公积金账号
private String fundAccount;

View File

@ -39,8 +39,8 @@ public class InsuranceArchivesOtherSaveParam {
//其他福利方案id
private Long otherSchemeId;
//其他福利方案id")
private Long otherName;
//其他福利方案名称
private String otherName;
//其他福利缴纳组织
private Long paymentOrganization;

View File

@ -39,9 +39,8 @@ public class InsuranceArchivesSocialSaveParam {
//社保方案id
private Long socialSchemeId;
//社保方案id
//todo 前端需要调整
private Long socialName;
//社保方案名称
private String socialName;
//社保账号
private String schemeAccount;

View File

@ -63,6 +63,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.xpath.operations.Bool;
import weaver.file.ImageFileManager;
import weaver.hrm.User;
@ -931,9 +932,31 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesAccountPO.setFund(insuranceArchivesFundSchemePO);
insuranceArchivesAccountPO.setOther(insuranceArchivesOtherSchemePO);
insuranceArchivesAccountPO.setBaseInfo(insuranceArchivesBaseInfoPO);
//校验福利基数是否符合上下限要求todo
//校验福利基数是否符合上下限要求
Boolean socialCheckBase = siArchivesBiz.checkWelBaseLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentBaseString());
Boolean fundCheckBase = siArchivesBiz.checkWelBaseLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentBaseString());
Boolean otherCheckBase = siArchivesBiz.checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString());
if (socialCheckBase && fundCheckBase && otherCheckBase) {
insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO);
} else {
String checkMessage = "该条数据中";
if (!socialCheckBase) {
checkMessage = checkMessage + "社保福利基数、";
}
if (!fundCheckBase) {
checkMessage = checkMessage + "公积金福利基数、";
}
if (!otherCheckBase) {
checkMessage = checkMessage + "其他福利基数、";
}
checkMessage = checkMessage.substring(0, checkMessage.length() - 1);
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, checkMessage + "数值超出相关福利方案的基数上下限要求,不可导入!"));
excelComments.add(errorMessageMap);
isError = true;
}
insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO);
}
return isError;
}