From 547e7cd662e02fbfc7a7a626ee14599f11dca7aa Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 19 Dec 2022 17:26:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=A1=A5=E5=B7=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AF=BC=E5=85=A5=E6=97=B6=EF=BC=8C=E6=8B=92=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E6=9C=AA=E8=AE=BE=E7=BD=AE=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E3=80=81=E5=85=AC=E7=A7=AF=E9=87=91=E3=80=81=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E7=9A=84=E6=AD=A3=E5=B8=B8=E7=BC=B4=E7=BA=B3?= =?UTF-8?q?=E9=A1=B9=E8=BF=9B=E8=A1=8C=E8=A1=A5=E5=B7=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SIAccountServiceImpl.java | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) 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) {