Commit c285665c739ddb4426f89d879ebd8269741ada37
1 parent
81a8a91c
feature(*): 考评阶段指标上报
考评阶段指标上报
Showing
40 changed files
with
836 additions
and
358 deletions
doc/2023_update.sql
fw-morax-common/src/main/java/cn/fw/morax/common/constant/TimeTaskConstant.java
... | ... | @@ -36,6 +36,11 @@ public class TimeTaskConstant { |
36 | 36 | public static final String SALARY_GROUP_USER = "0 0 1 * * ?"; |
37 | 37 | |
38 | 38 | /** |
39 | + * 考评组指标上报定时器 每天凌晨1点 | |
40 | + */ | |
41 | + public static final String EVAL_GROUP_REPORT_MQ = "0 10 1 * * ?"; | |
42 | + | |
43 | + /** | |
39 | 44 | * 绩效星级特殊调整 每月1号6点执行 |
40 | 45 | */ |
41 | 46 | public static final String KPI_STAR_SPECIAL_RULE = "0 0 6 1 * ?"; | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalGroupIndicatorDao.java
1 | 1 | package cn.fw.morax.dao.eval; |
2 | 2 | |
3 | 3 | |
4 | +import cn.fw.morax.domain.bo.StageIndicatorBO; | |
4 | 5 | import cn.fw.morax.domain.bo.eval.EvalGroupIndicatorBO; |
5 | 6 | import cn.fw.morax.domain.db.eval.EvalGroupIndicator; |
6 | 7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
7 | 8 | |
8 | 9 | import java.time.LocalDate; |
10 | +import java.util.List; | |
9 | 11 | import java.util.Set; |
10 | 12 | |
11 | 13 | /** |
... | ... | @@ -27,4 +29,12 @@ public interface EvalGroupIndicatorDao extends BaseMapper<EvalGroupIndicator> { |
27 | 29 | * @return |
28 | 30 | */ |
29 | 31 | Set<EvalGroupIndicatorBO> allIndicators(LocalDate dataDate, Long evalGroupId); |
32 | + | |
33 | + /** | |
34 | + * 查询阶段指标 | |
35 | + * @param dataDate | |
36 | + * @param codeType | |
37 | + * @return | |
38 | + */ | |
39 | + List<StageIndicatorBO> getStageIndicators(LocalDate dataDate, Integer codeType); | |
30 | 40 | } | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalGroupRankStageDao.java
... | ... | @@ -3,6 +3,10 @@ package cn.fw.morax.dao.eval; |
3 | 3 | |
4 | 4 | import cn.fw.morax.domain.db.eval.EvalGroupRankStage; |
5 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
6 | +import org.apache.ibatis.annotations.Param; | |
7 | + | |
8 | +import java.time.LocalDate; | |
9 | +import java.util.List; | |
6 | 10 | |
7 | 11 | /** |
8 | 12 | * <p> |
... | ... | @@ -14,4 +18,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
14 | 18 | */ |
15 | 19 | public interface EvalGroupRankStageDao extends BaseMapper<EvalGroupRankStage> { |
16 | 20 | |
21 | + List<EvalGroupRankStage> getEffects(@Param("dataDate") LocalDate dataDate); | |
22 | + | |
17 | 23 | } | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/kpi/KpiStageMqLogDao.java
0 → 100644
1 | +package cn.fw.morax.dao.kpi; | |
2 | + | |
3 | +import cn.fw.morax.domain.db.kpi.KpiRewardPoint; | |
4 | +import cn.fw.morax.domain.db.kpi.KpiStageMqLog; | |
5 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
6 | +import org.springframework.stereotype.Repository; | |
7 | + | |
8 | +/** | |
9 | + * @author : kurisu | |
10 | + * @version : 1.0 | |
11 | + * @className : KpiRewardPointDao | |
12 | + * @description : 绩效分奖惩纪录 | |
13 | + * @date : 2022-04-24 10:32 | |
14 | + */ | |
15 | +@Repository | |
16 | +public interface KpiStageMqLogDao extends BaseMapper<KpiStageMqLog> { | |
17 | +} | ... | ... |
fw-morax-dao/src/main/resources/mapper/eval/EvalGroupIndicatorMapper.xml
... | ... | @@ -9,7 +9,6 @@ |
9 | 9 | <result column="name" property="name"/> |
10 | 10 | <result column="base_score" property="baseScore"/> |
11 | 11 | <result column="score_way" property="scoreWay"/> |
12 | - <result column="param_alias" property="paramAlias"/> | |
13 | 12 | <result column="precondition_alias" property="preconditionAlias"/> |
14 | 13 | <result column="yn" property="yn"/> |
15 | 14 | <result column="create_time" property="createTime"/> |
... | ... | @@ -25,6 +24,17 @@ |
25 | 24 | <result column="post_name" property="postName"/> |
26 | 25 | </resultMap> |
27 | 26 | |
27 | + <!-- 通用查询映射结果 --> | |
28 | + <resultMap id="StageIndicatorResultMap" type="cn.fw.morax.domain.bo.StageIndicatorBO"> | |
29 | + <result column="groupId" property="groupId"/> | |
30 | + <result column="code" property="code"/> | |
31 | + <result column="evalGroupId" property="evalGroupId"/> | |
32 | + <result column="eval_group_rank_id" property="evalGroupRankId"/> | |
33 | + <result column="begin_time" property="beginTime"/> | |
34 | + <result column="over_time" property="overTime"/> | |
35 | + <result column="shop_ids" property="shopIds" typeHandler="cn.fw.common.data.mybatis.handler.LongListTypeHandler"/> | |
36 | + </resultMap> | |
37 | + | |
28 | 38 | <select id="allIndicators" resultType="cn.fw.morax.domain.bo.kpi.KpiIndicatorBO"> |
29 | 39 | select |
30 | 40 | t1.id eval_group_indicator_id, |
... | ... | @@ -51,4 +61,28 @@ |
51 | 61 | </where> |
52 | 62 | </select> |
53 | 63 | |
64 | + <select id="getStageIndicators" resultMap="StageIndicatorResultMap"> | |
65 | + select | |
66 | + t1.group_id AS groupId, | |
67 | + t2.id, | |
68 | + t2.eval_group_rank_id, | |
69 | + t2.begin_time, | |
70 | + t2.over_time, | |
71 | + t3.id AS evalGroupId, | |
72 | + t3.shop_ids, | |
73 | + t4.code | |
74 | + FROM | |
75 | + eval_group_rank t1 | |
76 | + LEFT JOIN eval_group_rank_stage t2 ON t1.id = t2.eval_group_rank_id AND t2.yn = 1 | |
77 | + LEFT JOIN eval_group t3 ON t2.id = t3.eval_group_rank_stage_id AND t3.yn = 1 | |
78 | + LEFT JOIN eval_group_indicator_param t4 ON t4.eval_group_id = t3.id AND t4.yn = 1 | |
79 | + WHERE | |
80 | + t1.yn = 1 | |
81 | + AND t1.`status` IN ( 3, 4 ) | |
82 | + AND t2.begin_time <= #{dataDate} | |
83 | + AND t2.over_time >= #{dataDate} | |
84 | + AND t4.code_type = #{codeType} | |
85 | + AND t4.target_calc_type IN (3,4) | |
86 | + </select> | |
87 | + | |
54 | 88 | </mapper> |
55 | 89 | \ No newline at end of file | ... | ... |
fw-morax-dao/src/main/resources/mapper/eval/EvalGroupRankDao.xml
... | ... | @@ -5,25 +5,24 @@ |
5 | 5 | <!-- 通用查询映射结果 --> |
6 | 6 | <resultMap id="BaseResultMap" type="cn.fw.morax.domain.db.eval.EvalGroupRank"> |
7 | 7 | <result column="id" property="id"/> |
8 | - <result column="scope_type" property="scopeType"/> | |
9 | - <result column="name" property="name"/> | |
10 | - <result column="egcs" property="egcs" typeHandler="cn.fw.common.data.mybatis.handler.StringListTypeHandler"/> | |
11 | - <result column="status" property="status"/> | |
12 | - <result column="group_id" property="groupId"/> | |
13 | - <result column="yn" property="yn"/> | |
14 | - <result column="create_by" property="createBy"/> | |
15 | - <result column="create_time" property="createTime"/> | |
16 | - <result column="update_by" property="updateBy"/> | |
17 | - <result column="update_time" property="updateTime"/> | |
8 | + <result column="name" property="name"/> | |
9 | + <result column="status" property="status"/> | |
10 | + <result column="group_id" property="groupId"/> | |
11 | + <result column="multi_stage" property="multiStage"/> | |
12 | + <result column="yn" property="yn"/> | |
13 | + <result column="create_by" property="createBy"/> | |
14 | + <result column="create_time" property="createTime"/> | |
15 | + <result column="update_by" property="updateBy"/> | |
16 | + <result column="update_time" property="updateTime"/> | |
18 | 17 | </resultMap> |
19 | 18 | |
20 | 19 | <!-- 通用查询映射结果 --> |
21 | 20 | <resultMap id="BaseResultVoMap" type="cn.fw.morax.domain.vo.eval.EvalGroupRankVO"> |
22 | 21 | <result column="id" property="id"/> |
23 | - <result column="scope_type" property="scopeType"/> | |
24 | 22 | <result column="name" property="name"/> |
25 | - <result column="egcs" property="egcs" typeHandler="cn.fw.common.data.mybatis.handler.StringListTypeHandler"/> | |
23 | + <result column="status" property="status"/> | |
26 | 24 | <result column="group_id" property="groupId"/> |
25 | + <result column="multi_stage" property="multiStage"/> | |
27 | 26 | </resultMap> |
28 | 27 | |
29 | 28 | <sql id="all_columns"> | ... | ... |
fw-morax-dao/src/main/resources/mapper/eval/EvalGroupRankStageDao.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.EvalGroupRankStageDao"> | |
4 | + | |
5 | + <!-- 通用查询映射结果 --> | |
6 | + <resultMap id="BaseResultMap" type="cn.fw.morax.domain.db.eval.EvalGroupRankStage"> | |
7 | + <result column="id" property="id"/> | |
8 | + <result column="eval_group_rank_id" property="evalGroupRankId"/> | |
9 | + <result column="name" property="name"/> | |
10 | + <result column="begin_time" property="beginTime"/> | |
11 | + <result column="over_time" property="overTime"/> | |
12 | + <result column="yn" property="yn"/> | |
13 | + <result column="create_time" property="createTime"/> | |
14 | + <result column="update_time" property="updateTime"/> | |
15 | + </resultMap> | |
16 | + | |
17 | +</mapper> | |
0 | 18 | \ No newline at end of file | ... | ... |
fw-morax-dao/src/main/resources/mapper/kpi/KpiStageMqLogDao.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="com.jc.generator.code.test.mapper.KpiStageMqLogMapper"> | |
4 | + | |
5 | + <!-- 通用查询映射结果 --> | |
6 | + <resultMap id="BaseResultMap" type="com.jc.generator.code.test.entity.KpiStageMqLog"> | |
7 | + <result column="id" property="id"/> | |
8 | + <result column="eval_group_rank_id" property="evalGroupRankId"/> | |
9 | + <result column="eval_group_id" property="evalGroupId"/> | |
10 | + <result column="begin_time" property="beginTime"/> | |
11 | + <result column="over_time" property="overTime"/> | |
12 | + <result column="shop_ids" property="shopIds"/> | |
13 | + <result column="user_ids" property="userIds"/> | |
14 | + <result column="group_id" property="groupId"/> | |
15 | + <result column="create_time" property="createTime"/> | |
16 | + </resultMap> | |
17 | + | |
18 | + | |
19 | +</mapper> | |
0 | 20 | \ No newline at end of file | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/bo/StageIndicatorBO.java
0 → 100644
1 | +package cn.fw.morax.domain.bo; | |
2 | + | |
3 | +import cn.fw.morax.domain.enums.ScoreWayEnum; | |
4 | +import lombok.*; | |
5 | + | |
6 | +import java.time.LocalDate; | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * @author : kurisu | |
11 | + * @version : 1.0 | |
12 | + * @className : KpiIndicatorBO | |
13 | + * @description : 绩效指标bo | |
14 | + * @date : 2022-04-11 15:25 | |
15 | + */ | |
16 | +@Data | |
17 | +@EqualsAndHashCode | |
18 | +@AllArgsConstructor | |
19 | +@NoArgsConstructor | |
20 | +@Builder | |
21 | +public class StageIndicatorBO { | |
22 | + | |
23 | + /** | |
24 | + * 编码 | |
25 | + */ | |
26 | + private String indicatorCode; | |
27 | + | |
28 | + /** | |
29 | + * 阶段开始时间 | |
30 | + */ | |
31 | + private LocalDate beginTime; | |
32 | + | |
33 | + /** | |
34 | + * 阶段结束时间 | |
35 | + */ | |
36 | + private LocalDate endTime; | |
37 | + | |
38 | + /** | |
39 | + * 唯一id | |
40 | + */ | |
41 | + private List<Long> shopIds; | |
42 | + /** | |
43 | + * 唯一id | |
44 | + */ | |
45 | + private Long evalGroupId; | |
46 | + /** | |
47 | + * 唯一id | |
48 | + */ | |
49 | + private Long evalGroupRankId; | |
50 | + /** | |
51 | + * 集团 | |
52 | + */ | |
53 | + private Long groupId; | |
54 | + | |
55 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalGroup.java
... | ... | @@ -52,32 +52,6 @@ public class EvalGroup extends BaseAuditableTimeEntity<EvalGroup, Long> { |
52 | 52 | private String egc; |
53 | 53 | |
54 | 54 | /** |
55 | - * 考评,活动名称 | |
56 | - */ | |
57 | - private String name; | |
58 | - | |
59 | - /** | |
60 | - * 考评范围; 1:门店考评 2:人员考评 | |
61 | - */ | |
62 | - private EvalScopeEnum scopeType; | |
63 | - | |
64 | - /** | |
65 | - * 适用角色编码 | |
66 | - */ | |
67 | - @TableField(typeHandler = StringListTypeHandler.class) | |
68 | - private List<String> roleCodes; | |
69 | - /** | |
70 | - * 适用角色名称 | |
71 | - */ | |
72 | - @TableField(typeHandler = StringListTypeHandler.class) | |
73 | - private List<String> roleNames; | |
74 | - | |
75 | -// /** | |
76 | -// * 状态;1:审批中 2:待生效 3:生效中 4:已失效 5:草稿 | |
77 | -// */ | |
78 | -// private SettingStatusEnum status; | |
79 | - | |
80 | - /** | |
81 | 55 | * 岗位id |
82 | 56 | */ |
83 | 57 | private Long postId; |
... | ... | @@ -99,32 +73,6 @@ public class EvalGroup extends BaseAuditableTimeEntity<EvalGroup, Long> { |
99 | 73 | @TableField(typeHandler = StringListTypeHandler.class) |
100 | 74 | private List<String> shopNames; |
101 | 75 | |
102 | -// /** | |
103 | -// * 调整原因 | |
104 | -// */ | |
105 | -// private String reason; | |
106 | - | |
107 | -// /** | |
108 | -// * 附件;fid逗号隔开 | |
109 | -// */ | |
110 | -// @TableField(typeHandler = StringListTypeHandler.class) | |
111 | -// private List<String> attachment; | |
112 | - | |
113 | - /** | |
114 | - * 生效时间 | |
115 | - */ | |
116 | - private LocalDate beginTime; | |
117 | - | |
118 | - /** | |
119 | - * 结束时间 | |
120 | - */ | |
121 | - private LocalDate overTime; | |
122 | - | |
123 | - /** | |
124 | - * 状态;1:审批中 2:审批拒绝 3:生效中 4:草稿 | |
125 | - */ | |
126 | -// private SettingStatusEnum status; | |
127 | - | |
128 | 76 | /** |
129 | 77 | * 包含指标数量 |
130 | 78 | */ | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalUserPool.java
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/kpi/KpiStageMqLog.java
0 → 100644
1 | +package cn.fw.morax.domain.db.kpi; | |
2 | + | |
3 | +import cn.fw.common.data.mybatis.handler.LongListTypeHandler; | |
4 | +import com.baomidou.mybatisplus.annotation.IdType; | |
5 | +import com.baomidou.mybatisplus.annotation.TableField; | |
6 | +import com.baomidou.mybatisplus.annotation.TableId; | |
7 | +import com.baomidou.mybatisplus.annotation.TableName; | |
8 | +import com.baomidou.mybatisplus.extension.activerecord.Model; | |
9 | +import lombok.Data; | |
10 | +import lombok.EqualsAndHashCode; | |
11 | +import lombok.experimental.Accessors; | |
12 | + | |
13 | +import java.io.Serializable; | |
14 | +import java.time.LocalDate; | |
15 | +import java.time.LocalDateTime; | |
16 | +import java.util.List; | |
17 | + | |
18 | +/** | |
19 | + * <p> | |
20 | + * | |
21 | + * </p> | |
22 | + * | |
23 | + * @author jiangchao | |
24 | + * @since 2023-05-12 | |
25 | + */ | |
26 | +@Data | |
27 | +@EqualsAndHashCode(callSuper = false) | |
28 | +@Accessors(chain = true) | |
29 | +@TableName(autoResultMap = true) | |
30 | +public class KpiStageMqLog extends Model<KpiStageMqLog> { | |
31 | + | |
32 | + private static final long serialVersionUID = 1L; | |
33 | + @TableId(type = IdType.ASSIGN_ID) | |
34 | + private Long id; | |
35 | + | |
36 | + /** | |
37 | + * 编码 | |
38 | + */ | |
39 | + private String indicatorCode; | |
40 | + | |
41 | + /** | |
42 | + * 考评排名组id | |
43 | + */ | |
44 | + private Long evalGroupRankId; | |
45 | + | |
46 | + /** | |
47 | + * 考评组id | |
48 | + */ | |
49 | + private Long evalGroupId; | |
50 | + | |
51 | + /** | |
52 | + * 开始时间 | |
53 | + */ | |
54 | + private LocalDate beginTime; | |
55 | + | |
56 | + /** | |
57 | + * 结束时间 | |
58 | + */ | |
59 | + private LocalDate endTime; | |
60 | + | |
61 | + /** | |
62 | + * 适用门店ids | |
63 | + */ | |
64 | + @TableField(typeHandler = LongListTypeHandler.class) | |
65 | + private List<Long> shopIds; | |
66 | + | |
67 | + /** | |
68 | + * 适用人员ids | |
69 | + */ | |
70 | + @TableField(typeHandler = LongListTypeHandler.class) | |
71 | + private List<Long> userIds; | |
72 | + | |
73 | + /** | |
74 | + * 集团id | |
75 | + */ | |
76 | + private Long groupId; | |
77 | + | |
78 | + /** | |
79 | + * 创建时间 | |
80 | + */ | |
81 | + private LocalDateTime createTime; | |
82 | + | |
83 | + | |
84 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/eval/EvalConfigPostIndicatorsDTO.java
fw-morax-domain/src/main/java/cn/fw/morax/domain/enums/SettingDraftTypeEnum.java
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalGroupRankStageVO.java
0 → 100644
1 | +package cn.fw.morax.domain.vo.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import com.baomidou.mybatisplus.annotation.TableLogic; | |
5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
6 | +import lombok.Data; | |
7 | +import lombok.EqualsAndHashCode; | |
8 | + | |
9 | +import java.time.LocalDate; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * <p> | |
14 | + * 考评组 | |
15 | + * </p> | |
16 | + * | |
17 | + * @author jiangchao | |
18 | + * @since 2022-12-09 | |
19 | + */ | |
20 | +@Data | |
21 | +@EqualsAndHashCode(callSuper = false) | |
22 | +public class EvalGroupRankStageVO { | |
23 | + | |
24 | + private static final long serialVersionUID = 1L; | |
25 | + | |
26 | + /** | |
27 | + * 主键id | |
28 | + */ | |
29 | + private Long id; | |
30 | + /** | |
31 | + * 阶段名称 | |
32 | + */ | |
33 | + private String name; | |
34 | + | |
35 | + /** | |
36 | + * 考评排名组id | |
37 | + */ | |
38 | + private Long evalGroupRankId; | |
39 | + | |
40 | + /** | |
41 | + * 生效时间 | |
42 | + */ | |
43 | + private LocalDate beginTime; | |
44 | + | |
45 | + /** | |
46 | + * 结束时间 | |
47 | + */ | |
48 | + private LocalDate overTime; | |
49 | + | |
50 | + /** | |
51 | + * 考评组 | |
52 | + */ | |
53 | + private List<EvalGroupVO> evalGroups; | |
54 | + | |
55 | + | |
56 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalGroupRankVO.java
1 | 1 | package cn.fw.morax.domain.vo.eval; |
2 | 2 | |
3 | -import cn.fw.morax.domain.enums.EvalScopeEnum; | |
3 | +import cn.fw.common.data.mybatis.handler.StringListTypeHandler; | |
4 | 4 | import cn.fw.morax.domain.enums.SettingStatusEnum; |
5 | -import cn.fw.morax.domain.enums.StarEvaluationEnum; | |
6 | -import cn.fw.morax.domain.vo.kpi.KpiGroupRankStarLaddersVO; | |
7 | -import cn.fw.morax.domain.vo.kpi.KpiGroupVO; | |
5 | +import com.baomidou.mybatisplus.annotation.TableField; | |
8 | 6 | import lombok.Data; |
9 | 7 | |
10 | -import java.math.BigDecimal; | |
8 | +import java.time.LocalDate; | |
11 | 9 | import java.util.List; |
12 | 10 | import java.util.Set; |
13 | 11 | |
... | ... | @@ -24,55 +22,71 @@ public class EvalGroupRankVO { |
24 | 22 | private Long id; |
25 | 23 | |
26 | 24 | /** |
27 | - * 考评范围; 1:人员考评 2:门店考评 | |
25 | + * 考评排名组名称 | |
28 | 26 | */ |
29 | - private EvalScopeEnum scopeType; | |
27 | + private String name; | |
30 | 28 | |
31 | 29 | /** |
32 | - * 组合名称 | |
30 | + * 状态;1:审批中 2:待生效 3:生效中 4:已失效 5:草稿 | |
33 | 31 | */ |
34 | - private String name; | |
32 | + private SettingStatusEnum status; | |
35 | 33 | |
36 | 34 | /** |
37 | - * 岗位id | |
35 | + * 多阶段 | |
38 | 36 | */ |
39 | - private List<Long> postIds; | |
37 | + private Boolean multiStage; | |
38 | + | |
40 | 39 | /** |
41 | - * 岗位名称 | |
40 | + * 集团id | |
42 | 41 | */ |
43 | - private Set<String> postNames; | |
42 | + private Long groupId; | |
43 | + | |
44 | 44 | /** |
45 | - * 适用门店ids | |
45 | + * 调整原因 | |
46 | 46 | */ |
47 | - private List<Long> shopIds; | |
47 | + private String reason; | |
48 | + | |
48 | 49 | /** |
49 | - * 适用门店名称 | |
50 | + * 附件;fid逗号隔开 | |
50 | 51 | */ |
51 | - private Set<String> shopNames; | |
52 | + @TableField(typeHandler = StringListTypeHandler.class) | |
53 | + private List<String> attachment; | |
54 | + | |
52 | 55 | /** |
53 | - * 考评组编码 | |
56 | + * 生效时间 | |
54 | 57 | */ |
55 | - private List<String> egcs; | |
58 | + private LocalDate beginTime; | |
56 | 59 | |
57 | 60 | /** |
58 | - * 考评组名称 | |
61 | + * 结束时间 | |
59 | 62 | */ |
60 | - private List<String> evalGroupNames; | |
63 | + private LocalDate overTime; | |
61 | 64 | |
62 | 65 | /** |
63 | - * 集团id | |
66 | + * 岗位id | |
64 | 67 | */ |
65 | - private Long groupId; | |
68 | + private List<Long> postIds; | |
66 | 69 | |
67 | 70 | /** |
68 | - * 状态;1:审批中 2:待生效 3:生效中 4:已失效 5:草稿 | |
71 | + * 岗位名称 | |
69 | 72 | */ |
70 | - private SettingStatusEnum status; | |
73 | + private Set<String> postNames; | |
71 | 74 | |
72 | 75 | /** |
73 | - * 考评组 | |
76 | + * 适用门店ids | |
74 | 77 | */ |
75 | - private List<EvalGroupVO> evalGroups; | |
78 | + private List<Long> shopIds; | |
79 | + | |
80 | + /** | |
81 | + * 适用门店名称 | |
82 | + */ | |
83 | + private Set<String> shopNames; | |
84 | + | |
85 | + /** | |
86 | + * 考评排名组阶段 | |
87 | + */ | |
88 | + private List<EvalGroupRankStageVO> stages; | |
89 | + | |
76 | 90 | |
77 | 91 | |
78 | 92 | } |
79 | 93 | \ No newline at end of file | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalGroupVO.java
... | ... | @@ -5,6 +5,7 @@ import cn.fw.common.data.mybatis.handler.StringListTypeHandler; |
5 | 5 | import cn.fw.morax.domain.enums.EvalScopeEnum; |
6 | 6 | import cn.fw.morax.domain.enums.SettingStatusEnum; |
7 | 7 | import com.baomidou.mybatisplus.annotation.TableField; |
8 | +import com.baomidou.mybatisplus.annotation.TableLogic; | |
8 | 9 | import com.baomidou.mybatisplus.annotation.TableName; |
9 | 10 | import lombok.Data; |
10 | 11 | import lombok.EqualsAndHashCode; |
... | ... | @@ -29,26 +30,20 @@ public class EvalGroupVO { |
29 | 30 | * id |
30 | 31 | */ |
31 | 32 | private Long id; |
32 | - | |
33 | 33 | /** |
34 | - * 考评组编码 | |
34 | + * 考评排名组id | |
35 | 35 | */ |
36 | - private String egc; | |
36 | + private Long evalGroupRankId; | |
37 | 37 | |
38 | 38 | /** |
39 | - * 考评,活动名称 | |
39 | + * 考评阶段id | |
40 | 40 | */ |
41 | - private String name; | |
41 | + private Long evalGroupRankStageId; | |
42 | 42 | |
43 | 43 | /** |
44 | - * 考评类型; 1:活动考评 2:其他考评 | |
45 | - */ | |
46 | -// private EvalTypeEnum type; | |
47 | - | |
48 | - /** | |
49 | - * 考评范围; 1:门店考评 2:人员考评 | |
44 | + * 考评组编码 | |
50 | 45 | */ |
51 | - private EvalScopeEnum scopeType; | |
46 | + private String egc; | |
52 | 47 | |
53 | 48 | /** |
54 | 49 | * 岗位id |
... | ... | @@ -73,28 +68,6 @@ public class EvalGroupVO { |
73 | 68 | private List<String> shopNames; |
74 | 69 | |
75 | 70 | /** |
76 | - * 适用角色编码 | |
77 | - */ | |
78 | - @TableField(typeHandler = StringListTypeHandler.class) | |
79 | - private List<String> roleCodes; | |
80 | - /** | |
81 | - * 适用角色名称 | |
82 | - */ | |
83 | - @TableField(typeHandler = StringListTypeHandler.class) | |
84 | - private List<String> roleNames; | |
85 | - | |
86 | - /** | |
87 | - * 调整原因 | |
88 | - */ | |
89 | - private String reason; | |
90 | - | |
91 | - /** | |
92 | - * 附件;fid逗号隔开 | |
93 | - */ | |
94 | - private List<String> attachment; | |
95 | - | |
96 | - | |
97 | - /** | |
98 | 71 | * 包含指标数量 |
99 | 72 | */ |
100 | 73 | private Integer indicatorNum; |
... | ... | @@ -105,16 +78,6 @@ public class EvalGroupVO { |
105 | 78 | private Long groupId; |
106 | 79 | |
107 | 80 | /** |
108 | - * 生效时间 | |
109 | - */ | |
110 | - private LocalDate beginTime; | |
111 | - | |
112 | - /** | |
113 | - * 结束时间 | |
114 | - */ | |
115 | - private LocalDate overTime; | |
116 | - | |
117 | - /** | |
118 | 81 | * 考评指标 |
119 | 82 | */ |
120 | 83 | private List<EvalGroupIndicatorVO> indicators; | ... | ... |
fw-morax-sdk/src/main/java/cn/fw/morax/sdk/dto/kpi/KpiStageReportNoticeMQ.java
0 → 100644
1 | +package cn.fw.morax.sdk.dto.kpi; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Builder; | |
5 | +import lombok.Data; | |
6 | +import lombok.NoArgsConstructor; | |
7 | + | |
8 | +import java.time.LocalDate; | |
9 | +import java.util.Date; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author jiangchao | |
14 | + * @des: 绩效阶段指标上报 | |
15 | + * @date 2023/5/12 9:27 | |
16 | + */ | |
17 | +@Data | |
18 | +@AllArgsConstructor | |
19 | +@NoArgsConstructor | |
20 | +@Builder | |
21 | +public class KpiStageReportNoticeMQ { | |
22 | + /** | |
23 | + * topic | |
24 | + */ | |
25 | + public final static String TOPIC = "kpi_stage_report"; | |
26 | + /** | |
27 | + * 编码 | |
28 | + */ | |
29 | + private String code; | |
30 | + | |
31 | + /** | |
32 | + * 阶段开始时间 | |
33 | + */ | |
34 | + private Date beginTime; | |
35 | + | |
36 | + /** | |
37 | + * 阶段结束时间 | |
38 | + */ | |
39 | + private Date endTime; | |
40 | + | |
41 | + /** | |
42 | + * 门店 | |
43 | + */ | |
44 | + private List<Long> shopIds; | |
45 | + | |
46 | + /** | |
47 | + * 人员id | |
48 | + */ | |
49 | + private List<Long> userIds; | |
50 | + | |
51 | + /** | |
52 | + * 唯一id | |
53 | + */ | |
54 | + private String uid; | |
55 | + | |
56 | +} | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalGroupRankController.java
... | ... | @@ -57,33 +57,33 @@ public class EvalGroupRankController { |
57 | 57 | return success(evalGroupRankBizService.evalGroupRankPage(dto)); |
58 | 58 | } |
59 | 59 | |
60 | - /** | |
61 | - * 未选择考评组列表 | |
62 | - * | |
63 | - * @param dto | |
64 | - * @return | |
65 | - */ | |
66 | - @GetMapping("/eval-group/page") | |
67 | - @ControllerMethod("未选择考评组列表") | |
68 | - public Message<AppPage<EvalGroupVO>> restEvalGroupPage(@Validated EvalGroupRankQueryDTO dto) { | |
69 | - if (PublicUtil.isEmpty(dto.getScopeType())) { | |
70 | - throw new BusinessException("参数错误"); | |
71 | - } | |
72 | - return success(evalGroupRankBizService.restEvalGroupPage(dto)); | |
73 | - } | |
60 | +// /** | |
61 | +// * 未选择考评组列表 | |
62 | +// * | |
63 | +// * @param dto | |
64 | +// * @return | |
65 | +// */ | |
66 | +// @GetMapping("/eval-group/page") | |
67 | +// @ControllerMethod("未选择考评组列表") | |
68 | +// public Message<AppPage<EvalGroupVO>> restEvalGroupPage(@Validated EvalGroupRankQueryDTO dto) { | |
69 | +// if (PublicUtil.isEmpty(dto.getScopeType())) { | |
70 | +// throw new BusinessException("参数错误"); | |
71 | +// } | |
72 | +// return success(evalGroupRankBizService.restEvalGroupPage(dto)); | |
73 | +// } | |
74 | 74 | |
75 | - /** | |
76 | - * 考评组排名配置保存 | |
77 | - * | |
78 | - * @param dto | |
79 | - * @return | |
80 | - */ | |
81 | - @PostMapping("/config") | |
82 | - @ControllerMethod("考评组排名配置保存") | |
83 | - public Message<Void> saveEvalGroupRank(@RequestBody @Validated EvalGroupRankDTO dto, @CurrentUser LoginAuthBean currentUser) { | |
84 | - evalGroupRankBizService.saveEvalGroupRank(dto); | |
85 | - return success(); | |
86 | - } | |
75 | +// /** | |
76 | +// * 考评组排名配置保存 | |
77 | +// * | |
78 | +// * @param dto | |
79 | +// * @return | |
80 | +// */ | |
81 | +// @PostMapping("/config") | |
82 | +// @ControllerMethod("考评组排名配置保存") | |
83 | +// public Message<Void> saveEvalGroupRank(@RequestBody @Validated EvalGroupRankDTO dto, @CurrentUser LoginAuthBean currentUser) { | |
84 | +// evalGroupRankBizService.saveEvalGroupRank(dto); | |
85 | +// return success(); | |
86 | +// } | |
87 | 87 | |
88 | 88 | |
89 | 89 | /** | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalTaskController.java
... | ... | @@ -120,12 +120,12 @@ public class EvalTaskController { |
120 | 120 | // return success(); |
121 | 121 | // } |
122 | 122 | |
123 | - @GetMapping("/eval-group") | |
124 | - @ControllerMethod("处理考评组") | |
125 | - public Message<Void> processCurMonthEffectEvals() { | |
126 | - evalGroupTask.processCurMonthEffectEvals(); | |
127 | - return success(); | |
128 | - } | |
123 | +// @GetMapping("/eval-group") | |
124 | +// @ControllerMethod("处理考评组") | |
125 | +// public Message<Void> processCurMonthEffectEvals() { | |
126 | +// evalGroupTask.processCurMonthEffectEvals(); | |
127 | +// return success(); | |
128 | +// } | |
129 | 129 | |
130 | 130 | |
131 | 131 | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/SettingDraftController.java
... | ... | @@ -8,6 +8,7 @@ import cn.fw.data.base.domain.common.Message; |
8 | 8 | import cn.fw.morax.common.utils.PublicUtil; |
9 | 9 | import cn.fw.morax.domain.dto.SettingDraftDTO; |
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.*; |
12 | 13 | import cn.fw.morax.domain.dto.query.*; |
13 | 14 | import cn.fw.morax.domain.dto.salary.SalaryGroupDTO; |
... | ... | @@ -97,6 +98,18 @@ public class SettingDraftController { |
97 | 98 | } |
98 | 99 | |
99 | 100 | /** |
101 | + * 考评排名组列表 | |
102 | + * | |
103 | + * @param dto | |
104 | + * @return | |
105 | + */ | |
106 | + @GetMapping("/eval-rank-page") | |
107 | + @ControllerMethod("考评排名组列表") | |
108 | + public Message<AppPage<EvalGroupRankDTO>> evalGroupRankPage(@Validated SettingDraftQueryDTO dto) { | |
109 | + return success(settingDraftBizService.evalGroupRankPage(dto)); | |
110 | + } | |
111 | + | |
112 | + /** | |
100 | 113 | * 绩效组草稿详情 |
101 | 114 | * |
102 | 115 | * @param id 草稿id |
... | ... | @@ -145,6 +158,20 @@ public class SettingDraftController { |
145 | 158 | } |
146 | 159 | |
147 | 160 | /** |
161 | + * 考评排名组草稿详情 | |
162 | + * | |
163 | + * @param id 草稿id | |
164 | + * @return | |
165 | + */ | |
166 | + @GetMapping("/eval-rank-detail") | |
167 | + @ControllerMethod("考评排名组草稿详情") | |
168 | + public Message<EvalGroupRankDTO> draftEvalGroupRankDetail(@NotNull(message = "草稿id不能为空") Long id) { | |
169 | + return success(settingDraftBizService.draftEvalGroupRankDetail(id)); | |
170 | + } | |
171 | + | |
172 | + | |
173 | + | |
174 | + /** | |
148 | 175 | * 删除草稿,审批不通过、 |
149 | 176 | * |
150 | 177 | * @return | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/task/EvalGroupTask.java
... | ... | @@ -2,12 +2,16 @@ package cn.fw.morax.server.task; |
2 | 2 | |
3 | 3 | import cn.fw.common.cache.locker.DistributedLocker; |
4 | 4 | import cn.fw.morax.common.constant.TimeTaskConstant; |
5 | +import cn.fw.morax.common.utils.DateUtil; | |
5 | 6 | import cn.fw.morax.common.utils.PublicUtil; |
7 | +import cn.fw.morax.domain.bo.StageIndicatorBO; | |
6 | 8 | import cn.fw.morax.domain.db.eval.*; |
7 | -import cn.fw.morax.domain.enums.EvalScopeEnum; | |
8 | -import cn.fw.morax.domain.enums.EvalShopPoolStatusEnum; | |
9 | +import cn.fw.morax.domain.db.kpi.KpiStageMqLog; | |
9 | 10 | import cn.fw.morax.domain.enums.SettingStatusEnum; |
11 | +import cn.fw.morax.sdk.dto.kpi.KpiStageReportNoticeMQ; | |
12 | +import cn.fw.morax.service.component.KpiStageIndicatorReportProducer; | |
10 | 13 | import cn.fw.morax.service.data.eval.*; |
14 | +import cn.fw.morax.service.data.kpi.KpiStageMqLogService; | |
11 | 15 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
12 | 16 | import lombok.Getter; |
13 | 17 | import lombok.RequiredArgsConstructor; |
... | ... | @@ -18,6 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
18 | 22 | import org.springframework.scheduling.annotation.Scheduled; |
19 | 23 | import org.springframework.stereotype.Component; |
20 | 24 | import org.springframework.transaction.annotation.Transactional; |
25 | +import org.springframework.util.CollectionUtils; | |
21 | 26 | |
22 | 27 | import java.time.LocalDate; |
23 | 28 | import java.util.*; |
... | ... | @@ -36,11 +41,15 @@ import java.util.stream.Collectors; |
36 | 41 | @ConditionalOnProperty(prefix = "task", name = "switch", havingValue = "on") |
37 | 42 | public class EvalGroupTask { |
38 | 43 | |
44 | + private final EvalGroupIndicatorService evalGroupIndicatorService; | |
39 | 45 | private final EvalGroupRankStageService evalGroupRankStageService; |
40 | 46 | private final EvalShopPoolService evalShopPoolService; |
47 | + private final EvalGroupUserService evalGroupUserService; | |
48 | + private final KpiStageMqLogService kpiStageMqLogService; | |
41 | 49 | private final EvalGroupRankService evalGroupRankService; |
42 | 50 | private final DistributedLocker distributedLocker; |
43 | 51 | private final EvalGroupService evalGroupService; |
52 | + private final KpiStageIndicatorReportProducer kpiStageIndicatorReportProducer; | |
44 | 53 | |
45 | 54 | @Value("${spring.cache.custom.global-prefix}:eval:group") |
46 | 55 | @Getter |
... | ... | @@ -50,49 +59,68 @@ public class EvalGroupTask { |
50 | 59 | private String evalGroupRankKey; |
51 | 60 | |
52 | 61 | /** |
53 | - * 每天凌晨3点 | |
54 | - * 1. 将待生效数据改为生效中 | |
55 | - * 2. 将之前的配置设置为失效 | |
56 | - * 3. 处理重复数据,合并、拆分门店的考评组配置需要把其他的重复配置失效 | |
62 | + * 发送业务上报mq通知 | |
57 | 63 | */ |
58 | - @Scheduled(cron = TimeTaskConstant.EVAL_STATUS) | |
59 | - @Transactional(rollbackFor = Exception.class) | |
60 | - public void processCurMonthEffectEvals() { | |
61 | - Lock lock = distributedLocker.lock(getEvalGroupDistKey()); | |
62 | - if (! ((RLock) lock).isLocked()) { | |
63 | - return; | |
64 | - } | |
65 | - try { | |
66 | - log.info("定时任务【每月考评组配置状态改变】开始执行"); | |
67 | - LocalDate currentTime = LocalDate.now(); | |
68 | - List<EvalGroupRank> evalGroupRanks = evalGroupRankService.list(Wrappers.<EvalGroupRank>lambdaQuery() | |
69 | - .eq(EvalGroupRank::getStatus, SettingStatusEnum.EFFECTIVE) | |
70 | - .eq(EvalGroupRank::getYn, Boolean.TRUE) | |
71 | - ); | |
72 | - if (PublicUtil.isEmpty(evalGroupRanks)) { | |
64 | + @Scheduled(cron = TimeTaskConstant.EVAL_GROUP_REPORT_MQ) | |
65 | + public void sendNotice() { | |
66 | + final String lockKey = ":kpiSendNotice"; | |
67 | + Lock lock = distributedLocker.lock(lockKey); | |
68 | + if (((RLock) lock).isLocked()) { | |
69 | + LocalDate lastDate = LocalDate.now().minusDays(1); | |
70 | + List<StageIndicatorBO> evalGroupRankStages = evalGroupIndicatorService.getStageIndicators(lastDate); | |
71 | + if (CollectionUtils.isEmpty(evalGroupRankStages)) { | |
73 | 72 | return; |
74 | 73 | } |
75 | - List<EvalGroupRank> ineffectiveRanks = new ArrayList<>(); | |
76 | - for (EvalGroupRank evalGroupRank : evalGroupRanks) { | |
77 | - List<EvalGroupRankStage> stages = evalGroupRankStageService.list(Wrappers.<EvalGroupRankStage>lambdaQuery() | |
78 | - .eq(EvalGroupRankStage::getEvalGroupRankId, evalGroupRank.getId()) | |
79 | - .eq(EvalGroupRankStage::getYn, Boolean.TRUE) | |
80 | - ); | |
81 | - Boolean ineffective = stages.stream() | |
82 | - .filter(evalGroup -> evalGroup.getOverTime().isAfter(currentTime)).findFirst().isPresent(); | |
83 | - if (ineffective) { | |
84 | - evalGroupRank.setStatus(SettingStatusEnum.INEFFECTIVE); | |
85 | - ineffectiveRanks.add(evalGroupRank); | |
74 | + for (StageIndicatorBO stageIndicator : evalGroupRankStages) { | |
75 | + try { | |
76 | + sendNotice(stageIndicator, lastDate); | |
77 | + } catch (Exception e) { | |
78 | + log.error("发送绩效阶段上报mq失败: [{}]", stageIndicator, e); | |
86 | 79 | } |
87 | 80 | } |
88 | - } catch (Exception e){ | |
89 | - log.error(e.getMessage(), e); | |
90 | - } finally { | |
91 | 81 | lock.unlock(); |
92 | 82 | } |
93 | 83 | } |
94 | 84 | |
95 | 85 | /** |
86 | + * 发送绩效数据上报mq | |
87 | + * | |
88 | + * @param localDate | |
89 | + */ | |
90 | + @Transactional(rollbackFor = Exception.class) | |
91 | + public void sendNotice(StageIndicatorBO stageIndicator, final LocalDate localDate) { | |
92 | + KpiStageMqLog mqLog = new KpiStageMqLog(); | |
93 | + mqLog.setIndicatorCode(stageIndicator.getIndicatorCode()); | |
94 | + mqLog.setBeginTime(stageIndicator.getBeginTime()); | |
95 | + mqLog.setEndTime(localDate); | |
96 | + mqLog.setEvalGroupId(stageIndicator.getEvalGroupId()); | |
97 | + mqLog.setEvalGroupRankId(stageIndicator.getEvalGroupRankId()); | |
98 | + mqLog.setGroupId(stageIndicator.getGroupId()); | |
99 | + List<EvalGroupUser> users = evalGroupUserService.list(Wrappers.<EvalGroupUser>lambdaQuery() | |
100 | + .eq(EvalGroupUser::getEvalGroupId, stageIndicator.getEvalGroupId()) | |
101 | + .eq(EvalGroupUser::getDataDate, localDate) | |
102 | + .eq(EvalGroupUser::getYn, Boolean.TRUE) | |
103 | + ); | |
104 | + List<Long> userIds = users.stream().map(EvalGroupUser::getUserId).distinct().collect(Collectors.toList()); | |
105 | + List<Long> shopIds = users.stream().map(EvalGroupUser::getShopId).distinct().collect(Collectors.toList()); | |
106 | + if (PublicUtil.isEmpty(userIds)) { | |
107 | + return; | |
108 | + } | |
109 | + mqLog.setShopIds(shopIds); | |
110 | + mqLog.setUserIds(userIds); | |
111 | + kpiStageMqLogService.save(mqLog); | |
112 | + | |
113 | + kpiStageIndicatorReportProducer.send(KpiStageReportNoticeMQ.builder() | |
114 | + .code(stageIndicator.getIndicatorCode()) | |
115 | + .beginTime(DateUtil.localDateTime2Date(mqLog.getBeginTime().atTime(0,0,1))) | |
116 | + .endTime(DateUtil.localDateTime2Date(mqLog.getEndTime().atTime(23,59,59))) | |
117 | + .shopIds(mqLog.getShopIds()) | |
118 | + .userIds(mqLog.getUserIds()) | |
119 | + .uid(mqLog.getId().toString()) | |
120 | + .build()); | |
121 | + } | |
122 | + | |
123 | + /** | |
96 | 124 | * 每月考评排名组配置状态改变 |
97 | 125 | */ |
98 | 126 | @Scheduled(cron = TimeTaskConstant.EVAL_GROUP_RANK_STATUS) | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/SettingDraftBizService.java
... | ... | @@ -12,6 +12,7 @@ import cn.fw.morax.domain.db.SettingDraft; |
12 | 12 | import cn.fw.morax.domain.db.kpi.KpiGroupUser; |
13 | 13 | import cn.fw.morax.domain.dto.SettingDraftDTO; |
14 | 14 | import cn.fw.morax.domain.dto.eval.EvalDTO; |
15 | +import cn.fw.morax.domain.dto.eval.EvalGroupRankDTO; | |
15 | 16 | import cn.fw.morax.domain.dto.kpi.KpiGroupDTO; |
16 | 17 | import cn.fw.morax.domain.dto.kpi.KpiGroupRankBaseInfoDTO; |
17 | 18 | import cn.fw.morax.domain.dto.kpi.KpiGroupRankDTO; |
... | ... | @@ -116,6 +117,41 @@ public class SettingDraftBizService { |
116 | 117 | * @param dto |
117 | 118 | * @return |
118 | 119 | */ |
120 | + public AppPage<EvalGroupRankDTO> evalGroupRankPage(SettingDraftQueryDTO dto) { | |
121 | + PageData<SettingDraft> pageData = settingDraftService.page(new PageData<>(dto.getCurrent(), dto.getPageSize()), | |
122 | + Wrappers.<SettingDraft>lambdaQuery() | |
123 | + .eq(SettingDraft::getGroupId, dto.getGroupId()) | |
124 | + .eq(SettingDraft::getType, dto.getType()) | |
125 | + .apply(PublicUtil.isNotEmpty(dto.getPostId()), MessageFormatUtil.transferWithQuotationMarks("FIND_IN_SET({0}, post_ids)", dto.getPostId())) | |
126 | + .apply(PublicUtil.isNotEmpty(dto.getShopId()), MessageFormatUtil.transferWithQuotationMarks("FIND_IN_SET({0}, shop_ids)", dto.getShopId())) | |
127 | + .eq(PublicUtil.isNotEmpty(dto.getStatus()), SettingDraft::getStatus, dto.getStatus()) | |
128 | + .like(PublicUtil.isNotEmpty(dto.getName()), SettingDraft::getName, dto.getName()) | |
129 | + .eq(SettingDraft::getYn, Boolean.TRUE) | |
130 | + .last("ORDER BY id DESC") | |
131 | + ); | |
132 | + | |
133 | + Map<Long, String> finalApprovalRecordMap = getApprovalNo(pageData, dto.getType()); | |
134 | + return PublicUtil.toPage(pageData, settingDraft -> { | |
135 | + EvalGroupRankDTO evalGroupRankDTO = JSON.parseObject(settingDraft.getContent(), EvalGroupRankDTO.class); | |
136 | + evalGroupRankDTO.setApprovalNo(finalApprovalRecordMap.getOrDefault(settingDraft.getId(), "")); | |
137 | + evalGroupRankDTO.setDraftId(settingDraft.getId()); | |
138 | + evalGroupRankDTO.setDraftStatus(settingDraft.getStatus()); | |
139 | +// List<KpiGroupRankBaseInfoDTO> baseInfoDTOs = JSON.parseArray(settingDraft.getBaseInfo(), KpiGroupRankBaseInfoDTO.class); | |
140 | +// if (PublicUtil.isNotEmpty(baseInfoDTOs)) { | |
141 | +// List<String> postNames = baseInfoDTOs.stream().map(KpiGroupRankBaseInfoDTO::getPostName).distinct().collect(Collectors.toList()); | |
142 | +// List<String> shopNames = baseInfoDTOs.stream().flatMap(base -> base.getShopNames().stream()).distinct().collect(Collectors.toList()); | |
143 | +// evalGroupRankDTO.setPostNames(postNames); | |
144 | +// evalGroupRankDTO.setShopNames(shopNames); | |
145 | +// } | |
146 | + return evalGroupRankDTO; | |
147 | + }); | |
148 | + } | |
149 | + | |
150 | + /** | |
151 | + * 分页查询 | |
152 | + * @param dto | |
153 | + * @return | |
154 | + */ | |
119 | 155 | public AppPage<SalaryGroupDTO> salaryGroupPage(SettingDraftQueryDTO dto) { |
120 | 156 | PageData<SettingDraft> pageData = settingDraftService.page(new PageData<>(dto.getCurrent(), dto.getPageSize()), |
121 | 157 | Wrappers.<SettingDraft>lambdaQuery() |
... | ... | @@ -373,6 +409,18 @@ public class SettingDraftBizService { |
373 | 409 | evalDTO.setDraftId(settingDraft.getId()); |
374 | 410 | return evalDTO; |
375 | 411 | } |
412 | + /** | |
413 | + * 绩效排名组详情 | |
414 | + * | |
415 | + * @param id | |
416 | + * @return | |
417 | + */ | |
418 | + public EvalGroupRankDTO draftEvalGroupRankDetail(Long id) { | |
419 | + SettingDraft settingDraft = this.getSettingDraft(id, SettingDraftTypeEnum.EVAL_GROUP_RANK); | |
420 | + EvalGroupRankDTO evalDTO = JSON.parseObject(settingDraft.getContent(), EvalGroupRankDTO.class); | |
421 | + evalDTO.setDraftId(settingDraft.getId()); | |
422 | + return evalDTO; | |
423 | + } | |
376 | 424 | |
377 | 425 | @Transactional(rollbackFor = Exception.class) |
378 | 426 | public SettingDraft approvalDraft(ApprovalRecord approvalRecord, ApprovalResultEvent result) { | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalCalculateService.java
... | ... | @@ -206,7 +206,6 @@ public class EvalCalculateService { |
206 | 206 | |
207 | 207 | public void updatePool(EvalGroup evalGroup, LocalDate localDate, List<EvalPoolRewardDetail> rewardDetails, List<EvalGroupUserShop> userShops) { |
208 | 208 | final Long evalGroupId = evalGroup.getId(); |
209 | - EvalScopeEnum evalScope = evalGroup.getScopeType(); | |
210 | 209 | List<Long> poolIds = userShops.stream().map(EvalGroupUserShop::getPoolId).collect(Collectors.toList()); |
211 | 210 | if (PublicUtil.isNotEmpty(rewardDetails)) { |
212 | 211 | evalPoolRewardDetailService.remove(Wrappers.<EvalPoolRewardDetail>lambdaQuery() |
... | ... | @@ -216,37 +215,19 @@ public class EvalCalculateService { |
216 | 215 | ); |
217 | 216 | evalPoolRewardDetailService.saveBatch(rewardDetails); |
218 | 217 | } |
219 | - if (EvalScopeEnum.STAFF.equals(evalScope)) { | |
220 | - for (EvalGroupUserShop userShop : userShops) { | |
221 | - BigDecimal scoreRatio = BigDecimal.ZERO; | |
222 | - if (userShop.getIndicatorTotalScore().compareTo(BigDecimal.ZERO) > 0) { | |
223 | - scoreRatio = userShop.getScore().divide(userShop.getIndicatorTotalScore(), 2, RoundingMode.DOWN); | |
224 | - } | |
225 | - evalUserPoolService.update(Wrappers.<EvalUserPool>lambdaUpdate() | |
226 | - .eq(EvalUserPool::getId, userShop.getPoolId()) | |
227 | - .eq(EvalUserPool::getYn, Boolean.TRUE) | |
228 | - .set(EvalUserPool::getReward, userShop.getReward()) | |
229 | - .set(EvalUserPool::getScore, userShop.getScore()) | |
230 | - .set(EvalUserPool::getScoreRatio, scoreRatio) | |
231 | - .set(EvalUserPool::getMonthly, YearMonth.from(localDate)) | |
232 | - .set(EvalUserPool::getDataDate, localDate) | |
233 | - ); | |
234 | - } | |
235 | - return; | |
236 | - } | |
237 | 218 | for (EvalGroupUserShop userShop : userShops) { |
238 | 219 | BigDecimal scoreRatio = BigDecimal.ZERO; |
239 | 220 | if (userShop.getIndicatorTotalScore().compareTo(BigDecimal.ZERO) > 0) { |
240 | 221 | scoreRatio = userShop.getScore().divide(userShop.getIndicatorTotalScore(), 2, RoundingMode.DOWN); |
241 | 222 | } |
242 | - evalShopPoolService.update(Wrappers.<EvalShopPool>lambdaUpdate() | |
243 | - .eq(EvalShopPool::getId, userShop.getPoolId()) | |
244 | - .eq(EvalShopPool::getYn, Boolean.TRUE) | |
245 | - .set(EvalShopPool::getReward, userShop.getReward()) | |
246 | - .set(EvalShopPool::getScore, userShop.getScore()) | |
247 | - .set(EvalShopPool::getScoreRatio, scoreRatio) | |
248 | - .set(EvalShopPool::getMonthly, YearMonth.from(localDate)) | |
249 | - .set(EvalShopPool::getDataDate, localDate) | |
223 | + evalUserPoolService.update(Wrappers.<EvalUserPool>lambdaUpdate() | |
224 | + .eq(EvalUserPool::getId, userShop.getPoolId()) | |
225 | + .eq(EvalUserPool::getYn, Boolean.TRUE) | |
226 | + .set(EvalUserPool::getReward, userShop.getReward()) | |
227 | + .set(EvalUserPool::getScore, userShop.getScore()) | |
228 | + .set(EvalUserPool::getScoreRatio, scoreRatio) | |
229 | + .set(EvalUserPool::getMonthly, YearMonth.from(localDate)) | |
230 | + .set(EvalUserPool::getDataDate, localDate) | |
250 | 231 | ); |
251 | 232 | } |
252 | 233 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupBizService.java
... | ... | @@ -73,8 +73,9 @@ public class EvalGroupBizService { |
73 | 73 | * @return |
74 | 74 | */ |
75 | 75 | @Transactional(rollbackFor = Exception.class) |
76 | - @DisLock(prefix = "#this.getSaveGroupPrefix()", key = "#dto.getName()", message = "保存中,请勿重复操作") | |
76 | + @DisLock(prefix = "#this.getSaveGroupPrefix()", key = "#evalGroupRankDto.getName()", message = "保存中,请勿重复操作") | |
77 | 77 | public void saveEvalGroupRank(EvalGroupRankDTO evalGroupRankDto, LoginAuthBean user, Boolean isSubmit) { |
78 | + this.checkNameRepetition(evalGroupRankDto); | |
78 | 79 | AtomicInteger evalGroupSize = new AtomicInteger(); |
79 | 80 | LocalDate lastStageOverTime = null; |
80 | 81 | Boolean multiStage = evalGroupRankDto.getMultiStage(); |
... | ... | @@ -127,7 +128,7 @@ public class EvalGroupBizService { |
127 | 128 | settingDraft = new SettingDraft(); |
128 | 129 | settingDraft.setGroupId(dto.getGroupId()); |
129 | 130 | settingDraft.setYn(Boolean.TRUE); |
130 | - settingDraft.setType(SettingDraftTypeEnum.EVAL); | |
131 | + settingDraft.setType(SettingDraftTypeEnum.EVAL_GROUP_RANK); | |
131 | 132 | } else { |
132 | 133 | settingDraft = settingDraftService.getById(dto.getDraftId()); |
133 | 134 | BV.notNull(settingDraft, "草稿配置不存在,请重试"); |
... | ... | @@ -343,17 +344,15 @@ public class EvalGroupBizService { |
343 | 344 | /** |
344 | 345 | * 检查绩效组排名名称是否重复 |
345 | 346 | * |
346 | - * @param id | |
347 | - * @param name | |
347 | + * @param evalGroupRankDto | |
348 | 348 | */ |
349 | - public void checkNameRepetition(Long id, String name) { | |
350 | - int count = evalGroupService.count(Wrappers.<EvalGroup>lambdaQuery() | |
351 | - .eq(EvalGroup::getName, name) | |
352 | - .ne(PublicUtil.isNotEmpty(id), EvalGroup::getId, id) | |
353 | - .eq(EvalGroup::getYn, Boolean.TRUE) | |
354 | -// .eq(EvalGroup::getStatus, SettingStatusEnum.EFFECTIVE) | |
349 | + public void checkNameRepetition(EvalGroupRankDTO evalGroupRankDto) { | |
350 | + int count = evalGroupRankService.count(Wrappers.<EvalGroupRank>lambdaQuery() | |
351 | + .eq(EvalGroupRank::getName, evalGroupRankDto.getName()) | |
352 | + .ne(PublicUtil.isNotEmpty(evalGroupRankDto.getId()), EvalGroupRank::getId, evalGroupRankDto.getId()) | |
353 | + .eq(EvalGroupRank::getYn, Boolean.TRUE) | |
355 | 354 | ); |
356 | - BV.isTrue(count <= 0, "绩效组名称重复,请重新输入"); | |
355 | + BV.isTrue(count <= 0, "考评排名组名称重复,请重新输入"); | |
357 | 356 | } |
358 | 357 | |
359 | 358 | /** | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupDataService.java
... | ... | @@ -72,7 +72,6 @@ public class EvalGroupDataService { |
72 | 72 | List<Long> evalGroupIds = evalGroups.stream().map(EvalGroup::getId).collect(Collectors.toList()); |
73 | 73 | evalGroupService.update(Wrappers.<EvalGroup>lambdaUpdate() |
74 | 74 | .in(EvalGroup::getId, evalGroupIds) |
75 | - .set(EvalGroup::getOverTime, LocalDate.now().minusDays(1)) | |
76 | 75 | .set(EvalGroup::getUpdateTime, new Date()) |
77 | 76 | .set(EvalGroup::getYn, Boolean.FALSE) |
78 | 77 | ); | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupRankBizService.java
1 | 1 | package cn.fw.morax.service.biz.eval; |
2 | 2 | |
3 | -import cn.fw.common.data.mybatis.pagination.PageData; | |
4 | 3 | import cn.fw.common.page.AppPage; |
5 | 4 | import cn.fw.morax.common.constant.Constant; |
6 | 5 | import cn.fw.morax.common.utils.PublicUtil; |
... | ... | @@ -20,10 +19,11 @@ import org.springframework.beans.factory.annotation.Value; |
20 | 19 | import org.springframework.stereotype.Service; |
21 | 20 | import org.springframework.transaction.annotation.Transactional; |
22 | 21 | |
23 | -import java.math.BigDecimal; | |
24 | 22 | import java.time.LocalDate; |
25 | -import java.util.*; | |
26 | -import java.util.function.Function; | |
23 | +import java.util.ArrayList; | |
24 | +import java.util.HashSet; | |
25 | +import java.util.List; | |
26 | +import java.util.Map; | |
27 | 27 | import java.util.stream.Collectors; |
28 | 28 | |
29 | 29 | import static cn.fw.common.businessvalidator.Validator.BV; |
... | ... | @@ -33,10 +33,11 @@ import static cn.fw.common.businessvalidator.Validator.BV; |
33 | 33 | @Slf4j |
34 | 34 | public class EvalGroupRankBizService { |
35 | 35 | |
36 | + private final EvalGroupRankStageService evalGroupRankStageService; | |
37 | + private final EvalGroupRankService evalGroupRankService; | |
36 | 38 | private final EvalUserPoolService evalUserPoolService; |
37 | 39 | private final EvalShopPoolService evalShopPoolService; |
38 | 40 | private final EvalGroupService evalGroupService; |
39 | - private final EvalGroupRankService evalGroupRankService; | |
40 | 41 | private final EvalService evalService; |
41 | 42 | |
42 | 43 | @Value("${spring.cache.custom.global-prefix}:kpi:group:save:") |
... | ... | @@ -62,29 +63,18 @@ public class EvalGroupRankBizService { |
62 | 63 | } |
63 | 64 | |
64 | 65 | List<EvalGroupRankVO> evalGroupRankVOS = evalGroupRankService.queryPageRank(dto); |
65 | - List<String> egcs = evalGroupRankVOS.stream().map(EvalGroupRankVO::getEgcs).collect(ArrayList::new, List::addAll, List::addAll); | |
66 | - List<EvalGroup> evalGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
67 | - .in(EvalGroup::getEgc, egcs) | |
68 | - .eq(EvalGroup::getYn, Boolean.TRUE) | |
69 | - ); | |
70 | - Map<String, EvalGroup> egcGroupMap = evalGroups.stream().collect(Collectors.toMap(EvalGroup::getEgc, Function.identity(), (v1, v2) -> v1)); | |
66 | + List<EvalGroup> evalGroups = evalGroupService.getEvalGroups(evalGroupRankVOS.stream().map(EvalGroupRankVO::getId).collect(Collectors.toList())); | |
67 | + Map<Long, List<EvalGroup>> egcGroupMap = evalGroups.stream().collect(Collectors.groupingBy(EvalGroup::getEvalGroupRankId)); | |
71 | 68 | for (EvalGroupRankVO epiGroupRankVO : evalGroupRankVOS) { |
72 | 69 | epiGroupRankVO.setPostIds(new ArrayList<>()); |
73 | 70 | epiGroupRankVO.setPostNames(new HashSet<>()); |
74 | 71 | epiGroupRankVO.setShopIds(new ArrayList<>()); |
75 | 72 | epiGroupRankVO.setShopNames(new HashSet<>()); |
76 | - epiGroupRankVO.setEvalGroupNames(new ArrayList<>()); | |
77 | - for (String kgc : epiGroupRankVO.getEgcs()) { | |
78 | - if (egcGroupMap.containsKey(kgc)) { | |
79 | - EvalGroup evalGroup = egcGroupMap.get(kgc); | |
80 | - epiGroupRankVO.getPostIds().add(evalGroup.getPostId()); | |
81 | - epiGroupRankVO.getPostNames().add(evalGroup.getPostName()); | |
82 | - epiGroupRankVO.getShopIds().addAll(evalGroup.getShopIds()); | |
83 | - epiGroupRankVO.getShopNames().addAll(evalGroup.getShopNames()); | |
84 | - if (PublicUtil.isNotEmpty(evalGroup.getName())) { | |
85 | - epiGroupRankVO.getEvalGroupNames().add(evalGroup.getName()); | |
86 | - } | |
87 | - } | |
73 | + for (EvalGroup evalGroup : egcGroupMap.get(epiGroupRankVO.getId())) { | |
74 | + epiGroupRankVO.getPostIds().add(evalGroup.getPostId()); | |
75 | + epiGroupRankVO.getPostNames().add(evalGroup.getPostName()); | |
76 | + epiGroupRankVO.getShopIds().addAll(evalGroup.getShopIds()); | |
77 | + epiGroupRankVO.getShopNames().addAll(evalGroup.getShopNames()); | |
88 | 78 | } |
89 | 79 | } |
90 | 80 | page.setTotal(total); |
... | ... | @@ -165,12 +155,20 @@ public class EvalGroupRankBizService { |
165 | 155 | public EvalGroupRankVO evalGroupRankDetail(Long id) { |
166 | 156 | EvalGroupRank evalGroupRank = evalGroupRankService.getById(id); |
167 | 157 | EvalGroupRankVO evalGroupRankVO = PublicUtil.copy(evalGroupRank, EvalGroupRankVO.class); |
168 | - List<EvalGroup> evalGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
169 | - .eq(EvalGroup::getYn, Boolean.TRUE) | |
170 | - .in(EvalGroup::getEgc, evalGroupRankVO.getEgcs()) | |
158 | + | |
159 | + List<EvalGroupRankStage> stages = evalGroupRankStageService.list(Wrappers.<EvalGroupRankStage>lambdaQuery() | |
160 | + .in(EvalGroupRankStage::getEvalGroupRankId, evalGroupRankVO.getId()) | |
161 | + .eq(EvalGroupRankStage::getYn, Boolean.TRUE) | |
171 | 162 | ); |
163 | + List<EvalGroupRankStageVO> stageVOS = PublicUtil.copyList(stages, EvalGroupRankStageVO.class); | |
164 | + evalGroupRankVO.setStages(stageVOS); | |
165 | + | |
166 | + List<EvalGroup> evalGroups = evalGroupService.getEvalGroups(evalGroupRankVO.getId()); | |
172 | 167 | List<EvalGroupVO> evalGroupVOS = PublicUtil.copyList(evalGroups, EvalGroupVO.class); |
173 | - evalGroupRankVO.setEvalGroups(evalGroupVOS); | |
168 | + Map<Long, List<EvalGroupVO>> evalGroupStageMap = evalGroupVOS.stream().collect(Collectors.groupingBy(EvalGroupVO::getEvalGroupRankStageId)); | |
169 | + for (EvalGroupRankStageVO stageVO : stageVOS) { | |
170 | + stageVO.setEvalGroups(evalGroupStageMap.getOrDefault(stageVO.getId(), new ArrayList<>())); | |
171 | + } | |
174 | 172 | return evalGroupRankVO; |
175 | 173 | } |
176 | 174 | |
... | ... | @@ -264,27 +262,6 @@ public class EvalGroupRankBizService { |
264 | 262 | } |
265 | 263 | } |
266 | 264 | |
267 | - /** | |
268 | - * 检查考评组排名名称是否重复 | |
269 | - * | |
270 | - * @param egcs | |
271 | - */ | |
272 | - public void checkEgcRepetition(Long id, List<String> egcs) { | |
273 | - List<EvalGroupRankVO> evalGroupRankVOS = evalGroupRankService.queryByEgcs(egcs, id); | |
274 | - if (PublicUtil.isEmpty(evalGroupRankVOS)) { | |
275 | - return; | |
276 | - } | |
277 | - //出现重复,返回错误信息 | |
278 | - List<String> allEgcs = evalGroupRankVOS.stream().map(EvalGroupRankVO::getEgcs).collect(ArrayList::new, List::addAll, List::addAll); | |
279 | - allEgcs.retainAll(egcs); | |
280 | - List<EvalGroup> repetitionEvals = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
281 | - .eq(EvalGroup::getYn, Boolean.TRUE) | |
282 | - .in(EvalGroup::getEgc, allEgcs) | |
283 | - ); | |
284 | - String name = repetitionEvals.stream().map(EvalGroup::getName).collect(Collectors.joining(",")); | |
285 | - BV.isEmpty(evalGroupRankVOS, "考评组【" + name + "】已经在其他排名包中,请重试"); | |
286 | - } | |
287 | - | |
288 | 265 | |
289 | 266 | /** |
290 | 267 | * 根据id删除考评组排名包 |
... | ... | @@ -292,6 +269,15 @@ public class EvalGroupRankBizService { |
292 | 269 | */ |
293 | 270 | public void removeById(Long id) { |
294 | 271 | evalGroupRankService.removeById(id); |
272 | + evalGroupRankStageService.remove(Wrappers.<EvalGroupRankStage>lambdaUpdate() | |
273 | + .eq(EvalGroupRankStage::getEvalGroupRankId, id) | |
274 | + ); | |
275 | + evalGroupService.remove(Wrappers.<EvalGroup>lambdaUpdate() | |
276 | + .eq(EvalGroup::getEvalGroupRankId, id) | |
277 | + ); | |
278 | + evalUserPoolService.remove(Wrappers.<EvalUserPool>lambdaUpdate() | |
279 | + .eq(EvalUserPool::getEvalGroupRankId, id) | |
280 | + ); | |
295 | 281 | } |
296 | 282 | |
297 | 283 | public List<EvalUserPoolVO> staffRank(EvalGroupRankQueryDto dto) { | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalIndicatorBizService.java
... | ... | @@ -309,28 +309,35 @@ public class EvalIndicatorBizService { |
309 | 309 | .eq(EvalIndicator::getEnable, Boolean.TRUE) |
310 | 310 | ); |
311 | 311 | |
312 | - List<Long> postIds = new ArrayList<Long>(){{add(evalConfigPostIndicatorsDTO.getPostId());}}; | |
313 | - List<PostInfoDTO> postInfoDTOS = ehrRpcService.getPostInfoList(postIds); | |
314 | - List<String> roleCodes = postInfoDTOS.stream() | |
315 | - .map(PostInfoDTO::getRoleList) | |
316 | - .filter(Objects::nonNull) | |
317 | - .flatMap(Collection::stream) | |
318 | - .map(PostRoleDTO::getRoleCode) | |
319 | - .distinct().collect(Collectors.toList()); | |
320 | - Boolean queryManagerRole = commonService.hasManagerRole(roleCodes); | |
321 | - IndicatorPostQueryDTO dto = new IndicatorPostQueryDTO(roleCodes, queryManagerRole); | |
322 | - dto.setApplicableType(applicableType); | |
312 | +// List<Long> postIds = new ArrayList<Long>(){{add(evalConfigPostIndicatorsDTO.getPostId());}}; | |
313 | +// List<PostInfoDTO> postInfoDTOS = ehrRpcService.getPostInfoList(postIds); | |
314 | +// List<String> roleCodes = postInfoDTOS.stream() | |
315 | +// .map(PostInfoDTO::getRoleList) | |
316 | +// .filter(Objects::nonNull) | |
317 | +// .flatMap(Collection::stream) | |
318 | +// .map(PostRoleDTO::getRoleCode) | |
319 | +// .distinct().collect(Collectors.toList()); | |
320 | +// Boolean queryManagerRole = commonService.hasManagerRole(roleCodes); | |
321 | +// IndicatorPostQueryDTO dto = new IndicatorPostQueryDTO(roleCodes, queryManagerRole); | |
322 | +// dto.setApplicableType(applicableType); | |
323 | 323 | //绩效指标 |
324 | - List<IndicatorsVO> indicatorsVOS = indicatorsService.getPostIndicators(dto); | |
324 | + List<Indicators> indicators = indicatorsService.list(Wrappers.<Indicators>lambdaQuery() | |
325 | + .eq(Indicators::getYn, Boolean.TRUE) | |
326 | + .eq(Indicators::getEnable, Boolean.TRUE) | |
327 | + ); | |
328 | + List<IndicatorsVO> indicatorsVOS = null; | |
329 | + if (PublicUtil.isNotEmpty(indicators)) { | |
330 | + indicatorsVOS = PublicUtil.copyList(indicators, IndicatorsVO.class); | |
331 | + } | |
325 | 332 | |
326 | 333 | List<CompositeIndicatorVO> compositeIndicators = Lists.newArrayListWithCapacity(evalIndicators.size() + indicatorsVOS.size()); |
327 | 334 | |
328 | 335 | for (EvalIndicator evalIndicator : evalIndicators) { |
329 | 336 | compositeIndicators.add(convertVO(evalIndicator)); |
330 | 337 | } |
331 | - for (IndicatorsVO indicators : indicatorsVOS) { | |
332 | - indicators.setCodeType(IndicatorCodeTypeEnum.INDICATOR); | |
333 | - compositeIndicators.add(convertVO(indicators)); | |
338 | + for (IndicatorsVO indicatorsVo : indicatorsVOS) { | |
339 | + indicatorsVo.setCodeType(IndicatorCodeTypeEnum.INDICATOR); | |
340 | + compositeIndicators.add(convertVO(indicatorsVo)); | |
334 | 341 | } |
335 | 342 | //(绩效)组合指标 和 考评组合指标 |
336 | 343 | dealEvalAndIndicator(evalConfigPostIndicatorsDTO.getWithCombination(), evalConfigPostIndicatorsDTO.getGroupId(), compositeIndicators,DataScopeTypeEnum.STAFF); | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/IndicatorBizService.java
... | ... | @@ -201,15 +201,15 @@ public class IndicatorBizService { |
201 | 201 | } |
202 | 202 | errorStr.append("薪酬组:[").append(String.join(",", salaryGroupNames)).append("]"); |
203 | 203 | } |
204 | - List<EvalGroup> evalGroups = this.getEvalGroupByIndicatorCode(indicatorCode); | |
205 | - Set<String> evalGroupNames = evalGroups.stream().map(EvalGroup::getName).collect(Collectors.toSet()); | |
206 | - if (PublicUtil.isNotEmpty(evalGroupNames)) { | |
207 | - if (errorStr.length() > 0) { | |
208 | - errorStr.append(","); | |
209 | - } | |
210 | - errorStr.append("考评组:[").append(String.join(",", salaryGroupNames)).append("]"); | |
211 | - } | |
212 | - | |
204 | +// List<EvalGroup> evalGroups = this.getEvalGroupByIndicatorCode(indicatorCode); | |
205 | +// Set<String> evalGroupNames = evalGroups.stream().map(EvalGroup::getName).collect(Collectors.toSet()); | |
206 | +// if (PublicUtil.isNotEmpty(evalGroups)) { | |
207 | +// if (errorStr.length() > 0) { | |
208 | +// errorStr.append(","); | |
209 | +// } | |
210 | +// errorStr.append("考评组:[").append(String.join(",", salaryGroupNames)).append("]"); | |
211 | +// errorStr.append("考评组"); | |
212 | +// } | |
213 | 213 | |
214 | 214 | if (errorStr.length() > 0) { |
215 | 215 | errorStr.append("正在使用此绩效指标,不能禁用"); |
... | ... | @@ -542,46 +542,46 @@ public class IndicatorBizService { |
542 | 542 | * @param indicatorCode |
543 | 543 | * @return |
544 | 544 | */ |
545 | - public List<EvalGroup> getEvalGroupByIndicatorCode(String indicatorCode) { | |
546 | - List<EvalGroupIndicatorParam> evalGroupIndicatorParams = evalGroupIndicatorParamService.list(Wrappers.<EvalGroupIndicatorParam>lambdaQuery() | |
547 | - .eq(EvalGroupIndicatorParam::getCode, indicatorCode) | |
548 | - .eq(EvalGroupIndicatorParam::getCodeType, IndicatorCodeTypeEnum.INDICATOR) | |
549 | - .eq(EvalGroupIndicatorParam::getYn, Boolean.TRUE) | |
550 | - ); | |
551 | - List<EvalGroupIndicatorPrecondition> preconditions = evalGroupIndicatorPreconditionService.list(Wrappers.<EvalGroupIndicatorPrecondition>lambdaQuery() | |
552 | - .eq(EvalGroupIndicatorPrecondition::getCode, indicatorCode) | |
553 | - .eq(EvalGroupIndicatorPrecondition::getCodeType, IndicatorCodeTypeEnum.INDICATOR) | |
554 | - .eq(EvalGroupIndicatorPrecondition::getYn, Boolean.TRUE) | |
555 | - ); | |
556 | - | |
557 | - Set<Long> evalGroupIds = new HashSet<>(); | |
558 | - if (PublicUtil.isNotEmpty(evalGroupIndicatorParams)) { | |
559 | - evalGroupIds.addAll(evalGroupIndicatorParams.stream().map(EvalGroupIndicatorParam::getEvalGroupId).collect(Collectors.toSet())); | |
560 | - } | |
561 | - if (PublicUtil.isNotEmpty(preconditions)) { | |
562 | - evalGroupIds.addAll(preconditions.stream().map(EvalGroupIndicatorPrecondition::getEvalGroupId).collect(Collectors.toSet())); | |
563 | - } | |
564 | - | |
565 | - if (PublicUtil.isEmpty(evalGroupIds)) { | |
566 | - return new ArrayList<>(); | |
567 | - } | |
568 | - | |
569 | -// List<SettingStatusEnum> status = new ArrayList<SettingStatusEnum>(){{ | |
570 | -// add(SettingStatusEnum.APPROVING); | |
571 | -// add(SettingStatusEnum.BE_EFFECTIVE); | |
572 | -// add(SettingStatusEnum.EFFECTIVE); | |
573 | -// }}; | |
574 | - | |
575 | - | |
576 | - LocalDate now = LocalDate.now(); | |
577 | - List<EvalGroup> evalGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
578 | - .in(EvalGroup::getId, evalGroupIds) | |
579 | - .ge(EvalGroup::getBeginTime, now) | |
580 | - .le(EvalGroup::getOverTime, now) | |
581 | - .eq(EvalGroup::getYn, Boolean.TRUE) | |
582 | - ); | |
583 | - return evalGroups; | |
584 | - } | |
545 | +// public List<EvalGroup> getEvalGroupByIndicatorCode(String indicatorCode) { | |
546 | +// List<EvalGroupIndicatorParam> evalGroupIndicatorParams = evalGroupIndicatorParamService.list(Wrappers.<EvalGroupIndicatorParam>lambdaQuery() | |
547 | +// .eq(EvalGroupIndicatorParam::getCode, indicatorCode) | |
548 | +// .eq(EvalGroupIndicatorParam::getCodeType, IndicatorCodeTypeEnum.INDICATOR) | |
549 | +// .eq(EvalGroupIndicatorParam::getYn, Boolean.TRUE) | |
550 | +// ); | |
551 | +// List<EvalGroupIndicatorPrecondition> preconditions = evalGroupIndicatorPreconditionService.list(Wrappers.<EvalGroupIndicatorPrecondition>lambdaQuery() | |
552 | +// .eq(EvalGroupIndicatorPrecondition::getCode, indicatorCode) | |
553 | +// .eq(EvalGroupIndicatorPrecondition::getCodeType, IndicatorCodeTypeEnum.INDICATOR) | |
554 | +// .eq(EvalGroupIndicatorPrecondition::getYn, Boolean.TRUE) | |
555 | +// ); | |
556 | +// | |
557 | +// Set<Long> evalGroupIds = new HashSet<>(); | |
558 | +// if (PublicUtil.isNotEmpty(evalGroupIndicatorParams)) { | |
559 | +// evalGroupIds.addAll(evalGroupIndicatorParams.stream().map(EvalGroupIndicatorParam::getEvalGroupId).collect(Collectors.toSet())); | |
560 | +// } | |
561 | +// if (PublicUtil.isNotEmpty(preconditions)) { | |
562 | +// evalGroupIds.addAll(preconditions.stream().map(EvalGroupIndicatorPrecondition::getEvalGroupId).collect(Collectors.toSet())); | |
563 | +// } | |
564 | +// | |
565 | +// if (PublicUtil.isEmpty(evalGroupIds)) { | |
566 | +// return new ArrayList<>(); | |
567 | +// } | |
568 | +// | |
569 | +//// List<SettingStatusEnum> status = new ArrayList<SettingStatusEnum>(){{ | |
570 | +//// add(SettingStatusEnum.APPROVING); | |
571 | +//// add(SettingStatusEnum.BE_EFFECTIVE); | |
572 | +//// add(SettingStatusEnum.EFFECTIVE); | |
573 | +//// }}; | |
574 | +// | |
575 | +// | |
576 | +// LocalDate now = LocalDate.now(); | |
577 | +// List<EvalGroup> evalGroups = evalGroupService.list(Wrappers.<EvalGroup>lambdaQuery() | |
578 | +// .in(EvalGroup::getId, evalGroupIds) | |
579 | +// .ge(EvalGroup::getBeginTime, now) | |
580 | +// .le(EvalGroup::getOverTime, now) | |
581 | +// .eq(EvalGroup::getYn, Boolean.TRUE) | |
582 | +// ); | |
583 | +// return evalGroups; | |
584 | +// } | |
585 | 585 | |
586 | 586 | /** |
587 | 587 | * 转换数据 | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/component/KpiStageIndicatorReportProducer.java
0 → 100644
1 | +package cn.fw.morax.service.component; | |
2 | + | |
3 | +import cn.fw.morax.sdk.dto.kpi.KpiStageReportNoticeMQ; | |
4 | +import lombok.extern.slf4j.Slf4j; | |
5 | +import org.apache.rocketmq.spring.core.RocketMQTemplate; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Component; | |
8 | +import org.springframework.web.bind.annotation.RequestMapping; | |
9 | + | |
10 | +/** | |
11 | + * @author kurisu | |
12 | + */ | |
13 | +@Slf4j | |
14 | +@Component | |
15 | +public class KpiStageIndicatorReportProducer { | |
16 | + @Autowired | |
17 | + private RocketMQTemplate rocketMQTemplate; | |
18 | + | |
19 | + @RequestMapping(value = "send") | |
20 | + public void send(KpiStageReportNoticeMQ dto) { | |
21 | + log.info("指标业务数据上报通知mq: body:[{}]", dto); | |
22 | + rocketMQTemplate.syncSend(KpiStageReportNoticeMQ.TOPIC + ":*", dto); | |
23 | + } | |
24 | +} | |
0 | 25 | \ No newline at end of file | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalGroupIndicatorService.java
1 | 1 | package cn.fw.morax.service.data.eval; |
2 | 2 | |
3 | 3 | |
4 | +import cn.fw.morax.domain.bo.StageIndicatorBO; | |
4 | 5 | import cn.fw.morax.domain.bo.eval.EvalGroupIndicatorBO; |
5 | 6 | import cn.fw.morax.domain.bo.kpi.KpiIndicatorBO; |
6 | 7 | import cn.fw.morax.domain.db.eval.EvalGroupIndicator; |
... | ... | @@ -9,6 +10,7 @@ import org.springframework.lang.NonNull; |
9 | 10 | |
10 | 11 | import java.time.LocalDate; |
11 | 12 | import java.util.Date; |
13 | +import java.util.List; | |
12 | 14 | import java.util.Set; |
13 | 15 | |
14 | 16 | /** |
... | ... | @@ -31,4 +33,12 @@ public interface EvalGroupIndicatorService extends IService<EvalGroupIndicator> |
31 | 33 | */ |
32 | 34 | Set<EvalGroupIndicatorBO> allIndicators(@NonNull final LocalDate dataDate, final Long evalGroupId); |
33 | 35 | |
36 | + /** | |
37 | + * | |
38 | + * | |
39 | + * @param dataDate | |
40 | + * @return | |
41 | + */ | |
42 | + List<StageIndicatorBO> getStageIndicators(LocalDate dataDate); | |
43 | + | |
34 | 44 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalGroupRankService.java
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalGroupRankStageService.java
... | ... | @@ -4,6 +4,9 @@ package cn.fw.morax.service.data.eval; |
4 | 4 | import cn.fw.morax.domain.db.eval.EvalGroupRankStage; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
6 | 6 | |
7 | +import java.time.LocalDate; | |
8 | +import java.util.List; | |
9 | + | |
7 | 10 | /** |
8 | 11 | * <p> |
9 | 12 | * 考评组 服务类 |
... | ... | @@ -14,4 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService; |
14 | 17 | */ |
15 | 18 | public interface EvalGroupRankStageService extends IService<EvalGroupRankStage> { |
16 | 19 | |
20 | + List<EvalGroupRankStage> getEffects(LocalDate dataDate); | |
17 | 21 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalGroupService.java
... | ... | @@ -67,6 +67,20 @@ public interface EvalGroupService extends IService<EvalGroup> { |
67 | 67 | * |
68 | 68 | * @return |
69 | 69 | */ |
70 | + List<EvalGroup> getEvalGroups(@NonNull final List<Long> evalGroupRankIds); | |
71 | + | |
72 | + /** | |
73 | + * 获取考评排名组的考评组 | |
74 | + * | |
75 | + * @return | |
76 | + */ | |
77 | + List<EvalGroup> getEvalGroups(@NonNull final Long evalGroupRankId); | |
78 | + | |
79 | + /** | |
80 | + * 获取考评排名组的考评组 | |
81 | + * | |
82 | + * @return | |
83 | + */ | |
70 | 84 | List<EvalGroup> getEffectsByRankId(@NonNull final Long evalGroupRankId, @NonNull final LocalDate localDate); |
71 | 85 | |
72 | 86 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalGroupIndicatorServiceImpl.java
... | ... | @@ -2,13 +2,16 @@ package cn.fw.morax.service.data.eval.impl; |
2 | 2 | |
3 | 3 | |
4 | 4 | import cn.fw.morax.dao.eval.EvalGroupIndicatorDao; |
5 | +import cn.fw.morax.domain.bo.StageIndicatorBO; | |
5 | 6 | import cn.fw.morax.domain.bo.eval.EvalGroupIndicatorBO; |
6 | 7 | import cn.fw.morax.domain.db.eval.EvalGroupIndicator; |
8 | +import cn.fw.morax.domain.enums.IndicatorCodeTypeEnum; | |
7 | 9 | import cn.fw.morax.service.data.eval.EvalGroupIndicatorService; |
8 | 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | 11 | import org.springframework.stereotype.Service; |
10 | 12 | |
11 | 13 | import java.time.LocalDate; |
14 | +import java.util.List; | |
12 | 15 | import java.util.Set; |
13 | 16 | |
14 | 17 | /** |
... | ... | @@ -27,4 +30,9 @@ public class EvalGroupIndicatorServiceImpl extends ServiceImpl<EvalGroupIndicato |
27 | 30 | public Set<EvalGroupIndicatorBO> allIndicators(LocalDate dataDate, Long evalGroupId) { |
28 | 31 | return this.baseMapper.allIndicators(dataDate, evalGroupId); |
29 | 32 | } |
33 | + | |
34 | + @Override | |
35 | + public List<StageIndicatorBO> getStageIndicators(LocalDate dataDate) { | |
36 | + return this.baseMapper.getStageIndicators(dataDate, IndicatorCodeTypeEnum.INDICATOR.getValue()); | |
37 | + } | |
30 | 38 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalGroupRankStageServiceImpl.java
... | ... | @@ -7,6 +7,9 @@ import cn.fw.morax.service.data.eval.EvalGroupRankStageService; |
7 | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
8 | 8 | import org.springframework.stereotype.Service; |
9 | 9 | |
10 | +import java.time.LocalDate; | |
11 | +import java.util.List; | |
12 | + | |
10 | 13 | /** |
11 | 14 | * <p> |
12 | 15 | * 考评组 服务实现类 |
... | ... | @@ -18,4 +21,8 @@ import org.springframework.stereotype.Service; |
18 | 21 | @Service |
19 | 22 | public class EvalGroupRankStageServiceImpl extends ServiceImpl<EvalGroupRankStageDao, EvalGroupRankStage> implements EvalGroupRankStageService { |
20 | 23 | |
24 | + @Override | |
25 | + public List<EvalGroupRankStage> getEffects(LocalDate dataDate) { | |
26 | + return this.getEffects(dataDate); | |
27 | + } | |
21 | 28 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalGroupServiceImpl.java
... | ... | @@ -51,6 +51,21 @@ public class EvalGroupServiceImpl extends ServiceImpl<EvalGroupDao, EvalGroup> i |
51 | 51 | } |
52 | 52 | |
53 | 53 | @Override |
54 | + public List<EvalGroup> getEvalGroups(@NonNull final List<Long> evalGroupRankIds) { | |
55 | + return this.baseMapper.selectList(Wrappers.<EvalGroup>lambdaQuery() | |
56 | + .in(EvalGroup::getEvalGroupRankId, evalGroupRankIds) | |
57 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
58 | + ); | |
59 | + } | |
60 | + @Override | |
61 | + public List<EvalGroup> getEvalGroups(@NonNull final Long evalGroupRankId) { | |
62 | + return this.baseMapper.selectList(Wrappers.<EvalGroup>lambdaQuery() | |
63 | + .in(EvalGroup::getEvalGroupRankId, evalGroupRankId) | |
64 | + .eq(EvalGroup::getYn, Boolean.TRUE) | |
65 | + ); | |
66 | + } | |
67 | + | |
68 | + @Override | |
54 | 69 | public List<EvalGroup> getEffectsByRankId(@NonNull final Long evalGroupRankId, @NonNull final LocalDate localDate) { |
55 | 70 | return this.baseMapper.getEffectsByRankId(evalGroupRankId, localDate); |
56 | 71 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/kpi/KpiStageMqLogService.java
0 → 100644
1 | +package cn.fw.morax.service.data.kpi; | |
2 | + | |
3 | +import cn.fw.morax.domain.db.kpi.KpiStageMqLog; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | + | |
6 | +/** | |
7 | + * @author : kurisu | |
8 | + * @version : 1.0 | |
9 | + * @className : KpiRewardPointService | |
10 | + * @description : 绩效分奖惩服务 | |
11 | + * @date : 2022-04-24 10:38 | |
12 | + */ | |
13 | +public interface KpiStageMqLogService extends IService<KpiStageMqLog> { | |
14 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/kpi/impl/KpiStageMqLogServiceImpl.java
0 → 100644
1 | +package cn.fw.morax.service.data.kpi.impl; | |
2 | + | |
3 | +import cn.fw.morax.dao.kpi.KpiRewardPointDao; | |
4 | +import cn.fw.morax.dao.kpi.KpiStageMqLogDao; | |
5 | +import cn.fw.morax.domain.db.kpi.KpiRewardPoint; | |
6 | +import cn.fw.morax.domain.db.kpi.KpiStageMqLog; | |
7 | +import cn.fw.morax.service.data.kpi.KpiRewardPointService; | |
8 | +import cn.fw.morax.service.data.kpi.KpiStageMqLogService; | |
9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
10 | +import org.springframework.stereotype.Service; | |
11 | + | |
12 | +/** | |
13 | + * @author : kurisu | |
14 | + * @version : 1.0 | |
15 | + * @className : KpiRewardPointServiceImpl | |
16 | + * @description : 绩效分奖惩服务 | |
17 | + * @date : 2022-04-24 10:39 | |
18 | + */ | |
19 | +@Service | |
20 | +public class KpiStageMqLogServiceImpl extends ServiceImpl<KpiStageMqLogDao, KpiStageMqLog> implements KpiStageMqLogService { | |
21 | +} | ... | ... |