薪酬系统-福利台账,补差数据导入时,拒绝对于未设置社保、公积金、其他福利的正常缴纳项进行补差

This commit is contained in:
sy 2022-12-19 17:26:44 +08:00
parent 2f10986e2b
commit 547e7cd662
1 changed files with 51 additions and 2 deletions

View File

@ -52,6 +52,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryFormItemUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
@ -2728,7 +2729,15 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
if (list.isEmpty()) {
//新增数据情况
InsuranceAccountDetailPO createPO = buildBalanceAccountDetail(paymentOrganization, insuranceCategoryPOS, singleAccount, billMonth, employeeId, currentEmployeeId);
createInsuranceAccountDetailList.add(createPO);
if(checkBalance(createPO)) {
createInsuranceAccountDetailList.add(createPO);
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!"));
excelComments.add(errorMessageMap);
}
} else if (list.size() > 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
@ -2738,7 +2747,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//更新数据情况
//拼装待更新数据
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
updateInsuranceAccountDetailList.add(handleInsuranceAccountDetail(list.get(0), map));
InsuranceAccountDetailPO updatePO = handleInsuranceAccountDetail(list.get(0), map);
if(checkBalance(updatePO)) {
updateInsuranceAccountDetailList.add(updatePO);
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!"));
excelComments.add(errorMessageMap);
}
}
}
@ -2786,6 +2804,37 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
return apidatas;
}
/**
* 检查补差数据中的福利缴纳费用相关福利类别是否在正常缴纳中有设置缴纳
* @param po
* @return
*/
private boolean checkBalance(InsuranceAccountDetailPO po) {
InsuranceAccountDetailPO commonAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
.billMonth(po.getBillMonth())
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
.employeeId(po.getEmployeeId())
.paymentOrganization(po.getPaymentOrganization())
.build());
if (commonAccountPO != null) {
boolean commonSocialFlag = (StringUtils.isBlank(commonAccountPO.getSocialSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getSocialSum()));
boolean commonFundFlag = (StringUtils.isBlank(commonAccountPO.getFundSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getFundSum()));
boolean commonOtherFlag = (StringUtils.isBlank(commonAccountPO.getOtherSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getOtherSum()));
boolean balanceSocialFlag = (StringUtils.isBlank(po.getSocialSum()) || SalaryEntityUtil.StringEqZERO(po.getSocialSum()));
boolean balanceFundFlag = (StringUtils.isBlank(po.getFundSum()) || SalaryEntityUtil.StringEqZERO(po.getFundSum()));
boolean balanceOtherFlag = (StringUtils.isBlank(po.getOtherSum()) || SalaryEntityUtil.StringEqZERO(po.getOtherSum()));
//在正常缴纳数据中未设置的福利类别社保公积金其他福利不允许在补差数据中缴纳
if ((!commonSocialFlag && balanceSocialFlag) || (!commonFundFlag && balanceFundFlag) || (!commonOtherFlag && balanceOtherFlag)) {
return false;
} else {
return true;
}
} else {
return false;
}
}
public InsuranceAccountDetailPO buildBalanceAccountDetail(Long paymentOrganization, List<ICategoryPO> insuranceCategoryPOS,
List<Map<String, Object>> singleAccount, String billMonth, Long employeeId, Long creator) {