diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 7551f2190..0ffa7db2b 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -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 errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!")); + excelComments.add(errorMessageMap); + } + } else if (list.size() > 1) { isError = true; Map 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 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 insuranceCategoryPOS, List> singleAccount, String billMonth, Long employeeId, Long creator) {