From 63ae86978f54d4292a4af14da5edda1fbea118fa Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 30 Jan 2023 09:31:31 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=EF=BC=8C=E5=AF=BC=E5=87=BA?= =?UTF-8?q?excel=E6=96=87=E4=BB=B6=E5=90=8D=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/web/SISchemeController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/engine/salary/web/SISchemeController.java b/src/com/engine/salary/web/SISchemeController.java index 2ed092b8e..4270508d1 100644 --- a/src/com/engine/salary/web/SISchemeController.java +++ b/src/com/engine/salary/web/SISchemeController.java @@ -33,6 +33,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -200,6 +201,8 @@ public class SISchemeController { } else { fileName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导出"); } + + fileName = fileName + LocalDate.now(); try { fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); } catch (UnsupportedEncodingException e) { @@ -278,6 +281,8 @@ public class SISchemeController { } else { fileName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导入模板"); } + + fileName = fileName + LocalDate.now(); try { fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); } catch (UnsupportedEncodingException e) { From ae6822dc915892de645599eab97c869e2e812248 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 30 Jan 2023 17:29:07 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=96=B9=E6=A1=88=EF=BC=8C=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E5=AF=B9=E8=B1=A1=E7=9A=84=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BD=BD=E4=BD=93=EF=BC=88po,dto=EF=BC=89?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=B4=E7=BA=B3=E5=91=A8=E6=9C=9F=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=96=B0=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=B9=B6=E5=AF=B9?= =?UTF-8?q?sql=E4=B8=AD=E7=9A=84=E6=9F=A5=E8=AF=A2=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sischeme/dto/InsuranceSchemeDetailDTO.java | 15 +++++++++++++++ .../sischeme/po/InsuranceSchemeDetailPO.java | 15 +++++++++++++++ .../sischeme/InsuranceSchemeDetailMapper.xml | 6 ++++++ 3 files changed, 36 insertions(+) diff --git a/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeDetailDTO.java b/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeDetailDTO.java index 9777478a7..c291c7eff 100644 --- a/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeDetailDTO.java +++ b/src/com/engine/salary/entity/sischeme/dto/InsuranceSchemeDetailDTO.java @@ -93,4 +93,19 @@ public class InsuranceSchemeDetailDTO { * 进位规则 */ private String rententionRule; + + /** + * 缴纳周期 + */ + private String paymentCycle; + + /** + * 核算方式 + */ + private String accountType; + + /** + * 缴纳周期规则设置 + */ + private String cycleSetting; } diff --git a/src/com/engine/salary/entity/sischeme/po/InsuranceSchemeDetailPO.java b/src/com/engine/salary/entity/sischeme/po/InsuranceSchemeDetailPO.java index 40f491caf..a65ce19d7 100644 --- a/src/com/engine/salary/entity/sischeme/po/InsuranceSchemeDetailPO.java +++ b/src/com/engine/salary/entity/sischeme/po/InsuranceSchemeDetailPO.java @@ -90,6 +90,21 @@ public class InsuranceSchemeDetailPO { */ private Integer rententionRule; + /** + * 缴纳周期,0不进行周期缴纳,1进行周期缴纳 + */ + private Integer paymentCycle; + + /** + * 核算方式 + */ + private Integer accountType; + + /** + * 缴纳周期规则设置 + */ + private String cycleSetting; + /** * 创建人id */ diff --git a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml index 63e9b6d66..27e8b6072 100644 --- a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml +++ b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml @@ -15,6 +15,9 @@ + + + @@ -37,6 +40,9 @@ , t.fixed_cost , t.valid_num , t.rentention_rule + , t.payment_cycle + , t.account_type + , t.cycle_setting , t.create_time , t.update_time , t.creator From 6abc2068eaa482d8ce13ebd90d74ea7252d04de4 Mon Sep 17 00:00:00 2001 From: sy Date: Tue, 31 Jan 2023 17:40:34 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=96=B9=E6=A1=88=EF=BC=8C=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E6=96=B0=E5=A2=9E=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E3=80=81=E6=9F=A5=E7=9C=8B=E6=96=B9=E6=B3=95=E6=94=B9=E8=BF=9B?= =?UTF-8?q?=EF=BC=8C=E7=A6=8F=E5=88=A9=E6=A0=B8=E7=AE=97=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=96=B9=E6=A1=88=E4=B8=AD=E7=9A=84=E7=BC=B4?= =?UTF-8?q?=E7=BA=B3=E5=91=A8=E6=9C=9F=E5=9B=A0=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 183 ++++++++++++++++-- src/com/engine/salary/biz/SISchemeBiz.java | 18 ++ .../entity/sischeme/bo/InsuranceSchemeBO.java | 3 + .../sischeme/InsuranceSchemeDetailMapper.xml | 12 ++ 4 files changed, 196 insertions(+), 20 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index bda2fae67..12cfa2157 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -388,11 +388,11 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization); //核算社保 - accountSocial(insuranceAccountDetailPO, v, tenantKey); + accountSocial(insuranceAccountDetailPO, v, billMonth, tenantKey); //核算公积金 - accountFund(insuranceAccountDetailPO, v, tenantKey); + accountFund(insuranceAccountDetailPO, v, billMonth, tenantKey); //核算其他福利 - accountOther(insuranceAccountDetailPO, v, tenantKey); + accountOther(insuranceAccountDetailPO, v, billMonth, tenantKey); //计算合计 account(insuranceAccountDetailPO); //临时表PO @@ -524,7 +524,7 @@ public class SIAccountBiz extends Service { return insuranceAccountDetailPO; } - public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String tenantKey) { + public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, String tenantKey) { if (accountPO.getOther() != null) { InsuranceArchivesOtherSchemePO otherPO = accountPO.getOther(); insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization()); @@ -536,8 +536,10 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳其他的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map otherPerson = detailPOS.stream() - .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) + && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -560,7 +562,29 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (po.getPaymentCycle() != null && po.getPaymentCycle() == 1) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } otherPerJsonMap.put(String.valueOf(e), result.toPlainString()); otherPer.add(result); }); @@ -574,7 +598,8 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳公积金的单位福利 Map otherCom = detailPOS.stream() .filter( - item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) + && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -597,7 +622,29 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } otherComJsonMap.put(String.valueOf(e), result.toPlainString()); otherComList.add(result); }); @@ -613,7 +660,7 @@ public class SIAccountBiz extends Service { } - public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String tenantKey) { + public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, String tenantKey) { if (accountPO.getFund() != null) { InsuranceArchivesFundSchemePO fundPO = accountPO.getFund(); insuranceAccountDetailPO.setFundPayOrg(fundPO.getPaymentOrganization()); @@ -627,8 +674,10 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map fundperson = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) + && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -651,7 +700,29 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } fundPerJsonMap.put(String.valueOf(e), result.toPlainString()); fundPer.add(result); }); @@ -664,7 +735,8 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳公积金的单位福利 Map fundCom = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) + && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -687,8 +759,29 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); - ; +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } fundComJsonMap.put(String.valueOf(e), result.toPlainString()); fundComList.add(result); }); @@ -705,7 +798,7 @@ public class SIAccountBiz extends Service { } - public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String tenantKey) { + public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, String tenantKey) { if (accountPO.getSocial() != null) { InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial(); insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization()); @@ -718,8 +811,13 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map schemeperson = detailPOS.stream() - .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())) + .filter(item -> + Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && + Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) && + (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))) + ) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -736,13 +834,35 @@ public class SIAccountBiz extends Service { List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); - needArchivesPerson.stream().forEach(e -> { + needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } socialPerJsonMap.put(String.valueOf(e), result.toPlainString()); socialPer.add(result); }); @@ -755,7 +875,8 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳社保的单位福利 Map schemeCom = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && + (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -778,7 +899,29 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } sociaComJsonMap.put(String.valueOf(e), result.toPlainString()); socialCom.add(result); diff --git a/src/com/engine/salary/biz/SISchemeBiz.java b/src/com/engine/salary/biz/SISchemeBiz.java index b1596254f..2c0f21f65 100644 --- a/src/com/engine/salary/biz/SISchemeBiz.java +++ b/src/com/engine/salary/biz/SISchemeBiz.java @@ -79,6 +79,9 @@ public class SISchemeBiz { .insuranceName(item.getInsuranceName()) .paymentScope(e.getDefaultLabel()) .rententionRule(String.valueOf(RententionRuleEnum.ROUND.getValue())) + .cycleSetting("000000000000") + .paymentCycle("0") + .accountType("0") .build(); if (Objects.equals(item.getDataType(), DataTypeEnum.SYSTEM.getValue())) { insuranceSchemeDetailDTO.setIsPayment(true); @@ -98,6 +101,21 @@ public class SISchemeBiz { if (insuranceSchemeDetailPO.getIsPayment() != null) { insuranceSchemeDetailDTO.setIsPayment(Objects.equals(insuranceSchemeDetailPO.getIsPayment(), IsPaymentEnum.YES.getValue())); } + if (insuranceSchemeDetailPO.getPaymentCycle() != null) { + insuranceSchemeDetailDTO.setPaymentCycle(insuranceSchemeDetailPO.getPaymentCycle() + ""); + } else { + insuranceSchemeDetailDTO.setPaymentCycle("0"); + } + if (insuranceSchemeDetailPO.getAccountType() != null) { + insuranceSchemeDetailDTO.setAccountType(insuranceSchemeDetailPO.getAccountType() + ""); + } else { + insuranceSchemeDetailDTO.setAccountType("0"); + } + if (insuranceSchemeDetailPO.getCycleSetting() == null) { + insuranceSchemeDetailDTO.setCycleSetting("000000000000"); + } else { + insuranceSchemeDetailDTO.setCycleSetting(insuranceSchemeDetailPO.getCycleSetting()); + } if (StringUtils.isNotBlank(insuranceSchemeDetailPO.getUpperLimit())) { BigDecimal bigDecimal = new BigDecimal(insuranceSchemeDetailPO.getUpperLimit()); insuranceSchemeDetailDTO.setUpperLimit(numberCheck(bigDecimal.toPlainString()) ? null : bigDecimal); diff --git a/src/com/engine/salary/entity/sischeme/bo/InsuranceSchemeBO.java b/src/com/engine/salary/entity/sischeme/bo/InsuranceSchemeBO.java index 1a6cdd3d5..4b24e4021 100644 --- a/src/com/engine/salary/entity/sischeme/bo/InsuranceSchemeBO.java +++ b/src/com/engine/salary/entity/sischeme/bo/InsuranceSchemeBO.java @@ -72,6 +72,9 @@ public class InsuranceSchemeBO { .upperLimit(item.getUpperLimit() != null ? item.getUpperLimit().toString() : "0.000") .paymentProportion(item.getPaymentProportion() != null ? item.getPaymentProportion().toString() : "0.0000") .rententionRule(item.getRententionRule() != null ? Integer.valueOf(item.getRententionRule()) : null) + .paymentCycle(Integer.parseInt(item.getPaymentCycle())) + .cycleSetting(item.getCycleSetting()) + .accountType(Integer.parseInt(item.getAccountType())) .updateTime(new Date()) .validNum(item.getValidNum()) .build() diff --git a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml index 27e8b6072..fc81b31f1 100644 --- a/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml +++ b/src/com/engine/salary/mapper/sischeme/InsuranceSchemeDetailMapper.xml @@ -128,6 +128,9 @@ fixed_cost, valid_num, rentention_rule, + payment_cycle, + account_type, + cycle_setting, create_time, update_time, creator, @@ -147,6 +150,9 @@ #{fixedCost}, #{validNum}, #{rententionRule}, + #{paymentCycle}, + #{accountType}, + #{cycleSetting}, #{createTime}, #{updateTime}, #{creator}, @@ -174,6 +180,9 @@ fixed_cost, valid_num, rentention_rule, + payment_cycle, + account_type, + cycle_setting, create_time, update_time, creator, @@ -193,6 +202,9 @@ #{fixedCost}, #{validNum}, #{rententionRule}, + #{paymentCycle}, + #{accountType}, + #{cycleSetting}, #{createTime}, #{updateTime}, #{creator}, From 2e7ea046f2536271c45ed3f7168798ea18868af5 Mon Sep 17 00:00:00 2001 From: sy Date: Thu, 2 Feb 2023 14:47:39 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E8=BF=87=E7=A8=8B=E5=8A=A0=E5=85=A5=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E6=96=B9=E6=A1=88=E7=BC=B4=E7=BA=B3=E5=91=A8=E6=9C=9F?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 204 +++++++++++++++++--- 1 file changed, 173 insertions(+), 31 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 12cfa2157..f435eaccd 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1246,17 +1246,17 @@ public class SIAccountBiz extends Service { if (accountPO.getOther() != null) { accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); } - accountSocial(insuranceAccountDetailPO, accountPO); - accountFund(insuranceAccountDetailPO, accountPO); - accountOther(insuranceAccountDetailPO, accountPO); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountSocialByData(insuranceAccountDetailPO, baseParam); accountFundByData(insuranceAccountDetailPO, baseParam); accountOtherByData(insuranceAccountDetailPO, baseParam); } else { - accountSocial(insuranceAccountDetailPO, accountPO); - accountFund(insuranceAccountDetailPO, accountPO); - accountOther(insuranceAccountDetailPO, accountPO); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } return account(insuranceAccountDetailPO); @@ -1266,11 +1266,11 @@ public class SIAccountBiz extends Service { if (accountPO.getSocial() != null) { accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); } - accountSocial(insuranceAccountDetailPO, accountPO); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountSocialByData(insuranceAccountDetailPO, baseParam); } else { - accountSocial(insuranceAccountDetailPO, accountPO); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } } @@ -1305,11 +1305,11 @@ public class SIAccountBiz extends Service { if (accountPO.getFund() != null) { accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString()); } - accountFund(insuranceAccountDetailPO, accountPO); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountFundByData(insuranceAccountDetailPO, baseParam); } else { - accountFund(insuranceAccountDetailPO, accountPO); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } } @@ -1319,11 +1319,11 @@ public class SIAccountBiz extends Service { if (accountPO.getOther() != null) { accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); } - accountOther(insuranceAccountDetailPO, accountPO); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountOtherByData(insuranceAccountDetailPO, baseParam); } else { - accountOther(insuranceAccountDetailPO, accountPO); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); } } @@ -1332,7 +1332,7 @@ public class SIAccountBiz extends Service { } - public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) { + public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) { if (accountPO.getOther() != null) { InsuranceArchivesOtherSchemePO otherPO = accountPO.getOther(); insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization()); @@ -1342,8 +1342,9 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳其他的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map otherPerson = detailPOS.stream() - .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1366,8 +1367,30 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); - ; +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (po.getPaymentCycle() != null && po.getPaymentCycle() == 1) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } + otherPerJsonMap.put(String.valueOf(e), result.toPlainString()); otherPer.add(result); }); @@ -1381,7 +1404,7 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳公积金的单位福利 Map otherCom = detailPOS.stream() .filter( - item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1404,8 +1427,30 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); - ; +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } + otherComJsonMap.put(String.valueOf(e), result.toPlainString()); otherComList.add(result); }); @@ -1420,7 +1465,7 @@ public class SIAccountBiz extends Service { return insuranceAccountDetailPO; } - public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) { + public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) { if (accountPO.getFund() != null) { InsuranceArchivesFundSchemePO fundPO = accountPO.getFund(); insuranceAccountDetailPO.setFundPayOrg(fundPO.getPaymentOrganization()); @@ -1432,8 +1477,9 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map fundperson = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1456,8 +1502,30 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); - ; +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } + fundPerJsonMap.put(String.valueOf(e), result.toPlainString()); fundPer.add(result); }); @@ -1470,7 +1538,7 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳公积金的单位福利 Map fundCom = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1493,7 +1561,30 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } + fundComJsonMap.put(String.valueOf(e), result.toPlainString()); fundComList.add(result); }); @@ -1509,7 +1600,7 @@ public class SIAccountBiz extends Service { return insuranceAccountDetailPO; } - public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) { + public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) { if (accountPO.getSocial() != null) { InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial(); insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization()); @@ -1520,8 +1611,13 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map schemeperson = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue()) + .filter(item -> + Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && + Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) && + (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))) + ) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1537,13 +1633,35 @@ public class SIAccountBiz extends Service { } List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); - needArchivesPerson.stream().forEach(e -> { + needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } socialPerJsonMap.put(String.valueOf(e), result.toPlainString()); socialPer.add(result); @@ -1557,7 +1675,8 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳社保的单位福利 Map schemeCom = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && + (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1580,7 +1699,30 @@ public class SIAccountBiz extends Service { BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } + sociaComJsonMap.put(String.valueOf(e), result.toPlainString()); socialCom.add(result); From 9a4b58b2eedd49d402c49457a00c3619509f839d Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 3 Feb 2023 13:38:12 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E5=8F=AA=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=8C=BB=E7=96=97=E4=BF=9D=E9=99=A9=E5=92=8C=E5=85=BB?= =?UTF-8?q?=E8=80=81=E4=BF=9D=E9=99=A9=E6=97=B6=E7=9A=84=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E8=BF=87=E7=A8=8B=E5=8A=A0=E5=85=A5=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E6=96=B9=E6=A1=88=E7=BC=B4=E7=BA=B3=E5=91=A8=E6=9C=9F?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 71 +++++++++++++++++---- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index f435eaccd..0918b8ede 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1292,11 +1292,11 @@ public class SIAccountBiz extends Service { if (accountPO.getSocial() != null) { accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); } - accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids); + accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getBillMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountEndowmentInsuranceByData(insuranceAccountDetailPO, baseParam, ids); } else { - accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids); + accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getBillMonth()); } } @@ -1739,7 +1739,7 @@ public class SIAccountBiz extends Service { return insuranceAccountDetailPO; } - public InsuranceAccountDetailPO accountEndowmentInsurance(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, List categoryIds) { + public InsuranceAccountDetailPO accountEndowmentInsurance(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, List categoryIds, String billMonth) { if (accountPO.getSocial() != null) { InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial(); insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization()); @@ -1750,8 +1750,11 @@ public class SIAccountBiz extends Service { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 + int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1; Map schemeperson = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) + && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) + && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1761,7 +1764,7 @@ public class SIAccountBiz extends Service { if (archivesPerson != null) { categoryIds.forEach(item -> { if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) { - if (StringUtils.isNotBlank(archivesPerson.get(item))) { + if (StringUtils.isNotBlank(archivesPerson.get(String.valueOf(item)))) { needArchivesPerson.add(item); } @@ -1771,13 +1774,35 @@ public class SIAccountBiz extends Service { List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); - needArchivesPerson.stream().forEach(e -> { + needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentNum = new BigDecimal(archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } socialPerJsonMap.put(String.valueOf(e), result.toPlainString()); socialPer.add(result); }); @@ -1790,7 +1815,8 @@ public class SIAccountBiz extends Service { //方案中包含的需要缴纳社保的单位福利 Map schemeCom = detailPOS.stream() - .filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue()) + .filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && + (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))) .collect( Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity())); //档案中包含的基数信息 @@ -1800,7 +1826,7 @@ public class SIAccountBiz extends Service { if (archivesCom != null) { categoryIds.forEach(item -> { if (archivesCom.containsKey(String.valueOf(item)) && schemeCom.containsKey(item)) { - if (StringUtils.isNotBlank(archivesCom.get(item))) { + if (StringUtils.isNotBlank(archivesCom.get(String.valueOf(item)))) { needArchivesCom.add(item); } @@ -1816,13 +1842,36 @@ public class SIAccountBiz extends Service { List socialCom = new ArrayList<>(); Map sociaComJsonMap = new HashMap<>(); - needArchivesCom.stream().forEach(e -> { + needArchivesCom.forEach(e -> { InsuranceSchemeDetailPO po = schemeCom.get(e); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentNum = SalaryEntityUtil.string2BigDecimalDefault0(archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); - BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); +// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + BigDecimal result = new BigDecimal("0"); + if (Objects.equals(po.getPaymentCycle(), 1)) { + int monthValue = 1; + for (int i = monthIndex - 1; i >= 0; i--) { + String cycleValue = po.getCycleSetting().charAt(i) + ""; + if (Integer.parseInt(cycleValue) == 1) { + break; + } + monthValue++; + } + if (po.getAccountType() == 1) { + paymentNum = paymentNum.multiply(new BigDecimal(monthValue)); + fixedCost = fixedCost.multiply(new BigDecimal(monthValue)); + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } else { + for (int i = 0; i < monthValue; i++) { + result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost))); + } + } + } else { + result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); + } + sociaComJsonMap.put(String.valueOf(e), result.toPlainString()); socialCom.add(result); From 45d9fa4c1239407098749fbec8a8feaafe4af430 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 3 Feb 2023 17:04:30 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E6=97=B6=E6=8C=89=E7=85=A7=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E6=9C=88=E4=BB=BD=E8=80=83=E8=99=91=E7=BC=B4=E7=BA=B3=E5=91=A8?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 0918b8ede..e7b8e7538 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1246,17 +1246,17 @@ public class SIAccountBiz extends Service { if (accountPO.getOther() != null) { accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); } - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); - accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountSocialByData(insuranceAccountDetailPO, baseParam); accountFundByData(insuranceAccountDetailPO, baseParam); accountOtherByData(insuranceAccountDetailPO, baseParam); } else { - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); - accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } return account(insuranceAccountDetailPO); @@ -1266,11 +1266,11 @@ public class SIAccountBiz extends Service { if (accountPO.getSocial() != null) { accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); } - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountSocialByData(insuranceAccountDetailPO, baseParam); } else { - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } } @@ -1292,11 +1292,11 @@ public class SIAccountBiz extends Service { if (accountPO.getSocial() != null) { accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); } - accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getBillMonth()); + accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getSupplementaryMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountEndowmentInsuranceByData(insuranceAccountDetailPO, baseParam, ids); } else { - accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getBillMonth()); + accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getSupplementaryMonth()); } } @@ -1305,11 +1305,11 @@ public class SIAccountBiz extends Service { if (accountPO.getFund() != null) { accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString()); } - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountFundByData(insuranceAccountDetailPO, baseParam); } else { - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } } @@ -1319,11 +1319,11 @@ public class SIAccountBiz extends Service { if (accountPO.getOther() != null) { accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); } - accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountOtherByData(insuranceAccountDetailPO, baseParam); } else { - accountOther(insuranceAccountDetailPO, accountPO, baseParam.getBillMonth()); + accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } } From de5b5d4c1954ba5bc8b4c3095b4a623a998f2704 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 8 Feb 2023 11:33:17 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E7=BC=B4=E7=BA=B3=E5=91=A8=E6=9C=9F=E6=A0=B8=E7=AE=97=E6=97=B6?= =?UTF-8?q?=E8=80=83=E8=99=91=E8=B5=B7=E5=A7=8B=E7=BC=B4=E7=BA=B3=E6=9C=88?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E8=A1=A5=E7=BC=B4=E4=B8=8D=E5=85=81=E8=AE=B8=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E8=B5=B7=E5=A7=8B=E7=BC=B4=E7=BA=B3=E6=9C=88=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E6=9C=88=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 60 +++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index e7b8e7538..4207393fc 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -553,6 +553,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(otherPerson, billMonth, otherPO.getOtherStartTime()); List otherPer = new ArrayList<>(); Map otherPerJsonMap = new HashMap<>(); @@ -613,6 +615,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(otherCom, billMonth, otherPO.getOtherStartTime()); List otherComList = new ArrayList<>(); Map otherComJsonMap = new HashMap<>(); @@ -691,6 +695,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(fundperson, billMonth, fundPO.getFundStartTime()); List fundPer = new ArrayList<>(); Map fundPerJsonMap = new HashMap<>(); @@ -750,6 +756,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(fundCom, billMonth, fundPO.getFundStartTime()); List fundComList = new ArrayList<>(); Map fundComJsonMap = new HashMap<>(); @@ -831,6 +839,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime()); List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); @@ -890,6 +900,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime()); List socialCom = new ArrayList<>(); Map sociaComJsonMap = new HashMap<>(); @@ -938,6 +950,29 @@ public class SIAccountBiz extends Service { return insuranceAccountDetailPO; } + /** + * 对于核算月和福利起始缴纳月处于同年时,要避免根据周期缴纳福利费用时,可能出现的多余费用缴纳情况 + * @param schemeDetail 福利方案明细 + * @param billMonth 核算月 + * @param startMonth 福利起始缴纳月 + * @return + */ + public Map checkCycleSettingWithStartMonth(Map schemeDetail, String billMonth, String startMonth) { + String billYear = billMonth.substring(0,4); + if (StringUtils.isNotBlank(startMonth) && billYear.equals(startMonth.substring(0,4))) { + int startMonthIndex = Integer.parseInt(startMonth.split("-")[1]) - 1; + schemeDetail.forEach((k, v) -> { + if (v.getPaymentCycle() != null && v.getPaymentCycle().equals(1) && startMonthIndex != 0) { + StringBuilder newCycleSetting = new StringBuilder(v.getCycleSetting()); + newCycleSetting.setCharAt(startMonthIndex - 1, '1'); + v.setCycleSetting(newCycleSetting.toString()); + } + }); + + } + return schemeDetail; + } + public void batchSaveAccountInspectDetail(List list, String billMonth, String tenantKey) { List insuranceAccountInspectAllPOS = accountInspect(list, true); batchDelInspectDetail(insuranceAccountInspectAllPOS); @@ -1338,7 +1373,9 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization()); insuranceAccountDetailPO.setOtherSchemeId(otherPO.getOtherSchemeId()); insuranceAccountDetailPO.setOtherPaymentBaseString(otherPO.getOtherPaymentBaseString()); - if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null) { + //判断是否在起始缴纳月和最后缴纳月之间 + Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), otherPO.getOtherStartTime(), otherPO.getOtherEndTime()); + if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳其他的个人福利 @@ -1358,6 +1395,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(otherPerson, billMonth, otherPO.getOtherStartTime()); List otherPer = new ArrayList<>(); Map otherPerJsonMap = new HashMap<>(); @@ -1418,6 +1457,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(otherCom, billMonth, otherPO.getOtherStartTime()); List otherComList = new ArrayList<>(); Map otherComJsonMap = new HashMap<>(); @@ -1473,7 +1514,9 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setSupplementFundAccount(fundPO.getSupplementFundAccount()); insuranceAccountDetailPO.setFundSchemeId(fundPO.getFundSchemeId()); insuranceAccountDetailPO.setFundPaymentBaseString(fundPO.getFundPaymentBaseString()); - if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null) { + //判断是否在起始缴纳月和最后缴纳月之间 + Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), fundPO.getFundStartTime(), fundPO.getFundEndTime()); + if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 @@ -1493,6 +1536,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(fundperson, billMonth, fundPO.getFundStartTime()); List fundPer = new ArrayList<>(); Map fundPerJsonMap = new HashMap<>(); @@ -1552,6 +1597,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(fundCom, billMonth, fundPO.getFundStartTime()); List fundComList = new ArrayList<>(); Map fundComJsonMap = new HashMap<>(); @@ -1607,7 +1654,9 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount()); insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId()); insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString()); - if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) { + //判断是否在起始缴纳月和最后缴纳月之间 + Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); + if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 @@ -1631,6 +1680,9 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime()); + List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); needArchivesPerson.forEach(e -> { @@ -1690,6 +1742,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime()); List socialCom = new ArrayList<>(); Map sociaComJsonMap = new HashMap<>(); From 5657d5cc642236fb70b77e895ac090763ced6921 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 8 Feb 2023 13:04:23 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E8=A1=A5=E7=BC=B4=E6=96=B9=E5=BC=8F=E4=B8=80=E5=92=8C=E4=BA=8C?= =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E8=A1=A5=E7=BC=B4=E8=B5=B7=E5=A7=8B?= =?UTF-8?q?=E7=BC=B4=E7=BA=B3=E6=9C=88=E4=B9=8B=E5=89=8D=E7=9A=84=E6=9C=88?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 4207393fc..806a92120 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1800,7 +1800,10 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount()); insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId()); insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString()); - if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) { + //判断是否在起始缴纳月和最后缴纳月之间 + Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); + + if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 @@ -1825,6 +1828,8 @@ public class SIAccountBiz extends Service { } }); } + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime()); List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); @@ -1886,6 +1891,8 @@ public class SIAccountBiz extends Service { } }); + //判断核算周期、核算月、福利起始缴纳月的关系 + checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime()); // archivesCom.forEach((id, value) -> { // if (schemeCom.containsKey(Long.valueOf(id))) { From 390d2d7851f38f0ebdb3e27c04fcb9f9619b825f Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 8 Feb 2023 14:50:45 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E8=B5=B7=E5=A7=8B=E7=BC=B4=E7=BA=B3=E6=9C=88=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E7=A6=8F=E5=88=A9=E9=BB=98=E8=AE=A4=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 806a92120..a567d2f78 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1374,7 +1374,7 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setOtherSchemeId(otherPO.getOtherSchemeId()); insuranceAccountDetailPO.setOtherPaymentBaseString(otherPO.getOtherPaymentBaseString()); //判断是否在起始缴纳月和最后缴纳月之间 - Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), otherPO.getOtherStartTime(), otherPO.getOtherEndTime()); + Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, otherPO.getOtherStartTime(), otherPO.getOtherEndTime()); if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); @@ -1515,8 +1515,8 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setFundSchemeId(fundPO.getFundSchemeId()); insuranceAccountDetailPO.setFundPaymentBaseString(fundPO.getFundPaymentBaseString()); //判断是否在起始缴纳月和最后缴纳月之间 - Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), fundPO.getFundStartTime(), fundPO.getFundEndTime()); - if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null && inDataRange) { + Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, fundPO.getFundStartTime(), fundPO.getFundEndTime()); + if ((Objects.equals(NonPaymentEnum.YES.getValue(), fundPO.getNonPayment()) || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 @@ -1655,8 +1655,8 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId()); insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString()); //判断是否在起始缴纳月和最后缴纳月之间 - Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); - if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { + Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); + if ((Objects.equals(NonPaymentEnum.YES.getValue(), socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利 @@ -1801,9 +1801,9 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId()); insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString()); //判断是否在起始缴纳月和最后缴纳月之间 - Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); + Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); - if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { + if ((Objects.equals(NonPaymentEnum.YES.getValue(), socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class); //方案中包含的需要缴纳社保的个人福利