From 31317fe8ac74da8a7d18e4deec7cb5b3c276daa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 22 Sep 2022 17:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=BA=BA=E6=95=B0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 18 +++++++++--------- .../engine/salary/util/SalaryEntityUtil.java | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 255354b29..04e16465e 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -220,19 +220,19 @@ public class SIAccountBiz extends Service { List socials = siArchivesBiz.getSocialByEmployeeIds(empIds); List emp1 = socials.stream() - .filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime()+ "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01")))) + .filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01")))) .map(InsuranceArchivesSocialSchemePO::getEmployeeId) .collect(Collectors.toList()); List funds = siArchivesBiz.getFundByEmployeeIds(empIds); List emp2 = funds.stream() - .filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime()+ "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01")))) + .filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01")))) .map(InsuranceArchivesFundSchemePO::getEmployeeId) .collect(Collectors.toList()); List others = siArchivesBiz.getOtherByEmployeeIds(empIds); List emp3 = others.stream() - .filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime()+ "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01")))) + .filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01")))) .map(InsuranceArchivesOtherSchemePO::getEmployeeId) .collect(Collectors.toList()); validIds.addAll(emp1); @@ -776,11 +776,11 @@ public class SIAccountBiz extends Service { boolean otherPersonFlag = false; for (InsuranceAccountDetailPO item : v) { // 判断社保是否为0 - socialPersonFlag = (StringUtils.isBlank(item.getSocialSum()) || Double.parseDouble(item.getSocialSum()) <=0.0 ); + socialPersonFlag = (StringUtils.isBlank(item.getSocialSum()) || SalaryEntityUtil.StringEqZERO(item.getSocialSum())); BigDecimal socialPerson = socialPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getSocialSum()); - fundPersonFlag = (StringUtils.isBlank(item.getFundSum()) || Double.parseDouble(item.getFundSum()) <=0.0); + fundPersonFlag = (StringUtils.isBlank(item.getFundSum()) || SalaryEntityUtil.StringEqZERO(item.getFundSum())); BigDecimal fundPerson = fundPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getFundSum()); - otherPersonFlag = (StringUtils.isBlank(item.getOtherSum()) || Double.parseDouble(item.getOtherSum()) <=0.0); + otherPersonFlag = (StringUtils.isBlank(item.getOtherSum()) || SalaryEntityUtil.StringEqZERO(item.getOtherSum())); BigDecimal otherPerson = otherPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getOtherSum()); socialTemp = socialTemp.add(socialPerson); fundTemp = fundTemp.add(fundPerson); @@ -1615,7 +1615,7 @@ public class SIAccountBiz extends Service { int otherNum = 0; BigDecimal otherPaySum = new BigDecimal("0"); for (InsuranceAccountDetailPO item : pos) { - if (StringUtils.isNotBlank(item.getOtherSum()) && !item.getOtherSum().equals("0")) { + if (StringUtils.isNotBlank(item.getOtherSum()) && !item.getOtherSum().equals("0")) { otherNum += 1; otherPaySum = otherPaySum.add(new BigDecimal(item.getOtherSum())); } @@ -1641,7 +1641,7 @@ public class SIAccountBiz extends Service { int socialNum = 0; BigDecimal socialPaySum = new BigDecimal("0"); for (InsuranceAccountDetailPO item : pos) { - if (StringUtils.isNotBlank(item.getSocialSum()) && !item.getSocialSum().equals("0")) { + if (StringUtils.isNotBlank(item.getSocialSum()) && !item.getSocialSum().equals("0")) { socialNum += 1; socialPaySum = socialPaySum.add(new BigDecimal(item.getSocialSum())); } @@ -1676,7 +1676,7 @@ public class SIAccountBiz extends Service { */ public int checkIfBusinessaccounting(InsuranceAccountBatchPO param) { List list = getSIAccountUtilMapper().checkIfBusinessaccounting(param.getId()); - return (int) list.stream().filter(e -> e.getBillmonth().equals(e.getTaxcycle().substring(0,7))).count(); + return (int) list.stream().filter(e -> e.getBillmonth().equals(e.getTaxcycle().substring(0, 7))).count(); } diff --git a/src/com/engine/salary/util/SalaryEntityUtil.java b/src/com/engine/salary/util/SalaryEntityUtil.java index 5924edff9..8fdbec465 100644 --- a/src/com/engine/salary/util/SalaryEntityUtil.java +++ b/src/com/engine/salary/util/SalaryEntityUtil.java @@ -223,6 +223,7 @@ public class SalaryEntityUtil { /** * String转Long + * * @param obj * @return */ @@ -235,6 +236,7 @@ public class SalaryEntityUtil { /** * String转BigDecimal + * * @param obj * @return */ @@ -247,6 +249,7 @@ public class SalaryEntityUtil { /** * String转BigDecimal + * * @param obj * @return */ @@ -257,4 +260,17 @@ public class SalaryEntityUtil { return BigDecimal.ZERO; } + /** + * 判断字符串是否等于0 + * + * @param obj + * @return + */ + public static boolean StringEqZERO(String obj) { + if (NumberUtils.isCreatable(obj)) { + return BigDecimal.ZERO.compareTo(new BigDecimal(obj)) == 0; + } + return false; + } + }