领悦生成逻辑调整

This commit is contained in:
Harryxzy 2025-04-18 14:22:40 +08:00
parent 56d4ef206c
commit e620efbc5d
4 changed files with 89 additions and 17 deletions

View File

@ -149,4 +149,6 @@ public interface LySalaryReportService {
void generateCymxSbReport(String salaryMonth); void generateCymxSbReport(String salaryMonth);
void generateCymxGjjReport(String salaryMonth); void generateCymxGjjReport(String salaryMonth);
void deleteByIds(List<Long> needDeleteIds);
} }

View File

@ -153,13 +153,32 @@ public class LyFundReportServiceImpl extends Service implements LyFundReportServ
// 获取本月是否已有报表数据 // 获取本月是否已有报表数据
List<LyFundReportPO> lyFundReportPOS = listBySalaryMonth(salaryMonthDate); List<LyFundReportPO> lyFundReportPOS = listBySalaryMonth(salaryMonthDate);
// 过滤出已推送成功的数据
List<String> canNotGenGmgsqcList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(lyFundReportPOS)) { if (CollectionUtils.isNotEmpty(lyFundReportPOS)) {
throw new SalaryRunTimeException("本薪资所属月已生成公积金汇总报表,无法生成公积金汇总报表数据"); List<LyFundReportPO> canNotDeleteList = lyFundReportPOS.stream()
.filter(report -> (report.getGjjffpzFlag() != null && report.getGjjffpzFlag().equals(NumberUtils.INTEGER_ONE)) || (report.getGjjjtpzFlag() != null && report.getGjjjtpzFlag().equals(NumberUtils.INTEGER_ONE)))
.collect(Collectors.toList());
// 获取不能生成的发放公司全称
canNotGenGmgsqcList = canNotDeleteList.stream().map(LyFundReportPO::getGmgsqc).distinct().collect(Collectors.toList());
// 删除其余未推送成功的报表数据
List<String> finalCanNotGenGmgsqcList = canNotGenGmgsqcList;
List<Long> needDeleteIds = lyFundReportPOS.stream().filter(po -> !finalCanNotGenGmgsqcList.contains(po.getGmgsqc()))
.map(LyFundReportPO::getId)
.collect(Collectors.toList());
deleteByIds(needDeleteIds);
} }
// if (CollectionUtils.isNotEmpty(lyFundReportPOS)) {
// throw new SalaryRunTimeException("本薪资所属月已生成公积金汇总报表,无法生成公积金汇总报表数据");
// }
// 获取建模中社保数据 // 获取建模中社保数据
List<UfGjjInfo> gjjInfoList = listUfGjjInfoBySalaryMonth(salaryMonthDate); List<UfGjjInfo> gjjInfoList = listUfGjjInfoBySalaryMonth(salaryMonthDate);
if (CollectionUtils.isNotEmpty(gjjInfoList)) { if (CollectionUtils.isNotEmpty(gjjInfoList)) {
// 获取所有法人主体信息
Map<String, String> frztMap = getLyPZService(user).listAllFrzt();
List<String> finalCanNotGenGmgsqcList1 = canNotGenGmgsqcList;
gjjInfoList = gjjInfoList.stream().filter(gjjInfo -> !finalCanNotGenGmgsqcList1.contains(frztMap.get(gjjInfo.getFycdgsqc()))).collect(Collectors.toList());
Map<String, List<UfGjjInfo>> resultGroup = SalaryEntityUtil.group2Map(gjjInfoList, gjjInfo -> Util.null2String(gjjInfo.getFycdgsqc()) Map<String, List<UfGjjInfo>> resultGroup = SalaryEntityUtil.group2Map(gjjInfoList, gjjInfo -> Util.null2String(gjjInfo.getFycdgsqc())
+ "-split" + Util.null2String(gjjInfo.getGjjcdgsmc()) + "-split" + Util.null2String(gjjInfo.getGjjcdgsmc())
+ "-split" + Util.null2String(gjjInfo.getZnxmmc())); + "-split" + Util.null2String(gjjInfo.getZnxmmc()));
@ -167,8 +186,6 @@ public class LyFundReportServiceImpl extends Service implements LyFundReportServ
LinkedHashMap<String, List<UfGjjInfo>> sortedMap = new LinkedHashMap<>(); LinkedHashMap<String, List<UfGjjInfo>> sortedMap = new LinkedHashMap<>();
resultGroup.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue())); resultGroup.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue()));
// 获取所有法人主体信息
Map<String, String> frztMap = getLyPZService(user).listAllFrzt();
Date now = new Date(); Date now = new Date();
sortedMap.forEach((key, valueList) -> { sortedMap.forEach((key, valueList) -> {
String[] split = key.split("-split"); String[] split = key.split("-split");
@ -661,7 +678,10 @@ public class LyFundReportServiceImpl extends Service implements LyFundReportServ
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return; return;
} }
getLyFundReportMapper().deleteByIds(ids); List<List<Long>> partition = Lists.partition(ids, 500);
partition.forEach(part -> {
getLyFundReportMapper().deleteByIds(part);
});
} }
@Override @Override

View File

@ -206,9 +206,24 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
// 获取本月是否已有报表数据 // 获取本月是否已有报表数据
List<LySalaryReportPO> lySalaryReportPOS = listBySalaryMonth(salaryMonthDate); List<LySalaryReportPO> lySalaryReportPOS = listBySalaryMonth(salaryMonthDate);
// 过滤出已推送成功的数据
List<String> canNotGenFfgsqcList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(lySalaryReportPOS)) { if (CollectionUtils.isNotEmpty(lySalaryReportPOS)) {
throw new SalaryRunTimeException("本薪资所属月已生成薪资汇总报表,无法生成薪资报表数据"); List<LySalaryReportPO> canNotDeleteList = lySalaryReportPOS.stream()
.filter(report -> (report.getXzjtpzFlag() != null && report.getXzjtpzFlag().equals(NumberUtils.INTEGER_ONE)) || (report.getXzffpzFlag() != null && report.getXzffpzFlag().equals(NumberUtils.INTEGER_ONE)))
.collect(Collectors.toList());
// 获取不能生成的发放公司全称
canNotGenFfgsqcList = canNotDeleteList.stream().map(LySalaryReportPO::getFfgsqc).distinct().collect(Collectors.toList());
// 删除其余未推送成功的报表数据
List<String> finalCanNotGenFfgsqcList = canNotGenFfgsqcList;
List<Long> needDeleteIds = lySalaryReportPOS.stream().filter(po -> !finalCanNotGenFfgsqcList.contains(po.getFfgsqc()))
.map(LySalaryReportPO::getId)
.collect(Collectors.toList());
deleteByIds(needDeleteIds);
} }
// if (CollectionUtils.isNotEmpty(lySalaryReportPOS)) {
// throw new SalaryRunTimeException("本薪资所属月已生成薪资汇总报表,无法生成薪资报表数据");
// }
BaseBean baseBean = new BaseBean(); BaseBean baseBean = new BaseBean();
// 获取薪资核算结果 // 获取薪资核算结果
@ -224,15 +239,22 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
if (CollectionUtils.isNotEmpty(salaryAcctEmployeePOList)) { if (CollectionUtils.isNotEmpty(salaryAcctEmployeePOList)) {
String dataSourceStr = StringUtils.join(salaryAcctRecordIds, ","); String dataSourceStr = StringUtils.join(salaryAcctRecordIds, ",");
// 获取这些人的发放公司全称数据
List<Long> salaryAcctEmpIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
Long ffgsqcItemId = getPropLongValue(baseBean, "lySalaryNCReport", "salary_ffgsqc_item_id");
List<SalaryAcctResultPO> acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, Collections.singletonList(ffgsqcItemId));
List<String> finalCanNotGenFfgsqcList1 = canNotGenFfgsqcList;
List<Long> needExcludeAcctEmpIds = acctResultList.stream().filter(result -> finalCanNotGenFfgsqcList1.contains(result.getResultValue()))
.map(SalaryAcctResultPO::getSalaryAcctEmpId).collect(Collectors.toList());
salaryAcctEmployeePOList = salaryAcctEmployeePOList.stream().filter(employee -> !needExcludeAcctEmpIds.contains(employee.getId())).collect(Collectors.toList());
// 获取薪资项目id // 获取薪资项目id
List<Long> salaryItemIds = new ArrayList<>(); List<Long> salaryItemIds = new ArrayList<>();
// 是职能还是项目 // 是职能还是项目
Long znxmlxItemId = getPropLongValue(baseBean, "lySalaryNCReport", "salary_znxmlx_item_id"); Long znxmlxItemId = getPropLongValue(baseBean, "lySalaryNCReport", "salary_znxmlx_item_id");
salaryItemIds.add(znxmlxItemId); salaryItemIds.add(znxmlxItemId);
// 发放公司全称
// 发放公司全称
Long ffgsqcItemId = getPropLongValue(baseBean, "lySalaryNCReport", "salary_ffgsqc_item_id");
salaryItemIds.add(ffgsqcItemId); salaryItemIds.add(ffgsqcItemId);
// 费用承担公司全称 // 费用承担公司全称
Long fycdgsqcItemId = getPropLongValue(baseBean, "lySalaryNCReport", "salary_fycdgsqc_item_id"); Long fycdgsqcItemId = getPropLongValue(baseBean, "lySalaryNCReport", "salary_fycdgsqc_item_id");
@ -298,9 +320,9 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
salaryItemIds.add(bysfItemId); salaryItemIds.add(bysfItemId);
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(salaryItemIds); List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(salaryItemIds);
salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList()); salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
List<Long> salaryAcctEmpIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); salaryAcctEmpIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
// 获取薪资核算结果 // 获取薪资核算结果
List<SalaryAcctResultPO> acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIds); acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIds);
List<SalarySobEmpFieldPO> salarySobEmpFields = new ArrayList<>(); List<SalarySobEmpFieldPO> salarySobEmpFields = new ArrayList<>();
salarySobEmpFields.add(SalarySobEmpFieldPO.builder().fieldCode("subcompanyId").build()); salarySobEmpFields.add(SalarySobEmpFieldPO.builder().fieldCode("subcompanyId").build());
salarySobEmpFields.add(SalarySobEmpFieldPO.builder().fieldCode("departmentId").build()); salarySobEmpFields.add(SalarySobEmpFieldPO.builder().fieldCode("departmentId").build());
@ -819,11 +841,15 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
.build(); .build();
} }
private void deleteByIds(List<Long> salaryReportIds) { @Override
public void deleteByIds(List<Long> salaryReportIds) {
if (CollectionUtils.isEmpty(salaryReportIds)) { if (CollectionUtils.isEmpty(salaryReportIds)) {
return; return;
} }
getLySalaryReportMapper().deleteByIds(salaryReportIds); List<List<Long>> partition = Lists.partition(salaryReportIds, 500);
partition.forEach(part -> {
getLySalaryReportMapper().deleteByIds(part);
});
} }
@Override @Override

View File

@ -170,13 +170,36 @@ public class LySocialReportServiceImpl extends Service implements LySocialReport
// 获取本月是否已有报表数据 // 获取本月是否已有报表数据
List<LySocialReportPO> lySocialReportPOS = listBySalaryMonth(salaryMonthDate); List<LySocialReportPO> lySocialReportPOS = listBySalaryMonth(salaryMonthDate);
// 过滤出已推送成功的数据
List<String> canNotGenGmgsqcList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(lySocialReportPOS)) { if (CollectionUtils.isNotEmpty(lySocialReportPOS)) {
throw new SalaryRunTimeException("本薪资所属月已生成社保汇总报表,无法生成社保汇总报表数据"); List<LySocialReportPO> canNotDeleteList = lySocialReportPOS.stream()
.filter(report -> (report.getSbjtpzFlag() != null && report.getSbjtpzFlag().equals(NumberUtils.INTEGER_ONE)) || (report.getSbffpzFlag() != null && report.getSbffpzFlag().equals(NumberUtils.INTEGER_ONE)))
.collect(Collectors.toList());
// 获取不能生成的购买公司全称
canNotGenGmgsqcList = canNotDeleteList.stream().map(LySocialReportPO::getGmgsqc).distinct().collect(Collectors.toList());
// 删除其余未推送成功的报表数据
List<String> finalCanNotGenGmgsqcList = canNotGenGmgsqcList;
List<Long> needDeleteIds = lySocialReportPOS.stream().filter(po -> !finalCanNotGenGmgsqcList.contains(po.getGmgsqc()))
.map(LySocialReportPO::getId)
.collect(Collectors.toList());
deleteByIds(needDeleteIds);
} }
// if (CollectionUtils.isNotEmpty(lySocialReportPOS)) {
// throw new SalaryRunTimeException("本薪资所属月已生成社保汇总报表,无法生成社保汇总报表数据");
// }
// 获取建模中社保数据 // 获取建模中社保数据
List<UfSbInfo> sbInfoList = listUfSbInfoBySalaryMonth(salaryMonthDate); List<UfSbInfo> sbInfoList = listUfSbInfoBySalaryMonth(salaryMonthDate);
if (CollectionUtils.isNotEmpty(sbInfoList)) { if (CollectionUtils.isNotEmpty(sbInfoList)) {
// 获取所有法人主体信息
Map<String, String> frztMap = getLyPZService(user).listAllFrzt();
// 过滤购买公司
List<String> finalCanNotGenGmgsqcList1 = canNotGenGmgsqcList;
sbInfoList = sbInfoList.stream().filter(sbInfo -> !finalCanNotGenGmgsqcList1.contains(frztMap.get(sbInfo.getGmgsqc()))).collect(Collectors.toList());
Map<String, List<UfSbInfo>> resultGroup = SalaryEntityUtil.group2Map(sbInfoList, sbInfo -> Util.null2String(sbInfo.getGmgsqc()) Map<String, List<UfSbInfo>> resultGroup = SalaryEntityUtil.group2Map(sbInfoList, sbInfo -> Util.null2String(sbInfo.getGmgsqc())
+ "-split" + Util.null2String(sbInfo.getSbcdgsmc()) + "-split" + Util.null2String(sbInfo.getSbcdgsmc())
+ "-split" + Util.null2String(sbInfo.getZnxmmc())); + "-split" + Util.null2String(sbInfo.getZnxmmc()));
@ -184,8 +207,6 @@ public class LySocialReportServiceImpl extends Service implements LySocialReport
LinkedHashMap<String, List<UfSbInfo>> sortedMap = new LinkedHashMap<>(); LinkedHashMap<String, List<UfSbInfo>> sortedMap = new LinkedHashMap<>();
resultGroup.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue())); resultGroup.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue()));
// 获取所有法人主体信息
Map<String, String> frztMap = getLyPZService(user).listAllFrzt();
Date now = new Date(); Date now = new Date();
sortedMap.forEach((key, valueList) -> { sortedMap.forEach((key, valueList) -> {
String[] split = key.split("-split"); String[] split = key.split("-split");
@ -919,7 +940,10 @@ public class LySocialReportServiceImpl extends Service implements LySocialReport
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return; return;
} }
getLySocialReportMapper().deleteByIds(ids); List<List<Long>> partition = Lists.partition(ids, 500);
partition.forEach(part -> {
getLySocialReportMapper().deleteByIds(part);
});
} }
@Override @Override