Commit a92022b747147f505738c2c8aca25a4221f164fe

Authored by 姜超
1 parent f11b16d6

feature(*): 绩效不再使用kgc

绩效不再使用kgc
fw-morax-dao/src/main/java/cn/fw/morax/dao/kpi/KpiGroupUserDao.java
... ... @@ -19,21 +19,19 @@ public interface KpiGroupUserDao extends BaseMapper<KpiGroupUser> {
19 19 /**
20 20 * 获取某月最近的绩效组人员数据
21 21 *
22   - * @param kgc
23 22 * @param yearMonth
24 23 * @return
25 24 */
26   - KpiGroupUser getMonthLastData(@Param("kgc") String kgc,
  25 + KpiGroupUser getMonthLastData(@Param("kpiGroupId") Long kpiGroupId,
27 26 @Param("userId") Long userId,
28 27 @Param("yearMonth") YearMonth yearMonth);
29 28 /**
30 29 * 获取某月第一天的绩效组人员数据
31 30 *
32   - * @param kgc
33 31 * @param yearMonth
34 32 * @return
35 33 */
36   - KpiGroupUser getMonthFirstData(@Param("kgc") String kgc,
  34 + KpiGroupUser getMonthFirstData(@Param("kpiGroupId") Long kpiGroupId,
37 35 @Param("userId") Long userId,
38 36 @Param("yearMonth") YearMonth yearMonth);
39 37 }
... ...
fw-morax-dao/src/main/resources/mapper/kpi/KpiGroupUserMapper.xml
... ... @@ -14,7 +14,7 @@
14 14 FROM
15 15 kpi_group_user
16 16 WHERE
17   - kgc = #{kgc}
  17 + kpi_group_id = #{kpiGroupId}
18 18 AND user_id = #{userId}
19 19 AND DATE_FORMAT(data_date, '%Y-%m') = #{yearMonth}
20 20 AND yn = 1
... ... @@ -29,7 +29,7 @@
29 29 FROM
30 30 kpi_group_user
31 31 WHERE
32   - kgc = #{kgc}
  32 + kpi_group_id = #{kpiGroupId}
33 33 AND user_id = #{userId}
34 34 AND DATE_FORMAT(data_date, '%Y-%m') = #{yearMonth}
35 35 AND yn = 1
... ...
fw-morax-server/src/main/java/cn/fw/morax/server/task/KpiReportRatioTask.java
... ... @@ -368,10 +368,10 @@ public class KpiReportRatioTask {
368 368 List<KpiGroup> kpiGroups = calDto.getKpiGroups();
369 369  
370 370 for (KpiGroupRank rank : calDto.getKpiGroupRanks()) {
371   - List<String> kgcs = rank.getKgcs();
  371 + List<Long> kpiGroupIds = rank.getKpiGroupIds();
372 372 //绩效排名组下对应的绩效组集合
373 373 List<KpiGroup> rankKpiGroups = kpiGroups.stream()
374   - .filter(kpiGroup -> kgcs.contains(kpiGroup.getKgc()))
  374 + .filter(kpiGroup -> kpiGroupIds.contains(kpiGroup.getId()))
375 375 .collect(Collectors.toList());
376 376 Set<Long> createShopIds = rankKpiGroups.stream().flatMap(kpiGroup -> kpiGroup.getShopIds().stream()).collect(Collectors.toSet());
377 377  
... ... @@ -380,7 +380,7 @@ public class KpiReportRatioTask {
380 380  
381 381 Long shopId = shop.getId();
382 382 Predicate<KpiPool> predicate = pool -> {
383   - return shopId.equals(pool.getShopId()) && kgcs.contains(pool.getKgc()) && Boolean.TRUE.equals(pool.getInclusion());
  383 + return shopId.equals(pool.getShopId()) && kpiGroupIds.contains(pool.getKpiGroupId()) && Boolean.TRUE.equals(pool.getInclusion());
384 384 };
385 385 kpiRatio.setS5(rank.getName());
386 386 kpiRatio.setL5(rank.getId());
... ... @@ -396,7 +396,7 @@ public class KpiReportRatioTask {
396 396  
397 397 KpiRatio kpiRatio = new KpiRatio(ReportDimensionEnum.KPI_RANK, calDto.getGroupId());;
398 398 Predicate<KpiPool> predicate = pool -> {
399   - return kgcs.contains(pool.getKgc()) && Boolean.TRUE.equals(pool.getInclusion());
  399 + return kpiGroupIds.contains(pool.getKpiGroupId()) && Boolean.TRUE.equals(pool.getInclusion());
400 400 };
401 401 kpiRatio.setS5(rank.getName());
402 402 kpiRatio.setL5(rank.getId());
... ... @@ -488,10 +488,10 @@ public class KpiReportRatioTask {
488 488 List<KpiGroupRank> kpiGroupRanks = calDto.getKpiGroupRanks();
489 489  
490 490 Map<Long, String> kpiGroupNameMap = kpiGroups.stream().collect(Collectors.toMap(KpiGroup::getId, KpiGroup::getName, (v1, v2) -> v1));
491   - Map<String, KpiGroupRank> kgcRankMap = new HashMap<>();
  491 + Map<Long, KpiGroupRank> kpiGroupRankMap = new HashMap<>();
492 492 for (KpiGroupRank rank : kpiGroupRanks) {
493   - for (String kgc : rank.getKgcs()) {
494   - kgcRankMap.put(kgc, rank);
  493 + for (Long kpiGroupId : rank.getKpiGroupIds()) {
  494 + kpiGroupRankMap.put(kpiGroupId, rank);
495 495 }
496 496 }
497 497  
... ... @@ -512,8 +512,8 @@ public class KpiReportRatioTask {
512 512 kpiRatio.setL4(pool.getKpiGroupId());
513 513 kpiRatio.setS4(kpiGroupNameMap.getOrDefault(pool.getKpiGroupId(), " "));
514 514  
515   - if (kgcRankMap.containsKey(pool.getKgc())) {
516   - KpiGroupRank rank = kgcRankMap.get(pool.getKgc());
  515 + if (kpiGroupRankMap.containsKey(pool.getKpiGroupId())) {
  516 + KpiGroupRank rank = kpiGroupRankMap.get(pool.getKpiGroupId());
517 517 kpiRatio.setL5(rank.getId());
518 518 kpiRatio.setS5(rank.getName());
519 519 }
... ...
fw-morax-server/src/main/java/cn/fw/morax/server/task/KpiReportTask.java
... ... @@ -144,7 +144,7 @@ public class KpiReportTask {
144 144 */
145 145 private void createRankReport(KpiGroupRank kpiGroupRank, Long groupId, LocalDate date) {
146 146 //获取绩效排名组下的所有绩效组信息
147   - List<KpiGroup> kpiGroups = this.getKpiGroups(kpiGroupRank.getKgcs(), date);
  147 + List<KpiGroup> kpiGroups = this.getKpiGroups(kpiGroupRank.getKpiGroupIds(), date);
148 148 if (CollectionUtils.isEmpty(kpiGroups)){
149 149 log.error("绩效排名组id [{}] 下不存在有效的绩效组信息",kpiGroupRank.getId());
150 150 return;
... ... @@ -643,13 +643,16 @@ public class KpiReportTask {
643 643  
644 644  
645 645  
646   - public List<KpiGroup> getKpiGroups(List<String> egcs, LocalDate date) {
  646 + public List<KpiGroup> getKpiGroups(List<Long> kpiGroupIds, LocalDate date) {
  647 + if (PublicUtil.isEmpty(kpiGroupIds)) {
  648 + return new ArrayList<>();
  649 + }
647 650 List<Integer> effectStatus = new ArrayList<Integer>(){{
648 651 add(SettingStatusEnum.EFFECTIVE.getValue());
649 652 add(SettingStatusEnum.INEFFECTIVE.getValue());
650 653 }};
651 654 List<KpiGroup> kpiGroups = kpiGroupService.list(Wrappers.<KpiGroup>lambdaQuery()
652   - .in(KpiGroup::getKgc, egcs)
  655 + .in(KpiGroup::getId, kpiGroupIds)
653 656 .eq(KpiGroup::getYn, Boolean.TRUE)
654 657 .in(KpiGroup::getStatus, effectStatus)
655 658 .le(KpiGroup::getBeginTime, date)
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupBizService.java
... ... @@ -1096,7 +1096,7 @@ public class KpiGroupBizService {
1096 1096 kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate()
1097 1097 .set(KpiPool::getYn, Boolean.FALSE)
1098 1098 .set(KpiPool::getUpdateTime, new Date())
1099   - .eq(KpiPool::getKgc, kpiGroup.getKgc())
  1099 + .eq(KpiPool::getKpiGroupId, kpiGroup.getId())
1100 1100 .eq(KpiPool::getYn, Boolean.TRUE)
1101 1101 .eq(KpiPool::getMonthly, YearMonth.now())
1102 1102 );
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupDataService.java
... ... @@ -348,7 +348,7 @@ public class KpiGroupDataService {
348 348 .eq(KpiGroupUser::getKpiGroupId, kpiGroupId)
349 349 );
350 350 kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate()
351   - .set(KpiPool::getKgc, kgc)
  351 +// .set(KpiPool::getKgc, kgc)
352 352 .set(KpiPool::getUpdateTime, new Date())
353 353 .eq(KpiPool::getKpiGroupId, kpiGroupId)
354 354 );
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupIndicatorBizService.java
... ... @@ -148,7 +148,7 @@ public class KpiGroupIndicatorBizService {
148 148 * @return
149 149 */
150 150 public LocalDate getPoolLastData(KpiPool kpiPool) {
151   - KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly());
  151 + KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKpiGroupId(), kpiPool.getUserId(), kpiPool.getMonthly());
152 152 if (PublicUtil.isEmpty(kpiGroupUser)) {
153 153 log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool));
154 154 return PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly());
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiPoolBizService.java
... ... @@ -761,7 +761,7 @@ public class KpiPoolBizService {
761 761 * @return
762 762 */
763 763 public void buildPoolData(KpiPool kpiPool, KpiPoolDetailVO kpiPoolDetailVo) {
764   - KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly());
  764 + KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKpiGroupId(), kpiPool.getUserId(), kpiPool.getMonthly());
765 765 if (PublicUtil.isEmpty(kpiGroupUser)) {
766 766 log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool));
767 767 kpiPoolDetailVo.setEndTime(PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly()).atTime(23, 59, 59));
... ... @@ -774,7 +774,7 @@ public class KpiPoolBizService {
774 774 kpiPoolDetailVo.setIgnoreCauseDesc(kpiGroupUser.getIgnoreCauseDesc());
775 775 }
776 776 kpiPoolDetailVo.setEndTime(kpiGroupUser.getDataDate().atTime(23, 59, 59));
777   - KpiGroupUser firstKpiGroupUser = kpiGroupUserService.getMonthFirstData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly());
  777 + KpiGroupUser firstKpiGroupUser = kpiGroupUserService.getMonthFirstData(kpiPool.getKpiGroupId(), kpiPool.getUserId(), kpiPool.getMonthly());
778 778 kpiPoolDetailVo.setStartTime(firstKpiGroupUser.getDataDate().atTime(00, 00, 00));
779 779 }
780 780  
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiPoolCommonService.java
... ... @@ -116,7 +116,7 @@ public class KpiPoolCommonService {
116 116 */
117 117 public KpiPool inspectionPool(KpiGroupUser user) {
118 118 KpiPool kpiPool = kpiPoolService.getOne(Wrappers.<KpiPool>lambdaQuery()
119   - .eq(KpiPool::getKgc, user.getKgc())
  119 + .eq(KpiPool::getKpiGroupId, user.getKpiGroupId())
120 120 .eq(KpiPool::getUserId, user.getUserId())
121 121 .eq(KpiPool::getMonthly, YearMonth.from(user.getDataDate()))
122 122 .eq(KpiPool::getYn, Boolean.TRUE)
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/data/kpi/KpiGroupUserService.java
... ... @@ -11,18 +11,16 @@ public interface KpiGroupUserService extends IService&lt;KpiGroupUser&gt; {
11 11 /**
12 12 * 获取某月最近的绩效组人员数据
13 13 *
14   - * @param kgc
15 14 * @param yearMonth
16 15 * @return
17 16 */
18   - KpiGroupUser getMonthLastData(String kgc, Long userId, YearMonth yearMonth);
  17 + KpiGroupUser getMonthLastData(Long kpiGroupId, Long userId, YearMonth yearMonth);
19 18  
20 19 /**
21 20 * 获取某月第一天的绩效组人员数据
22 21 *
23   - * @param kgc
24 22 * @param yearMonth
25 23 * @return
26 24 */
27   - KpiGroupUser getMonthFirstData(String kgc, Long userId, YearMonth yearMonth);
  25 + KpiGroupUser getMonthFirstData(Long kpiGroupId, Long userId, YearMonth yearMonth);
28 26 }
... ...
fw-morax-service/src/main/java/cn/fw/morax/service/data/kpi/impl/KpiGroupUserServiceImpl.java
... ... @@ -16,11 +16,11 @@ import java.time.YearMonth;
16 16 public class KpiGroupUserServiceImpl extends ServiceImpl<KpiGroupUserDao, KpiGroupUser> implements KpiGroupUserService {
17 17  
18 18 @Override
19   - public KpiGroupUser getMonthLastData(String kgc, Long userId, YearMonth yearMonth) {
20   - return this.baseMapper.getMonthLastData(kgc, userId, yearMonth);
  19 + public KpiGroupUser getMonthLastData(Long kpiGroupId, Long userId, YearMonth yearMonth) {
  20 + return this.baseMapper.getMonthLastData(kpiGroupId, userId, yearMonth);
21 21 }
22 22 @Override
23   - public KpiGroupUser getMonthFirstData(String kgc, Long userId, YearMonth yearMonth) {
24   - return this.baseMapper.getMonthFirstData(kgc, userId, yearMonth);
  23 + public KpiGroupUser getMonthFirstData(Long kpiGroupId, Long userId, YearMonth yearMonth) {
  24 + return this.baseMapper.getMonthFirstData(kpiGroupId, userId, yearMonth);
25 25 }
26 26 }
... ...