From 36e2f96ae50c06aeec5a5f9b74ba1b2cae4c2cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 28 Jul 2022 14:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E6=96=B9=E6=A1=88=E8=B5=B7?= =?UTF-8?q?=E5=A7=8B=E7=BC=B4=E7=BA=B3=E5=92=8C=E6=9C=80=E5=90=8E=E7=BC=B4?= =?UTF-8?q?=E7=BA=B3=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 41 +++++++++++-------- .../engine/salary/util/SalaryDateUtil.java | 26 +++++++++++- 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 746bf2af2..96c7d512a 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -39,6 +39,7 @@ import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryAssert; +import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; @@ -419,7 +420,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()); InsuranceSchemeDetailPOEncrypt.decryptList(detailPOS); //方案中包含的需要缴纳其他的个人福利 @@ -431,7 +434,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { archivesPerson.forEach((id, value) -> { if (otherPerson.containsKey(Long.valueOf(id))) { needArchivesPerson.add(Long.valueOf(id)); @@ -468,7 +471,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (otherCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); @@ -508,7 +511,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()); InsuranceSchemeDetailPOEncrypt.decryptList(detailPOS); //方案中包含的需要缴纳社保的个人福利 @@ -520,7 +525,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { archivesPerson.forEach((id, value) -> { if (fundperson.containsKey(Long.valueOf(id))) { needArchivesPerson.add(Long.valueOf(id)); @@ -556,7 +561,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (fundCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); @@ -597,7 +602,9 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount()); insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId()); insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString()); - if ((NonPaymentEnum.YES.getValue().equals(socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) { + //判断是否在起始缴纳月和最后缴纳月之间 + Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime()); + if ((NonPaymentEnum.YES.getValue().equals(socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) { List detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId()); InsuranceSchemeDetailPOEncrypt.decryptList(detailPOS); //方案中包含的需要缴纳社保的个人福利 @@ -609,7 +616,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { archivesPerson.forEach((id, value) -> { if (schemeperson.containsKey(Long.valueOf(id))) { needArchivesPerson.add(Long.valueOf(id)); @@ -645,7 +652,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (schemeCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); @@ -994,7 +1001,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { archivesPerson.forEach((id, value) -> { if (otherPerson.containsKey(Long.valueOf(id))) { needArchivesPerson.add(Long.valueOf(id)); @@ -1032,7 +1039,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (otherCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); @@ -1084,7 +1091,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { archivesPerson.forEach((id, value) -> { if (fundperson.containsKey(Long.valueOf(id))) { needArchivesPerson.add(Long.valueOf(id)); @@ -1121,7 +1128,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (fundCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); @@ -1173,7 +1180,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { archivesPerson.forEach((id, value) -> { if (schemeperson.containsKey(Long.valueOf(id))) { needArchivesPerson.add(Long.valueOf(id)); @@ -1209,7 +1216,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (schemeCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); @@ -1261,7 +1268,7 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 个人 List needArchivesPerson = new ArrayList<>(); - if(archivesPerson!=null){ + if (archivesPerson != null) { categoryIds.forEach(item -> { if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) { needArchivesPerson.add(item); @@ -1298,7 +1305,7 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); - if(archivesCom!=null){ + if (archivesCom != null) { archivesCom.forEach((id, value) -> { if (schemeCom.containsKey(Long.valueOf(id))) { needArchivesCom.add(Long.valueOf(id)); diff --git a/src/com/engine/salary/util/SalaryDateUtil.java b/src/com/engine/salary/util/SalaryDateUtil.java index 8c52c97fd..c3fdc3f38 100644 --- a/src/com/engine/salary/util/SalaryDateUtil.java +++ b/src/com/engine/salary/util/SalaryDateUtil.java @@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.time.FastDateFormat; +import org.jetbrains.annotations.NotNull; import weaver.general.BaseBean; import java.text.ParseException; @@ -453,7 +454,7 @@ public class SalaryDateUtil { return str; } - private static Date dateStrToLocalDate(String date) { + public static Date dateStrToLocalDate(String date) { Date localDate = null; try { date = date.substring(0, 10); @@ -489,6 +490,29 @@ public class SalaryDateUtil { return localDate; } + + @NotNull + public static Boolean monthInRange(String billMonth, String startMonth, String endMonth) { + billMonth = billMonth + "-01"; + Date billMonthDate = SalaryDateUtil.dateStrToLocalDate(billMonth); + Boolean inDataRange = true; + if (StringUtils.isNotBlank(startMonth)) { + startMonth = startMonth + "-01"; + Date socialStartDate = SalaryDateUtil.dateStrToLocalDate(startMonth); + if (billMonthDate.before(socialStartDate)) { + inDataRange = false; + } + } + if (StringUtils.isNotBlank(endMonth)) { + endMonth = endMonth + "-01"; + Date socialEndDate = SalaryDateUtil.dateStrToLocalDate(endMonth); + if (billMonthDate.after(socialEndDate)) { + inDataRange = false; + } + } + return inDataRange; + } + }