Commit e8cf26f2b5d289d7fca71a2c604b4bcd85765178
Committed by
姜超
1 parent
d22abbcb
更新-薪酬额外项字段的计算和添加
Showing
2 changed files
with
255 additions
and
22 deletions
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/salary/ReportSalaryDim.java
... | ... | @@ -93,7 +93,7 @@ public class ReportSalaryDim extends BaseEntity<ReportSalaryDim, Long> { |
93 | 93 | private StarLevelEnum starLevel; |
94 | 94 | |
95 | 95 | /** |
96 | - * 总薪酬 | |
96 | + * 总薪酬 = actRevenueTotalMoney(总收入合计) - actDeductTotalMoney(总扣除合计) | |
97 | 97 | */ |
98 | 98 | private BigDecimal totalReward; |
99 | 99 | |
... | ... | @@ -102,4 +102,64 @@ public class ReportSalaryDim extends BaseEntity<ReportSalaryDim, Long> { |
102 | 102 | */ |
103 | 103 | private BigDecimal kpiScoreRatio; |
104 | 104 | |
105 | + /** | |
106 | + * 总收入合计 | |
107 | + */ | |
108 | + private BigDecimal actRevenueTotalMoney; | |
109 | + | |
110 | + /** | |
111 | + * 总绩效提成 | |
112 | + */ | |
113 | + private BigDecimal actKpiMoney; | |
114 | + | |
115 | + /** | |
116 | + * 总内部奖励 | |
117 | + */ | |
118 | + private BigDecimal actAwardMoney; | |
119 | + | |
120 | + /** | |
121 | + * 总福利补贴 | |
122 | + */ | |
123 | + private BigDecimal actSubsidyMoney; | |
124 | + | |
125 | + /** | |
126 | + * 总试用期工资 | |
127 | + */ | |
128 | + private BigDecimal actProbationMoney; | |
129 | + | |
130 | + /** | |
131 | + * 总岗位最低补偿 | |
132 | + */ | |
133 | + private BigDecimal actJobCompensateMoney; | |
134 | + | |
135 | + /** | |
136 | + * 总考评奖励 | |
137 | + */ | |
138 | + private BigDecimal actEvalAwardMoney; | |
139 | + | |
140 | + /** | |
141 | + * 总扣除合计 | |
142 | + */ | |
143 | + private BigDecimal actDeductTotalMoney; | |
144 | + | |
145 | + /** | |
146 | + * 总内部罚款扣除 | |
147 | + */ | |
148 | + private BigDecimal actPenaltyMoney; | |
149 | + | |
150 | + /** | |
151 | + * 总社保扣除 | |
152 | + */ | |
153 | + private BigDecimal actNecessaryMoney; | |
154 | + | |
155 | + /** | |
156 | + * 总个税扣除 | |
157 | + */ | |
158 | + private BigDecimal actPersonTaxMoney; | |
159 | + | |
160 | + /** | |
161 | + * 总公积金扣除 | |
162 | + */ | |
163 | + private BigDecimal actAccumulationFundMoney; | |
164 | + | |
105 | 165 | } | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/task/SalaryReportTask.java
... | ... | @@ -6,7 +6,7 @@ import cn.fw.morax.common.constant.TimeTaskConstant; |
6 | 6 | import cn.fw.morax.common.utils.DateUtil; |
7 | 7 | import cn.fw.morax.common.utils.PublicUtil; |
8 | 8 | import cn.fw.morax.domain.bo.salary.SalaryGroupProjectBO; |
9 | -import cn.fw.morax.domain.db.kpi.*; | |
9 | +import cn.fw.morax.domain.db.kpi.IndicatorUserValue; | |
10 | 10 | import cn.fw.morax.domain.db.salary.*; |
11 | 11 | import cn.fw.morax.domain.enums.*; |
12 | 12 | import cn.fw.morax.domain.vo.salary.SalaryGroupProjectParamVO; |
... | ... | @@ -49,6 +49,8 @@ import java.util.*; |
49 | 49 | import java.util.concurrent.atomic.AtomicInteger; |
50 | 50 | import java.util.concurrent.locks.Lock; |
51 | 51 | import java.util.function.Function; |
52 | +import java.util.function.Predicate; | |
53 | +import java.util.function.ToDoubleFunction; | |
52 | 54 | import java.util.stream.Collectors; |
53 | 55 | |
54 | 56 | /** |
... | ... | @@ -86,6 +88,7 @@ public class SalaryReportTask { |
86 | 88 | private final CommonService commonService; |
87 | 89 | private final EhrRpcService ehrRpcService; |
88 | 90 | private final OopRpcService oopRpcService; |
91 | + private final SalaryPoolDetailService salaryPoolDetailService; | |
89 | 92 | |
90 | 93 | |
91 | 94 | @Value("${special-indicator-code.car-series}") |
... | ... | @@ -223,10 +226,12 @@ public class SalaryReportTask { |
223 | 226 | List<SalaryPool> pools, |
224 | 227 | Long reportSalaryId) { |
225 | 228 | MultiKeyMap<Long, BigDecimal> userSalaryMap = this.getUserIndicatorHitMap(salaryGroupProjects, date, pools); |
229 | + Map<Long, List<SalaryPoolDetail>> salaryPoolDetailMap = this.getSalaryPoolDetailMap(date, pools); | |
226 | 230 | List<ReportSalaryDimValue> reportSalaryValues = new ArrayList<>(); |
227 | 231 | //人的维度为基础,计算各个指标信息对应的数据 |
228 | 232 | for (SalaryPool pool : pools) { |
229 | - ReportSalaryDim reportSalaryDim = saveStaffDim(pool, date, reportSalaryId); | |
233 | + List<SalaryPoolDetail> salaryPoolIdDetails = Optional.ofNullable(salaryPoolDetailMap.get(pool.getId())).orElse(Collections.emptyList()); | |
234 | + ReportSalaryDim reportSalaryDim = saveStaffDim(pool, date, reportSalaryId,salaryPoolIdDetails); | |
230 | 235 | userDims.add(reportSalaryDim); |
231 | 236 | final Long userId = pool.getUserId(); |
232 | 237 | final Long reportSalaryDimId = reportSalaryDim.getId(); |
... | ... | @@ -286,9 +291,7 @@ public class SalaryReportTask { |
286 | 291 | if (PublicUtil.isEmpty(shopDimReportIds)) { |
287 | 292 | continue; |
288 | 293 | } |
289 | - BigDecimal averageSalary = calcAverageTotalSalary(userDims, shopDimReportIds); | |
290 | - BigDecimal kpiScoreRatio = calcAverageKpiScoreRatio(userDims, shopDimReportIds); | |
291 | - final Long shopReportSalaryDimId = this.saveShopDimDB(shopId, shopMap, date, reportSalaryId, averageSalary, kpiScoreRatio); | |
294 | + final Long shopReportSalaryDimId = this.saveShopDimDB(shopId, shopMap, date, reportSalaryId, userDims, shopDimReportIds); | |
292 | 295 | |
293 | 296 | for (SalaryGroupProjectBO salaryGroupProject : salaryGroupProjects) { |
294 | 297 | BigDecimal value = calcAverageValue(userSalaryValues, shopDimReportIds, salaryGroupProject.getId().toString()); |
... | ... | @@ -341,9 +344,9 @@ public class SalaryReportTask { |
341 | 344 | if (PublicUtil.isEmpty(managerStaffDimReportIds)) { |
342 | 345 | continue; |
343 | 346 | } |
344 | - BigDecimal kpiScoreRatio = calcAverageKpiScoreRatio(userDims, managerStaffDimReportIds); | |
345 | - BigDecimal averageSalary = calcAverageTotalSalary(userDims, managerStaffDimReportIds); | |
346 | - final Long reportSalaryDimId = this.saveManagerDimDB(manager, date, reportSalaryId, managerMap, averageSalary, kpiScoreRatio, manageStaffIds); | |
347 | + //BigDecimal kpiScoreRatio = calcAverageKpiScoreRatio(userDims, managerStaffDimReportIds); | |
348 | + //BigDecimal averageSalary = calcAverageTotalSalary(userDims, managerStaffDimReportIds); | |
349 | + final Long reportSalaryDimId = this.saveManagerDimDB(manager, date, reportSalaryId, managerMap,manageStaffIds,managerStaffDimReportIds,userDims); | |
347 | 350 | for (SalaryGroupProjectBO salaryGroupProject : salaryGroupProjects) { |
348 | 351 | BigDecimal value = calcAverageValue(userSalaryValues, managerStaffDimReportIds, salaryGroupProject.getId().toString()); |
349 | 352 | childReportSalaryDimValues.add(this.convertProjectValueDB(salaryGroupProject, value)); |
... | ... | @@ -371,6 +374,44 @@ public class SalaryReportTask { |
371 | 374 | return staffInfos.stream().collect(Collectors.toMap(StaffBaseInfoDTO::getId, Function.identity(), (v1, v2) -> v1)); |
372 | 375 | } |
373 | 376 | |
377 | + /** | |
378 | + * 抽象处理平均值计算 | |
379 | + * @param data | |
380 | + * @param predicate | |
381 | + * @param field | |
382 | + * @return | |
383 | + */ | |
384 | + private <T> BigDecimal calcAverage(final Collection<T> data,Predicate<T> predicate, final ToDoubleFunction<T> field) { | |
385 | + if (CollectionUtils.isEmpty(data)) { | |
386 | + return BigDecimal.ZERO; | |
387 | + } | |
388 | + Double averageRatioDouble = data.stream() | |
389 | + .filter(predicate) | |
390 | + .mapToDouble(field) | |
391 | + .average() | |
392 | + .orElse(0); | |
393 | + return BigDecimal.valueOf(averageRatioDouble); | |
394 | + } | |
395 | + | |
396 | + /** | |
397 | + * 抽象处理平均值计算 | |
398 | + * @param data | |
399 | + * @param field | |
400 | + * @return | |
401 | + * @param <T> | |
402 | + */ | |
403 | + private <T> BigDecimal calcAverage(final Collection<T> data, final ToDoubleFunction<T> field) { | |
404 | + if (CollectionUtils.isEmpty(data)) { | |
405 | + return BigDecimal.ZERO; | |
406 | + } | |
407 | + Double averageRatioDouble = data.stream() | |
408 | + .mapToDouble(field) | |
409 | + .average() | |
410 | + .orElse(0); | |
411 | + return BigDecimal.valueOf(averageRatioDouble); | |
412 | + } | |
413 | + | |
414 | + | |
374 | 415 | public BigDecimal calcAverageTotalSalary(List<ReportSalaryDim> dims, Set<Long> ReportDimIds) { |
375 | 416 | Double averageRatioDouble = dims.stream() |
376 | 417 | .filter(user -> ReportDimIds.contains(user.getId())) |
... | ... | @@ -398,8 +439,12 @@ public class SalaryReportTask { |
398 | 439 | return new BigDecimal(averageRatioDouble.toString()); |
399 | 440 | } |
400 | 441 | |
401 | - public Long saveShopDimDB(Long shopId, Map<Long, String> shopMap, | |
402 | - LocalDate date, Long reportSalaryId, BigDecimal averageSalary, BigDecimal kpiScoreRatio) { | |
442 | + public Long saveShopDimDB(Long shopId, | |
443 | + Map<Long, String> shopMap, | |
444 | + LocalDate date, | |
445 | + Long reportSalaryId, | |
446 | + List<ReportSalaryDim> userDims, | |
447 | + Set<Long> shopDimReportIds) { | |
403 | 448 | ReportSalaryDim reportSalaryDim = new ReportSalaryDim(); |
404 | 449 | reportSalaryDim.setDimension(ReportDimensionEnum.SHOP); |
405 | 450 | reportSalaryDim.setReferId(shopId); |
... | ... | @@ -407,24 +452,118 @@ public class SalaryReportTask { |
407 | 452 | reportSalaryDim.setShopName(shopMap.get(shopId)); |
408 | 453 | reportSalaryDim.setDataDate(date); |
409 | 454 | reportSalaryDim.setReportSalaryId(reportSalaryId); |
410 | - reportSalaryDim.setTotalReward(averageSalary); | |
411 | - reportSalaryDim.setKpiScoreRatio(kpiScoreRatio); | |
455 | + //计算平均值薪酬的额外项 | |
456 | + extCalcAverage(userDims, shopDimReportIds, reportSalaryDim); | |
412 | 457 | reportSalaryDimService.save(reportSalaryDim); |
413 | 458 | return reportSalaryDim.getId(); |
414 | 459 | } |
460 | + | |
461 | + /** | |
462 | + * 计算平均值薪酬的额外项 | |
463 | + * @param userDims | |
464 | + * @param shopDimReportIds | |
465 | + * @param reportSalaryDim | |
466 | + */ | |
467 | + private void extCalcAverage(List<ReportSalaryDim> userDims, Set<Long> shopDimReportIds, ReportSalaryDim reportSalaryDim) { | |
468 | + List<ReportSalaryDim> filterUserDims = userDims.stream().filter(e -> shopDimReportIds.contains(e.getId())).collect(Collectors.toList()); | |
469 | + //绩效得分率(N) | |
470 | + reportSalaryDim.setKpiScoreRatio(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getKpiScoreRatio()).orElse(BigDecimal.ZERO).doubleValue())); | |
471 | + //收入-平均值 | |
472 | + reportSalaryDim.setActKpiMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActKpiMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
473 | + reportSalaryDim.setActAwardMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActAwardMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
474 | + reportSalaryDim.setActSubsidyMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActSubsidyMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
475 | + reportSalaryDim.setActProbationMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActProbationMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
476 | + reportSalaryDim.setActJobCompensateMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActJobCompensateMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
477 | + reportSalaryDim.setActEvalAwardMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActEvalAwardMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
478 | + //总收入合计平均值 | |
479 | + reportSalaryDim.setActRevenueTotalMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActRevenueTotalMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
480 | + //reportSalaryDim.setActRevenueTotalMoney( | |
481 | + // reportSalaryDim.getActKpiMoney() | |
482 | + // .add(reportSalaryDim.getActAwardMoney()) | |
483 | + // .add(reportSalaryDim.getActSubsidyMoney()) | |
484 | + // .add(reportSalaryDim.getActProbationMoney()) | |
485 | + // .add(reportSalaryDim.getActJobCompensateMonry()) | |
486 | + // .add(reportSalaryDim.getActEvalAwardMoney()) | |
487 | + //); | |
488 | + //扣除-平均值 | |
489 | + reportSalaryDim.setActPenaltyMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActPenaltyMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
490 | + reportSalaryDim.setActNecessaryMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActNecessaryMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
491 | + reportSalaryDim.setActPersonTaxMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActPersonTaxMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
492 | + reportSalaryDim.setActAccumulationFundMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActAccumulationFundMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
493 | + //总扣除合计平均值 | |
494 | + reportSalaryDim.setActDeductTotalMoney(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getActDeductTotalMoney()).orElse(BigDecimal.ZERO).doubleValue())); | |
495 | + //reportSalaryDim.setActDeductTotalMoney( | |
496 | + // reportSalaryDim.getActPenaltyMoney() | |
497 | + // .add(reportSalaryDim.getActNecessaryMoney()) | |
498 | + // .add(reportSalaryDim.getActPersonTaxMoney()) | |
499 | + // .add(reportSalaryDim.getActAccumulationFundMoney()) | |
500 | + //); | |
501 | + //总薪酬平均值 = 总收入合计 - 总扣除合计 or 直接取平均值 | |
502 | + reportSalaryDim.setTotalReward(calcAverage(filterUserDims, e -> Optional.ofNullable(e.getTotalReward()).orElse(BigDecimal.ZERO).doubleValue())); | |
503 | + //reportSalaryDim.setTotalReward( | |
504 | + // reportSalaryDim.getActRevenueTotalMoney() | |
505 | + // .subtract(reportSalaryDim.getActDeductTotalMoney())); | |
506 | + } | |
507 | + | |
508 | + /** | |
509 | + * 计算人员的 | |
510 | + * 增加 薪资类型相关项目处理 ++ | |
511 | + * @param salaryPoolDetails | |
512 | + * @param reportSalaryDim | |
513 | + */ | |
514 | + private void extCaleUserMoney(List<SalaryPoolDetail> salaryPoolDetails, ReportSalaryDim reportSalaryDim) { | |
515 | + //额外计算项++ | |
516 | + Map<SalaryTypeEnum, List<SalaryPoolDetail>> salaryTypeEnumListMap = salaryPoolDetails | |
517 | + .stream() | |
518 | + .collect(Collectors.groupingBy(SalaryPoolDetail::getType)); | |
519 | + //收入 | |
520 | + reportSalaryDim.setActKpiMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.ROYALTIES)); | |
521 | + reportSalaryDim.setActAwardMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.AWARD)); | |
522 | + reportSalaryDim.setActSubsidyMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.SUBSIDY)); | |
523 | + reportSalaryDim.setActProbationMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.PROBATION)); | |
524 | + reportSalaryDim.setActJobCompensateMoney(BigDecimal.ZERO); | |
525 | + reportSalaryDim.setActEvalAwardMoney(BigDecimal.ZERO); | |
526 | + //总收入合计 | |
527 | + reportSalaryDim.setActRevenueTotalMoney( | |
528 | + reportSalaryDim.getActKpiMoney() | |
529 | + .add(reportSalaryDim.getActAwardMoney()) | |
530 | + .add(reportSalaryDim.getActSubsidyMoney()) | |
531 | + .add(reportSalaryDim.getActProbationMoney()) | |
532 | + .add(reportSalaryDim.getActJobCompensateMoney()) | |
533 | + .add(reportSalaryDim.getActEvalAwardMoney()) | |
534 | + ); | |
535 | + //扣除 | |
536 | + reportSalaryDim.setActPenaltyMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.PENALTY)); | |
537 | + reportSalaryDim.setActNecessaryMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.NECESSARY)); | |
538 | + reportSalaryDim.setActPersonTaxMoney(getSalaryTypeEnumMoney(salaryTypeEnumListMap,SalaryTypeEnum.PERSON_TAX)); | |
539 | + reportSalaryDim.setActAccumulationFundMoney(BigDecimal.ZERO); | |
540 | + //总扣除合计 | |
541 | + reportSalaryDim.setActDeductTotalMoney( | |
542 | + reportSalaryDim.getActPenaltyMoney() | |
543 | + .add(reportSalaryDim.getActNecessaryMoney()) | |
544 | + .add(reportSalaryDim.getActPersonTaxMoney()) | |
545 | + .add(reportSalaryDim.getActAccumulationFundMoney()) | |
546 | + ); | |
547 | + //总薪酬 = 总收入合计 - 总扣除合计 | |
548 | + reportSalaryDim.setTotalReward( | |
549 | + reportSalaryDim.getActRevenueTotalMoney() | |
550 | + .subtract(reportSalaryDim.getActDeductTotalMoney())); | |
551 | + } | |
552 | + | |
553 | + | |
415 | 554 | public Long saveManagerDimDB(ManagerDTO manager, |
416 | 555 | LocalDate date, |
417 | 556 | Long reportSalaryId, |
418 | 557 | Map<Long, StaffBaseInfoDTO> managerMap, |
419 | - BigDecimal averageSalary, | |
420 | - BigDecimal kpiScoreRatio, | |
421 | - List<Long> manageStaffIds) { | |
558 | + List<Long> manageStaffIds, | |
559 | + Set<Long> managerStaffDimReportIds, | |
560 | + List<ReportSalaryDim> userDims) { | |
422 | 561 | ReportSalaryDim reportSalaryDim = new ReportSalaryDim(); |
423 | 562 | reportSalaryDim.setDimension(ReportDimensionEnum.MANAGER); |
424 | 563 | reportSalaryDim.setUserId(manager.getStaffId()); |
425 | 564 | reportSalaryDim.setUserName(manager.getStaffName()); |
426 | - reportSalaryDim.setTotalReward(averageSalary); | |
427 | - reportSalaryDim.setKpiScoreRatio(kpiScoreRatio); | |
565 | + //计算平均值薪酬的额外项 | |
566 | + extCalcAverage(userDims, managerStaffDimReportIds, reportSalaryDim); | |
428 | 567 | reportSalaryDim.setDataDate(date); |
429 | 568 | reportSalaryDim.setReportSalaryId(reportSalaryId); |
430 | 569 | if (managerMap.containsKey(manager.getStaffId())) { |
... | ... | @@ -550,7 +689,22 @@ public class SalaryReportTask { |
550 | 689 | return userGroupIndicatorHitMap; |
551 | 690 | } |
552 | 691 | |
553 | - | |
692 | + /** | |
693 | + * 这个薪酬详情每天6:00 会计算完成,cn.fw.morax.server.task.SalaryCalcTask#cacheCalculableKpiGroup() | |
694 | + * @param date | |
695 | + * @param pools | |
696 | + * @return <薪酬池id: 薪酬池详情list> | |
697 | + */ | |
698 | + private Map<Long, List<SalaryPoolDetail>> getSalaryPoolDetailMap(LocalDate date, List<SalaryPool> pools) { | |
699 | + if (CollectionUtils.isEmpty(pools)){ | |
700 | + return Collections.emptyMap(); | |
701 | + } | |
702 | + List<SalaryPoolDetail> salaryPoolDetailList = salaryPoolDetailService.list(Wrappers.<SalaryPoolDetail>lambdaQuery() | |
703 | + .in(SalaryPoolDetail::getSalaryPoolId, pools.stream().map(SalaryPool::getId).collect(Collectors.toSet())) | |
704 | + .eq(SalaryPoolDetail::getSalaryDate, date) | |
705 | + .eq(SalaryPoolDetail::getYn, Boolean.TRUE)); | |
706 | + return salaryPoolDetailList.stream().collect(Collectors.groupingBy(SalaryPoolDetail::getSalaryPoolId)); | |
707 | + } | |
554 | 708 | |
555 | 709 | public Map<Long, SalaryGroupProjectTargetHitLog> queryUserTargetValue(Long referId, Long userId, LocalDate dataDate) { |
556 | 710 | List<SalaryGroupProjectTargetHitLog> targetHitLogs = salaryGroupProjectTargetHitLogService.list(Wrappers.<SalaryGroupProjectTargetHitLog>lambdaQuery() |
... | ... | @@ -701,7 +855,8 @@ public class SalaryReportTask { |
701 | 855 | projectBO.setCodeType(codeType); |
702 | 856 | break; |
703 | 857 | } |
704 | - case FIXATION: CAR_SERIES: { | |
858 | + case FIXATION: | |
859 | + case CAR_SERIES: { | |
705 | 860 | projectBO.setCode(project.getCommissionCode()); |
706 | 861 | projectBO.setCodeType(IndicatorCodeTypeEnum.COMBINE_INDICATOR); |
707 | 862 | break; |
... | ... | @@ -721,7 +876,7 @@ public class SalaryReportTask { |
721 | 876 | return projects; |
722 | 877 | } |
723 | 878 | |
724 | - public ReportSalaryDim saveStaffDim(SalaryPool pool, LocalDate date, Long reportSalaryRankId){ | |
879 | + public ReportSalaryDim saveStaffDim(SalaryPool pool, LocalDate date, Long reportSalaryRankId,List<SalaryPoolDetail> salaryPoolDetails){ | |
725 | 880 | ReportSalaryDim reportSalaryDim = new ReportSalaryDim(); |
726 | 881 | reportSalaryDim.setDimension(ReportDimensionEnum.STAFF); |
727 | 882 | reportSalaryDim.setReferId(pool.getUserId()); |
... | ... | @@ -735,14 +890,32 @@ public class SalaryReportTask { |
735 | 890 | reportSalaryDim.setDataDate(date); |
736 | 891 | reportSalaryDim.setReportSalaryId(reportSalaryRankId); |
737 | 892 | reportSalaryDim.setStarLevel(pool.getStarLevel()); |
738 | - reportSalaryDim.setTotalReward(pool.getReward()); | |
739 | 893 | // KpiPool kpiPool = kpiPoolCommonService.queryPool(pool); |
740 | 894 | // if (PublicUtil.isNotEmpty(kpiPool)) { |
741 | 895 | // BigDecimal kpiScoreRatio = Optional.ofNullable(kpiPool.getKpiScoreRatio()).orElse(BigDecimal.ZERO); |
742 | 896 | // reportSalaryDim.setKpiScoreRatio(kpiScoreRatio.multiply(Constant.ONE_HUNDRED)); |
743 | 897 | // } |
898 | + //薪资类型相关项目处理 | |
899 | + extCaleUserMoney(salaryPoolDetails, reportSalaryDim); | |
744 | 900 | reportSalaryDimService.save(reportSalaryDim); |
745 | 901 | return reportSalaryDim; |
746 | 902 | } |
747 | 903 | |
904 | + /** | |
905 | + * 获取 SalaryTypeEnum 对应的薪酬总值 | |
906 | + * @param salaryTypeEnumListMap | |
907 | + * @param salaryTypeEnum | |
908 | + * @return | |
909 | + */ | |
910 | + private BigDecimal getSalaryTypeEnumMoney(Map<SalaryTypeEnum, List<SalaryPoolDetail>> salaryTypeEnumListMap,SalaryTypeEnum salaryTypeEnum){ | |
911 | + if (CollectionUtils.isEmpty(salaryTypeEnumListMap)){ | |
912 | + return BigDecimal.ZERO; | |
913 | + } | |
914 | + List<SalaryPoolDetail> list = salaryTypeEnumListMap.get(salaryTypeEnum); | |
915 | + if (CollectionUtils.isEmpty(list)){ | |
916 | + return BigDecimal.ZERO; | |
917 | + } | |
918 | + return list.stream().filter(Objects::nonNull).map(SalaryPoolDetail::getSalaryAmount).reduce(BigDecimal.ZERO, BigDecimal::add); | |
919 | + } | |
920 | + | |
748 | 921 | } | ... | ... |