Commit a9445e724e7a6f83f2a122f9c6f94ee4f6e982bd
1 parent
58b7591d
feature(*): 查看考评详情
查看考评详情
Showing
4 changed files
with
98 additions
and
49 deletions
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/eval/EvalUserRankDTO.java
0 → 100644
1 | +package cn.fw.morax.domain.dto.eval; | ||
2 | + | ||
3 | +import cn.fw.morax.common.utils.PublicUtil; | ||
4 | +import lombok.AllArgsConstructor; | ||
5 | +import lombok.Builder; | ||
6 | +import lombok.Data; | ||
7 | +import lombok.NoArgsConstructor; | ||
8 | + | ||
9 | +import javax.validation.constraints.NotNull; | ||
10 | +import java.time.LocalDate; | ||
11 | +import java.time.YearMonth; | ||
12 | + | ||
13 | +/** | ||
14 | + * <p> | ||
15 | + * 绩效组排名配置 | ||
16 | + * </p> | ||
17 | + * | ||
18 | + * @author jiangchao | ||
19 | + * @since 2022-09-26 | ||
20 | + */ | ||
21 | +@Data | ||
22 | +@Builder | ||
23 | +@NoArgsConstructor | ||
24 | +@AllArgsConstructor | ||
25 | +public class EvalUserRankDTO { | ||
26 | + | ||
27 | + /** | ||
28 | + * 用户id | ||
29 | + */ | ||
30 | +// @NotNull(message = "用户id不能为空") | ||
31 | + private Long userId; | ||
32 | + | ||
33 | + /** | ||
34 | + * 门店 | ||
35 | + */ | ||
36 | + @NotNull(message = "门店") | ||
37 | + private Long shopId; | ||
38 | + | ||
39 | + /** | ||
40 | + * 岗位 | ||
41 | + */ | ||
42 | + @NotNull(message = "岗位") | ||
43 | + private Long postId; | ||
44 | + | ||
45 | + /** | ||
46 | + * 考评排名组id | ||
47 | + */ | ||
48 | + @NotNull(message = "考评排名组id") | ||
49 | + private Long evalGroupRankId; | ||
50 | + | ||
51 | + /** | ||
52 | + * 月份 | ||
53 | + */ | ||
54 | + private YearMonth monthly; | ||
55 | + | ||
56 | + public void initMonthly() { | ||
57 | + if (PublicUtil.isEmpty(this.monthly)) { | ||
58 | + this.monthly = YearMonth.now(); | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | +} |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/EvalSelectorVO.java
@@ -17,17 +17,8 @@ import java.util.List; | @@ -17,17 +17,8 @@ import java.util.List; | ||
17 | */ | 17 | */ |
18 | @Data | 18 | @Data |
19 | @EqualsAndHashCode | 19 | @EqualsAndHashCode |
20 | -@Builder | ||
21 | public class EvalSelectorVO { | 20 | public class EvalSelectorVO { |
22 | /** | 21 | /** |
23 | - * 岗位id | ||
24 | - */ | ||
25 | - private Long postId; | ||
26 | - /** | ||
27 | - * 门店id | ||
28 | - */ | ||
29 | - private Long shopId; | ||
30 | - /** | ||
31 | * 名称 | 22 | * 名称 |
32 | */ | 23 | */ |
33 | private String name; | 24 | private String name; |
@@ -37,17 +28,6 @@ public class EvalSelectorVO { | @@ -37,17 +28,6 @@ public class EvalSelectorVO { | ||
37 | */ | 28 | */ |
38 | private List<EvalUserGroupRankVO> ranks; | 29 | private List<EvalUserGroupRankVO> ranks; |
39 | 30 | ||
40 | - public static EvalSelectorVO whit(Long postId, Long shopId, String shopName, String postName) { | ||
41 | - String name = shopName + | ||
42 | - " (" + | ||
43 | - postName + | ||
44 | - ") "; | ||
45 | - EvalSelectorVO vo = new EvalSelectorVO(); | ||
46 | - vo.setShopId(shopId); | ||
47 | - vo.setPostId(postId); | ||
48 | - vo.setName(name); | ||
49 | - return vo; | ||
50 | - } | ||
51 | 31 | ||
52 | public EvalSelectorVO() { | 32 | public EvalSelectorVO() { |
53 | } | 33 | } |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/app/EvalPoolController.java
@@ -9,6 +9,7 @@ import cn.fw.common.web.auth.annotation.CurrentUser; | @@ -9,6 +9,7 @@ import cn.fw.common.web.auth.annotation.CurrentUser; | ||
9 | import cn.fw.data.base.domain.common.Message; | 9 | import cn.fw.data.base.domain.common.Message; |
10 | import cn.fw.morax.common.utils.PublicUtil; | 10 | import cn.fw.morax.common.utils.PublicUtil; |
11 | import cn.fw.morax.domain.dto.eval.EvalGroupIndicatorRankDTO; | 11 | import cn.fw.morax.domain.dto.eval.EvalGroupIndicatorRankDTO; |
12 | +import cn.fw.morax.domain.dto.eval.EvalUserRankDTO; | ||
12 | import cn.fw.morax.domain.dto.query.EvalPoolQueryDTO; | 13 | import cn.fw.morax.domain.dto.query.EvalPoolQueryDTO; |
13 | import cn.fw.morax.domain.enums.EvalScopeEnum; | 14 | import cn.fw.morax.domain.enums.EvalScopeEnum; |
14 | import cn.fw.morax.domain.vo.EvalSelectorVO; | 15 | import cn.fw.morax.domain.vo.EvalSelectorVO; |
@@ -24,6 +25,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -24,6 +25,7 @@ import lombok.extern.slf4j.Slf4j; | ||
24 | import org.springframework.validation.annotation.Validated; | 25 | import org.springframework.validation.annotation.Validated; |
25 | import org.springframework.web.bind.annotation.*; | 26 | import org.springframework.web.bind.annotation.*; |
26 | 27 | ||
28 | +import javax.validation.Valid; | ||
27 | import javax.validation.constraints.NotNull; | 29 | import javax.validation.constraints.NotNull; |
28 | import java.time.LocalDate; | 30 | import java.time.LocalDate; |
29 | import java.time.YearMonth; | 31 | import java.time.YearMonth; |
@@ -79,7 +81,8 @@ public class EvalPoolController { | @@ -79,7 +81,8 @@ public class EvalPoolController { | ||
79 | @GetMapping("/staff-selector") | 81 | @GetMapping("/staff-selector") |
80 | @IgnoreUserToken | 82 | @IgnoreUserToken |
81 | @ControllerMethod("本月可查看的其他考评池选项") | 83 | @ControllerMethod("本月可查看的其他考评池选项") |
82 | - public Message<List<EvalSelectorVO>> evalPoolSelector(@CurrentUser LoginAuthBean user, Long userId, @RequestParam(required = false) YearMonth monthly) { | 84 | + public Message<List<EvalSelectorVO>> evalPoolSelector(@CurrentUser LoginAuthBean user, Long userId, |
85 | + @RequestParam(required = false) YearMonth monthly) { | ||
83 | if (Objects.isNull(monthly)) { | 86 | if (Objects.isNull(monthly)) { |
84 | monthly = YearMonth.now(); | 87 | monthly = YearMonth.now(); |
85 | } | 88 | } |
@@ -91,33 +94,28 @@ public class EvalPoolController { | @@ -91,33 +94,28 @@ public class EvalPoolController { | ||
91 | 94 | ||
92 | /** | 95 | /** |
93 | * 考评详情查询 (查看自己考评详情) | 96 | * 考评详情查询 (查看自己考评详情) |
94 | - * | ||
95 | - * @param userId 用户id | ||
96 | - * @param monthly 月度 | ||
97 | - * @return 绩效池详情 | ||
98 | - * @ignoreParams userId | ||
99 | */ | 97 | */ |
100 | @GetMapping("/own-detail") | 98 | @GetMapping("/own-detail") |
101 | @ControllerMethod("考评详情查询") | 99 | @ControllerMethod("考评详情查询") |
102 | public Message<List<EvalUserRankStageVO>> evalPoolOwnDetail(@CurrentUser Long userId, | 100 | public Message<List<EvalUserRankStageVO>> evalPoolOwnDetail(@CurrentUser Long userId, |
103 | - @RequestParam(required = false) YearMonth monthly) { | ||
104 | - if (Objects.isNull(monthly)) { | ||
105 | - monthly = YearMonth.now(); | ||
106 | - } | ||
107 | - return success(evalGroupPoolService.queryUserPoolDetail(userId, monthly)); | 101 | + @Valid EvalUserRankDTO dto) { |
102 | + dto.initMonthly(); | ||
103 | + dto.setUserId(userId); | ||
104 | + return success(evalGroupPoolService.queryRankStagePools(dto)); | ||
108 | } | 105 | } |
109 | 106 | ||
110 | /** | 107 | /** |
111 | * 考评详情查询 (查看他人考评详情) | 108 | * 考评详情查询 (查看他人考评详情) |
112 | * | 109 | * |
113 | - * @param evalPoolId 用户id | ||
114 | - * @return 绩效池详情 | ||
115 | - * @ignoreParams userId | ||
116 | */ | 110 | */ |
117 | - @GetMapping("/staff") | 111 | + @GetMapping("/detail") |
118 | @ControllerMethod("考评详情查询") | 112 | @ControllerMethod("考评详情查询") |
119 | - public Message<EvalUserPoolVO> evalPoolDetail(@NotNull(message = "考评池id不能为空") Long evalPoolId) { | ||
120 | - return success(evalGroupPoolService.queryRankStagePools(evalPoolId)); | 113 | + public Message<List<EvalUserRankStageVO>> evalPoolDetail(@Valid EvalUserRankDTO dto) { |
114 | + dto.initMonthly(); | ||
115 | + if (PublicUtil.isEmpty(dto.getUserId())) { | ||
116 | + throw new BusinessException("人员信息不能为空"); | ||
117 | + } | ||
118 | + return success(evalGroupPoolService.queryRankStagePools(dto)); | ||
121 | } | 119 | } |
122 | 120 | ||
123 | /** | 121 | /** |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupPoolService.java
@@ -7,6 +7,7 @@ import cn.fw.morax.common.utils.PublicUtil; | @@ -7,6 +7,7 @@ import cn.fw.morax.common.utils.PublicUtil; | ||
7 | import cn.fw.morax.domain.db.eval.*; | 7 | import cn.fw.morax.domain.db.eval.*; |
8 | import cn.fw.morax.domain.db.kpi.*; | 8 | import cn.fw.morax.domain.db.kpi.*; |
9 | import cn.fw.morax.domain.dto.eval.EvalGroupIndicatorRankDTO; | 9 | import cn.fw.morax.domain.dto.eval.EvalGroupIndicatorRankDTO; |
10 | +import cn.fw.morax.domain.dto.eval.EvalUserRankDTO; | ||
10 | import cn.fw.morax.domain.enums.*; | 11 | import cn.fw.morax.domain.enums.*; |
11 | import cn.fw.morax.domain.vo.EvalSelectorVO; | 12 | import cn.fw.morax.domain.vo.EvalSelectorVO; |
12 | import cn.fw.morax.domain.vo.SelectorVO; | 13 | import cn.fw.morax.domain.vo.SelectorVO; |
@@ -104,29 +105,38 @@ public class EvalGroupPoolService { | @@ -104,29 +105,38 @@ public class EvalGroupPoolService { | ||
104 | * | 105 | * |
105 | * @return | 106 | * @return |
106 | */ | 107 | */ |
107 | - public List<EvalUserRankStageVO> queryRankStagePools(final Long userId, final Long evalGroupRankId) { | ||
108 | - | 108 | + public List<EvalUserRankStageVO> queryRankStagePools(EvalUserRankDTO dto) { |
109 | + final Long userId = dto.getUserId(); | ||
110 | + final Long postId = dto.getPostId(); | ||
111 | + final Long shopId = dto.getShopId(); | ||
112 | + final Long evalGroupRankId = dto.getEvalGroupRankId(); | ||
109 | List<EvalUserPool> pools = evalUserPoolService.list(Wrappers.<EvalUserPool>lambdaQuery() | 113 | List<EvalUserPool> pools = evalUserPoolService.list(Wrappers.<EvalUserPool>lambdaQuery() |
114 | + .eq(EvalUserPool::getPostId, postId) | ||
115 | + .eq(EvalUserPool::getShopId, shopId) | ||
110 | .eq(EvalUserPool::getUserId, userId) | 116 | .eq(EvalUserPool::getUserId, userId) |
111 | .eq(EvalUserPool::getEvalGroupRankId, evalGroupRankId) | 117 | .eq(EvalUserPool::getEvalGroupRankId, evalGroupRankId) |
112 | .eq(EvalUserPool::getYn, Boolean.TRUE) | 118 | .eq(EvalUserPool::getYn, Boolean.TRUE) |
113 | .orderByDesc(EvalUserPool::getScoreRatio) | 119 | .orderByDesc(EvalUserPool::getScoreRatio) |
114 | ); | 120 | ); |
115 | - pools.stream().map(EvalUserPool::getE) | ||
116 | - | 121 | + Map<Long, List<EvalUserPool>> stagePoolMap = pools.stream().collect(Collectors.groupingBy(EvalUserPool::getEvalGroupRankStageId)); |
122 | + List<Long> evalGroupRankStageIds = pools.stream().map(EvalUserPool::getEvalGroupRankStageId).collect(Collectors.toList()); | ||
117 | 123 | ||
118 | List<EvalGroupRankStage> stages = evalGroupRankStageService.list(Wrappers.<EvalGroupRankStage>lambdaQuery() | 124 | List<EvalGroupRankStage> stages = evalGroupRankStageService.list(Wrappers.<EvalGroupRankStage>lambdaQuery() |
119 | - .in(EvalGroupRankStage::getEvalGroupRankId, evalGroupRankId) | 125 | + .in(EvalGroupRankStage::getId, evalGroupRankStageIds) |
120 | .eq(EvalGroupRankStage::getYn, Boolean.TRUE) | 126 | .eq(EvalGroupRankStage::getYn, Boolean.TRUE) |
127 | + .orderByAsc(EvalGroupRankStage::getBeginTime) | ||
121 | ); | 128 | ); |
122 | 129 | ||
123 | - | ||
124 | - | ||
125 | - EvalUserPool evalUserPool = evalUserPoolService.getById(poolId); | ||
126 | - if (PublicUtil.isEmpty(evalUserPool)) { | ||
127 | - return null; | 130 | + List<EvalUserRankStageVO> stageVos = PublicUtil.copyList(stages, EvalUserRankStageVO.class); |
131 | + for (EvalUserRankStageVO stageVO : stageVos) { | ||
132 | + List<EvalUserPool> rankPools = stagePoolMap.get(stageVO.getId()); | ||
133 | + if (PublicUtil.isNotEmpty(rankPools)) { | ||
134 | + EvalUserPool stagePool = rankPools.get(0); | ||
135 | + EvalUserPoolVO evalUserPoolVO = PublicUtil.copy(stagePool, EvalUserPoolVO.class); | ||
136 | + stageVO.setPool(evalUserPoolVO); | ||
137 | + } | ||
128 | } | 138 | } |
129 | - return poolDetail(evalUserPool); | 139 | + return stageVos; |
130 | } | 140 | } |
131 | 141 | ||
132 | // /** | 142 | // /** |
@@ -376,7 +386,6 @@ public class EvalGroupPoolService { | @@ -376,7 +386,6 @@ public class EvalGroupPoolService { | ||
376 | if (PublicUtil.isEmpty(pool)) { | 386 | if (PublicUtil.isEmpty(pool)) { |
377 | return null; | 387 | return null; |
378 | } | 388 | } |
379 | -// BV.notNull(pool, "考评池不存在"); | ||
380 | Long userId = pool.getUserId(); | 389 | Long userId = pool.getUserId(); |
381 | return getHitIndicatorDetail(evalPoolId, EvalScopeEnum.STAFF, userId, evalGroupIndicatorId, dataDate); | 390 | return getHitIndicatorDetail(evalPoolId, EvalScopeEnum.STAFF, userId, evalGroupIndicatorId, dataDate); |
382 | } | 391 | } |