diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index b3543aff3..55d424148 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -39,7 +39,6 @@ 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; @@ -89,6 +88,7 @@ public class SIAccountBiz extends Service { private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() { return SqlProxyHandle.getProxy(InsuranceAccountDetailMapper.class); } + private SIAccountUtilMapper getSIAccountUtilMapper() { return MapperProxyFactory.getProxy(SIAccountUtilMapper.class); } @@ -165,7 +165,7 @@ public class SIAccountBiz extends Service { Long paymentOrganization = param.getPaymentOrganization(); // List employeeIds = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), paymentOrganization); List employeeIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(paymentOrganization); - employeeIds = employeeIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList()); + employeeIds = employeeIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList()); if (CollectionUtils.isEmpty(employeeIds)) { List list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), paymentOrganization)); SiAccountEncrypt.decryptInsuranceAccountBatchList(list); @@ -211,20 +211,23 @@ public class SIAccountBiz extends Service { //过滤不在扣缴义务人下的数据 Collection employeeIdsInTaxAgent = getTaxAgentService().listEmployeeIdsInTaxAgent(param.getPaymentOrganization()); - empIds= empIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList()); + empIds = empIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList()); List socials = siArchivesBiz.getSocialByEmployeeIds(empIds); - List emp1 = socials.stream().filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getSocialEndTime())) <= 0)) + List emp1 = socials.stream() +// .filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime()) != 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()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getFundEndTime())) <= 0)) + List emp2 = funds.stream() +// .filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime()) != 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()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getOtherEndTime())) <= 0)) + List emp3 = others.stream() +// .filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime()) != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01")))) .map(InsuranceArchivesOtherSchemePO::getEmployeeId) .collect(Collectors.toList()); validIds.addAll(emp1); @@ -428,11 +431,14 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 个人 List needArchivesPerson = new ArrayList<>(); - archivesPerson.forEach((id, value) -> { - if (otherPerson.containsKey(Long.valueOf(id))) { - needArchivesPerson.add(Long.valueOf(id)); - } - }); + if(archivesPerson!=null){ + archivesPerson.forEach((id, value) -> { + if (otherPerson.containsKey(Long.valueOf(id))) { + needArchivesPerson.add(Long.valueOf(id)); + } + }); + } + List otherPer = new ArrayList<>(); Map otherPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -462,11 +468,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (otherCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (otherCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List otherComList = new ArrayList<>(); Map otherComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -511,11 +520,14 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 个人 List needArchivesPerson = new ArrayList<>(); - archivesPerson.forEach((id, value) -> { - if (fundperson.containsKey(Long.valueOf(id))) { - needArchivesPerson.add(Long.valueOf(id)); - } - }); + if(archivesPerson!=null){ + archivesPerson.forEach((id, value) -> { + if (fundperson.containsKey(Long.valueOf(id))) { + needArchivesPerson.add(Long.valueOf(id)); + } + }); + } + List fundPer = new ArrayList<>(); Map fundPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -545,11 +557,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (fundCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (fundCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List fundComList = new ArrayList<>(); Map fundComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -595,11 +610,14 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 个人 List needArchivesPerson = new ArrayList<>(); - archivesPerson.forEach((id, value) -> { - if (schemeperson.containsKey(Long.valueOf(id))) { - needArchivesPerson.add(Long.valueOf(id)); - } - }); + if(archivesPerson!=null){ + archivesPerson.forEach((id, value) -> { + if (schemeperson.containsKey(Long.valueOf(id))) { + needArchivesPerson.add(Long.valueOf(id)); + } + }); + } + List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -628,11 +646,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (schemeCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (schemeCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List socialCom = new ArrayList<>(); Map sociaComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -974,11 +995,14 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 个人 List needArchivesPerson = new ArrayList<>(); - archivesPerson.forEach((id, value) -> { - if (otherPerson.containsKey(Long.valueOf(id))) { - needArchivesPerson.add(Long.valueOf(id)); - } - }); + if(archivesPerson!=null){ + archivesPerson.forEach((id, value) -> { + if (otherPerson.containsKey(Long.valueOf(id))) { + needArchivesPerson.add(Long.valueOf(id)); + } + }); + } + List otherPer = new ArrayList<>(); Map otherPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -1009,11 +1033,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap().getClass()); //需要核算其他的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (otherCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (otherCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List otherComList = new ArrayList<>(); Map otherComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -1058,11 +1085,14 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 个人 List needArchivesPerson = new ArrayList<>(); - archivesPerson.forEach((id, value) -> { - if (fundperson.containsKey(Long.valueOf(id))) { - needArchivesPerson.add(Long.valueOf(id)); - } - }); + if(archivesPerson!=null){ + archivesPerson.forEach((id, value) -> { + if (fundperson.containsKey(Long.valueOf(id))) { + needArchivesPerson.add(Long.valueOf(id)); + } + }); + } + List fundPer = new ArrayList<>(); Map fundPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -1092,11 +1122,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap().getClass()); //需要核算公积金的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (fundCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (fundCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List fundComList = new ArrayList<>(); Map fundComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -1141,11 +1174,13 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 个人 List needArchivesPerson = new ArrayList<>(); - archivesPerson.forEach((id, value) -> { - if (schemeperson.containsKey(Long.valueOf(id))) { - needArchivesPerson.add(Long.valueOf(id)); - } - }); + if(archivesPerson!=null){ + archivesPerson.forEach((id, value) -> { + if (schemeperson.containsKey(Long.valueOf(id))) { + needArchivesPerson.add(Long.valueOf(id)); + } + }); + } List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -1175,11 +1210,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (schemeCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (schemeCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List socialCom = new ArrayList<>(); Map sociaComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -1224,11 +1262,14 @@ public class SIAccountBiz extends Service { HashMap archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 个人 List needArchivesPerson = new ArrayList<>(); - categoryIds.forEach(item -> { - if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) { - needArchivesPerson.add(item); - } - }); + if(archivesPerson!=null){ + categoryIds.forEach(item -> { + if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) { + needArchivesPerson.add(item); + } + }); + } + List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { @@ -1258,11 +1299,14 @@ public class SIAccountBiz extends Service { HashMap archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap().getClass()); //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); - archivesCom.forEach((id, value) -> { - if (schemeCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); - } - }); + if(archivesCom!=null){ + archivesCom.forEach((id, value) -> { + if (schemeCom.containsKey(Long.valueOf(id))) { + needArchivesCom.add(Long.valueOf(id)); + } + }); + } + List socialCom = new ArrayList<>(); Map sociaComJsonMap = new HashMap<>(); needArchivesCom.stream().forEach(e -> { @@ -1631,20 +1675,22 @@ public class SIAccountBiz extends Service { /** * 查询台账id是否已经薪资核算核算过 + * * @param param * @return */ - public int checkIfBusinessaccounting(InsuranceAccountBatchPO param){ + public int checkIfBusinessaccounting(InsuranceAccountBatchPO param) { return getSIAccountUtilMapper().checkIfBusinessaccounting(param.getId()).get(0).getNum(); } /** * 更新薪资台账 + * * @param param * @return */ - public void updateById(InsuranceAccountBatchPO param){ + public void updateById(InsuranceAccountBatchPO param) { getInsuranceAccountBatchMapper().updateById(param); } diff --git a/src/com/engine/salary/entity/salaryarchive/dto/SalaryArchiveListDTO.java b/src/com/engine/salary/entity/salaryarchive/dto/SalaryArchiveListDTO.java index 7d7c580c8..4186df5f2 100644 --- a/src/com/engine/salary/entity/salaryarchive/dto/SalaryArchiveListDTO.java +++ b/src/com/engine/salary/entity/salaryarchive/dto/SalaryArchiveListDTO.java @@ -81,4 +81,9 @@ public class SalaryArchiveListDTO { @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date payEndDate; + /** + * 是否人在扣缴义务人下 + */ + private String isInTaxAgent; + } diff --git a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java index 87d5de6af..49b01278d 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -114,21 +114,30 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic pos.stream().forEach(item -> { if (StringUtils.isNotBlank(item.getSocialPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getFundPaymentBaseString())) { Map fundJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if(fundJson!=null){ + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getOtherPaymentBaseString())) { Map otherJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if(otherJson!=null){ + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); @@ -164,21 +173,30 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic pos.stream().forEach(item -> { if (StringUtils.isNotBlank(item.getSocialPerJson())) { Map socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getFundPerJson())) { Map fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if(fundJson!=null){ + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getOtherPerJson())) { Map otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if(otherJson!=null){ + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); @@ -214,21 +232,30 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic pos.stream().forEach(item -> { if (StringUtils.isNotBlank(item.getSocialComJson())) { Map socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getFundComJson())) { Map fundJson = JSON.parseObject(item.getFundComJson(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if(fundJson!=null){ + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getOtherComJson())) { Map otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if(otherJson!=null){ + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); @@ -307,23 +334,32 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic InsuranceArchivesSocialSchemePO social = item.getSocial(); if (social != null && StringUtils.isNotBlank(social.getSocialPaymentBaseString())) { Map socialJson = JSON.parseObject(social.getSocialPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } InsuranceArchivesFundSchemePO fund = item.getFund(); if (fund != null && StringUtils.isNotBlank(fund.getFundPaymentBaseString())) { Map fundJson = JSON.parseObject(fund.getFundPaymentBaseString(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if(fundJson!=null){ + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } InsuranceArchivesOtherSchemePO other = item.getOther(); if (other != null && StringUtils.isNotBlank(other.getOtherPaymentBaseString())) { Map otherJson = JSON.parseObject(other.getOtherPaymentBaseString(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if(otherJson!=null){ + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); diff --git a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java index ce39dc26a..434d9f36e 100644 --- a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java @@ -73,9 +73,11 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ record.put("socialSchemeName", MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).querySchemeName(item.getSocialSchemeId())); if (StringUtils.isNotEmpty(item.getSocialPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "socialBase", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + record.put(k + "socialBase", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } } record.put("fundPayOrg", item.getFundPayOrg() == null ? "" : (paymentMap.getOrDefault(item.getFundPayOrg(),TaxAgent.builder().build())).getName()); record.put("fundAccount", item.getFundAccount()); @@ -83,42 +85,60 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ record.put("supplementFundAccount", item.getSupplementFundAccount()); if (StringUtils.isNotEmpty(item.getFundPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "fundBase", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + record.put(k + "fundBase", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } } record.put("otherPayOrg", item.getOtherPayOrg() == null ? "" : (paymentMap.getOrDefault(item.getOtherPayOrg(),TaxAgent.builder().build())).getName()); record.put("otherSchemeName", MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).querySchemeName(item.getOtherSchemeId())); if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "otherBase", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + record.put(k + "otherBase", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } } if (StringUtils.isNotEmpty(item.getSocialPerJson())) { Map socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "socialPer", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(socialJson!=null){ + socialJson.forEach((k, v) -> { + record.put(k + "socialPer", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } + } record.put("socialPerSum", SalaryEntityUtil.thousandthConvert(item.getSocialPerSum())); if (StringUtils.isNotEmpty(item.getFundPerJson())) { Map fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "fundPer", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(fundPerJson!=null){ + fundPerJson.forEach((k, v) -> { + record.put(k + "fundPer", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } + } record.put("fundPerSum", SalaryEntityUtil.thousandthConvert(item.getFundPerSum())); if (StringUtils.isNotEmpty(item.getOtherPerJson())) { Map fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "otherPer", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(fundPerJson!=null){ + fundPerJson.forEach((k, v) -> { + record.put(k + "otherPer", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } + } record.put("otherPerSum", SalaryEntityUtil.thousandthConvert(item.getOtherPerSum())); record.put("perSum", SalaryEntityUtil.thousandthConvert(item.getPerSum())); if (StringUtils.isNotEmpty(item.getSocialComJson())) { Map fundPerJson = JSON.parseObject(item.getSocialComJson(), new HashMap().getClass()); + if(fundPerJson!=null){ + fundPerJson.forEach((k, v) -> { + record.put(k + "socialCom", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } fundPerJson.forEach((k, v) -> { record.put(k + "socialCom", SalaryEntityUtil.thousandthConvert((String) v)); }); @@ -126,16 +146,22 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ record.put("socialComSum", SalaryEntityUtil.thousandthConvert(item.getSocialComSum())); if (StringUtils.isNotEmpty(item.getFundComJson())) { Map fundPerJson = JSON.parseObject(item.getFundComJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "fundCom", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(fundPerJson!=null){ + fundPerJson.forEach((k, v) -> { + record.put(k + "fundCom", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } + } record.put("fundComSum", SalaryEntityUtil.thousandthConvert(item.getFundComSum())); if (StringUtils.isNotEmpty(item.getOtherComJson())) { Map fundPerJson = JSON.parseObject(item.getOtherComJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "otherCom", SalaryEntityUtil.thousandthConvert((String) v)); - }); + if(fundPerJson!=null){ + fundPerJson.forEach((k, v) -> { + record.put(k + "otherCom", SalaryEntityUtil.thousandthConvert((String) v)); + }); + } + } record.put("otherComSum", SalaryEntityUtil.thousandthConvert(item.getOtherComSum())); record.put("comSum", SalaryEntityUtil.thousandthConvert(item.getComSum())); diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 3bd6496fb..dec5e0066 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -663,6 +663,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } if (StringUtils.isNotEmpty(item.getOtherComJson())) { Map fundComJson = JSON.parseObject(item.getOtherComJson(), new HashMap().getClass()); + if (fundComJson!=null){ + + } fundComJson.forEach((k, v) -> { record.put(k + "otherCom", v); }); @@ -790,93 +793,111 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { comSum = comSum.add(comSumItem); if (StringUtils.isNotBlank(item.getSocialPerJson())) { Map socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap().getClass()); - socialJson.forEach((insuranceId, num) -> { - if (socialPerMap.get(insuranceId) == null) { - socialPerMap.put(insuranceId, num); - } else { - String oldNum = socialPerMap.get(insuranceId); - BigDecimal insuanceNum = new BigDecimal("0"); - BigDecimal oldDecimal = new BigDecimal(oldNum); - BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); - insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); - socialPerMap.put(insuranceId, insuanceNum.toPlainString()); - } - }); + if (socialJson!=null){ + socialJson.forEach((insuranceId, num) -> { + if (socialPerMap.get(insuranceId) == null) { + socialPerMap.put(insuranceId, num); + } else { + String oldNum = socialPerMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + socialPerMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getSocialComJson())) { Map socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap().getClass()); - socialJson.forEach((insuranceId, num) -> { - if (socialComMap.get(insuranceId) == null) { - socialComMap.put(insuranceId, num); - } else { - String oldNum = socialComMap.get(insuranceId); - BigDecimal insuanceNum = new BigDecimal("0"); - BigDecimal oldDecimal = new BigDecimal(oldNum); - BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); - insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); - socialComMap.put(insuranceId, insuanceNum.toPlainString()); - } - }); + if (socialJson!=null){ + socialJson.forEach((insuranceId, num) -> { + if (socialComMap.get(insuranceId) == null) { + socialComMap.put(insuranceId, num); + } else { + String oldNum = socialComMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + socialComMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getFundPerJson())) { Map fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); - fundJson.forEach((insuranceId, num) -> { - if (fundPerMap.get(insuranceId) == null) { - fundPerMap.put(insuranceId, num); - } else { - String oldNum = fundPerMap.get(insuranceId); - BigDecimal insuanceNum = new BigDecimal("0"); - BigDecimal oldDecimal = new BigDecimal(oldNum); - BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); - insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); - fundPerMap.put(insuranceId, insuanceNum.toPlainString()); - } - }); + if (fundJson!=null){ + fundJson.forEach((insuranceId, num) -> { + if (fundPerMap.get(insuranceId) == null) { + fundPerMap.put(insuranceId, num); + } else { + String oldNum = fundPerMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + fundPerMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getFundComJson())) { Map fundJson = JSON.parseObject(item.getFundComJson(), new HashMap().getClass()); - fundJson.forEach((insuranceId, num) -> { - if (fundComMap.get(insuranceId) == null) { - fundComMap.put(insuranceId, num); - } else { - String oldNum = fundComMap.get(insuranceId); - BigDecimal insuanceNum = new BigDecimal("0"); - BigDecimal oldDecimal = new BigDecimal(oldNum); - BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); - insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); - fundComMap.put(insuranceId, insuanceNum.toPlainString()); - } - }); + if (fundJson!=null){ + fundJson.forEach((insuranceId, num) -> { + if (fundComMap.get(insuranceId) == null) { + fundComMap.put(insuranceId, num); + } else { + String oldNum = fundComMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + fundComMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getOtherPerJson())) { Map otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); - otherJson.forEach((insuranceId, num) -> { - if (otherPerMap.get(insuranceId) == null) { - otherPerMap.put(insuranceId, num); - } else { - String oldNum = otherPerMap.get(insuranceId); - BigDecimal insuanceNum = new BigDecimal("0"); - BigDecimal oldDecimal = new BigDecimal(oldNum); - BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); - insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); - otherPerMap.put(insuranceId, insuanceNum.toPlainString()); - } - }); + if (otherJson!=null){ + otherJson.forEach((insuranceId, num) -> { + if (otherPerMap.get(insuranceId) == null) { + otherPerMap.put(insuranceId, num); + } else { + String oldNum = otherPerMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + otherPerMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getOtherComJson())) { Map otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap().getClass()); - otherJson.forEach((insuranceId, num) -> { - if (otherComMap.get(insuranceId) == null) { - otherComMap.put(insuranceId, num); - } else { - String oldNum = otherComMap.get(insuranceId); - BigDecimal insuanceNum = new BigDecimal("0"); - BigDecimal oldDecimal = new BigDecimal(oldNum); - BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); - insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); - otherComMap.put(insuranceId, insuanceNum.toPlainString()); - } - }); + if (otherJson!=null){ + otherJson.forEach((insuranceId, num) -> { + if (otherComMap.get(insuranceId) == null) { + otherComMap.put(insuranceId, num); + } else { + String oldNum = otherComMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + otherComMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } } insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerMap)); diff --git a/src/com/engine/salary/service/impl/SIExportServiceImpl.java b/src/com/engine/salary/service/impl/SIExportServiceImpl.java index b9b675dd5..1b4936225 100644 --- a/src/com/engine/salary/service/impl/SIExportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIExportServiceImpl.java @@ -47,12 +47,12 @@ import static com.engine.salary.enums.UserStatusEnum.getDefaultLabelByValue; * @Date 2022/4/18 * @Version V1.0 **/ -public class SIExportServiceImpl extends Service implements SIExportService { +public class SIExportServiceImpl extends Service implements SIExportService { private SIAccountBiz siAccountBiz = new SIAccountBiz(); private SISchemeService getSISchemeService(User user) { - return ServiceUtil.getService(SISchemeServiceImpl.class,user); + return ServiceUtil.getService(SISchemeServiceImpl.class, user); } @@ -63,7 +63,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { //获取扣缴义务人信息 List paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll(); - SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人")); + SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人")); Map paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity())); List insuranceAccountViewListDTOS = siAccountBiz.buildRecords(insuranceAccountDetailPOS, paymentMap); @@ -72,14 +72,14 @@ public class SIExportServiceImpl extends Service implements SIExportService { String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案"); // 2.表头 String[] header = { - SalaryI18nUtil.getI18nLabel( 93270, "缴纳组织"), - SalaryI18nUtil.getI18nLabel( 93272, "社保人数"), - SalaryI18nUtil.getI18nLabel( 93273, "公积金人数"), - SalaryI18nUtil.getI18nLabel( 93274, "其他福利人数"), - SalaryI18nUtil.getI18nLabel( 93275, "社保缴费合计"), - SalaryI18nUtil.getI18nLabel( 93276, "公积金缴费合计"), - SalaryI18nUtil.getI18nLabel( 93277, "其他福利缴费合计"), - SalaryI18nUtil.getI18nLabel( 93278, "合计")}; + SalaryI18nUtil.getI18nLabel(93270, "缴纳组织"), + SalaryI18nUtil.getI18nLabel(93272, "社保人数"), + SalaryI18nUtil.getI18nLabel(93273, "公积金人数"), + SalaryI18nUtil.getI18nLabel(93274, "其他福利人数"), + SalaryI18nUtil.getI18nLabel(93275, "社保缴费合计"), + SalaryI18nUtil.getI18nLabel(93276, "公积金缴费合计"), + SalaryI18nUtil.getI18nLabel(93277, "其他福利缴费合计"), + SalaryI18nUtil.getI18nLabel(93278, "合计")}; excelSheetData.add(Arrays.asList(header)); //工作簿数据 @@ -104,7 +104,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { @Override public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) { - List accountExportPOS = MapperProxyFactory.getProxy(InsuranceExportMapper.class).exportAccount(paymentStatus, param.getBillMonth(),param.getPaymentOrganization()); + List accountExportPOS = MapperProxyFactory.getProxy(InsuranceExportMapper.class).exportAccount(paymentStatus, param.getBillMonth(), param.getPaymentOrganization()); AccountExportPOEncrypt.decryptAccountExportPOList(accountExportPOS); List columns = new ArrayList<>(); List> records = new ArrayList<>(); @@ -112,7 +112,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { columns = buildCommonColumns(accountExportPOS, false); } if (PaymentStatusEnum.REPAIR.getValue() == paymentStatus) { - columns = buildCommonColumns(accountExportPOS, true); + columns = buildCommonColumns(accountExportPOS, true); } records = buildCommonRecords(accountExportPOS); List> excelSheetData = new ArrayList<>(); @@ -137,7 +137,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { List> result = new ArrayList<>(); List paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll(); - SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人")); + SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人")); Map schemeIdNameMap = getSISchemeService(user).getSchemeIdNameMap(); Map paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity())); list.forEach(item -> { @@ -150,15 +150,18 @@ public class SIExportServiceImpl extends Service implements SIExportService { record.put("mobile", item.getTelephone()); record.put("employeeStatus", item.getUserStatus() == null ? "" : getDefaultLabelByValue(item.getUserStatus())); ResourceFromEnum from = SalaryEnumUtil.enumMatchByValue(item.getResourceFrom(), ResourceFromEnum.values(), ResourceFromEnum.class); - record.put("sourceFrom", SalaryI18nUtil.getI18nLabel( from.getLabelId(), from.getDefaultLabel())); + record.put("sourceFrom", SalaryI18nUtil.getI18nLabel(from.getLabelId(), from.getDefaultLabel())); record.put("socialPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName()); record.put("socialAccount", item.getSocialAccount()); record.put("socialSchemeName", schemeIdNameMap.get(item.getSocialSchemeId())); if (StringUtils.isNotEmpty(item.getSocialPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "socialBase", v); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + record.put(k + "socialBase", v); + }); + } + } record.put("fundPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName()); record.put("fundAccount", item.getFundAccount()); @@ -166,59 +169,83 @@ public class SIExportServiceImpl extends Service implements SIExportService { record.put("supplementFundAccount", item.getSupplementFundAccount()); if (StringUtils.isNotEmpty(item.getFundPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "fundBase", v); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + record.put(k + "fundBase", v); + }); + } + } record.put("otherPayOrg", paymentMap.get(item.getOtherPayOrg()) == null ? "" : paymentMap.get(item.getOtherPayOrg()).getName()); record.put("otherSchemeName", schemeIdNameMap.get(item.getOtherSchemeId())); if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "otherBase", v); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + record.put(k + "otherBase", v); + }); + } + } if (StringUtils.isNotEmpty(item.getSocialPerJson())) { Map socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - record.put(k + "socialPer", v); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + record.put(k + "socialPer", v); + }); + } + } record.put("socialPerSum", item.getSocialPerSum()); if (StringUtils.isNotEmpty(item.getFundPerJson())) { Map fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "fundPer", v); - }); + if (fundPerJson != null) { + fundPerJson.forEach((k, v) -> { + record.put(k + "fundPer", v); + }); + } + } record.put("fundPerSum", item.getFundPerSum()); if (StringUtils.isNotEmpty(item.getOtherPerJson())) { Map fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "otherPer", v); - }); + if (fundPerJson != null) { + fundPerJson.forEach((k, v) -> { + record.put(k + "otherPer", v); + }); + } + } record.put("otherPerSum", item.getOtherPerSum()); record.put("perSum", item.getPerSum()); if (StringUtils.isNotEmpty(item.getSocialComJson())) { Map fundPerJson = JSON.parseObject(item.getSocialComJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "socialCom", v); - }); + if (fundPerJson != null) { + fundPerJson.forEach((k, v) -> { + record.put(k + "socialCom", v); + }); + } + } record.put("socialComSum", item.getSocialComSum()); if (StringUtils.isNotEmpty(item.getFundComJson())) { Map fundPerJson = JSON.parseObject(item.getFundComJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "fundCom", v); - }); + if (fundPerJson != null) { + fundPerJson.forEach((k, v) -> { + record.put(k + "fundCom", v); + }); + } + } record.put("fundComSum", item.getFundComSum()); if (StringUtils.isNotEmpty(item.getOtherPerJson())) { Map fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); - fundPerJson.forEach((k, v) -> { - record.put(k + "otherCom", v); - }); + if (fundPerJson != null) { + fundPerJson.forEach((k, v) -> { + record.put(k + "otherCom", v); + }); + } + } record.put("otherComSum", item.getOtherComSum()); record.put("comSum", item.getComSum()); @@ -240,21 +267,30 @@ public class SIExportServiceImpl extends Service implements SIExportService { pos.stream().forEach(item -> { if (StringUtils.isNotBlank(item.getSocialComJson())) { Map socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getFundComJson())) { Map fundJson = JSON.parseObject(item.getFundComJson(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if (fundJson != null) { + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getOtherComJson())) { Map otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if (otherJson != null) { + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); @@ -263,19 +299,19 @@ public class SIExportServiceImpl extends Service implements SIExportService { socailIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { socialColumns.put( - categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"), + categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100289, "单位"), social + "socialCom"); } }); fundIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"), + fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100289, "单位"), social + "fundCom"); } }); otherIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"), + otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100289, "单位"), social + "otherCom"); } }); @@ -294,21 +330,30 @@ public class SIExportServiceImpl extends Service implements SIExportService { pos.stream().forEach(item -> { if (StringUtils.isNotBlank(item.getSocialPerJson())) { Map socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getFundPerJson())) { Map fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if (fundJson != null) { + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getOtherPerJson())) { Map otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if (otherJson != null) { + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); @@ -316,19 +361,19 @@ public class SIExportServiceImpl extends Service implements SIExportService { Map otherColumns = new HashMap<>(); socailIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"), + socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(87159, "个人"), social + "socialPer"); } }); fundIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"), + fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(87159, "个人"), social + "fundPer"); } }); otherIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"), + otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(87159, "个人"), social + "otherPer"); } }); @@ -345,64 +390,64 @@ public class SIExportServiceImpl extends Service implements SIExportService { Map> columns = buildPaymentTitle(pos, categoryIdNameMap); Map> personColumns = buildPersonalTitle(pos, categoryIdNameMap); Map> comColumns = buildComTitle(pos, categoryIdNameMap); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86185, "部门"), "department")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86186, "手机号"), "mobile")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86187, "员工状态"), "employeeStatus")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100377, "数据来源"), "sourceFrom")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "userName")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "department")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "employeeStatus")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100377, "数据来源"), "sourceFrom")); if (flag) { - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100379, "补缴月份"), "supplementaryMonth")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100379, "补缴月份"), "supplementaryMonth")); } - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91325, "社保缴纳组织"), "socialPayOrg")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91324, "社保账号"), "socialAccount")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称"), "socialSchemeName")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91325, "社保缴纳组织"), "socialPayOrg")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91324, "社保账号"), "socialAccount")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"), "socialSchemeName")); //组装社保基数 columns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91488, "公积金缴纳组织"), "fundPayOrg")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91486, "公积金账号"), "fundAccount")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91485, "公积金方案名称"), "fundSchemeName")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91488, "公积金缴纳组织"), "fundPayOrg")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91486, "公积金账号"), "fundAccount")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"), "fundSchemeName")); //组装公积金基数 columns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91487, "补充公积金账号"), "supplementFundAccount")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91497, "其他福利缴纳组织"), "otherPayOrg")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91496, "其他福利方案名称"), "otherSchemeName")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号"), "supplementFundAccount")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91497, "其他福利缴纳组织"), "otherPayOrg")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"), "otherSchemeName")); columns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); personColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100388, "社保个人合计"), "socialPerSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"), "socialPerSum")); personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100390, "公积金个人合计"), "fundPerSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"), "fundPerSum")); personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100392, "其他福利个人合计"), "otherPerSum")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100393, "个人合计"), "perSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计"), "otherPerSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100393, "个人合计"), "perSum")); comColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100394, "社保单位合计"), "socialComSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100394, "社保单位合计"), "socialComSum")); comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100395, "公积金单位合计"), "fundComSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计"), "fundComSum")); comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> { - list.add(new WeaTableColumn("150px",k, v)); + list.add(new WeaTableColumn("150px", k, v)); }); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100396, "其他福利单位合计"), "fundComSum")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100397, "单位合计"), "comSum")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100398, "社保合计"), "socialSum")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100399, "公积金合计"), "fundSum")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100400, "其他福利合计"), "otherSum")); - list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 93278, "合计"), "total")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计"), "fundComSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100397, "单位合计"), "comSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100398, "社保合计"), "socialSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100399, "公积金合计"), "fundSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100400, "其他福利合计"), "otherSum")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(93278, "合计"), "total")); return list; } @@ -436,21 +481,30 @@ public class SIExportServiceImpl extends Service implements SIExportService { pos.stream().forEach(item -> { if (StringUtils.isNotBlank(item.getSocialPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap().getClass()); - socialJson.forEach((k, v) -> { - socailIds.add(k); - }); + if (socialJson != null) { + socialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getFundPaymentBaseString())) { Map fundJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap().getClass()); - fundJson.forEach((k, v) -> { - fundIds.add(k); - }); + if (fundJson != null) { + fundJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } if (StringUtils.isNotBlank(item.getOtherPaymentBaseString())) { Map otherJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap().getClass()); - otherJson.forEach((k, v) -> { - otherIds.add(k); - }); + if (otherJson != null) { + otherJson.forEach((k, v) -> { + otherIds.add(k); + }); + } + } }); Map socialColumns = new HashMap<>(); @@ -458,17 +512,17 @@ public class SIExportServiceImpl extends Service implements SIExportService { Map otherColumns = new HashMap<>(); socailIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "socialBase"); + socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100293, "申报基数"), social + "socialBase"); } }); fundIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "fundBase"); + fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100293, "申报基数"), social + "fundBase"); } }); otherIds.stream().forEach(social -> { if (categoryIdNameMap.containsKey(social)) { - otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "otherBase"); + otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100293, "申报基数"), social + "otherBase"); } }); result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns); diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index b34ef9be4..4aaaf7ec9 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -120,11 +120,22 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe //获取管理的人员范围 List taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(currentEmployeeId); - Set employeeId = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId); + Set employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId); + + Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId); + Set taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId); //获取所有薪资档案 List list = getSalaryArchiveMapper().list(queryParam); - List finalAllArchive = list.stream().filter(dto -> employeeId.contains(dto.getEmployeeId())).collect(Collectors.toList()); + List finalAllArchive = list.stream().filter(dto -> taxAgentIds.contains(dto.getTaxAgentId())).collect(Collectors.toList()); + finalAllArchive = finalAllArchive.stream().map(dto -> { + if(employeeIds.contains(dto.getEmployeeId())){ + dto.setIsInTaxAgent("Y"); + }else { + dto.setIsInTaxAgent("N"); + } + return dto; + }).collect(Collectors.toList()); PageInfo pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), SalaryArchiveListDTO.class); pageInfo.setTotal(finalAllArchive.size()); @@ -271,7 +282,15 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe String sheetName = SalaryI18nUtil.getI18nLabel(85368, "薪资档案"); // 获取所有可被引用的薪资项目 List salaryItems = salaryItemMapper.getCanAdjustSalaryItems(); - String[] header = {SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), SalaryI18nUtil.getI18nLabel(86185, "部门"), SalaryI18nUtil.getI18nLabel(86186, "手机号"), SalaryI18nUtil.getI18nLabel(91075, "状态")}; + String[] header = { + SalaryI18nUtil.getI18nLabel(85429, "姓名"), + SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(86185, "部门"), + SalaryI18nUtil.getI18nLabel(86186, "手机号"), + SalaryI18nUtil.getI18nLabel(91075, "状态"), + SalaryI18nUtil.getI18nLabel(91075, "起始发薪日期"), + SalaryI18nUtil.getI18nLabel(91075, "最后发薪日期") + }; // 2.表头 List headerList = new ArrayList<>(Arrays.asList(header)); for (SalaryItemPO salaryItem : salaryItems) { @@ -302,11 +321,13 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe rows.add(headerList); listMaps.forEach(e -> { List row = new ArrayList<>(); - row.add(e.get("username").toString()); - row.add(e.get("taxAgentName").toString()); - row.add(e.get("departmentName").toString()); - row.add(e.get("mobile") == null ? "" : e.get("mobile").toString()); - row.add(e.get("employeeStatus").toString()); + row.add(Util.null2String(e.get("username"))); + row.add(Util.null2String(e.get("taxAgentName"))); + row.add(Util.null2String(e.get("departmentName"))); + row.add(Util.null2String(e.get("mobile"))); + row.add(Util.null2String(e.get("employeeStatus"))); + row.add(Util.null2String(e.get("payStartDate"))); + row.add(Util.null2String(e.get("payEndDate"))); // 薪资项目数据 for (SalaryItemPO salaryItem : salaryItems) { row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : ""); diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java index 9a39e4e3f..4d3eab9a7 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java @@ -110,6 +110,7 @@ public class SalaryArchiveWrapper extends Service { Map datas = new HashMap<>(); datas.put("pageInfo", pageInfos); datas.put("dataKey", result.getResultMap()); + datas.put("salaryArchives", salaryArchives); return datas; }