diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index c03ef2a39..7f91e79d1 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -18,10 +18,7 @@ import com.engine.salary.encrypt.AESEncryptUtil; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.siarchives.bo.InsuranceArchivesBO; -import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseDTO; -import com.engine.salary.entity.siarchives.dto.InsuranceArchivesFundSchemeDTO; -import com.engine.salary.entity.siarchives.dto.InsuranceArchivesOtherSchemeDTO; -import com.engine.salary.entity.siarchives.dto.InsuranceArchivesSocialSchemeDTO; +import com.engine.salary.entity.siarchives.dto.*; import com.engine.salary.entity.siarchives.param.*; import com.engine.salary.entity.siarchives.po.*; import com.engine.salary.entity.sicategory.po.ICategoryPO; @@ -33,10 +30,7 @@ import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; import com.engine.salary.enums.siaccount.EmployeeStatusEnum; import com.engine.salary.enums.sicategory.*; import com.engine.salary.exception.SalaryRunTimeException; -import com.engine.salary.mapper.siarchives.FundSchemeMapper; -import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper; -import com.engine.salary.mapper.siarchives.OtherSchemeMapper; -import com.engine.salary.mapper.siarchives.SocialSchemeMapper; +import com.engine.salary.mapper.siarchives.*; import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; @@ -58,6 +52,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; +import org.springframework.beans.BeanUtils; import org.springframework.util.StopWatch; import weaver.conn.mybatis.MyBatisFactory; import weaver.general.Util; @@ -667,8 +662,22 @@ public class SIArchivesBiz { otherIds.add(param.getId()); List oldOtherInfoList = otherSchemeMapper.getOtherById(otherIds); + //设置福利档案基数调整记录数据 + InsuranceArchivesBaseHistoryDTO adjustInfo = InsuranceArchivesBaseHistoryDTO.builder() + .adjustAfterSchemeId(param.getOtherSchemeId()) + .adjustAfterBaseJson(paramReq.getPaymentForm()) + .welfareType(paramReq.getWelfareType().getValue()) + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build(); + if (oldOtherInfoList.size() == 1) { InsuranceArchivesOtherSchemePO oldOtherInfo = oldOtherInfoList.get(0); + //设置福利档案基数调整记录数据 + encryptUtil.decrypt(oldOtherInfo, InsuranceArchivesOtherSchemePO.class); + adjustInfo.setAdjustBeforeBaseJson(oldOtherInfo.getOtherPaymentBaseString()); + adjustInfo.setAdjustBeforeSchemeId(oldOtherInfo.getOtherSchemeId()); + //新数据 InsuranceArchivesOtherSchemePO updateOtherInfo = InsuranceArchivesOtherSchemePO.builder() .id(oldOtherInfo.getId()) @@ -745,10 +754,13 @@ public class SIArchivesBiz { } else { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!")); } - - } + //生成福利档案基数调整记录数据 + List adjustHistoryList = createAdjustInfo(adjustInfo, employeeId); + //福利档案基数调整记录数据入库 + batchInsertAdjustHistory(adjustHistoryList, employeeId); + } finally { sqlSession.close(); } @@ -776,8 +788,22 @@ public class SIArchivesBiz { fundIds.add(param.getId()); List oldFundInfoList = fundSchemeMapper.getFundById(fundIds); + //设置福利档案基数调整记录数据 + InsuranceArchivesBaseHistoryDTO adjustInfo = InsuranceArchivesBaseHistoryDTO.builder() + .adjustAfterSchemeId(param.getFundSchemeId()) + .adjustAfterBaseJson(paramReq.getPaymentForm()) + .welfareType(paramReq.getWelfareType().getValue()) + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build(); + if (oldFundInfoList.size() == 1) { InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0); + //设置福利档案基数调整记录数据 + encryptUtil.decrypt(oldFundInfo, InsuranceArchivesFundSchemePO.class); + adjustInfo.setAdjustBeforeBaseJson(oldFundInfo.getFundPaymentBaseString()); + adjustInfo.setAdjustBeforeSchemeId(oldFundInfo.getFundSchemeId()); + //新数据 InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder() .id(oldFundInfo.getId()) .fundSchemeId(param.getFundSchemeId()) @@ -860,6 +886,11 @@ public class SIArchivesBiz { } + //生成福利档案基数调整记录数据 + List adjustHistoryList = createAdjustInfo(adjustInfo, employeeId); + //福利档案基数调整记录数据入库 + batchInsertAdjustHistory(adjustHistoryList, employeeId); + } finally { sqlSession.close(); } @@ -893,10 +924,25 @@ public class SIArchivesBiz { List socialIds = new ArrayList(); socialIds.add(param.getId()); List oldSocialInfoList = socialSchemeMapper.getSocialById(socialIds); + + //设置福利档案基数调整记录数据 + InsuranceArchivesBaseHistoryDTO adjustInfo = InsuranceArchivesBaseHistoryDTO.builder() + .adjustAfterSchemeId(param.getSocialSchemeId()) + .adjustAfterBaseJson(paramReq.getPaymentForm()) + .welfareType(paramReq.getWelfareType().getValue()) + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build(); + //组装新数据 if (oldSocialInfoList.size() == 1) { + //老数据 InsuranceArchivesSocialSchemePO oldSocialInfo = oldSocialInfoList.get(0); - + //设置福利档案基数调整记录数据 + encryptUtil.decrypt(oldSocialInfo, InsuranceArchivesSocialSchemePO.class); + adjustInfo.setAdjustBeforeBaseJson(oldSocialInfo.getSocialPaymentBaseString()); + adjustInfo.setAdjustBeforeSchemeId(oldSocialInfo.getSocialSchemeId()); + //新数据 InsuranceArchivesSocialSchemePO updateSocialInfo = InsuranceArchivesSocialSchemePO.builder() .id(oldSocialInfo.getId()) @@ -979,6 +1025,10 @@ public class SIArchivesBiz { } + //生成福利档案基数调整记录数据 + List adjustHistoryList = createAdjustInfo(adjustInfo, employeeId); + //福利档案基数调整记录数据入库 + batchInsertAdjustHistory(adjustHistoryList, employeeId); } finally { sqlSession.close(); } @@ -1822,4 +1872,220 @@ public class SIArchivesBiz { } return getInsuranceBaseInfoMapper().listEndDateIsNull(employeeIds); } + + public List dealSocialBaseAdjustInfoList(List adjustList, Long creator) { + List adjustHistoryList = new ArrayList<>(); + if (adjustList.size() > 0) { + //遍历待更新的福利档案数据,对每组档案生成基数调整记录(基数单元未变化则忽略) + for (InsuranceArchivesSocialSchemePO po : adjustList) { + List oldBaseInfoList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .paymentOrganization(po.getPaymentOrganization()).employeeId(po.getEmployeeId()).build()); + + InsuranceArchivesBaseHistoryDTO adjustInfo = InsuranceArchivesBaseHistoryDTO.builder() + .adjustAfterSchemeId(po.getSocialSchemeId()) + .adjustAfterBaseJson(po.getSocialPaymentBaseString()) + .welfareType(po.getWelfareType()) + .employeeId(po.getEmployeeId()) + .paymentOrganization(po.getPaymentOrganization()) + .build(); + if (oldBaseInfoList.size() == 1) { + //新增调整记录,变更 + InsuranceArchivesSocialSchemePO oldBaseInfo = oldBaseInfoList.get(0); + encryptUtil.decrypt(oldBaseInfo, InsuranceArchivesSocialSchemePO.class); + adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getSocialPaymentBaseString()); + adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getSocialSchemeId()); + } else if (oldBaseInfoList.size() > 1) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保档案存在冗余数据!")); + } + adjustHistoryList.addAll(createAdjustInfo(adjustInfo, creator)); + } + } + return adjustHistoryList; + + } + public List dealFundBaseAdjustInfoList(List adjustList, Long creator) { + List adjustHistoryList = new ArrayList<>(); + if (adjustList.size() > 0) { + //遍历待更新的福利档案数据,对每组档案生成基数调整记录(基数单元未变化则忽略) + for (InsuranceArchivesFundSchemePO po : adjustList) { + List oldBaseInfoList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .paymentOrganization(po.getPaymentOrganization()).employeeId(po.getEmployeeId()).build()); + + InsuranceArchivesBaseHistoryDTO adjustInfo = InsuranceArchivesBaseHistoryDTO.builder() + .adjustAfterSchemeId(po.getFundSchemeId()) + .adjustAfterBaseJson(po.getFundPaymentBaseString()) + .welfareType(po.getWelfareType()) + .employeeId(po.getEmployeeId()) + .paymentOrganization(po.getPaymentOrganization()) + .build(); + if (oldBaseInfoList.size() == 1) { + //新增调整记录,变更 + InsuranceArchivesFundSchemePO oldBaseInfo = oldBaseInfoList.get(0); + encryptUtil.decrypt(oldBaseInfo, InsuranceArchivesFundSchemePO.class); + adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getFundPaymentBaseString()); + adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getFundSchemeId()); + } else if (oldBaseInfoList.size() > 1) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金档案存在冗余数据!")); + } + adjustHistoryList.addAll(createAdjustInfo(adjustInfo, creator)); + } + } + return adjustHistoryList; + } + public List dealOtherBaseAdjustInfoList(List adjustList, Long creator) { + List adjustHistoryList = new ArrayList<>(); + if (adjustList.size() > 0) { + //遍历待更新的福利档案数据,对每组档案生成基数调整记录(基数单元未变化则忽略) + for (InsuranceArchivesOtherSchemePO po : adjustList) { + List oldBaseInfoList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .paymentOrganization(po.getPaymentOrganization()).employeeId(po.getEmployeeId()).build()); + + InsuranceArchivesBaseHistoryDTO adjustInfo = InsuranceArchivesBaseHistoryDTO.builder() + .adjustAfterSchemeId(po.getOtherSchemeId()) + .adjustAfterBaseJson(po.getOtherPaymentBaseString()) + .welfareType(po.getWelfareType()) + .employeeId(po.getEmployeeId()) + .paymentOrganization(po.getPaymentOrganization()) + .build(); + if (oldBaseInfoList.size() == 1) { + //新增调整记录,变更 + InsuranceArchivesOtherSchemePO oldBaseInfo = oldBaseInfoList.get(0); + encryptUtil.decrypt(oldBaseInfo, InsuranceArchivesOtherSchemePO.class); + adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getOtherPaymentBaseString()); + adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getOtherSchemeId()); + } else if (oldBaseInfoList.size() > 1) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利档案存在冗余数据!")); + } + adjustHistoryList.addAll(createAdjustInfo(adjustInfo, creator)); + } + } + return adjustHistoryList; + } + + //生成基数调整记录(基数单元未变化则忽略) + public List createAdjustInfo(InsuranceArchivesBaseHistoryDTO adjustInfo, Long creator) { + Date now = new Date(); + List toCreateAdjustHistoryList = new ArrayList<>(); + //旧档案不存在基数信息,则直接遍历新的基数数据,生成调整记录;旧档案存在基数信息,则合并新旧基数数据,遍历合并后的技术数据中的key,生成调整记录。 + if(adjustInfo.getAdjustAfterBaseJson() != null && adjustInfo.getAdjustBeforeBaseJson() == null) { + Map adjustAfterBaseMap = JSON.parseObject(adjustInfo.getAdjustAfterBaseJson(), new TypeReference>() { + }); + for (String key : adjustAfterBaseMap.keySet()) { + InsuranceArchivesBaseHistoryPO adjustItem = new InsuranceArchivesBaseHistoryPO(); + BeanUtils.copyProperties(adjustInfo, adjustItem); + adjustItem.setAdjustWelfareItemId(Long.valueOf(key)); + adjustItem.setAdjustAfterBaseValue((String) adjustAfterBaseMap.get(key)); + adjustItem.setOperateTime(now); + adjustItem.setOperator(creator); + adjustItem.setCreator(creator); + adjustItem.setCreateTime(now); + adjustItem.setUpdateTime(now); + adjustItem.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + adjustItem.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + adjustItem.setId(IdGenerator.generate()); + toCreateAdjustHistoryList.add(adjustItem); + } + } else if (adjustInfo.getAdjustAfterBaseJson() != null && adjustInfo.getAdjustBeforeBaseJson() != null) { + Map adjustAfterBaseMap = JSON.parseObject(adjustInfo.getAdjustAfterBaseJson(), new TypeReference>() { + }); + Map adjustBeforeBaseMap = JSON.parseObject(adjustInfo.getAdjustBeforeBaseJson(), new TypeReference>() { + }); + Map reDealMap = new HashMap<>(); + reDealMap.putAll(adjustAfterBaseMap); + reDealMap.putAll(adjustBeforeBaseMap); + for (String key : reDealMap.keySet()) { + String beforeValue = (String) adjustBeforeBaseMap.get(key); + String afterValue = (String) adjustAfterBaseMap.get(key); + if (SalaryEntityUtil.empty2Zero(beforeValue).compareTo(SalaryEntityUtil.empty2Zero(afterValue)) == 0) { + continue; + } + InsuranceArchivesBaseHistoryPO adjustItem = new InsuranceArchivesBaseHistoryPO(); + BeanUtils.copyProperties(adjustInfo, adjustItem); + adjustItem.setAdjustWelfareItemId(Long.valueOf(key)); + adjustItem.setAdjustBeforeBaseValue(beforeValue); + adjustItem.setAdjustAfterBaseValue(afterValue); + adjustItem.setOperateTime(now); + adjustItem.setOperator(creator); + adjustItem.setCreator(creator); + adjustItem.setCreateTime(now); + adjustItem.setUpdateTime(now); + adjustItem.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + adjustItem.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + adjustItem.setId(IdGenerator.generate()); + + toCreateAdjustHistoryList.add(adjustItem); + } + } + return toCreateAdjustHistoryList; + } + + /** + * 新增福利档案基数调整记录 + * + */ + public void batchInsertAdjustHistory(List adjustHistoryList, long employeeId) { + + if (CollectionUtils.isEmpty(adjustHistoryList)) { + return; + } + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + InsuranceBaseAdjustHistoryMapper mapper = sqlSession.getMapper(InsuranceBaseAdjustHistoryMapper.class); + List> partition = Lists.partition(adjustHistoryList, 100); + partition.forEach(mapper::batchSave); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } + + /** + * 获取福利档案基数调整记录 + * + */ + public List getAdjustHistoryList(Long paymentOrganization, Long employeeId) { + + if (paymentOrganization == null && employeeId == null) { + return null; + } + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + InsuranceBaseAdjustHistoryMapper mapper = sqlSession.getMapper(InsuranceBaseAdjustHistoryMapper.class); + List list = mapper.listByEmployeeIdAndPayOrg(paymentOrganization, employeeId); + return list; + } finally { + sqlSession.close(); + } + } + + /** + * 获取福利档案基数调整记录 + * + */ + public List getBaseHistoryByEmployeeIdAndOperator(Long operator, Long employeeId) { + + + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + InsuranceBaseAdjustHistoryMapper mapper = sqlSession.getMapper(InsuranceBaseAdjustHistoryMapper.class); + List list = mapper.listByEmployeeIdAndOperator(operator, employeeId); + return list; + } finally { + sqlSession.close(); + } + } + + public List buildAdjustHistoryColumns(long operateId) { + List list = new ArrayList<>(); + WeaTableColumn nameColumn = new WeaTableColumn("100px", "福利项名称", "welfareItemName"); + nameColumn.setFixed("left"); + list.add(nameColumn); + list.add(new WeaTableColumn("150px", "调整前方案", "adjustBeforeSchemeName")); + list.add(new WeaTableColumn("150px", "调整前基数", "adjustBeforeBaseValue")); + list.add(new WeaTableColumn("150px", "调整后方案", "adjustAfterSchemeName")); + list.add(new WeaTableColumn("150px", "调整后基数", "adjustAfterBaseValue")); + list.add(new WeaTableColumn("150px", "操作人", "operatorName")); + list.add(new WeaTableColumn("150px", "操作时间", "operatorTime")); + return list; + } } diff --git a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java index e8ffcf358..6a85ddd20 100644 --- a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java +++ b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java @@ -228,7 +228,10 @@ public class InsuranceComparisonResultBO { map.put(welfare.getId() + baseTypeInfo + welfareStand, temp); // 薪资项目字段的字段类型 map.put(welfare.getId() + baseTypeInfo + welfareStand + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !temp.get("acctResultValue").equals(temp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !temp.get("acctResultValue").equals(temp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(temp.get("acctResultValue").toString()).compareTo(SalaryEntityUtil.empty2Zero(temp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } } @@ -243,7 +246,11 @@ public class InsuranceComparisonResultBO { socialPerSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getSocialPerSum())); map.put("socialPerSum", socialPerSumTemp); map.put("socialPerSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !socialPerSumTemp.get("acctResultValue").equals(socialPerSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !socialPerSumTemp.get("acctResultValue").equals(socialPerSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(socialPerSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(socialPerSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -252,7 +259,11 @@ public class InsuranceComparisonResultBO { fundPerSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getFundPerSum())); map.put("fundPerSum", fundPerSumTemp); map.put("fundPerSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !fundPerSumTemp.get("acctResultValue").equals(fundPerSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !fundPerSumTemp.get("acctResultValue").equals(fundPerSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(fundPerSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(fundPerSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -261,7 +272,11 @@ public class InsuranceComparisonResultBO { otherPerSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getOtherPerSum())); map.put("otherPerSum", otherPerSumTemp); map.put("otherPerSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !otherPerSumTemp.get("acctResultValue").equals(otherPerSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !otherPerSumTemp.get("acctResultValue").equals(otherPerSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(otherPerSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(otherPerSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -270,7 +285,11 @@ public class InsuranceComparisonResultBO { perSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getPerSum())); map.put("perSum", perSumTemp); map.put("perSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !perSumTemp.get("acctResultValue").equals(perSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !perSumTemp.get("acctResultValue").equals(perSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(perSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(perSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -280,7 +299,11 @@ public class InsuranceComparisonResultBO { socialComSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getSocialComSum())); map.put("socialComSum", socialComSumTemp); map.put("socialComSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !socialComSumTemp.get("acctResultValue").equals(socialComSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !socialComSumTemp.get("acctResultValue").equals(socialComSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(socialComSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(socialComSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -289,7 +312,11 @@ public class InsuranceComparisonResultBO { fundComSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getFundComSum())); map.put("fundComSum", fundComSumTemp); map.put("fundComSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !fundComSumTemp.get("acctResultValue").equals(fundComSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !fundComSumTemp.get("acctResultValue").equals(fundComSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(fundComSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(fundComSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -298,7 +325,11 @@ public class InsuranceComparisonResultBO { otherComSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getOtherComSum())); map.put("otherComSum", otherComSumTemp); map.put("otherComSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !otherComSumTemp.get("acctResultValue").equals(otherComSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !otherComSumTemp.get("acctResultValue").equals(otherComSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(otherComSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(otherComSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -307,7 +338,11 @@ public class InsuranceComparisonResultBO { perComTemp.put("excelResultValue", dealNull(excelAccountExportPO.getComSum())); map.put("comSum", perComTemp); map.put("comSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !perComTemp.get("acctResultValue").equals(perComTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !perComTemp.get("acctResultValue").equals(perComTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(perComTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(perComTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -317,7 +352,11 @@ public class InsuranceComparisonResultBO { socialSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getSocialSum())); map.put("socialSum", socialSumTemp); map.put("socialSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !socialSumTemp.get("acctResultValue").equals(socialSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !socialSumTemp.get("acctResultValue").equals(socialSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(socialSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(socialSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -326,7 +365,11 @@ public class InsuranceComparisonResultBO { fundSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getFundSum())); map.put("fundSum", fundSumTemp); map.put("fundSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !fundSumTemp.get("acctResultValue").equals(fundSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !fundSumTemp.get("acctResultValue").equals(fundSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(fundSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(fundSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -335,7 +378,11 @@ public class InsuranceComparisonResultBO { otherSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getOtherSum())); map.put("otherSum", otherSumTemp); map.put("otherSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !otherSumTemp.get("acctResultValue").equals(otherSumTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !otherSumTemp.get("acctResultValue").equals(otherSumTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(otherSumTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(otherSumTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } @@ -344,7 +391,11 @@ public class InsuranceComparisonResultBO { totalTemp.put("excelResultValue", dealNull(excelAccountExportPO.getTotal())); map.put("total", totalTemp); map.put("total" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); - if (map.get("different").equals("false") && !totalTemp.get("acctResultValue").equals(totalTemp.get("excelResultValue"))) { +// if (map.get("different").equals("false") && !totalTemp.get("acctResultValue").equals(totalTemp.get("excelResultValue"))) { +// map.put("different", "true"); +// } + if (map.get("different").equals("false") && SalaryEntityUtil.empty2Zero(totalTemp.get("acctResultValue").toString()) + .compareTo(SalaryEntityUtil.empty2Zero(totalTemp.get("excelResultValue").toString())) != 0) { map.put("different", "true"); } diff --git a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesBaseHistoryDTO.java b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesBaseHistoryDTO.java new file mode 100644 index 000000000..259cc3e54 --- /dev/null +++ b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesBaseHistoryDTO.java @@ -0,0 +1,91 @@ +package com.engine.salary.entity.siarchives.dto; + +import com.engine.salary.annotation.TableTitle; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Author: sy + * @Description: + * @Date: 2023/10/16 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class InsuranceArchivesBaseHistoryDTO { + + private Long id; + + /** + * 人员id + */ + private Long employeeId; + + /** + *个税扣缴义务人id + */ + private Long paymentOrganization; + + /** + * 福利类型 + */ + private Integer welfareType; + + /** + * 调整前方案id + */ + private Long adjustBeforeSchemeId; + /** + * 调整后方案id + */ + private Long adjustAfterSchemeId; + + /** + * 调整的福利项id + */ + private Long adjustWelfareItemId; + + /** + * 操作人 + */ + private Long operator; + + private String tenantKey; + + private Long creator; + + private Integer deleteType; + + private Date createTime; + + private Date updateTime; + + + private String adjustBeforeBaseJson; + + private String adjustAfterBaseJson; + + @TableTitle(title = "对象", dataIndex = "employeeName", key = "employeeName") + private String employeeName; + @TableTitle(title = "个税扣缴义务人", dataIndex = "paymentOrganizationName", key = "paymentOrganizationName") + private String paymentOrganizationName; + @TableTitle(title = "福利项名称", dataIndex = "welfareItemName", key = "welfareItemName") + private String welfareItemName; + @TableTitle(title = "调整前方案", dataIndex = "adjustBeforeSchemeName", key = "adjustBeforeSchemeName") + private String adjustBeforeSchemeName; + @TableTitle(title = "调整前基数", dataIndex = "adjustBeforeBaseValue", key = "adjustBeforeBaseValue") + private String adjustBeforeBaseValue; + @TableTitle(title = "调整后方案", dataIndex = "adjustAfterSchemeName", key = "adjustAfterSchemeName") + private String adjustAfterSchemeName; + @TableTitle(title = "调整后基数", dataIndex = "adjustAfterBaseValue", key = "adjustAfterBaseValue") + private String adjustAfterBaseValue; + @TableTitle(title = "操作人", dataIndex = "operatorName", key = "operatorName") + private String operatorName; + @TableTitle(title = "操作时间", dataIndex = "operateTime", key = "operateTime") + private Date operateTime; +} diff --git a/src/com/engine/salary/entity/siarchives/param/SIArchiveBaseHistoryListParam.java b/src/com/engine/salary/entity/siarchives/param/SIArchiveBaseHistoryListParam.java new file mode 100644 index 000000000..efa7b7bc1 --- /dev/null +++ b/src/com/engine/salary/entity/siarchives/param/SIArchiveBaseHistoryListParam.java @@ -0,0 +1,28 @@ +package com.engine.salary.entity.siarchives.param; + +import com.engine.salary.enums.sicategory.WelfareTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author: sy + * @Description: 基数调整历史列表查询参数 + * @Date: 2023/10/17 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SIArchiveBaseHistoryListParam { + + private WelfareTypeEnum welfareTypeEnum; + + private Long employeeId; + private Long operator; + private Long paymentOrganization; + + private int current; + private int pageSize; +} diff --git a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseHistoryPO.java b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseHistoryPO.java new file mode 100644 index 000000000..6939c2258 --- /dev/null +++ b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseHistoryPO.java @@ -0,0 +1,80 @@ +package com.engine.salary.entity.siarchives.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Author: sy + * @Description: 福利档案基数调整记录 + * @Date: 2023/10/16 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_insurance_base_history +public class InsuranceArchivesBaseHistoryPO { + + private Long id; + + /** + * 人员id + */ + private Long employeeId; + + /** + * 个税扣缴义务人id + */ + private Long paymentOrganization; + + /** + * 福利类别 + */ + private Integer welfareType; + + /** + * 调整前方案id + */ + private Long adjustBeforeSchemeId; + /** + * 调整后方案id + */ + private Long adjustAfterSchemeId; + /** + * 调整前基数值 + */ + private String adjustBeforeBaseValue; + /** + * 调整后基数值 + */ + private String adjustAfterBaseValue; + + /** + * 调整的福利项id + */ + private Long adjustWelfareItemId; + + /** + * 操作人 + */ + private Long operator; + + /** + * 操作时间 + */ + private Date operateTime; + + private String tenantKey; + + private Long creator; + + private Integer deleteType; + + private Date createTime; + + private Date updateTime; +} diff --git a/src/com/engine/salary/mapper/siarchives/InsuranceBaseAdjustHistoryMapper.java b/src/com/engine/salary/mapper/siarchives/InsuranceBaseAdjustHistoryMapper.java new file mode 100644 index 000000000..746831ccb --- /dev/null +++ b/src/com/engine/salary/mapper/siarchives/InsuranceBaseAdjustHistoryMapper.java @@ -0,0 +1,29 @@ +package com.engine.salary.mapper.siarchives; + +import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseHistoryPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author sy + * @Date 2023/10/16 + **/ +public interface InsuranceBaseAdjustHistoryMapper { + + /** + * 批量保存 + */ + void batchSave(@Param("infos") List infos); + + /** + * 根据人员id和个税扣缴义务人id获取基数调整记录 + */ + List listByEmployeeIdAndPayOrg(@Param("paymentOrganization")Long paymentOrganization, @Param("employeeId")Long employeeId); + + /** + * 根据操作人或操作对象获取基数调整记录 + */ + List listByEmployeeIdAndOperator(@Param("operator")Long operator, @Param("employeeId")Long employeeId); +} diff --git a/src/com/engine/salary/mapper/siarchives/InsuranceBaseAdjustHistoryMapper.xml b/src/com/engine/salary/mapper/siarchives/InsuranceBaseAdjustHistoryMapper.xml new file mode 100644 index 000000000..c910cc17d --- /dev/null +++ b/src/com/engine/salary/mapper/siarchives/InsuranceBaseAdjustHistoryMapper.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + t.id + , t.employee_id + , t.payment_organization + , t.welfare_type + , t.adjust_before_scheme_id + , t.adjust_after_scheme_id + , t.adjust_before_base_value + , t.adjust_after_base_value + , t.adjust_welfare_item_id + , t.operator + , t.operate_time + , t.create_time + , t.update_time + , t.creator + , t.delete_type + , t.tenant_key + + + + INSERT INTO hrsa_insurance_base_history + (id,employee_id,payment_organization,welfare_type, + adjust_before_scheme_id,adjust_after_scheme_id, + adjust_before_base_value,adjust_after_base_value, + adjust_welfare_item_id,operator,operate_time, + tenant_key,creator,delete_type,create_time,update_time) + VALUES + + ( + #{item.id}, + #{item.employeeId}, + #{item.paymentOrganization}, + #{item.welfareType}, + #{item.adjustBeforeSchemeId}, + #{item.adjustAfterSchemeId}, + #{item.adjustBeforeBaseValue}, + #{item.adjustAfterBaseValue}, + #{item.adjustWelfareItemId}, + #{item.operator}, + #{item.operateTime}, + #{item.tenantKey}, + #{item.creator}, + #{item.deleteType}, + #{item.createTime}, + #{item.updateTime} + ) + + + + INSERT INTO hrsa_insurance_base_history + (id,employee_id,payment_organization,welfare_type, + adjust_before_scheme_id,adjust_after_scheme_id, + adjust_before_base_value,adjust_after_base_value, + adjust_welfare_item_id,operator,operate_time, + tenant_key,creator,delete_type,create_time,update_time) + + select + #{item.id,jdbcType=DOUBLE}, + #{item.employeeId,jdbcType=DOUBLE}, + #{item.paymentOrganization,jdbcType=DOUBLE}, + #{item.welfareType,jdbcType=DOUBLE}, + #{item.adjustBeforeSchemeId,jdbcType=DOUBLE}, + #{item.adjustAfterSchemeId,jdbcType=DOUBLE}, + #{item.adjustBeforeBaseValue,jdbcType=VARCHAR}, + #{item.adjustAfterBaseValue,jdbcType=VARCHAR}, + #{item.adjustWelfareItemId,jdbcType=DOUBLE}, + #{item.operator,jdbcType=DOUBLE}, + #{item.operateTime}, + #{item.tenantKey,jdbcType=VARCHAR}, + #{item.creator,jdbcType=DOUBLE}, + #{item.deleteType}, + #{item.createTime}, + #{item.updateTime} + from dual + + + + + INSERT INTO hrsa_insurance_base_history + (id,employee_id,payment_organization,welfare_type, + adjust_before_scheme_id,adjust_after_scheme_id, + adjust_before_base_value,adjust_after_base_value, + adjust_welfare_item_id,operator,operate_time, + tenant_key,creator,delete_type,create_time,update_time) + VALUES + ( + #{item.id}, + #{item.employeeId}, + #{item.paymentOrganization}, + #{item.welfareType}, + #{item.adjustBeforeSchemeId}, + #{item.adjustAfterSchemeId}, + #{item.adjustBeforeBaseValue}, + #{item.adjustAfterBaseValue}, + #{item.adjustWelfareItemId}, + #{item.operator}, + #{item.operateTime}, + #{item.tenantKey}, + #{item.creator}, + #{item.deleteType}, + #{item.createTime}, + #{item.updateTime} + ) + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SIArchivesService.java b/src/com/engine/salary/service/SIArchivesService.java index fb4c63752..3e98c15d3 100644 --- a/src/com/engine/salary/service/SIArchivesService.java +++ b/src/com/engine/salary/service/SIArchivesService.java @@ -1,9 +1,12 @@ package com.engine.salary.service; +import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO; import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam; import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam; +import com.engine.salary.entity.siarchives.param.SIArchiveBaseHistoryListParam; import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; +import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.util.Collection; @@ -103,4 +106,8 @@ public interface SIArchivesService { void deleteArchive(Collection longs); void handleStayDelData(long currentEmployeeId); + + PageInfo getAdjustHistoryList(SIArchiveBaseHistoryListParam param); + + PageInfo historyListByEmployeeIdAndOperator(SIArchiveBaseHistoryListParam param); } diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index 720ed4805..59b4d8e48 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -7,8 +7,10 @@ import com.engine.core.impl.Service; import com.engine.salary.biz.SIArchivesBiz; import com.engine.salary.cmd.siarchives.SIArchivesTipsCmd; import com.engine.salary.entity.siarchives.bo.InsuranceArchivesBaseInfoBO; +import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO; import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam; import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam; +import com.engine.salary.entity.siarchives.param.SIArchiveBaseHistoryListParam; import com.engine.salary.entity.siarchives.po.*; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; @@ -37,6 +39,8 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -1133,5 +1137,32 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService } } + @Override + public PageInfo getAdjustHistoryList(SIArchiveBaseHistoryListParam param) { + + if (param.getWelfareTypeEnum() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误")); + } + List adjustHistoryDTOS = siArchivesBiz.getAdjustHistoryList(param.getPaymentOrganization(), param.getEmployeeId()); + + List targetHistory = adjustHistoryDTOS.stream() + .filter(f -> f.getWelfareType().equals(param.getWelfareTypeEnum().getValue())).collect(Collectors.toList()); + + PageInfo listPage = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), + targetHistory , InsuranceArchivesBaseHistoryDTO.class); + + return listPage; + } + + @Override + public PageInfo historyListByEmployeeIdAndOperator(SIArchiveBaseHistoryListParam param) { + + List adjustHistoryDTOS = siArchivesBiz.getBaseHistoryByEmployeeIdAndOperator(param.getOperator(), param.getEmployeeId()); + + PageInfo listPage = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), + adjustHistoryDTOS , InsuranceArchivesBaseHistoryDTO.class); + + return listPage; + } } diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 06a0bd09e..011a4842b 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -1379,53 +1379,63 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { //导入社保档案 List socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(socialSchemePOS)) { -// socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new)); - //根据人员id和个税扣缴义务人id删除对应档案 - socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg); -// List socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList()); -// List> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100); -// socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds); + //去除员工id+个税扣缴义务人下重复的数据 socialSchemePOS = socialSchemePOS.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); + //生成福利档案基数调整历史记录 + List adjustSocialHistoryPOList = siArchivesBiz.dealSocialBaseAdjustInfoList(socialSchemePOS, (long) user.getUID()); + + //根据人员id和个税扣缴义务人id删除对应旧档案 + socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg); + + //新建新档案 List insuranceArchivesSocialSchemePOS = encryptUtil.encryptList(socialSchemePOS, InsuranceArchivesSocialSchemePO.class); List> partition = Lists.partition(insuranceArchivesSocialSchemePOS, 100); partition.forEach(getSocialSchemeMapper()::batchSave); + + //新建福利档案基数调整历史记录 + siArchivesBiz.batchInsertAdjustHistory(adjustSocialHistoryPOList, user.getUID()); } //导入公积金档案 List fundSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getFund).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(fundSchemePOS)) { -// fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new)); - //根据人员id和个税扣缴义务人id删除对应档案 - fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg); -// List fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList()); -// List> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100); -// fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds); + //去除员工id+个税扣缴义务人下重复的数据 fundSchemePOS = fundSchemePOS.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); + //生成福利档案基数调整历史记录 + List adjustFundHistoryPOList = siArchivesBiz.dealFundBaseAdjustInfoList(fundSchemePOS, (long) user.getUID()); + //根据人员id和个税扣缴义务人id删除对应档案 + fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg); + //新建新档案 List insuranceArchivesFundSchemePOS = encryptUtil.encryptList(fundSchemePOS, InsuranceArchivesFundSchemePO.class); List> partition = Lists.partition(insuranceArchivesFundSchemePOS, 100); partition.forEach(getFundSchemeMapper()::batchSave); + //新建福利档案基数调整历史记录 + siArchivesBiz.batchInsertAdjustHistory(adjustFundHistoryPOList, user.getUID()); } //导入其他福利档案 List otherSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getOther).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(otherSchemePOS)) { -// otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new)); - //根据人员id和个税扣缴义务人id删除对应档案 - otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg); -// List otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList()); -// List> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100); -// otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds); + //去除员工id+个税扣缴义务人下重复的数据 otherSchemePOS = otherSchemePOS.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); + //生成福利档案基数调整历史记录 + List adjustOtherHistoryPOList = siArchivesBiz.dealOtherBaseAdjustInfoList(otherSchemePOS, (long) user.getUID()); + + //根据人员id和个税扣缴义务人id删除对应档案 + otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg); + //新建新档案 List insuranceArchivesOtherSchemePOS = encryptUtil.encryptList(otherSchemePOS, InsuranceArchivesOtherSchemePO.class); List> partition = Lists.partition(insuranceArchivesOtherSchemePOS, 100); partition.forEach(getOtherSchemeMapper()::batchSave); + //新建福利档案基数调整历史记录 + siArchivesBiz.batchInsertAdjustHistory(adjustOtherHistoryPOList, user.getUID()); } //导入福利档案基础信息 List baseInfoPOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getBaseInfo).collect(Collectors.toList()); diff --git a/src/com/engine/salary/web/SIArchivesController.java b/src/com/engine/salary/web/SIArchivesController.java index d70763a45..ecc61b1b5 100644 --- a/src/com/engine/salary/web/SIArchivesController.java +++ b/src/com/engine/salary/web/SIArchivesController.java @@ -2,13 +2,16 @@ package com.engine.salary.web; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; +import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO; import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam; import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam; +import com.engine.salary.entity.siarchives.param.SIArchiveBaseHistoryListParam; import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.service.SIArchivesService; import com.engine.salary.service.impl.SIArchivesServiceImpl; import com.engine.salary.util.ResponseResult; +import com.engine.salary.util.page.PageInfo; import io.swagger.v3.oas.annotations.parameters.RequestBody; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -249,4 +252,15 @@ public class SIArchivesController { param.setExtWelArchiveList(true); return new ResponseResult>(user).run(getService(user)::listPage, param); } + + /** + * 查询档案基数调整记录列表 + */ + @POST + @Path("/getAdjustHistoryList") + @Produces(MediaType.APPLICATION_JSON) + public String getAdjustHistoryList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveBaseHistoryListParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getService(user)::historyListByEmployeeIdAndOperator, param); + } }