Commit e003f9074a5c8bc3a4e320796e084b66f3fe34ae
Merge branch 'test' into 'main'
feature(*): 绩效排名组缓存修改 绩效排名组缓存修改 See merge request !124
Showing
1 changed file
with
12 additions
and
28 deletions
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiPoolBizService.java
... | ... | @@ -13,10 +13,7 @@ import cn.fw.morax.domain.bo.kpi.KpiRankCalculableBO; |
13 | 13 | import cn.fw.morax.domain.bo.kpi.KpiStarLadderBO; |
14 | 14 | import cn.fw.morax.domain.db.kpi.*; |
15 | 15 | import cn.fw.morax.domain.dto.kpi.KpiGroupRankConfigQueryDTO; |
16 | -import cn.fw.morax.domain.enums.KpiAssessTypeEnum; | |
17 | -import cn.fw.morax.domain.enums.KpiIgnoreCauseEnum; | |
18 | -import cn.fw.morax.domain.enums.StarEvaluationEnum; | |
19 | -import cn.fw.morax.domain.enums.StarLevelEnum; | |
16 | +import cn.fw.morax.domain.enums.*; | |
20 | 17 | import cn.fw.morax.domain.vo.kpi.*; |
21 | 18 | import cn.fw.morax.service.data.kpi.*; |
22 | 19 | import com.alibaba.fastjson.JSON; |
... | ... | @@ -902,34 +899,21 @@ public class KpiPoolBizService { |
902 | 899 | * @param localDate |
903 | 900 | */ |
904 | 901 | public void cacheCalculableKpiGroupRank(LocalDate localDate) { |
905 | - List<KpiGroup> kpiGroups = kpiGroupService.queryKgiGroupsByDay(localDate); | |
906 | - if (CollectionUtils.isEmpty(kpiGroups)) { | |
907 | - log.info("没有需要计算排名的绩效组,日期:{}", localDate); | |
908 | - return; | |
909 | - } | |
910 | - Set<Long> calculateSeparatelyIds = kpiGroups.stream().map(KpiGroup::getId).collect(Collectors.toSet()); | |
911 | - Map<String, Long> kgcIdMap = kpiGroups.stream().collect(Collectors.toMap(KpiGroup::getKgc, KpiGroup::getId, (v1, v2) -> v1)); | |
912 | 902 | List<String> rankBOS = new ArrayList<>(); |
913 | - List<KpiGroupRank> kpiGroupRanks = kpiGroupRankService.list(Wrappers.<KpiGroupRank>lambdaQuery().eq(KpiGroupRank::getYn, Boolean.TRUE)); | |
903 | + List<KpiGroupRank> kpiGroupRanks = kpiGroupRankService.list(Wrappers.<KpiGroupRank>lambdaQuery() | |
904 | + .eq(KpiGroupRank::getStatus, SettingStatusEnum.EFFECTIVE) | |
905 | + .eq(KpiGroupRank::getYn, Boolean.TRUE) | |
906 | + ); | |
914 | 907 | for (KpiGroupRank kpiGroupRank : kpiGroupRanks) { |
915 | - Set<Long> kpiGroupIds = new HashSet<>(); | |
916 | - for (String kgc : kpiGroupRank.getKgcs()) { | |
917 | - Long kpiGroupId = kgcIdMap.getOrDefault(kgc, 0L); | |
918 | - if (kpiGroupId > 0) { | |
919 | - kpiGroupIds.add(kpiGroupId); | |
920 | - calculateSeparatelyIds.remove(kpiGroupId); | |
921 | - } | |
922 | - } | |
923 | - //@todo 缓存绩效排名组 | |
924 | - if (PublicUtil.isNotEmpty(kpiGroupIds)) { | |
925 | - rankBOS.add(JSONObject.toJSONString(cacheCalculableKpiGroupRank(kpiGroupRank, kpiGroupIds, localDate))); | |
908 | + if (PublicUtil.isNotEmpty(kpiGroupRank.getKpiGroupIds())) { | |
909 | + rankBOS.add(JSONObject.toJSONString(cacheCalculableKpiGroupRank(kpiGroupRank, | |
910 | + new HashSet<>(kpiGroupRank.getKpiGroupIds()), localDate))); | |
926 | 911 | } |
927 | 912 | } |
928 | - kpiGroups.stream().filter(kpiGroup -> calculateSeparatelyIds.contains(kpiGroup.getId())).forEach(kpiGroup -> { | |
929 | - rankBOS.add(JSONObject.toJSONString(cacheCalculableKpiGroupRank(kpiGroup, localDate))); | |
930 | - }); | |
931 | - ListOperations<String, String> listOps = stringRedisTemplate.opsForList(); | |
932 | - listOps.rightPushAll(getCalcuStarKey(), rankBOS); | |
913 | + if (PublicUtil.isNotEmpty(rankBOS)) { | |
914 | + ListOperations<String, String> listOps = stringRedisTemplate.opsForList(); | |
915 | + listOps.rightPushAll(getCalcuStarKey(), rankBOS); | |
916 | + } | |
933 | 917 | } |
934 | 918 | |
935 | 919 | /** | ... | ... |