Commit fac65912d691ddc007e32e1e0eecbd468076e86d
1 parent
ca30e172
feature(*): 考评排名组
考评排名组
Showing
12 changed files
with
860 additions
and
6 deletions
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalGroupRankDao.java
0 → 100644
1 | +package cn.fw.morax.dao.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.domain.db.eval.EvalGroupRank; | |
5 | +import cn.fw.morax.domain.dto.query.EvalGroupRankQueryDTO; | |
6 | +import cn.fw.morax.domain.dto.query.KpiGroupRankQueryDTO; | |
7 | +import cn.fw.morax.domain.vo.eval.EvalGroupRankVO; | |
8 | +import cn.fw.morax.domain.vo.kpi.KpiGroupRankVO; | |
9 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
10 | +import org.apache.ibatis.annotations.Param; | |
11 | + | |
12 | +import java.util.List; | |
13 | + | |
14 | +/** | |
15 | + * <p> | |
16 | + * 考评池 Mapper 接口 | |
17 | + * </p> | |
18 | + * | |
19 | + * @author jiangchao | |
20 | + * @since 2023-02-23 | |
21 | + */ | |
22 | +public interface EvalGroupRankDao extends BaseMapper<EvalGroupRank> { | |
23 | + | |
24 | + /** | |
25 | + * 查询绩效组排名总条数 | |
26 | + * | |
27 | + * @param dto | |
28 | + * @return | |
29 | + */ | |
30 | + long queryPageRankTotal(EvalGroupRankQueryDTO dto); | |
31 | + | |
32 | + /** | |
33 | + * 绩效组排名分页查询 | |
34 | + * | |
35 | + * @param dto | |
36 | + * @return | |
37 | + */ | |
38 | + List<EvalGroupRankVO> queryPageRank(EvalGroupRankQueryDTO dto); | |
39 | + | |
40 | + /** | |
41 | + * 通过egc查询绩效组排名 | |
42 | + * | |
43 | + * @return | |
44 | + */ | |
45 | + List<EvalGroupRankVO> queryByEgcs(@Param("egcs") List<String> egcs, | |
46 | + @Param("filterId") Long filterId); | |
47 | + | |
48 | +} | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalUserPoolDao.java
... | ... | @@ -24,8 +24,6 @@ public interface EvalUserPoolDao extends BaseMapper<EvalUserPool> { |
24 | 24 | |
25 | 25 | List<EvalUserPool> getLastPool(@Param("monthly") YearMonth monthly, @Param("groupId") Long groupId); |
26 | 26 | |
27 | - List<EvalUserPoolVO> getPools(@Param("monthly") YearMonth monthly, @Param("userId") Long userId); | |
28 | - | |
29 | 27 | /** |
30 | 28 | * 考评池分页查询 |
31 | 29 | * | ... | ... |
fw-morax-dao/src/main/resources/mapper/eval/EvalGroupRankMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="cn.fw.morax.dao.eval.EvalGroupRankDao"> | |
4 | + | |
5 | + <!-- 通用查询映射结果 --> | |
6 | + <resultMap id="BaseResultMap" type="cn.fw.morax.domain.db.eval.EvalGroupRank"> | |
7 | + <result column="id" property="id"/> | |
8 | + <result column="egcs" property="egcs" typeHandler="cn.fw.common.data.mybatis.handler.StringListTypeHandler"/> | |
9 | + <result column="group_id" property="groupId"/> | |
10 | + <result column="yn" property="yn"/> | |
11 | + <result column="create_by" property="createBy"/> | |
12 | + <result column="create_time" property="createTime"/> | |
13 | + <result column="update_by" property="updateBy"/> | |
14 | + <result column="update_time" property="updateTime"/> | |
15 | + </resultMap> | |
16 | + | |
17 | + <sql id="all_columns"> | |
18 | + id, name, egcs, | |
19 | + group_id, yn, create_time, update_time | |
20 | + </sql> | |
21 | + | |
22 | + <select id="queryPageRankTotal" parameterType="cn.fw.morax.domain.dto.query.EvalGroupRankQueryDTO" resultType="java.lang.Long"> | |
23 | + SELECT | |
24 | + count(*) | |
25 | + FROM | |
26 | + eval_group_rank | |
27 | + WHERE | |
28 | + yn = 1 | |
29 | + and group_id = #{groupId} | |
30 | + <if test="type != null"> | |
31 | + AND type = #{type} | |
32 | + </if> | |
33 | + <if test="egcs != null and egcs.size > 0 "> | |
34 | + AND | |
35 | + <foreach collection="egcs" item="egc" separator=" OR " open="(" close=")"> | |
36 | + FIND_IN_SET(#{egc}, egcs) | |
37 | + </foreach> | |
38 | + </if> | |
39 | + </select> | |
40 | + | |
41 | + <select id="queryPageRank" parameterType="cn.fw.morax.domain.dto.query.KpiGroupRankQueryDTO" | |
42 | + resultType="cn.fw.morax.domain.vo.eval.EvalGroupRankVO"> | |
43 | + SELECT | |
44 | + <include refid="all_columns"/> | |
45 | + FROM | |
46 | + eval_group_rank | |
47 | + WHERE | |
48 | + yn = 1 | |
49 | + and group_id = #{groupId} | |
50 | + <if test="type != null"> | |
51 | + AND type = #{type} | |
52 | + </if> | |
53 | + <if test="egcs != null and egcs.size > 0 "> | |
54 | + AND | |
55 | + <foreach collection="egcs" item="egc" separator=" OR " open="(" close=")"> | |
56 | + FIND_IN_SET(#{egc}, egcs) | |
57 | + </foreach> | |
58 | + </if> | |
59 | + limit #{current},#{pageSize} | |
60 | + </select> | |
61 | + | |
62 | + <select id="queryByEgcs" resultType="cn.fw.morax.domain.vo.eval.EvalGroupRankVO"> | |
63 | + SELECT | |
64 | + <include refid="all_columns"/> | |
65 | + FROM | |
66 | + eval_group_rank | |
67 | + WHERE | |
68 | + yn = 1 | |
69 | + <if test="filterId != null"> | |
70 | + AND id != #{filterId} | |
71 | + </if> | |
72 | + <if test="egcs != null and egcs.size > 0 "> | |
73 | + AND | |
74 | + <foreach collection="egcs" item="egc" separator=" OR " open="(" close=")"> | |
75 | + FIND_IN_SET(#{egc}, egcs) | |
76 | + </foreach> | |
77 | + </if> | |
78 | + </select> | |
79 | + | |
80 | +</mapper> | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalGroupRank.java
0 → 100644
1 | +package cn.fw.morax.domain.db.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableEntity; | |
4 | +import cn.fw.common.data.mybatis.handler.StringListTypeHandler; | |
5 | +import cn.fw.morax.domain.enums.DimensionTypeEnum; | |
6 | +import cn.fw.morax.domain.enums.StarEvaluationEnum; | |
7 | +import com.baomidou.mybatisplus.annotation.TableField; | |
8 | +import com.baomidou.mybatisplus.annotation.TableLogic; | |
9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
10 | +import lombok.Data; | |
11 | +import lombok.EqualsAndHashCode; | |
12 | + | |
13 | +import java.math.BigDecimal; | |
14 | +import java.util.List; | |
15 | + | |
16 | +/** | |
17 | + * <p> | |
18 | + * 考评组排名配置 | |
19 | + * </p> | |
20 | + * | |
21 | + * @author jiangchao | |
22 | + * @since 2022-09-26 | |
23 | + */ | |
24 | +@Data | |
25 | +@TableName(autoResultMap = true) | |
26 | +@EqualsAndHashCode(callSuper = true) | |
27 | +public class EvalGroupRank extends BaseAuditableEntity<EvalGroupRank, Long> { | |
28 | + | |
29 | + /** | |
30 | + * 组合名称 | |
31 | + */ | |
32 | + private String name; | |
33 | + | |
34 | + /** | |
35 | + * 维度类型 1:人员 2:门店 | |
36 | + */ | |
37 | + private DimensionTypeEnum type; | |
38 | + | |
39 | + /** | |
40 | + * 绩效组编码 | |
41 | + */ | |
42 | + @TableField(typeHandler = StringListTypeHandler.class) | |
43 | + private List<String> egcs; | |
44 | + | |
45 | + /** | |
46 | + * 集团id | |
47 | + */ | |
48 | + private Long groupId; | |
49 | + | |
50 | + /** | |
51 | + * 逻辑删除 | |
52 | + */ | |
53 | + @TableLogic | |
54 | + private Boolean yn; | |
55 | + | |
56 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/eval/EvalGroupRankDto.java
0 → 100644
1 | +package cn.fw.morax.domain.dto.eval; | |
2 | + | |
3 | +import cn.fw.common.web.annotation.LoginContextField; | |
4 | +import cn.fw.morax.domain.dto.kpi.KpiGroupRankStarLaddersDTO; | |
5 | +import cn.fw.morax.domain.enums.StarEvaluationEnum; | |
6 | +import lombok.AllArgsConstructor; | |
7 | +import lombok.Builder; | |
8 | +import lombok.Data; | |
9 | +import lombok.NoArgsConstructor; | |
10 | +import org.hibernate.validator.constraints.Length; | |
11 | + | |
12 | +import javax.validation.Valid; | |
13 | +import javax.validation.constraints.NotBlank; | |
14 | +import javax.validation.constraints.NotNull; | |
15 | +import javax.validation.constraints.Size; | |
16 | +import java.math.BigDecimal; | |
17 | +import java.util.List; | |
18 | + | |
19 | +/** | |
20 | + * <p> | |
21 | + * 考评组排名配置 | |
22 | + * </p> | |
23 | + * | |
24 | + * @author jiangchao | |
25 | + * @since 2022-09-26 | |
26 | + */ | |
27 | +@Data | |
28 | +@Builder | |
29 | +@NoArgsConstructor | |
30 | +@AllArgsConstructor | |
31 | +public class EvalGroupRankDto { | |
32 | + | |
33 | + /** | |
34 | + * id | |
35 | + */ | |
36 | + private Long id; | |
37 | + | |
38 | + /** | |
39 | + * 组合名称 | |
40 | + */ | |
41 | + @NotBlank(message = "组合名称不能为空") | |
42 | + @Length(max = 255, message = "组合名称超出最大限制") | |
43 | + private String name; | |
44 | + | |
45 | + /** | |
46 | + * 星级评定方式;1:考评得分率 2:人员百分比 | |
47 | + */ | |
48 | + @NotNull(message = "星级评定方式不能为空") | |
49 | + private StarEvaluationEnum starEvaluationType; | |
50 | + | |
51 | + /** | |
52 | + * 集团id | |
53 | + force */ | |
54 | + @LoginContextField(LoginContextField.Name.GROUP_ID) | |
55 | + private Long groupId; | |
56 | + | |
57 | + /** | |
58 | + * 用户名 | |
59 | + force */ | |
60 | + @LoginContextField(LoginContextField.Name.USER_NAME) | |
61 | + private String userName; | |
62 | + | |
63 | + /** | |
64 | + * 用户名 | |
65 | + force */ | |
66 | + @LoginContextField(LoginContextField.Name.USER_ID) | |
67 | + private Long userId; | |
68 | + | |
69 | + /** | |
70 | + * 撤销D级得分率 | |
71 | + */ | |
72 | + private BigDecimal revokedScoreRatio; | |
73 | + | |
74 | + /** | |
75 | + * 考评组编码 | |
76 | + */ | |
77 | + @NotNull(message = "考评组编码不能为空") | |
78 | + @Size(min = 1, message = "考评组编码不能为空") | |
79 | + private List<String> egcs; | |
80 | + | |
81 | + /** | |
82 | + * 星级评定阶梯 | |
83 | + */ | |
84 | + @Valid | |
85 | + @Size(min = 1, message = "星级评定阶梯不能为空") | |
86 | + @NotNull(message = "星级评定阶梯不能为空") | |
87 | + private List<KpiGroupRankStarLaddersDTO> starLadders; | |
88 | + | |
89 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/query/EvalGroupRankQueryDTO.java
0 → 100644
1 | +package cn.fw.morax.domain.dto.query; | |
2 | + | |
3 | +import cn.fw.common.page.BasePageQuery; | |
4 | +import cn.fw.common.web.annotation.LoginContextField; | |
5 | +import cn.fw.morax.domain.enums.DimensionTypeEnum; | |
6 | +import lombok.Data; | |
7 | + | |
8 | +import java.util.List; | |
9 | + | |
10 | +@Data | |
11 | +public class EvalGroupRankQueryDTO extends BasePageQuery { | |
12 | + | |
13 | + /** | |
14 | + * 岗位id | |
15 | + */ | |
16 | + private Long postId; | |
17 | + | |
18 | + /** | |
19 | + * 维度类型 1:人员 2:门店 | |
20 | + */ | |
21 | + private DimensionTypeEnum type; | |
22 | + | |
23 | + /** | |
24 | + * 考评组编码 | |
25 | + */ | |
26 | + private List<String> egcs; | |
27 | + | |
28 | + /** | |
29 | + * 考评组id | |
30 | + */ | |
31 | + private List<Long> evalGroupIds; | |
32 | + | |
33 | + /** | |
34 | + * 集团id | |
35 | + */ | |
36 | + @LoginContextField(LoginContextField.Name.GROUP_ID) | |
37 | + private Long groupId; | |
38 | + | |
39 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalGroupRankVO.java
0 → 100644
1 | +package cn.fw.morax.domain.vo.eval; | |
2 | + | |
3 | +import cn.fw.morax.domain.enums.DimensionTypeEnum; | |
4 | +import cn.fw.morax.domain.enums.StarEvaluationEnum; | |
5 | +import cn.fw.morax.domain.vo.kpi.KpiGroupRankStarLaddersVO; | |
6 | +import cn.fw.morax.domain.vo.kpi.KpiGroupVO; | |
7 | +import lombok.Data; | |
8 | + | |
9 | +import java.math.BigDecimal; | |
10 | +import java.util.List; | |
11 | +import java.util.Set; | |
12 | + | |
13 | +/** | |
14 | + * @author : kurisu | |
15 | + * @date : 2022-4-6 | |
16 | + * @desc : 考评组配置 | |
17 | + */ | |
18 | +@Data | |
19 | +public class EvalGroupRankVO { | |
20 | + /** | |
21 | + * 主键id | |
22 | + */ | |
23 | + private Long id; | |
24 | + | |
25 | + /** | |
26 | + * 维度类型 1:人员 2:门店 | |
27 | + */ | |
28 | + private DimensionTypeEnum type; | |
29 | + | |
30 | + /** | |
31 | + * 组合名称 | |
32 | + */ | |
33 | + private String name; | |
34 | + | |
35 | + /** | |
36 | + * 岗位id | |
37 | + */ | |
38 | + private List<Long> postIds; | |
39 | + /** | |
40 | + * 岗位名称 | |
41 | + */ | |
42 | + private Set<String> postNames; | |
43 | + /** | |
44 | + * 适用门店ids | |
45 | + */ | |
46 | + private List<Long> shopIds; | |
47 | + /** | |
48 | + * 适用门店名称 | |
49 | + */ | |
50 | + private Set<String> shopNames; | |
51 | + /** | |
52 | + * 考评组编码 | |
53 | + */ | |
54 | + private List<String> egcs; | |
55 | + | |
56 | + /** | |
57 | + * 考评组名称 | |
58 | + */ | |
59 | + private List<String> evalGroupNames; | |
60 | + | |
61 | + /** | |
62 | + * 集团id | |
63 | + */ | |
64 | + private Long groupId; | |
65 | + | |
66 | + /** | |
67 | + * 考评组 | |
68 | + */ | |
69 | + private List<Long> evalGroupIds; | |
70 | + | |
71 | + /** | |
72 | + * 考评组 | |
73 | + */ | |
74 | + private List<EvalGroupVO> evalGroups; | |
75 | + | |
76 | +} | |
0 | 77 | \ No newline at end of file | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalConfigController.java
... | ... | @@ -8,15 +8,19 @@ import cn.fw.common.web.auth.annotation.CurrentUser; |
8 | 8 | import cn.fw.data.base.domain.common.Message; |
9 | 9 | import cn.fw.morax.domain.dto.EvalIndicatorDTO; |
10 | 10 | import cn.fw.morax.domain.dto.eval.EvalDTO; |
11 | +import cn.fw.morax.domain.dto.eval.EvalGroupRankDto; | |
11 | 12 | import cn.fw.morax.domain.dto.kpi.IndicatorAbleDTO; |
12 | 13 | import cn.fw.morax.domain.dto.query.EvalGroupQueryDTO; |
14 | +import cn.fw.morax.domain.dto.query.EvalGroupRankQueryDTO; | |
13 | 15 | import cn.fw.morax.domain.dto.query.EvalIndicatorQueryDTO; |
16 | +import cn.fw.morax.domain.dto.query.KpiGroupRankStaffQueryDTO; | |
14 | 17 | import cn.fw.morax.domain.enums.ApplicableTypeEnum; |
15 | -import cn.fw.morax.domain.vo.eval.CompositeIndicatorVO; | |
16 | -import cn.fw.morax.domain.vo.eval.EvalIndicatorVO; | |
17 | -import cn.fw.morax.domain.vo.eval.EvalVO; | |
18 | +import cn.fw.morax.domain.vo.eval.*; | |
19 | +import cn.fw.morax.domain.vo.kpi.KpiGroupRankVO; | |
20 | +import cn.fw.morax.domain.vo.kpi.KpiGroupUserVO; | |
18 | 21 | import cn.fw.morax.service.biz.eval.EvalGroupBizService; |
19 | -import cn.fw.morax.service.biz.eval.EvalGroupDataService; | |
22 | +import cn.fw.morax.service.biz.eval.EvalGroupRankBizService; | |
23 | +import cn.fw.morax.service.biz.eval.EvalGroupUserBizService; | |
20 | 24 | import cn.fw.morax.service.biz.eval.EvalIndicatorBizService; |
21 | 25 | import cn.fw.security.auth.client.annotation.Authorization; |
22 | 26 | import cn.fw.security.auth.client.annotation.IgnoreAuth; |
... | ... | @@ -49,6 +53,8 @@ public class EvalConfigController { |
49 | 53 | |
50 | 54 | private final EvalGroupBizService evalGroupBizService; |
51 | 55 | private final EvalIndicatorBizService evalIndicatorBizService; |
56 | + private final EvalGroupRankBizService evalGroupRankBizService; | |
57 | + private final EvalGroupUserBizService evalGroupUserBizService; | |
52 | 58 | |
53 | 59 | /** |
54 | 60 | * 考评指标列表 |
... | ... | @@ -178,4 +184,77 @@ public class EvalConfigController { |
178 | 184 | return success(); |
179 | 185 | } |
180 | 186 | |
187 | + /** | |
188 | + * 考评排名列表 | |
189 | + * | |
190 | + * @param dto | |
191 | + * @return | |
192 | + */ | |
193 | + @GetMapping("/rank-page") | |
194 | + @ControllerMethod("绩效排名列表") | |
195 | + public Message<AppPage<EvalGroupRankVO>> evalGroupRankPage(@Validated EvalGroupRankQueryDTO dto) { | |
196 | + return success(evalGroupRankBizService.evalGroupRankPage(dto)); | |
197 | + } | |
198 | + | |
199 | + /** | |
200 | + * 未选择考评组列表 | |
201 | + * | |
202 | + * @param dto | |
203 | + * @return | |
204 | + */ | |
205 | + @GetMapping("/rank/rest-eval-group") | |
206 | + @ControllerMethod("未选择绩效组列表") | |
207 | + public Message<AppPage<EvalGroupVO>> restKpiGroupPage(@Validated EvalGroupRankQueryDTO dto) { | |
208 | + return success(evalGroupRankBizService.restEvalGroupPage(dto)); | |
209 | + } | |
210 | + | |
211 | + /** | |
212 | + * 考评组排名配置保存 | |
213 | + * | |
214 | + * @param dto | |
215 | + * @return | |
216 | + */ | |
217 | + @PostMapping("/rank-config") | |
218 | + @ControllerMethod("考评组排名配置保存") | |
219 | + public Message<Void> saveKpiGroupRank(@RequestBody @Validated EvalGroupRankDto dto, @CurrentUser LoginAuthBean currentUser) { | |
220 | + evalGroupRankBizService.saveEvalGroupRank(dto); | |
221 | + return success(); | |
222 | + } | |
223 | + | |
224 | + /** | |
225 | + * 考评组排名组合详情 | |
226 | + * | |
227 | + * @param id | |
228 | + * @return | |
229 | + */ | |
230 | + @GetMapping("/rank-config") | |
231 | + @ControllerMethod("考评组排名组合详情") | |
232 | + public Message<EvalGroupRankVO> evalGroupRankDetail(@NotNull(message = "考评排名组合包id不能为空") Long id) { | |
233 | + return success(evalGroupRankBizService.evalGroupRankDetail(id)); | |
234 | + } | |
235 | + | |
236 | + /** | |
237 | + * 删除考评排名组合包 | |
238 | + * | |
239 | + * @param id 考评排名组合包id | |
240 | + * @return | |
241 | + */ | |
242 | + @GetMapping("/rank-del") | |
243 | + @ControllerMethod("删除考评排名组合包") | |
244 | + public Message<Void> removeById(@NotNull(message = "考评排名组合包id不能为空") Long id) { | |
245 | + evalGroupRankBizService.removeById(id); | |
246 | + return success(); | |
247 | + } | |
248 | + | |
249 | + /** | |
250 | + * 查询考评组排名所有人员 | |
251 | + * | |
252 | + * @param dto | |
253 | + * @return | |
254 | + */ | |
255 | + @GetMapping("/rank-staffs") | |
256 | + @ControllerMethod("查询考评组排名所有人员") | |
257 | + public Message<List<EvalGroupUserVO>> queryRankStaffs(@Validated EvalGroupRankQueryDTO dto) { | |
258 | + return success(evalGroupUserBizService.queryRankStaffs(dto.getEvalGroupIds())); | |
259 | + } | |
181 | 260 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupRankBizService.java
0 → 100644
1 | +package cn.fw.morax.service.biz.eval; | |
2 | + | |
3 | +import cn.fw.common.data.mybatis.pagination.PageData; | |
4 | +import cn.fw.common.page.AppPage; | |
5 | +import cn.fw.morax.common.utils.PublicUtil; | |
6 | +import cn.fw.morax.domain.db.eval.Eval; | |
7 | +import cn.fw.morax.domain.db.eval.EvalGroup; | |
8 | +import cn.fw.morax.domain.db.eval.EvalGroupRank; | |
9 | +import cn.fw.morax.domain.dto.eval.EvalGroupRankDto; | |
10 | +import cn.fw.morax.domain.dto.query.EvalGroupRankQueryDTO; | |
11 | +import cn.fw.morax.domain.dto.query.KpiGroupRankQueryDTO; | |
12 | +import cn.fw.morax.domain.enums.SettingStatusEnum; | |
13 | +import cn.fw.morax.domain.vo.eval.EvalGroupRankVO; | |
14 | +import cn.fw.morax.domain.vo.eval.EvalGroupVO; | |
15 | +import cn.fw.morax.domain.vo.kpi.KpiGroupRankVO; | |
16 | +import cn.fw.morax.domain.vo.kpi.KpiGroupVO; | |
17 | +import cn.fw.morax.service.data.eval.EvalGroupRankService; | |
18 | +import cn.fw.morax.service.data.eval.EvalGroupService; | |
19 | +import cn.fw.morax.service.data.eval.EvalService; | |
20 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
21 | +import lombok.Getter; | |
22 | +import lombok.RequiredArgsConstructor; | |
23 | +import lombok.extern.slf4j.Slf4j; | |
24 | +import org.springframework.beans.factory.annotation.Value; | |
25 | +import org.springframework.stereotype.Service; | |
26 | +import org.springframework.transaction.annotation.Transactional; | |
27 | + | |
28 | +import java.util.*; | |
29 | +import java.util.function.Function; | |
30 | +import java.util.stream.Collectors; | |
31 | + | |
32 | +import static cn.fw.common.businessvalidator.Validator.BV; | |
33 | + | |
34 | +@RequiredArgsConstructor | |
35 | +@Service | |
36 | +@Slf4j | |
37 | +public class EvalGroupRankBizService { | |
38 | + | |
39 | + private final EvalGroupRankService evalGroupRankService; | |
40 | + private final EvalGroupService evalGroupService; | |
41 | + private final EvalService evalService; | |
42 | + | |
43 | + @Value("${spring.cache.custom.global-prefix}:eval:group:rank:save:") | |
44 | + @Getter | |
45 | + private String savePrefix; | |
46 | + | |
47 | + /** | |
48 | + * 考评排名列表 | |
49 | + * | |
50 | + * @param dto | |
51 | + * @return | |
52 | + */ | |
53 | + public AppPage<EvalGroupRankVO> evalGroupRankPage(EvalGroupRankQueryDTO dto) { | |
54 | + AppPage<EvalGroupRankVO> page = AppPage.empty(dto); | |
55 | +// List<String> queryKgcs = getKgcsByPostId(dto); | |
56 | +// if (PublicUtil.isNotEmpty(dto.getPostId()) && PublicUtil.isEmpty(queryKgcs)) { | |
57 | +// return page; | |
58 | +// } | |
59 | +// dto.setEgcs(queryKgcs); | |
60 | + Long total = evalGroupRankService.queryPageRankTotal(dto); | |
61 | + if (total <= 0) { | |
62 | + return page; | |
63 | + } | |
64 | + | |
65 | + List<EvalGroupRankVO> evalGroupRankVOS = evalGroupRankService.queryPageRank(dto); | |
66 | + List<String> egcs = evalGroupRankVOS.stream().map(EvalGroupRankVO::getEgcs).collect(ArrayList::new, List::addAll, List::addAll); | |
67 | + List<EvalGroup> epiGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
68 | + .in(EvalGroup::getEgc, egcs) | |
69 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
70 | + ); | |
71 | + Map<String, EvalGroup> kgcKpiGroupMap = epiGroups.stream().collect(Collectors.toMap(EvalGroup::getEgc, Function.identity(), (v1, v2) -> v1)); | |
72 | + for (EvalGroupRankVO evalGroupRankVO : evalGroupRankVOS) { | |
73 | + evalGroupRankVO.setPostIds(new ArrayList<>()); | |
74 | + evalGroupRankVO.setPostNames(new HashSet<>()); | |
75 | + evalGroupRankVO.setShopIds(new ArrayList<>()); | |
76 | + evalGroupRankVO.setShopNames(new HashSet<>()); | |
77 | + evalGroupRankVO.setEvalGroupNames(new ArrayList<>()); | |
78 | + for (String egc : evalGroupRankVO.getEgcs()) { | |
79 | + if (kgcKpiGroupMap.containsKey(egc)) { | |
80 | + EvalGroup kpiGroup = kgcKpiGroupMap.get(egc); | |
81 | + evalGroupRankVO.getPostIds().add(kpiGroup.getPostId()); | |
82 | + evalGroupRankVO.getPostNames().add(kpiGroup.getPostName()); | |
83 | + evalGroupRankVO.getShopIds().addAll(kpiGroup.getShopIds()); | |
84 | + evalGroupRankVO.getShopNames().addAll(kpiGroup.getShopNames()); | |
85 | + if (PublicUtil.isNotEmpty(kpiGroup.getName())) { | |
86 | + evalGroupRankVO.getEvalGroupNames().add(kpiGroup.getName()); | |
87 | + } | |
88 | + } | |
89 | + } | |
90 | + } | |
91 | + page.setTotal(total); | |
92 | + page.setData(evalGroupRankVOS); | |
93 | + return page; | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * 根据岗位查询考评组 | |
98 | + * | |
99 | + * @param dto | |
100 | + * @return | |
101 | + */ | |
102 | +// public List<String> getKgcsByPostId(EvalGroupRankQueryDTO dto) { | |
103 | +// if (PublicUtil.isEmpty(dto.getPostId())) { | |
104 | +// return null; | |
105 | +// } | |
106 | +// | |
107 | +// List<Eval> evals = evalService.list(Wrappers.<Eval>lambdaQuery() | |
108 | +// .eq(Eval::getStatus, SettingStatusEnum.EFFECTIVE) | |
109 | +// .eq(Eval::getId, Boolean.TRUE) | |
110 | +// ); | |
111 | +// if (PublicUtil.isEmpty(evals)) { | |
112 | +// return new ArrayList<>(); | |
113 | +// } | |
114 | +// | |
115 | +// List<EvalGroup> kpiGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
116 | +// .eq(EvalGroup::getStatus, SettingStatusEnum.EFFECTIVE) | |
117 | +// .eq(EvalGroup::getYn, Boolean.TRUE) | |
118 | +// .eq(EvalGroup::getPostId, dto.getPostId()) | |
119 | +// ); | |
120 | +// if (PublicUtil.isEmpty(kpiGroups)) { | |
121 | +// return null; | |
122 | +// } | |
123 | +// return kpiGroups.stream().map(EvalGroup::getKgc).collect(Collectors.toList()); | |
124 | +// } | |
125 | + | |
126 | + | |
127 | + | |
128 | + /** | |
129 | + * 未选择考评组列表 | |
130 | + * | |
131 | + * @param dto | |
132 | + * @return | |
133 | + */ | |
134 | + public AppPage<EvalGroupVO> restEvalGroupPage(EvalGroupRankQueryDTO dto) { | |
135 | + final Long groupId = dto.getGroupId(); | |
136 | + List<EvalGroupRank> evalGroupRanks = evalGroupRankService.list(Wrappers.<EvalGroupRank>lambdaQuery() | |
137 | + .eq(EvalGroupRank::getYn, Boolean.TRUE) | |
138 | + .eq(EvalGroupRank::getGroupId, groupId) | |
139 | + ); | |
140 | + Set<String> excludeEgcs = evalGroupRanks.stream().flatMap(rank -> rank.getEgcs().stream()).collect(Collectors.toSet()); | |
141 | + List<Long> evalIds = getEffectEvalId(groupId); | |
142 | + | |
143 | + PageData<EvalGroup> pageData = evalGroupService.page(new PageData<>(dto.getCurrent(), dto.getPageSize()), | |
144 | + Wrappers.<EvalGroup>lambdaQuery() | |
145 | + .eq(EvalGroup::getGroupId, dto.getGroupId()) | |
146 | + .in(EvalGroup::getEvalId, evalIds) | |
147 | + .eq(PublicUtil.isNotEmpty(dto.getPostId()), EvalGroup::getPostId, dto.getPostId()) | |
148 | + .notIn(PublicUtil.isNotEmpty(excludeEgcs), EvalGroup::getEgc, excludeEgcs) | |
149 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
150 | + ); | |
151 | + return PublicUtil.toPage(pageData, evalGroup -> { | |
152 | + EvalGroupVO evalGroupVo = PublicUtil.copy(evalGroup, EvalGroupVO.class); | |
153 | + evalGroupVo.setBeginTime(evalGroup.getBeginTime()); | |
154 | + evalGroupVo.setOverTime(evalGroup.getOverTime()); | |
155 | + return evalGroupVo; | |
156 | + }); | |
157 | + } | |
158 | + | |
159 | + public List<Long> getEffectEvalId(Long groupId) { | |
160 | + List<Eval> evals = evalService.list(Wrappers.<Eval>lambdaQuery() | |
161 | + .eq(Eval::getStatus, SettingStatusEnum.EFFECTIVE) | |
162 | + .eq(Eval::getGroupId, groupId) | |
163 | + .eq(Eval::getYn, Boolean.TRUE) | |
164 | + ); | |
165 | + if (PublicUtil.isEmpty(evals)) { | |
166 | + return new ArrayList<>(); | |
167 | + } | |
168 | + List<Long> evalIds = evals.stream().map(Eval::getId).collect(Collectors.toList()); | |
169 | + return evalIds; | |
170 | + } | |
171 | + | |
172 | + | |
173 | + /** | |
174 | + * 考评组排名组合详情 | |
175 | + * | |
176 | + * @param id | |
177 | + * @return | |
178 | + */ | |
179 | + public EvalGroupRankVO evalGroupRankDetail(Long id) { | |
180 | + EvalGroupRank evalGroupRank = evalGroupRankService.getById(id); | |
181 | + EvalGroupRankVO evalGroupRankVO = PublicUtil.copy(evalGroupRank, EvalGroupRankVO.class); | |
182 | + List<EvalGroup> evalGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
183 | + .in(EvalGroup::getEgc, evalGroupRank.getEgcs()) | |
184 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
185 | + ); | |
186 | + List<EvalGroupVO> evalGroupVOS = PublicUtil.copyList(evalGroups, EvalGroupVO.class); | |
187 | + evalGroupRankVO.setEvalGroups(evalGroupVOS); | |
188 | + evalGroupRankVO.setEvalGroupIds(evalGroupVOS.stream().map(EvalGroupVO::getId).distinct().collect(Collectors.toList())); | |
189 | + return evalGroupRankVO; | |
190 | + } | |
191 | + | |
192 | + | |
193 | + /** | |
194 | + * 考评组排名配置保存 | |
195 | + * | |
196 | + * @param dto | |
197 | + */ | |
198 | + @Transactional(rollbackFor = Exception.class) | |
199 | + public void saveEvalGroupRank(EvalGroupRankDto dto) { | |
200 | + checkEgcRepetition(dto.getId(), dto.getEgcs()); | |
201 | + checkNameRepetition(dto.getId(), dto.getName()); | |
202 | + | |
203 | + EvalGroupRank kpiGroupRank = this.convertPO(dto); | |
204 | + evalGroupRankService.saveOrUpdate(kpiGroupRank); | |
205 | + } | |
206 | + | |
207 | + /** | |
208 | + * 转换对象 | |
209 | + * | |
210 | + * @param dto | |
211 | + * @return | |
212 | + */ | |
213 | + public EvalGroupRank convertPO(EvalGroupRankDto dto) { | |
214 | + EvalGroupRank kpiGroupRank = null; | |
215 | + if (PublicUtil.isNotEmpty(dto.getId())) { | |
216 | + kpiGroupRank = evalGroupRankService.getById(dto.getId()); | |
217 | + BV.notNull(kpiGroupRank, "考评组排名不存在"); | |
218 | + kpiGroupRank.setId(dto.getId()); | |
219 | + } else { | |
220 | + kpiGroupRank = new EvalGroupRank(); | |
221 | + } | |
222 | + kpiGroupRank.setGroupId(dto.getGroupId()); | |
223 | + kpiGroupRank.setYn(Boolean.TRUE); | |
224 | + kpiGroupRank.setName(dto.getName()); | |
225 | + kpiGroupRank.setEgcs(dto.getEgcs()); | |
226 | + return kpiGroupRank; | |
227 | + } | |
228 | + | |
229 | + /** | |
230 | + * 检查考评组排名名称是否重复 | |
231 | + * | |
232 | + * @param id | |
233 | + * @param name | |
234 | + */ | |
235 | + public void checkNameRepetition(Long id, String name) { | |
236 | + int count = evalGroupRankService.count(Wrappers.<EvalGroupRank>lambdaQuery() | |
237 | + .eq(EvalGroupRank::getName, name) | |
238 | + .ne(PublicUtil.isNotEmpty(id), EvalGroupRank::getId, id) | |
239 | + .eq(EvalGroupRank::getYn, Boolean.TRUE) | |
240 | + ); | |
241 | + BV.isTrue(count <= 0, "考评组排名名称重复,请重新输入"); | |
242 | + } | |
243 | + | |
244 | + /** | |
245 | + * 检查考评组排名名称是否重复 | |
246 | + * | |
247 | + * @param egcs | |
248 | + */ | |
249 | + public void checkEgcRepetition(Long id, List<String> egcs) { | |
250 | + List<EvalGroupRankVO> epiGroupRankVOS = evalGroupRankService.queryByEgcs(egcs, id); | |
251 | + List<String> allEgcs = epiGroupRankVOS.stream().map(EvalGroupRankVO::getEgcs).collect(ArrayList::new, List::addAll, List::addAll); | |
252 | + if (PublicUtil.isEmpty(allEgcs)) { | |
253 | + return; | |
254 | + } | |
255 | + allEgcs.retainAll(egcs); | |
256 | + List<EvalGroup> repetitionEvals = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
257 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
258 | + .in(EvalGroup::getEgc, allEgcs) | |
259 | + ); | |
260 | + String evalName = repetitionEvals.stream().map(EvalGroup::getName).collect(Collectors.joining(",")); | |
261 | + BV.isEmpty(repetitionEvals, "考评组【" + evalName + "】已经在其他排名包中,请重试"); | |
262 | + } | |
263 | + | |
264 | + /** | |
265 | + * 根据id删除考评组排名包 | |
266 | + * @param id | |
267 | + */ | |
268 | + public void removeById(Long id) { | |
269 | + evalGroupRankService.removeById(id); | |
270 | + } | |
271 | + | |
272 | + | |
273 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupUserBizService.java
... | ... | @@ -11,9 +11,12 @@ import cn.fw.morax.domain.db.kpi.KpiStarSpecialRule; |
11 | 11 | import cn.fw.morax.domain.enums.EvalScopeEnum; |
12 | 12 | import cn.fw.morax.domain.enums.KpiIgnoreCauseEnum; |
13 | 13 | import cn.fw.morax.domain.enums.SettingStatusEnum; |
14 | +import cn.fw.morax.domain.vo.eval.EvalGroupUserVO; | |
15 | +import cn.fw.morax.domain.vo.kpi.KpiGroupUserVO; | |
14 | 16 | import cn.fw.morax.rpc.ehr.EhrRpcService; |
15 | 17 | import cn.fw.morax.rpc.ehr.dto.PerformanceStaffDTO; |
16 | 18 | import cn.fw.morax.service.data.eval.EvalGroupService; |
19 | +import cn.fw.morax.service.data.eval.EvalGroupUserService; | |
17 | 20 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
18 | 21 | import com.google.common.collect.Lists; |
19 | 22 | import com.google.common.collect.Maps; |
... | ... | @@ -47,6 +50,7 @@ public class EvalGroupUserBizService { |
47 | 50 | private final EvalGroupService evalGroupService; |
48 | 51 | private final EhrRpcService ehrRpcService; |
49 | 52 | private final StringRedisTemplate stringRedisTemplate; |
53 | + private final EvalGroupUserService evalGroupUserService; | |
50 | 54 | |
51 | 55 | @Value("${spring.cache.custom.global-prefix}:kpi:anticipated_date:") |
52 | 56 | @Getter |
... | ... | @@ -288,6 +292,33 @@ public class EvalGroupUserBizService { |
288 | 292 | } |
289 | 293 | |
290 | 294 | /** |
295 | + * 查询绩效组排名所有人员 | |
296 | + * | |
297 | + * @return | |
298 | + */ | |
299 | + public List<EvalGroupUserVO> queryRankStaffs(List<Long> evalGroupIds) { | |
300 | + LocalDate now = LocalDate.now(); | |
301 | + List<EvalGroup> evalGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
302 | + .in(EvalGroup::getId, evalGroupIds) | |
303 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
304 | + ); | |
305 | + | |
306 | + Map<Long, List<EvalGroup>> postEvalGroupMap = evalGroups.stream().collect(Collectors.groupingBy(EvalGroup::getPostId)); | |
307 | + | |
308 | + | |
309 | + List<EvalGroupUser> evalGroupUsers = Lists.newArrayListWithCapacity(100); | |
310 | + for (Map.Entry<Long, List<EvalGroup>> entry : postEvalGroupMap.entrySet()) { | |
311 | + HashSet<Long> shopIds = entry.getValue().stream().map(EvalGroup::getShopIds).collect(HashSet::new, Set::addAll, Set::addAll); | |
312 | + evalGroupUsers.addAll(this.fetchBuildImportUser(entry.getKey(), new ArrayList<>(shopIds), now)); | |
313 | + } | |
314 | + if (PublicUtil.isEmpty(evalGroupUsers)) { | |
315 | + return new ArrayList<>(); | |
316 | + } | |
317 | + List<EvalGroupUserVO> evalGroupUserVOS = PublicUtil.copyList(evalGroupUsers, EvalGroupUserVO.class); | |
318 | + return evalGroupUserVOS; | |
319 | + } | |
320 | + | |
321 | + /** | |
291 | 322 | * 转换员工基础信息 |
292 | 323 | * |
293 | 324 | * @param staff | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalGroupRankService.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.domain.db.eval.EvalGroupRank; | |
5 | +import cn.fw.morax.domain.dto.query.EvalGroupRankQueryDTO; | |
6 | +import cn.fw.morax.domain.dto.query.KpiGroupRankQueryDTO; | |
7 | +import cn.fw.morax.domain.vo.eval.EvalGroupRankVO; | |
8 | +import cn.fw.morax.domain.vo.kpi.KpiGroupRankVO; | |
9 | +import com.baomidou.mybatisplus.extension.service.IService; | |
10 | + | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * <p> | |
15 | + * 考评门店奖惩分配 服务类 | |
16 | + * </p> | |
17 | + * | |
18 | + * @author jiangchao | |
19 | + * @since 2023-02-23 | |
20 | + */ | |
21 | +public interface EvalGroupRankService extends IService<EvalGroupRank> { | |
22 | + | |
23 | + /** | |
24 | + * 查询绩效组排名总条数 | |
25 | + * | |
26 | + * @param dto | |
27 | + * @return | |
28 | + */ | |
29 | + long queryPageRankTotal(EvalGroupRankQueryDTO dto); | |
30 | + | |
31 | + /** | |
32 | + * 绩效组排名分页查询 | |
33 | + * | |
34 | + * @param dto | |
35 | + * @return | |
36 | + */ | |
37 | + List<EvalGroupRankVO> queryPageRank(EvalGroupRankQueryDTO dto); | |
38 | + | |
39 | + /** | |
40 | + * 通过egc查询考评组排名 | |
41 | + * | |
42 | + * @param kgcs | |
43 | + * @return | |
44 | + */ | |
45 | + List<EvalGroupRankVO> queryByEgcs(List<String> kgcs, Long filterId); | |
46 | + | |
47 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalGroupRankServiceImpl.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval.impl; | |
2 | + | |
3 | +import cn.fw.morax.dao.eval.EvalGroupRankDao; | |
4 | +import cn.fw.morax.domain.db.eval.EvalGroupRank; | |
5 | +import cn.fw.morax.domain.dto.query.EvalGroupRankQueryDTO; | |
6 | +import cn.fw.morax.domain.vo.eval.EvalGroupRankVO; | |
7 | +import cn.fw.morax.service.data.eval.EvalGroupRankService; | |
8 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * <p> | |
15 | + * 考评池 服务实现类 | |
16 | + * </p> | |
17 | + * | |
18 | + * @author jiangchao | |
19 | + * @since 2023-02-23 | |
20 | + */ | |
21 | +@Service | |
22 | +public class EvalGroupRankServiceImpl extends ServiceImpl<EvalGroupRankDao, EvalGroupRank> implements EvalGroupRankService { | |
23 | + | |
24 | + @Override | |
25 | + public long queryPageRankTotal(EvalGroupRankQueryDTO dto) { | |
26 | + return this.baseMapper.queryPageRankTotal(dto); | |
27 | + } | |
28 | + | |
29 | + @Override | |
30 | + public List<EvalGroupRankVO> queryPageRank(EvalGroupRankQueryDTO dto) { | |
31 | + return this.baseMapper.queryPageRank(dto); | |
32 | + } | |
33 | + | |
34 | + @Override | |
35 | + public List<EvalGroupRankVO> queryByEgcs(List<String> kgcs, Long filterId) { | |
36 | + return this.baseMapper.queryByEgcs(kgcs, filterId); | |
37 | + } | |
38 | +} | ... | ... |