Commit 0e60ab0471e8401d676d1cb2fd939eba2c64f77a
Merge branch 'jc-custom-indicator-2024-3-22' into 'main'
考评指标导入 考评指标导入 See merge request !607
Showing
57 changed files
with
2661 additions
and
22 deletions
doc/2023-05-18_update.sql
... | ... | @@ -3,6 +3,27 @@ ALTER TABLE `fw_morax`.`eval_pool_indicator_detail` |
3 | 3 | ADD INDEX `query_index`(`pool_id`, `scope_type`, `stage_dim`, `eval_group_id`, `data_date`, `yn`) USING BTREE; |
4 | 4 | |
5 | 5 | |
6 | +-- 2024年3月27日 | |
7 | +ALTER TABLE `fw_morax`.`eval_indicator_import_record` | |
8 | + ADD COLUMN `import_type` tinyint(4) NULL DEFAULT 1 COMMENT '考评指标导入类型;1:结果数据 2:分值原始数据' AFTER `status`; | |
9 | + | |
10 | +ALTER TABLE `fw_morax`.`eval_indicator_import_record` | |
11 | + ADD COLUMN `shop_ids` varchar(2048) NULL COMMENT '门店id' AFTER `approval_no`; | |
12 | + | |
13 | +ALTER TABLE `fw_morax`.`eval_indicator` | |
14 | + ADD COLUMN `role_codes` varchar(2048) NULL COMMENT '授权角色' AFTER `role_name`, | |
15 | +ADD COLUMN `role_names` varchar(2048) NULL COMMENT '授权角色名称' AFTER `role_codes`; | |
16 | + | |
17 | +ALTER TABLE `fw_morax`.`eval_indicator_value` | |
18 | + MODIFY COLUMN `shop_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '门店名称' AFTER `shop_id`; | |
19 | + | |
20 | +ALTER TABLE `fw_morax`.`eval_indicator_value` | |
21 | + ADD COLUMN `indicator_name` varchar(255) NULL COMMENT '指标名称' AFTER `indicator_code`; | |
22 | + | |
23 | +-- eval_indicator_import_menu | |
24 | +-- eval_indicator_import_detail_score | |
25 | +-- eval_indicator_import_key_value | |
26 | + | |
6 | 27 | -- 2024年4月3日 |
7 | 28 | ALTER TABLE `fw_morax`.`eval_group_user` |
8 | 29 | ADD COLUMN `staff_status` tinyint(8) NULL COMMENT '当前员工状态:1->试用,2->正式,8->待离职,9->离职' AFTER `data_date`; | ... | ... |
fw-morax-common/src/main/java/cn/fw/morax/common/config/EvalIndicatorVal.java
... | ... | @@ -25,6 +25,20 @@ public class EvalIndicatorVal { |
25 | 25 | @Getter |
26 | 26 | private String checkTodoLockKey; |
27 | 27 | |
28 | + @Value("${spring.cache.custom.global-prefix}:eval-import:") | |
29 | + @Getter | |
30 | + private String evalImport; | |
31 | + @Value("${spring.cache.custom.global-prefix}:eval-import-detail:") | |
32 | + @Getter | |
33 | + private String evalImportDetail; | |
34 | + | |
35 | + @Value("${spring.cache.custom.global-prefix}:eval-import-showroom-beautification:") | |
36 | + @Getter | |
37 | + private String evalShowroomBeautificationImport; | |
38 | + @Value("${spring.cache.custom.global-prefix}:eval-import-showroom-beautification-detail:") | |
39 | + @Getter | |
40 | + private String evalShowroomBeautificationImportDetail; | |
41 | + | |
28 | 42 | /** |
29 | 43 | * 最大重试次数 |
30 | 44 | */ | ... | ... |
fw-morax-common/src/main/java/cn/fw/morax/common/pojo/event/ImportEvalIndicatorScoreEvent.java
0 → 100644
1 | +package cn.fw.morax.common.pojo.event; | |
2 | + | |
3 | +import lombok.Builder; | |
4 | +import lombok.Data; | |
5 | + | |
6 | +@Data | |
7 | +@Builder | |
8 | +public class ImportEvalIndicatorScoreEvent { | |
9 | + | |
10 | + /** | |
11 | + * 考评指标导入记录id | |
12 | + */ | |
13 | + private Long evalIndicatorImportRecordId; | |
14 | + | |
15 | + /** | |
16 | + * 集团id | |
17 | + */ | |
18 | + private Long groupId; | |
19 | + | |
20 | + /** | |
21 | + * 数据日期 | |
22 | + */ | |
23 | +// private LocalDate dataDate; | |
24 | + | |
25 | + | |
26 | + public ImportEvalIndicatorScoreEvent() { | |
27 | + } | |
28 | + | |
29 | + public ImportEvalIndicatorScoreEvent(Long evalIndicatorImportRecordId, Long groupId) { | |
30 | + this.evalIndicatorImportRecordId = evalIndicatorImportRecordId; | |
31 | + this.groupId = groupId; | |
32 | + } | |
33 | +} | ... | ... |
fw-morax-common/src/main/java/cn/fw/morax/common/utils/ExcelDataUtil.java
fw-morax-dao/src/main/java/cn/fw/morax/dao/TemplateFileDao.java
0 → 100644
1 | +package cn.fw.morax.dao; | |
2 | + | |
3 | +import cn.fw.morax.domain.db.TemplateFile; | |
4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
5 | +import org.springframework.stereotype.Repository; | |
6 | + | |
7 | +/** | |
8 | + * 绩效校验离职记录 | |
9 | + * | |
10 | + * @author : kurisu | |
11 | + * @version : 2.0 | |
12 | + * @className : UserResignExamineDao | |
13 | + * @description : 绩效校验离职记录 | |
14 | + * @date : 2022-12-29 16:58 | |
15 | + */ | |
16 | +@Repository | |
17 | +public interface TemplateFileDao extends BaseMapper<TemplateFile> { | |
18 | +} | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalIndicatorImportDetailScoreDao.java
0 → 100644
1 | +package cn.fw.morax.dao.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.dao.orm.LocalMapper; | |
5 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportDetailScore; | |
6 | + | |
7 | +/** | |
8 | + * <p> | |
9 | + * 考评指标导入记录 Mapper 接口 | |
10 | + * </p> | |
11 | + * | |
12 | + * @author jiangchao | |
13 | + * @since 2023-01-30 | |
14 | + */ | |
15 | +public interface EvalIndicatorImportDetailScoreDao extends LocalMapper<EvalIndicatorImportDetailScore> { | |
16 | + | |
17 | +} | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalIndicatorImportKeyValueDao.java
0 → 100644
1 | +package cn.fw.morax.dao.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.dao.orm.LocalMapper; | |
5 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportKeyValue; | |
6 | + | |
7 | +/** | |
8 | + * <p> | |
9 | + * 考评指标导入记录 Mapper 接口 | |
10 | + * </p> | |
11 | + * | |
12 | + * @author jiangchao | |
13 | + * @since 2023-01-30 | |
14 | + */ | |
15 | +public interface EvalIndicatorImportKeyValueDao extends LocalMapper<EvalIndicatorImportKeyValue> { | |
16 | + | |
17 | +} | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalIndicatorImportMenuDao.java
0 → 100644
1 | +package cn.fw.morax.dao.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.dao.orm.LocalMapper; | |
5 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportMenu; | |
6 | + | |
7 | +/** | |
8 | + * <p> | |
9 | + * 考评指标导入记录 Mapper 接口 | |
10 | + * </p> | |
11 | + * | |
12 | + * @author jiangchao | |
13 | + * @since 2023-01-30 | |
14 | + */ | |
15 | +public interface EvalIndicatorImportMenuDao extends LocalMapper<EvalIndicatorImportMenu> { | |
16 | + | |
17 | +} | ... | ... |
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalIndicatorValueDao.java
1 | 1 | package cn.fw.morax.dao.eval; |
2 | 2 | |
3 | 3 | |
4 | +import cn.fw.morax.dao.orm.LocalMapper; | |
4 | 5 | import cn.fw.morax.domain.db.eval.EvalIndicatorValue; |
5 | 6 | import cn.fw.morax.domain.enums.DimensionTypeEnum; |
6 | 7 | import cn.fw.morax.domain.vo.kpi.IndicatorUserValueVO; |
... | ... | @@ -20,7 +21,7 @@ import java.util.Set; |
20 | 21 | * @author jiangchao |
21 | 22 | * @since 2023-01-30 |
22 | 23 | */ |
23 | -public interface EvalIndicatorValueDao extends BaseMapper<EvalIndicatorValue> { | |
24 | +public interface EvalIndicatorValueDao extends LocalMapper<EvalIndicatorValue> { | |
24 | 25 | |
25 | 26 | /** |
26 | 27 | * 查询最新上报数据 | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/bo/eval/EvalIndicatorScoreBO.java
0 → 100644
1 | +package cn.fw.morax.domain.bo.eval; | |
2 | + | |
3 | +import lombok.Data; | |
4 | +import lombok.EqualsAndHashCode; | |
5 | +import lombok.experimental.Accessors; | |
6 | + | |
7 | +import java.math.BigDecimal; | |
8 | +import java.time.LocalDate; | |
9 | + | |
10 | +/** | |
11 | + * <p> | |
12 | + * 自定义指标导入数据 | |
13 | + * </p> | |
14 | + * | |
15 | + * @author jiangchao | |
16 | + * @since 2024-03-26 | |
17 | + */ | |
18 | +@Data | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@Accessors(chain = true) | |
21 | +public class EvalIndicatorScoreBO { | |
22 | + | |
23 | + /** | |
24 | + * 门店id | |
25 | + */ | |
26 | + private Long shopId; | |
27 | + | |
28 | + /** | |
29 | + * 门店名称 | |
30 | + */ | |
31 | + private String shopName; | |
32 | + | |
33 | + /** | |
34 | + * 得分 | |
35 | + */ | |
36 | + private BigDecimal score; | |
37 | + | |
38 | + /** | |
39 | + * 总分 | |
40 | + */ | |
41 | + private BigDecimal totalScore; | |
42 | + | |
43 | + /** | |
44 | + * 数据结束日期 | |
45 | + */ | |
46 | + private LocalDate dataDate; | |
47 | + | |
48 | + | |
49 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/TemplateFile.java
0 → 100644
1 | +package cn.fw.morax.domain.db; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import cn.fw.morax.domain.enums.TemplateFileTypeEnum; | |
5 | +import com.baomidou.mybatisplus.annotation.TableLogic; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import lombok.Data; | |
8 | +import lombok.EqualsAndHashCode; | |
9 | +import lombok.experimental.Accessors; | |
10 | + | |
11 | +import java.io.Serializable; | |
12 | +import java.time.LocalDateTime; | |
13 | + | |
14 | +/** | |
15 | + * <p> | |
16 | + * 自定义指标导入菜单 | |
17 | + * </p> | |
18 | + * | |
19 | + * @author jiangchao | |
20 | + * @since 2024-04-16 | |
21 | + */ | |
22 | +@Data | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@Accessors(chain = true) | |
25 | +@TableName(autoResultMap = true) | |
26 | +public class TemplateFile extends BaseAuditableTimeEntity<TemplateFile, Long> { | |
27 | + | |
28 | + private static final long serialVersionUID = 1L; | |
29 | + | |
30 | + /** | |
31 | + * 模板类型 | |
32 | + */ | |
33 | + private TemplateFileTypeEnum type; | |
34 | + | |
35 | + /** | |
36 | + * tag | |
37 | + */ | |
38 | + private String tag; | |
39 | + | |
40 | + /** | |
41 | + * 文件地址 | |
42 | + */ | |
43 | + private String fid; | |
44 | + | |
45 | + /** | |
46 | + * 集团id | |
47 | + */ | |
48 | + private Long groupId; | |
49 | + | |
50 | + /** | |
51 | + * 逻辑删除 | |
52 | + */ | |
53 | + @TableLogic | |
54 | + private Boolean yn; | |
55 | + | |
56 | + | |
57 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicator.java
... | ... | @@ -3,6 +3,7 @@ package cn.fw.morax.domain.db.eval; |
3 | 3 | import cn.fw.common.data.entity.BaseAuditableTimeEntity; |
4 | 4 | import cn.fw.common.data.mybatis.handler.IntegerListTypeHandler; |
5 | 5 | import cn.fw.common.data.mybatis.handler.LongListTypeHandler; |
6 | +import cn.fw.common.data.mybatis.handler.StringListTypeHandler; | |
6 | 7 | import cn.fw.morax.domain.enums.*; |
7 | 8 | import com.baomidou.mybatisplus.annotation.TableField; |
8 | 9 | import com.baomidou.mybatisplus.annotation.TableLogic; |
... | ... | @@ -142,6 +143,18 @@ public class EvalIndicator extends BaseAuditableTimeEntity<EvalIndicator, Long> |
142 | 143 | private Integer importEndDate; |
143 | 144 | |
144 | 145 | /** |
146 | + * 适用角色编码 | |
147 | + */ | |
148 | + @TableField(typeHandler = StringListTypeHandler.class) | |
149 | + private List<String> roleCodes; | |
150 | + | |
151 | + /** | |
152 | + * 适用角色名称 | |
153 | + */ | |
154 | + @TableField(typeHandler = StringListTypeHandler.class) | |
155 | + private List<String> roleNames; | |
156 | + | |
157 | + /** | |
145 | 158 | * 逻辑删除 |
146 | 159 | */ |
147 | 160 | @TableLogic | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorImportDetail.java
... | ... | @@ -12,6 +12,8 @@ import java.io.Serializable; |
12 | 12 | import java.math.BigDecimal; |
13 | 13 | import java.time.LocalDate; |
14 | 14 | import java.time.LocalDateTime; |
15 | +import java.util.List; | |
16 | +import java.util.Map; | |
15 | 17 | |
16 | 18 | /** |
17 | 19 | * <p> |
... | ... | @@ -81,6 +83,11 @@ public class EvalIndicatorImportDetail extends BaseAuditableTimeEntity<EvalIndic |
81 | 83 | private String indicatorCode; |
82 | 84 | |
83 | 85 | /** |
86 | + * 指标值 | |
87 | + */ | |
88 | + private String jsonValue; | |
89 | + | |
90 | + /** | |
84 | 91 | * 月度指标业务值 |
85 | 92 | */ |
86 | 93 | private BigDecimal indicatorValue; |
... | ... | @@ -136,6 +143,12 @@ public class EvalIndicatorImportDetail extends BaseAuditableTimeEntity<EvalIndic |
136 | 143 | @TableField(exist = false) |
137 | 144 | private String unit; |
138 | 145 | |
146 | + /** | |
147 | + * 键值对 | |
148 | + */ | |
149 | + @TableField(exist = false) | |
150 | + private List<EvalIndicatorImportKeyValue> keyValues; | |
151 | + | |
139 | 152 | |
140 | 153 | public EvalIndicatorImportDetail() { |
141 | 154 | } | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorImportDetailScore.java
0 → 100644
1 | +package cn.fw.morax.domain.db.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import cn.fw.morax.domain.enums.ImportErrorReasonEnum; | |
5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
6 | +import lombok.Data; | |
7 | +import lombok.EqualsAndHashCode; | |
8 | +import lombok.experimental.Accessors; | |
9 | + | |
10 | +import java.math.BigDecimal; | |
11 | +import java.time.LocalDate; | |
12 | + | |
13 | +/** | |
14 | + * <p> | |
15 | + * 自定义指标导入数据 | |
16 | + * </p> | |
17 | + * | |
18 | + * @author jiangchao | |
19 | + * @since 2024-03-26 | |
20 | + */ | |
21 | +@Data | |
22 | +@EqualsAndHashCode(callSuper = false) | |
23 | +@Accessors(chain = true) | |
24 | +@TableName(autoResultMap = true) | |
25 | +public class EvalIndicatorImportDetailScore extends BaseAuditableTimeEntity<EvalIndicatorImportDetailScore, Long> { | |
26 | + | |
27 | + private static final long serialVersionUID = 1L; | |
28 | + | |
29 | + /** | |
30 | + * 导入记录id | |
31 | + */ | |
32 | + private Long recordId; | |
33 | + | |
34 | + /** | |
35 | + * 指标名称 | |
36 | + */ | |
37 | + private String indicatorName; | |
38 | + | |
39 | + /** | |
40 | + * 指标编码 | |
41 | + */ | |
42 | + private String indicatorCode; | |
43 | + | |
44 | + /** | |
45 | + * 门店id | |
46 | + */ | |
47 | + private Long shopId; | |
48 | + | |
49 | + /** | |
50 | + * 门店名称 | |
51 | + */ | |
52 | + private String shopName; | |
53 | + | |
54 | + | |
55 | + /** | |
56 | + * 得分 | |
57 | + */ | |
58 | + private BigDecimal score; | |
59 | + | |
60 | + /** | |
61 | + * 总分 | |
62 | + */ | |
63 | + private BigDecimal totalScore; | |
64 | + | |
65 | + /** | |
66 | + * 打分人员名称 | |
67 | + */ | |
68 | + private String graderStaffName; | |
69 | + | |
70 | + /** | |
71 | + * 打分人员id | |
72 | + */ | |
73 | + private Long graderStaffId; | |
74 | + | |
75 | + /** | |
76 | + * 阶段数据开始日期 | |
77 | + */ | |
78 | + private LocalDate stageStartDataDate; | |
79 | + | |
80 | + /** | |
81 | + * 阶段数据结束日期 | |
82 | + */ | |
83 | + private LocalDate stageEndDataDate; | |
84 | + | |
85 | + /** | |
86 | + * 数据结束日期 | |
87 | + */ | |
88 | + private LocalDate dataDate; | |
89 | + | |
90 | + /** | |
91 | + * 错误提示: 1:未匹配到人员 2:未匹配到门店 3:未匹配到指标 4:重复 5:时间错误 | |
92 | + */ | |
93 | + private ImportErrorReasonEnum errorType; | |
94 | + | |
95 | + /** | |
96 | + * 有效 | |
97 | + */ | |
98 | + private Boolean valid; | |
99 | + | |
100 | + /** | |
101 | + * 集团id | |
102 | + */ | |
103 | + private Long groupId; | |
104 | + | |
105 | + /** | |
106 | + * 逻辑删除 | |
107 | + */ | |
108 | + private Boolean yn; | |
109 | + | |
110 | + public EvalIndicatorImportDetailScore() { | |
111 | + } | |
112 | + | |
113 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorImportKeyValue.java
0 → 100644
1 | +package cn.fw.morax.domain.db.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import com.baomidou.mybatisplus.annotation.TableName; | |
5 | +import lombok.Data; | |
6 | +import lombok.EqualsAndHashCode; | |
7 | +import lombok.experimental.Accessors; | |
8 | + | |
9 | +import java.io.Serializable; | |
10 | +import java.math.BigDecimal; | |
11 | +import java.time.LocalDateTime; | |
12 | + | |
13 | +/** | |
14 | + * <p> | |
15 | + * 自定义指标导入数据 | |
16 | + * </p> | |
17 | + * | |
18 | + * @author jiangchao | |
19 | + * @since 2024-03-26 | |
20 | + */ | |
21 | +@Data | |
22 | +@EqualsAndHashCode(callSuper = false) | |
23 | +@Accessors(chain = true) | |
24 | +@TableName(autoResultMap = true) | |
25 | +public class EvalIndicatorImportKeyValue extends BaseAuditableTimeEntity<EvalIndicatorImportKeyValue, Long> { | |
26 | + | |
27 | + private static final long serialVersionUID = 1L; | |
28 | + | |
29 | + /** | |
30 | + * 导入记录id | |
31 | + */ | |
32 | + private Long recordId; | |
33 | + | |
34 | + /** | |
35 | + * 导入记录id | |
36 | + */ | |
37 | + private Long evalIndicatorImportDetailId; | |
38 | + | |
39 | + /** | |
40 | + * key | |
41 | + */ | |
42 | + private String key; | |
43 | + | |
44 | + /** | |
45 | + * 描述 | |
46 | + */ | |
47 | + private String desc; | |
48 | + | |
49 | + /** | |
50 | + * 指标业务值 | |
51 | + */ | |
52 | + private String value; | |
53 | + | |
54 | + /** | |
55 | + * 逻辑删除 | |
56 | + */ | |
57 | + private Boolean yn; | |
58 | + | |
59 | + public EvalIndicatorImportKeyValue() { | |
60 | + } | |
61 | + | |
62 | + public EvalIndicatorImportKeyValue(Long recordId, Long evalIndicatorImportDetailId) { | |
63 | + this.recordId = recordId; | |
64 | + this.evalIndicatorImportDetailId = evalIndicatorImportDetailId; | |
65 | + this.yn = Boolean.TRUE; | |
66 | + } | |
67 | + | |
68 | + public EvalIndicatorImportKeyValue(String key, String desc, String value) { | |
69 | + this.key = key; | |
70 | + this.desc = desc; | |
71 | + this.value = value; | |
72 | + this.yn = Boolean.TRUE; | |
73 | + } | |
74 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorImportMenu.java
0 → 100644
1 | +package cn.fw.morax.domain.db.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | +import com.baomidou.mybatisplus.annotation.TableLogic; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import lombok.Data; | |
8 | +import lombok.EqualsAndHashCode; | |
9 | +import lombok.experimental.Accessors; | |
10 | + | |
11 | +import java.io.Serializable; | |
12 | +import java.time.LocalDateTime; | |
13 | + | |
14 | +/** | |
15 | + * <p> | |
16 | + * 自定义指标导入菜单 | |
17 | + * </p> | |
18 | + * | |
19 | + * @author jiangchao | |
20 | + * @since 2024-04-16 | |
21 | + */ | |
22 | +@Data | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@Accessors(chain = true) | |
25 | +@TableName(autoResultMap = true) | |
26 | +public class EvalIndicatorImportMenu extends BaseAuditableTimeEntity<EvalIndicatorImportMenu, Long> { | |
27 | + | |
28 | + private static final long serialVersionUID = 1L; | |
29 | + | |
30 | + /** | |
31 | + * id | |
32 | + */ | |
33 | + private Long id; | |
34 | + | |
35 | + /** | |
36 | + * 指标编码 | |
37 | + */ | |
38 | + private String indicatorCode; | |
39 | + | |
40 | + /** | |
41 | + * 指标名称 | |
42 | + */ | |
43 | + private String indicatorName; | |
44 | + | |
45 | + /** | |
46 | + * 菜单名称 | |
47 | + */ | |
48 | + private String menuName; | |
49 | + | |
50 | + /** | |
51 | + * 集团id | |
52 | + */ | |
53 | + private Long groupId; | |
54 | + | |
55 | + /** | |
56 | + * 逻辑删除 | |
57 | + */ | |
58 | + @TableLogic | |
59 | + private Boolean yn; | |
60 | + | |
61 | + | |
62 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorImportRecord.java
1 | 1 | package cn.fw.morax.domain.db.eval; |
2 | 2 | |
3 | 3 | import cn.fw.common.data.entity.BaseAuditableTimeEntity; |
4 | +import cn.fw.common.data.mybatis.handler.LongListTypeHandler; | |
4 | 5 | import cn.fw.morax.domain.enums.*; |
6 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | 7 | import com.baomidou.mybatisplus.annotation.TableLogic; |
6 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
7 | 9 | import lombok.Data; |
... | ... | @@ -11,6 +13,7 @@ import lombok.experimental.Accessors; |
11 | 13 | import java.io.Serializable; |
12 | 14 | import java.time.LocalDate; |
13 | 15 | import java.time.LocalDateTime; |
16 | +import java.util.List; | |
14 | 17 | |
15 | 18 | /** |
16 | 19 | * <p> |
... | ... | @@ -114,6 +117,17 @@ public class EvalIndicatorImportRecord extends BaseAuditableTimeEntity<EvalIndic |
114 | 117 | private DataTimeTypeEnum dataTimeType; |
115 | 118 | |
116 | 119 | /** |
120 | + * 考评指标导入类型;1:结果数据 2:分值原始数据 | |
121 | + */ | |
122 | + private EvalIndicatorImportTypeEnum importType; | |
123 | + | |
124 | + /** | |
125 | + * 适用门店ids | |
126 | + */ | |
127 | + @TableField(typeHandler = LongListTypeHandler.class) | |
128 | + private List<Long> shopIds; | |
129 | + | |
130 | + /** | |
117 | 131 | * 逻辑删除 |
118 | 132 | */ |
119 | 133 | @TableLogic | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorScoreStageValue.java
0 → 100644
1 | +package cn.fw.morax.domain.db.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import com.baomidou.mybatisplus.annotation.TableName; | |
5 | +import lombok.Data; | |
6 | +import lombok.EqualsAndHashCode; | |
7 | +import lombok.experimental.Accessors; | |
8 | + | |
9 | +import java.io.Serializable; | |
10 | +import java.math.BigDecimal; | |
11 | +import java.time.LocalDate; | |
12 | +import java.time.LocalDateTime; | |
13 | + | |
14 | +/** | |
15 | + * <p> | |
16 | + * 自定义指标阶段得分值 | |
17 | + * </p> | |
18 | + * | |
19 | + * @author jiangchao | |
20 | + * @since 2024-03-22 | |
21 | + */ | |
22 | +@Data | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@Accessors(chain = true) | |
25 | +@TableName(autoResultMap = true) | |
26 | +public class EvalIndicatorScoreStageValue extends BaseAuditableTimeEntity<EvalIndicatorScoreStageValue, Long> { | |
27 | + | |
28 | + private static final long serialVersionUID = 1L; | |
29 | + | |
30 | + /** | |
31 | + * 维度类型 1:人员 2:门店 | |
32 | + */ | |
33 | + private Integer dimensionType; | |
34 | + | |
35 | + /** | |
36 | + * 编码 | |
37 | + */ | |
38 | + private String evalIndicatorCode; | |
39 | + | |
40 | + /** | |
41 | + * 编码名称 | |
42 | + */ | |
43 | + private String evalIndicatorName; | |
44 | + | |
45 | + /** | |
46 | + * 得分 | |
47 | + */ | |
48 | + private BigDecimal socre; | |
49 | + | |
50 | + /** | |
51 | + * 总分 | |
52 | + */ | |
53 | + private BigDecimal baseSocre; | |
54 | + | |
55 | + /** | |
56 | + * 人员id | |
57 | + */ | |
58 | + private Long userId; | |
59 | + | |
60 | + /** | |
61 | + * 人员名称 | |
62 | + */ | |
63 | + private String userName; | |
64 | + | |
65 | + /** | |
66 | + * 门店id | |
67 | + */ | |
68 | + private Long shopId; | |
69 | + | |
70 | + /** | |
71 | + * 门店名称 | |
72 | + */ | |
73 | + private String shopName; | |
74 | + | |
75 | + /** | |
76 | + * 阶段数据时间类型;1:阶段数据 2:阶段累计数据 | |
77 | + */ | |
78 | + private Integer stageDataTimeType; | |
79 | + | |
80 | + /** | |
81 | + * 数据开始日期 | |
82 | + */ | |
83 | + private LocalDate beginDate; | |
84 | + | |
85 | + /** | |
86 | + * 数据结束日期 | |
87 | + */ | |
88 | + private LocalDate endDate; | |
89 | + | |
90 | + /** | |
91 | + * 集团id | |
92 | + */ | |
93 | + private Long groupId; | |
94 | + | |
95 | + /** | |
96 | + * 逻辑删除 | |
97 | + */ | |
98 | + private Boolean yn; | |
99 | + | |
100 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorScoreValue.java
0 → 100644
1 | +package cn.fw.morax.domain.db.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import com.baomidou.mybatisplus.annotation.TableName; | |
5 | +import lombok.Data; | |
6 | +import lombok.EqualsAndHashCode; | |
7 | +import lombok.experimental.Accessors; | |
8 | + | |
9 | +import java.io.Serializable; | |
10 | +import java.math.BigDecimal; | |
11 | +import java.time.LocalDate; | |
12 | +import java.time.LocalDateTime; | |
13 | + | |
14 | +/** | |
15 | + * <p> | |
16 | + * 自定义指标得分值 | |
17 | + * </p> | |
18 | + * | |
19 | + * @author jiangchao | |
20 | + * @since 2024-03-22 | |
21 | + */ | |
22 | +@Data | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@Accessors(chain = true) | |
25 | +@TableName(autoResultMap = true) | |
26 | +public class EvalIndicatorScoreValue extends BaseAuditableTimeEntity<EvalIndicatorScoreValue, Long> { | |
27 | + | |
28 | + private static final long serialVersionUID = 1L; | |
29 | + | |
30 | + /** | |
31 | + * 维度类型 1:人员 2:门店 | |
32 | + */ | |
33 | + private Integer dimensionType; | |
34 | + | |
35 | + /** | |
36 | + * 编码 | |
37 | + */ | |
38 | + private String evalIndicatorCode; | |
39 | + | |
40 | + /** | |
41 | + * 编码名称 | |
42 | + */ | |
43 | + private String evalIndicatorName; | |
44 | + | |
45 | + /** | |
46 | + * 得分 | |
47 | + */ | |
48 | + private BigDecimal socre; | |
49 | + | |
50 | + /** | |
51 | + * 总分 | |
52 | + */ | |
53 | + private BigDecimal baseSocre; | |
54 | + | |
55 | + /** | |
56 | + * 人员id | |
57 | + */ | |
58 | + private Long userId; | |
59 | + | |
60 | + /** | |
61 | + * 人员名称 | |
62 | + */ | |
63 | + private String userName; | |
64 | + | |
65 | + /** | |
66 | + * 门店id | |
67 | + */ | |
68 | + private Long shopId; | |
69 | + | |
70 | + /** | |
71 | + * 门店名称 | |
72 | + */ | |
73 | + private String shopName; | |
74 | + | |
75 | + /** | |
76 | + * 数据类型;1:数量 2:百分比 3:金额 | |
77 | + */ | |
78 | + private Integer dataType; | |
79 | + | |
80 | + /** | |
81 | + * 数据日期 | |
82 | + */ | |
83 | + private LocalDate dataDate; | |
84 | + | |
85 | + /** | |
86 | + * 集团id | |
87 | + */ | |
88 | + private Long groupId; | |
89 | + | |
90 | + /** | |
91 | + * 逻辑删除 | |
92 | + */ | |
93 | + private Boolean yn; | |
94 | + | |
95 | + | |
96 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorValue.java
... | ... | @@ -61,10 +61,10 @@ public class EvalIndicatorValue extends BaseAuditableTimeEntity<EvalIndicatorVal |
61 | 61 | */ |
62 | 62 | private String indicatorCode; |
63 | 63 | |
64 | -// /** | |
65 | -// * 指标库名称 | |
66 | -// */ | |
67 | -// private String indicatorName; | |
64 | + /** | |
65 | + * 指标库名称 | |
66 | + */ | |
67 | + private String indicatorName; | |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * 指标业务值 | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/EvalIndicatorDTO.java
1 | 1 | package cn.fw.morax.domain.dto; |
2 | 2 | |
3 | +import cn.fw.common.data.mybatis.handler.StringListTypeHandler; | |
3 | 4 | import cn.fw.common.web.annotation.LoginContextField; |
4 | 5 | import cn.fw.morax.domain.enums.*; |
6 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | 7 | import lombok.Data; |
6 | 8 | import org.hibernate.validator.constraints.Length; |
7 | 9 | |
... | ... | @@ -137,6 +139,16 @@ public class EvalIndicatorDTO { |
137 | 139 | */ |
138 | 140 | private Integer importEndDate; |
139 | 141 | |
142 | + /** | |
143 | + * 适用角色编码 | |
144 | + */ | |
145 | + private List<String> roleCodes; | |
146 | + | |
147 | + /** | |
148 | + * 适用角色名称 | |
149 | + */ | |
150 | + private List<String> roleNames; | |
151 | + | |
140 | 152 | // /** |
141 | 153 | // * 月天数 |
142 | 154 | // */ | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/query/EvalIndicatorImportDetailQueryDTO.java
fw-morax-domain/src/main/java/cn/fw/morax/domain/dto/query/EvalIndicatorImportScoreQueryDTO.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 lombok.Data; | |
6 | + | |
7 | +import java.time.LocalDate; | |
8 | +import java.time.YearMonth; | |
9 | + | |
10 | +@Data | |
11 | +public class EvalIndicatorImportScoreQueryDTO extends BasePageQuery { | |
12 | + | |
13 | + /** | |
14 | + * 指标编码 | |
15 | + */ | |
16 | + private String indicatorCode; | |
17 | + | |
18 | + /** | |
19 | + * 导入人员 | |
20 | + */ | |
21 | + private Long userId; | |
22 | + | |
23 | + /** | |
24 | + * 门店id | |
25 | + */ | |
26 | + private Long shopId; | |
27 | + | |
28 | + /** | |
29 | + * 开始导入时间 | |
30 | + */ | |
31 | + private YearMonth monthly; | |
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/enums/EvalIndicatorImportTypeEnum.java
0 → 100644
1 | +package cn.fw.morax.domain.enums; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.enums.IEnum; | |
4 | +import com.fasterxml.jackson.annotation.JsonCreator; | |
5 | +import com.fasterxml.jackson.annotation.JsonValue; | |
6 | +import lombok.Getter; | |
7 | + | |
8 | +/** | |
9 | + * 考评指标导入类型 | |
10 | + * | |
11 | + * @author kurisu | |
12 | + */ | |
13 | +public enum EvalIndicatorImportTypeEnum implements IEnum<Integer> { | |
14 | + /** | |
15 | + * 考评指标导入类型;1:结果数据 2:分值原始数据 | |
16 | + */ | |
17 | + VALUE(1, "结果数据"), | |
18 | + SCORE_ORIGIN_VALUE(2, "分值原始数据"), | |
19 | + ; | |
20 | + | |
21 | + /** | |
22 | + * 值 | |
23 | + */ | |
24 | + private final Integer value; | |
25 | + /** | |
26 | + * 名称 | |
27 | + */ | |
28 | + @Getter | |
29 | + private final String name; | |
30 | + | |
31 | + EvalIndicatorImportTypeEnum(final Integer value, final String name) { | |
32 | + this.value = value; | |
33 | + this.name = name; | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * 根据枚举值获取枚举对象 | |
38 | + */ | |
39 | + @JsonCreator | |
40 | + public static EvalIndicatorImportTypeEnum ofValue(final Integer value) { | |
41 | + for (final EvalIndicatorImportTypeEnum _enum : EvalIndicatorImportTypeEnum.values()) { | |
42 | + if (_enum.value.equals(value)) { | |
43 | + return _enum; | |
44 | + } | |
45 | + } | |
46 | + return null; | |
47 | + } | |
48 | + | |
49 | + public static EvalIndicatorImportTypeEnum nameOfValue(final String name) { | |
50 | + for (final EvalIndicatorImportTypeEnum _enum : EvalIndicatorImportTypeEnum.values()) { | |
51 | + if (_enum.name.equals(name)) { | |
52 | + return _enum; | |
53 | + } | |
54 | + } | |
55 | + return null; | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * 获取值 | |
60 | + * | |
61 | + * @return 值 | |
62 | + */ | |
63 | + @JsonValue | |
64 | + @Override | |
65 | + public Integer getValue() { | |
66 | + return value; | |
67 | + } | |
68 | + | |
69 | + /** | |
70 | + * 获取描述 | |
71 | + * | |
72 | + * @return 值 | |
73 | + */ | |
74 | + @JsonCreator | |
75 | + public static String getNameByVale(final Integer value) { | |
76 | + for (final EvalIndicatorImportTypeEnum _enum : EvalIndicatorImportTypeEnum.values()) { | |
77 | + if (_enum.value.equals(value)) { | |
78 | + return _enum.getName(); | |
79 | + } | |
80 | + } | |
81 | + return ""; | |
82 | + } | |
83 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/enums/ImportErrorReasonEnum.java
... | ... | @@ -13,12 +13,13 @@ import lombok.Getter; |
13 | 13 | public enum ImportErrorReasonEnum implements IEnum<Integer> { |
14 | 14 | |
15 | 15 | /** |
16 | - * 错误类型: 1:未匹配到人员 2:未匹配到门店 3:未匹配到指标 | |
16 | + * 错误类型: 1:未匹配到人员 2:未匹配到门店 3:未匹配到指标 4:重复 5:时间错误 | |
17 | 17 | */ |
18 | 18 | NO_MATCH_STAFF(1, "未匹配到人员"), |
19 | 19 | NO_MATCH_SHOP(2, "未匹配到门店"), |
20 | 20 | NO_MATCH_INDICATOR(3, "未匹配到指标"), |
21 | 21 | REPETITION(4, "重复"), |
22 | + TIME_ERROR(5, "时间错误"), | |
22 | 23 | ; |
23 | 24 | |
24 | 25 | /** | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/enums/TemplateFileTypeEnum.java
0 → 100644
1 | +package cn.fw.morax.domain.enums; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.enums.IEnum; | |
4 | +import com.fasterxml.jackson.annotation.JsonCreator; | |
5 | +import com.fasterxml.jackson.annotation.JsonValue; | |
6 | +import lombok.Getter; | |
7 | + | |
8 | +/** | |
9 | + * 模板类型 | |
10 | + * | |
11 | + * @author : kurisu | |
12 | + * @version : 1.0 | |
13 | + * @className : TemplateFileTypeEnum | |
14 | + * @description : 模板类型 | |
15 | + * @date : 2022-05-06 18:24 | |
16 | + */ | |
17 | +public enum TemplateFileTypeEnum implements IEnum<Integer> { | |
18 | + /** | |
19 | + * 模板类型;1:考评指标库 | |
20 | + */ | |
21 | + EVAL_INDICATOR(1, "考评指标库"), | |
22 | + ; | |
23 | + | |
24 | + /** | |
25 | + * 值 | |
26 | + */ | |
27 | + private final Integer value; | |
28 | + /** | |
29 | + * 名称 | |
30 | + */ | |
31 | + @Getter | |
32 | + private final String name; | |
33 | + | |
34 | + TemplateFileTypeEnum(final Integer value, final String name) { | |
35 | + this.value = value; | |
36 | + this.name = name; | |
37 | + } | |
38 | + | |
39 | + /** | |
40 | + * 根据枚举值获取枚举对象 | |
41 | + */ | |
42 | + @JsonCreator | |
43 | + public static TemplateFileTypeEnum ofValue(final Integer value) { | |
44 | + for (final TemplateFileTypeEnum _enum : TemplateFileTypeEnum.values()) { | |
45 | + if (_enum.value.equals(value)) { | |
46 | + return _enum; | |
47 | + } | |
48 | + } | |
49 | + return null; | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * 获取描述 | |
54 | + * | |
55 | + * @return 值 | |
56 | + */ | |
57 | + @JsonCreator | |
58 | + public static String getNameByVale(final Integer value) { | |
59 | + for (final TemplateFileTypeEnum _enum : TemplateFileTypeEnum.values()) { | |
60 | + if (_enum.value.equals(value)) { | |
61 | + return _enum.getName(); | |
62 | + } | |
63 | + } | |
64 | + return ""; | |
65 | + } | |
66 | + | |
67 | + /** | |
68 | + * 获取值 | |
69 | + * | |
70 | + * @return 值 | |
71 | + */ | |
72 | + @JsonValue | |
73 | + @Override | |
74 | + public Integer getValue() { | |
75 | + return value; | |
76 | + } | |
77 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/CombineAndEvalIndicatorVO.java
... | ... | @@ -177,6 +177,16 @@ public class CombineAndEvalIndicatorVO { |
177 | 177 | */ |
178 | 178 | private Integer importEndDate; |
179 | 179 | |
180 | + /** | |
181 | + * 适用角色编码 | |
182 | + */ | |
183 | + private List<String> roleCodes; | |
184 | + | |
185 | + /** | |
186 | + * 适用角色名称 | |
187 | + */ | |
188 | + private List<String> roleNames; | |
189 | + | |
180 | 190 | |
181 | 191 | public void setHasTarget() { |
182 | 192 | this.setHasTarget((! TargetTypeEnum.NO.equals(this.getTargetType()))); | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportDetailScoreVO.java
0 → 100644
1 | +package cn.fw.morax.domain.vo.eval; | |
2 | + | |
3 | +import cn.fw.common.data.entity.BaseAuditableTimeEntity; | |
4 | +import cn.fw.morax.domain.enums.ImportErrorReasonEnum; | |
5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
6 | +import lombok.Data; | |
7 | +import lombok.EqualsAndHashCode; | |
8 | +import lombok.experimental.Accessors; | |
9 | + | |
10 | +import java.math.BigDecimal; | |
11 | +import java.time.LocalDate; | |
12 | + | |
13 | +/** | |
14 | + * <p> | |
15 | + * 自定义指标导入数据 | |
16 | + * </p> | |
17 | + * | |
18 | + * @author jiangchao | |
19 | + * @since 2024-03-26 | |
20 | + */ | |
21 | +@Data | |
22 | +@EqualsAndHashCode(callSuper = false) | |
23 | +@Accessors(chain = true) | |
24 | +public class EvalIndicatorImportDetailScoreVO { | |
25 | + | |
26 | + private static final long serialVersionUID = 1L; | |
27 | + | |
28 | + /** | |
29 | + * 导入记录id | |
30 | + */ | |
31 | + private Long id; | |
32 | + | |
33 | + | |
34 | + /** | |
35 | + * 导入记录id | |
36 | + */ | |
37 | + private Long recordId; | |
38 | + | |
39 | + /** | |
40 | + * 指标名称 | |
41 | + */ | |
42 | + private String indicatorName; | |
43 | + | |
44 | + /** | |
45 | + * 指标编码 | |
46 | + */ | |
47 | + private String indicatorCode; | |
48 | + | |
49 | + /** | |
50 | + * 门店id | |
51 | + */ | |
52 | + private Long shopId; | |
53 | + | |
54 | + /** | |
55 | + * 门店名称 | |
56 | + */ | |
57 | + private String shopName; | |
58 | + | |
59 | + | |
60 | + /** | |
61 | + * 得分 | |
62 | + */ | |
63 | + private BigDecimal score; | |
64 | + | |
65 | + /** | |
66 | + * 总分 | |
67 | + */ | |
68 | + private BigDecimal totalScore; | |
69 | + | |
70 | + /** | |
71 | + * 打分人员名称 | |
72 | + */ | |
73 | + private String graderStaffName; | |
74 | + | |
75 | + /** | |
76 | + * 打分人员id | |
77 | + */ | |
78 | + private Long graderStaffId; | |
79 | + | |
80 | + /** | |
81 | + * 阶段数据开始日期 | |
82 | + */ | |
83 | + private LocalDate stageStartDataDate; | |
84 | + | |
85 | + /** | |
86 | + * 阶段数据结束日期 | |
87 | + */ | |
88 | + private LocalDate stageEndDataDate; | |
89 | + | |
90 | + /** | |
91 | + * 数据结束日期 | |
92 | + */ | |
93 | + private LocalDate dataDate; | |
94 | + | |
95 | + /** | |
96 | + * 错误类型: 1:未匹配到人员 2:未匹配到门店 3:未匹配到指标 4:重复 5:时间错误 | |
97 | + */ | |
98 | + private ImportErrorReasonEnum errorType; | |
99 | + | |
100 | + /** | |
101 | + * 有效 | |
102 | + */ | |
103 | + private Boolean valid; | |
104 | + | |
105 | + /** | |
106 | + * 逻辑删除 | |
107 | + */ | |
108 | + private Boolean yn; | |
109 | + | |
110 | + public EvalIndicatorImportDetailScoreVO() { | |
111 | + } | |
112 | + | |
113 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportDetailVO.java
... | ... | @@ -13,6 +13,7 @@ import lombok.experimental.Accessors; |
13 | 13 | import java.math.BigDecimal; |
14 | 14 | import java.time.LocalDate; |
15 | 15 | import java.util.Date; |
16 | +import java.util.List; | |
16 | 17 | |
17 | 18 | /** |
18 | 19 | * <p> |
... | ... | @@ -33,6 +34,12 @@ public class EvalIndicatorImportDetailVO { |
33 | 34 | */ |
34 | 35 | // private Integer dimensionType; |
35 | 36 | |
37 | + | |
38 | + /** | |
39 | + * id | |
40 | + */ | |
41 | + private Long id; | |
42 | + | |
36 | 43 | /** |
37 | 44 | * 导入id |
38 | 45 | */ |
... | ... | @@ -144,6 +151,11 @@ public class EvalIndicatorImportDetailVO { |
144 | 151 | private BigDecimal stageIndicatorValue; |
145 | 152 | |
146 | 153 | /** |
154 | + * 指标值 | |
155 | + */ | |
156 | + private List<EvalIndicatorImportKeyValueVO> keyValues; | |
157 | + | |
158 | + /** | |
147 | 159 | * 转换为百分数展示 |
148 | 160 | */ |
149 | 161 | public void convertToPercent(){ | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportKeyValueVO.java
0 → 100644
1 | +package cn.fw.morax.domain.vo.eval; | |
2 | + | |
3 | +import lombok.Data; | |
4 | +import lombok.EqualsAndHashCode; | |
5 | +import lombok.experimental.Accessors; | |
6 | + | |
7 | +/** | |
8 | + * <p> | |
9 | + * 自定义指标导入数据 | |
10 | + * </p> | |
11 | + * | |
12 | + * @author jiangchao | |
13 | + * @since 2024-03-26 | |
14 | + */ | |
15 | +@Data | |
16 | +@EqualsAndHashCode(callSuper = false) | |
17 | +@Accessors(chain = true) | |
18 | +public class EvalIndicatorImportKeyValueVO { | |
19 | + | |
20 | + private static final long serialVersionUID = 1L; | |
21 | + | |
22 | + /** | |
23 | + * id | |
24 | + */ | |
25 | + private Long id; | |
26 | + | |
27 | + /** | |
28 | + * 导入记录id | |
29 | + */ | |
30 | + private Long recordId; | |
31 | + | |
32 | + /** | |
33 | + * 导入记录id | |
34 | + */ | |
35 | + private Long evalIndicatorImportDetailId; | |
36 | + | |
37 | + /** | |
38 | + * key | |
39 | + */ | |
40 | + private String key; | |
41 | + | |
42 | + /** | |
43 | + * 描述 | |
44 | + */ | |
45 | + private String desc; | |
46 | + | |
47 | + /** | |
48 | + * 指标业务值 | |
49 | + */ | |
50 | + private String value; | |
51 | + | |
52 | + /** | |
53 | + * 逻辑删除 | |
54 | + */ | |
55 | + private Boolean yn; | |
56 | + | |
57 | + public EvalIndicatorImportKeyValueVO() { | |
58 | + } | |
59 | + | |
60 | + public EvalIndicatorImportKeyValueVO(Long recordId, Long evalIndicatorImportDetailId) { | |
61 | + this.recordId = recordId; | |
62 | + this.evalIndicatorImportDetailId = evalIndicatorImportDetailId; | |
63 | + this.yn = Boolean.TRUE; | |
64 | + } | |
65 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportRecordVO.java
1 | 1 | package cn.fw.morax.domain.vo.eval; |
2 | 2 | |
3 | 3 | import cn.fw.common.data.entity.BaseAuditableTimeEntity; |
4 | +import cn.fw.common.data.mybatis.handler.LongListTypeHandler; | |
4 | 5 | import cn.fw.morax.domain.enums.DataTimeTypeEnum; |
5 | 6 | import cn.fw.morax.domain.enums.DimensionTypeEnum; |
7 | +import cn.fw.morax.domain.enums.EvalIndicatorImportTypeEnum; | |
6 | 8 | import cn.fw.morax.domain.enums.SettingDraftStatusEnum; |
9 | +import com.baomidou.mybatisplus.annotation.TableField; | |
7 | 10 | import com.baomidou.mybatisplus.annotation.TableLogic; |
8 | 11 | import com.baomidou.mybatisplus.annotation.TableName; |
9 | 12 | import lombok.Data; |
... | ... | @@ -109,9 +112,8 @@ public class EvalIndicatorImportRecordVO{ |
109 | 112 | */ |
110 | 113 | private String key; |
111 | 114 | |
112 | - | |
113 | 115 | /** |
114 | - * 状态;1:审批中 2:待生效 3:生效中 4:已失效 | |
116 | + * 草稿状态 1:未发布 2:发布待审批 3:审批拒绝 4:审批同意 5:撤销审批 | |
115 | 117 | */ |
116 | 118 | private SettingDraftStatusEnum status; |
117 | 119 | |
... | ... | @@ -126,6 +128,17 @@ public class EvalIndicatorImportRecordVO{ |
126 | 128 | private DataTimeTypeEnum dataTimeType; |
127 | 129 | |
128 | 130 | /** |
131 | + * 考评指标导入类型;1:结果数据 2:分值原始数据 | |
132 | + */ | |
133 | + private EvalIndicatorImportTypeEnum importType; | |
134 | + | |
135 | + /** | |
136 | + * 适用门店ids | |
137 | + */ | |
138 | + @TableField(typeHandler = LongListTypeHandler.class) | |
139 | + private List<Long> shopIds; | |
140 | + | |
141 | + /** | |
129 | 142 | * 导入详情 |
130 | 143 | */ |
131 | 144 | private List<EvalIndicatorImportDetailVO> details; | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportVO.java
0 → 100644
1 | +package cn.fw.morax.domain.vo.eval; | |
2 | + | |
3 | +import cn.fw.morax.domain.enums.DataTimeTypeEnum; | |
4 | +import cn.fw.morax.domain.enums.DimensionTypeEnum; | |
5 | +import cn.fw.morax.domain.enums.SettingDraftStatusEnum; | |
6 | +import lombok.Data; | |
7 | +import lombok.EqualsAndHashCode; | |
8 | +import lombok.experimental.Accessors; | |
9 | + | |
10 | +import java.time.LocalDate; | |
11 | +import java.util.Date; | |
12 | +import java.util.List; | |
13 | + | |
14 | +/** | |
15 | + * <p> | |
16 | + * 考评指标导入记录 | |
17 | + * </p> | |
18 | + * | |
19 | + * @author jiangchao | |
20 | + * @since 2023-01-30 | |
21 | + */ | |
22 | +@Data | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@Accessors(chain = true) | |
25 | +public class EvalIndicatorImportVO<T> { | |
26 | + | |
27 | + private static final long serialVersionUID = 1L; | |
28 | + | |
29 | + /** | |
30 | + * 导入人员id | |
31 | + */ | |
32 | + private Long id; | |
33 | + | |
34 | + /** | |
35 | + * 导入人员id | |
36 | + */ | |
37 | + private Long importUserId; | |
38 | + | |
39 | + /** | |
40 | + * 导入人员名称 | |
41 | + */ | |
42 | + private String importUserName; | |
43 | + | |
44 | + /** | |
45 | + * 门店id | |
46 | + */ | |
47 | + private Long shopId; | |
48 | + | |
49 | + /** | |
50 | + * 门店名称 | |
51 | + */ | |
52 | + private String shopName; | |
53 | + | |
54 | + /** | |
55 | + * 维度类型 1:人员 2:门店 | |
56 | + */ | |
57 | + private DimensionTypeEnum dimensionType; | |
58 | + | |
59 | + /** | |
60 | + * 指标编码 | |
61 | + */ | |
62 | + private String indicatorCode; | |
63 | + | |
64 | + /** | |
65 | + * 指标库名称 | |
66 | + */ | |
67 | + private String indicatorName; | |
68 | + | |
69 | + /** | |
70 | + * 类型:1: 百分比 2:数量 3:条件值 4:金额 | |
71 | + */ | |
72 | + private Integer valueType; | |
73 | + | |
74 | + /** | |
75 | + * 数据日期 | |
76 | + */ | |
77 | + private LocalDate dataDate; | |
78 | + | |
79 | + /** | |
80 | + * 导入条数 | |
81 | + */ | |
82 | + private Integer num; | |
83 | + | |
84 | + /** | |
85 | + * 成功导入条数 | |
86 | + */ | |
87 | + private Integer successNum; | |
88 | + | |
89 | + /** | |
90 | + * 失败导入条数 | |
91 | + */ | |
92 | + private Integer errorNum; | |
93 | + | |
94 | + /** | |
95 | + * 集团id | |
96 | + */ | |
97 | + private Long groupId; | |
98 | + | |
99 | + /** | |
100 | + * 创建时间 | |
101 | + */ | |
102 | + private Date createTime; | |
103 | + | |
104 | + /** | |
105 | + * 保存的key | |
106 | + */ | |
107 | + private String key; | |
108 | + | |
109 | + | |
110 | + /** | |
111 | + * 状态;1:审批中 2:待生效 3:生效中 4:已失效 | |
112 | + */ | |
113 | + private SettingDraftStatusEnum status; | |
114 | + | |
115 | + /** | |
116 | + * 审批单号 | |
117 | + */ | |
118 | + private String approvalNo; | |
119 | + | |
120 | + /** | |
121 | + * 数据时间类型;1:月数据 2:阶段数据 | |
122 | + */ | |
123 | + private DataTimeTypeEnum dataTimeType; | |
124 | + | |
125 | + /** | |
126 | + * 导入详情 | |
127 | + */ | |
128 | + private List<T> details; | |
129 | + | |
130 | +} | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/ShowroomScoreImportValueVO.java
0 → 100644
1 | +package cn.fw.morax.domain.vo.eval; | |
2 | + | |
3 | +import cn.fw.morax.common.annotation.ExcelField; | |
4 | +import lombok.Data; | |
5 | + | |
6 | +import java.math.BigDecimal; | |
7 | +import java.time.LocalDate; | |
8 | + | |
9 | +@Data | |
10 | +public class ShowroomScoreImportValueVO { | |
11 | + | |
12 | + /** | |
13 | + * 门店 | |
14 | + */ | |
15 | + @ExcelField(title = "门店", sort = 0, charSize = 16) | |
16 | + private String shopName; | |
17 | + | |
18 | + /** | |
19 | + * 得分 | |
20 | + */ | |
21 | + @ExcelField(title = "得分", sort = 2, charSize = 16) | |
22 | + private BigDecimal score; | |
23 | + | |
24 | + /** | |
25 | + * 总分 | |
26 | + */ | |
27 | + @ExcelField(title = "总分", sort = 3, charSize = 16) | |
28 | + private BigDecimal totalScore; | |
29 | + | |
30 | + /** | |
31 | + * 打分人员 | |
32 | + */ | |
33 | + @ExcelField(title = "打分人员", sort = 5, charSize = 16) | |
34 | + private String graderStaffName; | |
35 | + | |
36 | +// /** | |
37 | +// * 考核开始周期(如果是月数据 就是考核周期结束时间) | |
38 | +// */ | |
39 | +// @ExcelField(title = "考核开始周期", sort = 5, charSize = 16) | |
40 | +// private LocalDate startDataDate; | |
41 | + | |
42 | +// /** | |
43 | +// * 考核结束周期 | |
44 | +// */ | |
45 | +// private LocalDate endDataDate; | |
46 | +// | |
47 | + /** | |
48 | + * 月度日期 | |
49 | + */ | |
50 | + private LocalDate monthlyDate; | |
51 | + | |
52 | + | |
53 | +} | ... | ... |
fw-morax-rpc/src/main/java/cn/fw/morax/rpc/erp/ErpRpcService.java
... | ... | @@ -475,7 +475,13 @@ public class ErpRpcService { |
475 | 475 | } |
476 | 476 | try { |
477 | 477 | final Date startTime = DateUtil.localDateTime2Date(dataDate.with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 1)); |
478 | - final Date endTime = DateUtil.localDateTime2Date(dataDate.atTime(23, 59, 59)); | |
478 | + Date endTime; | |
479 | + //结束时间与当前时间比较,结束时间必须是过去时间 | |
480 | + if (dataDate.compareTo(LocalDate.now()) >= 0) { | |
481 | + endTime = DateUtil.localDateTime2Date(LocalDateTime.now().minusMinutes(1)); | |
482 | + } else { | |
483 | + endTime = DateUtil.localDateTime2Date(dataDate.atTime(23, 59, 59)); | |
484 | + } | |
479 | 485 | HRBatchRangeReq roleRangeDto = new HRBatchRangeReq(); |
480 | 486 | roleRangeDto.setGroupId(groupId); |
481 | 487 | roleRangeDto.setRoleCode(roleCode); | ... | ... |
fw-morax-rpc/src/main/java/cn/fw/morax/rpc/erp/dto/HRoleAuthRangeDayVO.java
0 → 100644
1 | +package cn.fw.morax.rpc.erp.dto; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +import java.time.LocalDate; | |
6 | + | |
7 | +/** | |
8 | + * @author jiangchao | |
9 | + * @des: 历史角色授权范围 | |
10 | + * @date 2024/3/19 15:32 | |
11 | + */ | |
12 | +@Data | |
13 | +public class HRoleAuthRangeDayVO { | |
14 | + | |
15 | + /** | |
16 | + * 集团 | |
17 | + */ | |
18 | + private Long groupId; | |
19 | + | |
20 | + /** | |
21 | + * 用户id | |
22 | + */ | |
23 | + private Long userId; | |
24 | + | |
25 | + /** | |
26 | + * 用户名称 | |
27 | + */ | |
28 | + private String userName; | |
29 | + | |
30 | + /** | |
31 | + * 角色id | |
32 | + */ | |
33 | + private Long roleId; | |
34 | + | |
35 | + /** | |
36 | + * 角色码 | |
37 | + */ | |
38 | + private String roleCode; | |
39 | + | |
40 | + /** | |
41 | + * 数据范围值 | |
42 | + */ | |
43 | + private Long rangeValue; | |
44 | + | |
45 | + /** | |
46 | + * 数据范围名称 | |
47 | + */ | |
48 | + private String rangeName; | |
49 | + | |
50 | + /** | |
51 | + * 时间线开始时间 | |
52 | + */ | |
53 | + private LocalDate startTime; | |
54 | + | |
55 | + /** | |
56 | + * 时间线结束时间 | |
57 | + */ | |
58 | + private LocalDate endTime; | |
59 | + | |
60 | + /** | |
61 | + * 授权天数 | |
62 | + */ | |
63 | + private Long authDays; | |
64 | +} | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/consumer/FinanceRpCallbackConsumer.java
... | ... | @@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional; |
26 | 26 | |
27 | 27 | import java.math.BigDecimal; |
28 | 28 | import java.time.LocalDateTime; |
29 | +import java.time.YearMonth; | |
29 | 30 | import java.util.ArrayList; |
30 | 31 | import java.util.Date; |
31 | 32 | import java.util.List; |
... | ... | @@ -73,6 +74,10 @@ public class FinanceRpCallbackConsumer implements RocketMQListener<RpCallbackMqD |
73 | 74 | cost.setAmount(payrollRecord.getAmount()); |
74 | 75 | cost.setCostDate(DateUtil.localDateTime2Date(payrollRecord.getMonthly().atEndOfMonth().atTime(23,59,59))); |
75 | 76 | cost.setShopId(payrollRecord.getFundShopId()); |
77 | + //3月之后推在职门店 | |
78 | + if (PublicUtil.isNotEmpty(payrollRecord.getMonthly()) && payrollRecord.getMonthly().compareTo(YearMonth.of(2024,3)) >= 0) { | |
79 | + cost.setShopId(payrollRecord.getShopId()); | |
80 | + } | |
76 | 81 | cost.setBusinessType(payrollRecord.getBusinessType()); |
77 | 82 | cost.setBusinessNo(payrollRecord.getBusinessNo()); |
78 | 83 | cost.setType(Constant.SALARY_FINANCE_BUSINESS_PAYMENT); | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/app/EvalController.java
... | ... | @@ -53,6 +53,7 @@ public class EvalController { |
53 | 53 | private final SettingDraftBizService settingDraftBizService; |
54 | 54 | private final EvalGroupRankBizService evalGroupRankBizService; |
55 | 55 | private final EvalIndicatorValueBizService evalIndicatorValueBizService; |
56 | + private final EvalIndicatorImportBizService evalIndicatorImportBizService; | |
56 | 57 | private final EvalIndicatorReportService evalIndicatorReportService; |
57 | 58 | |
58 | 59 | /** |
... | ... | @@ -81,6 +82,18 @@ public class EvalController { |
81 | 82 | } |
82 | 83 | |
83 | 84 | /** |
85 | + * 自定义指标得分数据导入详情 | |
86 | + * | |
87 | + * @param id | |
88 | + * @return | |
89 | + */ | |
90 | + @GetMapping("/score-import-detail") | |
91 | + @ControllerMethod("自定义指标得分数据导入详情") | |
92 | + public Message<List<EvalIndicatorImportDetailScoreVO>> scoreImportDetails(@NotNull(message = "录入详情id不能为空") Long id) { | |
93 | + return success(evalIndicatorImportBizService.scoreImportDetails(id)); | |
94 | + } | |
95 | + | |
96 | + /** | |
84 | 97 | * 导入记录详情审批查询 |
85 | 98 | * |
86 | 99 | * @return | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalIndicatorImportController.java
0 → 100644
1 | +package cn.fw.morax.server.controller.erp; | |
2 | + | |
3 | +import cn.fw.common.exception.BusinessException; | |
4 | +import cn.fw.common.page.AppPage; | |
5 | +import cn.fw.common.web.annotation.ControllerMethod; | |
6 | +import cn.fw.common.web.auth.LoginAuthBean; | |
7 | +import cn.fw.common.web.auth.annotation.CurrentUser; | |
8 | +import cn.fw.data.base.domain.common.Message; | |
9 | +import cn.fw.morax.common.utils.PublicUtil; | |
10 | +import cn.fw.morax.domain.dto.query.EvalIndicatorImportScoreQueryDTO; | |
11 | +import cn.fw.morax.domain.dto.query.EvalIndicatorImportSituationQueryDTO; | |
12 | +import cn.fw.morax.domain.vo.eval.*; | |
13 | +import cn.fw.morax.sdk.dto.eval.EvalIndicatorResult; | |
14 | +import cn.fw.morax.service.biz.eval.EvalIndicatorBizService; | |
15 | +import cn.fw.morax.service.biz.eval.EvalIndicatorImportBizService; | |
16 | +import cn.fw.morax.service.biz.eval.EvalIndicatorReportService; | |
17 | +import cn.fw.morax.service.biz.eval.EvalIndicatorValueBizService; | |
18 | +import cn.fw.security.auth.client.annotation.Authorization; | |
19 | +import cn.fw.security.auth.client.annotation.IgnoreAuth; | |
20 | +import cn.fw.security.auth.client.enums.AuthType; | |
21 | +import lombok.RequiredArgsConstructor; | |
22 | +import lombok.extern.slf4j.Slf4j; | |
23 | +import org.springframework.validation.annotation.Validated; | |
24 | +import org.springframework.web.bind.annotation.*; | |
25 | +import org.springframework.web.multipart.MultipartFile; | |
26 | + | |
27 | +import javax.validation.constraints.NotNull; | |
28 | +import java.util.List; | |
29 | + | |
30 | +import static cn.fw.common.web.util.ResultBuilder.success; | |
31 | + | |
32 | +/** | |
33 | + * @author jiangchao | |
34 | + * @des: 导入考评指标控制器 | |
35 | + * @date 2023/2/8 16:57 | |
36 | + */ | |
37 | +@Slf4j | |
38 | +@RequiredArgsConstructor | |
39 | +@Authorization(AuthType.ERP) | |
40 | +@Validated | |
41 | +@IgnoreAuth | |
42 | +@RestController | |
43 | +@RequestMapping("/erp/eval-indicator-import") | |
44 | +public class EvalIndicatorImportController { | |
45 | + | |
46 | + private final EvalIndicatorImportBizService evalIndicatorImportBizService; | |
47 | + private final EvalIndicatorValueBizService evalIndicatorValueBizService; | |
48 | + private final EvalIndicatorReportService evalIndicatorReportService; | |
49 | + private final EvalIndicatorBizService evalIndicatorBizService; | |
50 | + | |
51 | + /** | |
52 | + * 数据导入指标列表 | |
53 | + * | |
54 | + * @return | |
55 | + */ | |
56 | + @IgnoreAuth | |
57 | + @GetMapping("/indicators") | |
58 | + @ControllerMethod("数据导入指标列表") | |
59 | + public Message<List<EvalIndicatorVO>> evalIndicators(@CurrentUser LoginAuthBean user) { | |
60 | + return success(evalIndicatorImportBizService.evalIndicators(user)); | |
61 | + } | |
62 | + | |
63 | + /** | |
64 | + * 指标导入模板文件 | |
65 | + * | |
66 | + * @return | |
67 | + */ | |
68 | + @IgnoreAuth | |
69 | + @GetMapping("/template-file") | |
70 | + @ControllerMethod("指标导入模板文件") | |
71 | + public Message<String> evalIndicatorTemplateFile(@CurrentUser LoginAuthBean user, | |
72 | + @NotNull(message = "指标编码不能为空") @RequestParam("indicatorCode") String indicatorCode) { | |
73 | + return success(evalIndicatorImportBizService.evalIndicatorTemplateFile(user, indicatorCode)); | |
74 | + } | |
75 | + | |
76 | + | |
77 | + /** | |
78 | + * 展厅美化导入记录分页查询 | |
79 | + * | |
80 | + * @return | |
81 | + */ | |
82 | + @IgnoreAuth | |
83 | + @GetMapping("/showroom-page") | |
84 | + @ControllerMethod("展厅美化导入记录分页查询") | |
85 | + public Message<AppPage<EvalIndicatorImportRecordVO>> showroomImportPage(EvalIndicatorImportScoreQueryDTO dto) { | |
86 | + return success(evalIndicatorImportBizService.importPage(dto)); | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 展厅美化导入记录详情查询 | |
91 | + * | |
92 | + * @param id | |
93 | + * @return | |
94 | + */ | |
95 | + @GetMapping("/showroom-import-detail") | |
96 | + @ControllerMethod("展厅美化导入记录详情查询") | |
97 | + public Message<EvalIndicatorImportVO> scoreImportDetail(@NotNull(message = "录入详情id不能为空") Long id) { | |
98 | + return success(evalIndicatorImportBizService.scoreImportDetail(id)); | |
99 | + } | |
100 | + | |
101 | + /** | |
102 | + * 展厅美化导入清单查询 | |
103 | + * | |
104 | + * @return | |
105 | + */ | |
106 | + @IgnoreAuth | |
107 | + @GetMapping("/showroom-detail") | |
108 | + @ControllerMethod("展厅美化导入清单查询") | |
109 | + public Message<AppPage<EvalIndicatorImportDetailScoreVO>> showroomImportDetailPage(@Validated EvalIndicatorImportScoreQueryDTO dto) { | |
110 | + return success(evalIndicatorImportBizService.showroomImportDetailPage(dto)); | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * 上传展厅美化数据 | |
115 | + */ | |
116 | + @IgnoreAuth | |
117 | + @PostMapping("/analysis-file/showroom-shop") | |
118 | + @ControllerMethod("上传展厅美化数据") | |
119 | + public Message<EvalIndicatorImportVO> analysisStaffExcel(@RequestParam("file") MultipartFile file, | |
120 | + @RequestParam("indicatorCode") String indicatorCode, | |
121 | + @CurrentUser LoginAuthBean user) { | |
122 | + if (file.isEmpty()) { | |
123 | + throw new BusinessException("请上传文件"); | |
124 | + } | |
125 | + return success(evalIndicatorImportBizService.uploadShowroomMonthlyData(null, file, indicatorCode, user)); | |
126 | + } | |
127 | + | |
128 | + /** | |
129 | + * 上传展厅美化数据——fid | |
130 | + */ | |
131 | + @IgnoreAuth | |
132 | + @GetMapping("/analysis/showroom-shop") | |
133 | + @ControllerMethod("上传展厅美化数据") | |
134 | + public Message<EvalIndicatorImportVO> uploadShowroomMonthlyData(@RequestParam("fid") String fid, | |
135 | + @RequestParam("indicatorCode") String indicatorCode, | |
136 | + @CurrentUser LoginAuthBean user) { | |
137 | + if (PublicUtil.isEmpty(fid)) { | |
138 | + throw new BusinessException("请上传文件"); | |
139 | + } | |
140 | + return success(evalIndicatorImportBizService.uploadShowroomMonthlyData(fid, null, indicatorCode, user)); | |
141 | + } | |
142 | + | |
143 | + | |
144 | + /** | |
145 | + * 保存展厅美化数据 | |
146 | + * | |
147 | + * @return | |
148 | + */ | |
149 | + @GetMapping("/save-showroom-import") | |
150 | + @ControllerMethod("保存上传人员数据") | |
151 | + public Message<Void> saveShowroomImportData(String key, @CurrentUser LoginAuthBean user) { | |
152 | + if (PublicUtil.isEmpty(key)) { | |
153 | + throw new BusinessException("参数错误"); | |
154 | + } | |
155 | + evalIndicatorImportBizService.saveShowroomImportData(key, user); | |
156 | + return success(); | |
157 | + } | |
158 | + | |
159 | + /** | |
160 | + * 删除导入审批 | |
161 | + * | |
162 | + * @return | |
163 | + */ | |
164 | + @GetMapping("/del-import") | |
165 | + @ControllerMethod("删除导入审批") | |
166 | + public Message<Void> del(@NotNull(message = "草稿id不能为空") Long id, | |
167 | + @CurrentUser LoginAuthBean currentUser) { | |
168 | + evalIndicatorReportService.delImport(id, currentUser); | |
169 | + return success(); | |
170 | + } | |
171 | + | |
172 | + /** | |
173 | + * 撤销审批 | |
174 | + * | |
175 | + * @return | |
176 | + */ | |
177 | + @GetMapping("/cancel") | |
178 | + @ControllerMethod("撤销审批") | |
179 | + public Message<Void> cancelDraft(@NotNull(message = "草稿id不能为空") Long id, | |
180 | + @CurrentUser LoginAuthBean currentUser) { | |
181 | + evalIndicatorReportService.cancelDraft(id, currentUser); | |
182 | + return success(); | |
183 | + } | |
184 | + | |
185 | + /** | |
186 | + * 月度导入情况 | |
187 | + * | |
188 | + * @return | |
189 | + */ | |
190 | + @GetMapping("/month-import-data") | |
191 | + @ControllerMethod("月度导入情况") | |
192 | + public Message<List<IndicatorImportSituationVO>> monthImportData(@Validated EvalIndicatorImportSituationQueryDTO dto, | |
193 | + @CurrentUser LoginAuthBean currentUser) { | |
194 | + if (PublicUtil.isEmpty(currentUser) || PublicUtil.isEmpty(currentUser.getUserId())) { | |
195 | + return success(); | |
196 | + } | |
197 | + | |
198 | + return success(evalIndicatorValueBizService.getIndicatorImportSituation(dto.getMonthly(), Boolean.FALSE, currentUser)); | |
199 | + } | |
200 | + | |
201 | + /** | |
202 | + * 阶段导入情况 | |
203 | + * | |
204 | + * @return | |
205 | + */ | |
206 | + @GetMapping("/stage-import-data") | |
207 | + @ControllerMethod("阶段导入情况") | |
208 | + public Message<List<IndicatorImportSituationVO>> stageImportData(@Validated EvalIndicatorImportSituationQueryDTO dto, | |
209 | + @CurrentUser LoginAuthBean currentUser) { | |
210 | + if (PublicUtil.isEmpty(currentUser) || PublicUtil.isEmpty(currentUser.getUserId())) { | |
211 | + return success(); | |
212 | + } | |
213 | + return success(evalIndicatorValueBizService.getIndicatorImportSituation(dto.getMonthly(), Boolean.TRUE, currentUser)); | |
214 | + } | |
215 | + | |
216 | + /** | |
217 | + * 自定义指标列表 | |
218 | + */ | |
219 | + @GetMapping("/custom-indicators") | |
220 | + @ControllerMethod("自定义指标列表") | |
221 | + public Message<List<EvalIndicatorResult>> customIndicators(String indicatorName, @CurrentUser LoginAuthBean currentUser) { | |
222 | + return success(evalIndicatorBizService.customIndicators(indicatorName, currentUser.getGroupId())); | |
223 | + } | |
224 | + | |
225 | +} | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/KpiDebugController.java
... | ... | @@ -5,6 +5,7 @@ import cn.fw.data.base.domain.common.Message; |
5 | 5 | import cn.fw.ehr.sdk.api.mq.StaffLeaveEvent; |
6 | 6 | import cn.fw.morax.common.config.SpecialIndicatorCodeVal; |
7 | 7 | import cn.fw.morax.common.pojo.event.ImportEvalIndicatorEvent; |
8 | +import cn.fw.morax.common.pojo.event.ImportEvalIndicatorScoreEvent; | |
8 | 9 | import cn.fw.morax.common.utils.DateUtil; |
9 | 10 | import cn.fw.morax.common.utils.PublicUtil; |
10 | 11 | import cn.fw.morax.domain.db.eval.EvalIndicatorImportRecord; |
... | ... | @@ -27,6 +28,7 @@ import cn.fw.morax.service.biz.BusinessSysReportBizService; |
27 | 28 | import cn.fw.morax.service.biz.CommonService; |
28 | 29 | import cn.fw.morax.service.biz.kpi.*; |
29 | 30 | import cn.fw.morax.service.component.EvalIndicatorSaveObserver; |
31 | +import cn.fw.morax.service.component.EvalIndicatorScoreSaveObserver; | |
30 | 32 | import cn.fw.morax.service.data.eval.EvalIndicatorImportRecordService; |
31 | 33 | import cn.fw.morax.service.data.kpi.*; |
32 | 34 | import cn.fw.oop.sdk.dto.InvalidShopEvent; |
... | ... | @@ -74,6 +76,7 @@ public class KpiDebugController { |
74 | 76 | private final CommonService commonService; |
75 | 77 | private final GenericTask genericTask; |
76 | 78 | private final EvalIndicatorSaveObserver evalIndicatorSaveObserver; |
79 | + private final EvalIndicatorScoreSaveObserver evalIndicatorScoreSaveObserver; | |
77 | 80 | private final EvalIndicatorImportRecordService evalIndicatorImportRecordService; |
78 | 81 | private final KpiGroupUserService kpiGroupUserService; |
79 | 82 | private final KpiGroupService kpiGroupService; |
... | ... | @@ -124,6 +127,20 @@ public class KpiDebugController { |
124 | 127 | return success(); |
125 | 128 | } |
126 | 129 | |
130 | + @GetMapping("/save-eval-import-score") | |
131 | + @ControllerMethod("保存导入的展厅美化得分指标") | |
132 | + public Message<Void> saveEvalIndicatorScore(Long evalIndicatorImportRecordId) { | |
133 | + EvalIndicatorImportRecord record = evalIndicatorImportRecordService.getById(evalIndicatorImportRecordId); | |
134 | + if (PublicUtil.isEmpty(record)) { | |
135 | + return success(); | |
136 | + } | |
137 | + ImportEvalIndicatorScoreEvent event = new ImportEvalIndicatorScoreEvent(); | |
138 | + event.setEvalIndicatorImportRecordId(record.getId()); | |
139 | + event.setGroupId(record.getGroupId()); | |
140 | + evalIndicatorScoreSaveObserver.saveEvalIndicator(event); | |
141 | + return success(); | |
142 | + } | |
143 | + | |
127 | 144 | @GetMapping("/dealHistoryDataKpiGroupUser") |
128 | 145 | @ControllerMethod("历史数据KpiGroupUser状态处理") |
129 | 146 | public Message<Void> dealHistoryDataKpiGroupUser(@RequestParam(required = false) Long groupId, | ... | ... |
fw-morax-server/src/main/java/cn/fw/morax/server/runner/CheckCommandLineRunner.java
... | ... | @@ -9,7 +9,6 @@ import cn.fw.morax.service.data.salary.SalaryGeneralSettinService; |
9 | 9 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
10 | 10 | import lombok.RequiredArgsConstructor; |
11 | 11 | import lombok.extern.slf4j.Slf4j; |
12 | -import org.springframework.beans.factory.annotation.Autowired; | |
13 | 12 | import org.springframework.boot.CommandLineRunner; |
14 | 13 | import org.springframework.stereotype.Component; |
15 | 14 | import org.springframework.util.CollectionUtils; |
... | ... | @@ -29,6 +28,7 @@ import java.util.List; |
29 | 28 | @Slf4j |
30 | 29 | @RequiredArgsConstructor |
31 | 30 | public class CheckCommandLineRunner implements CommandLineRunner { |
31 | + private final EvalIndicatorScoreSaveObserver evalIndicatorScoreSaveObserver; | |
32 | 32 | private final SalaryGeneralSettinService salaryGeneralSettinService; |
33 | 33 | private final EvalIndicatorSaveObserver evalIndicatorSaveObserver; |
34 | 34 | private final KpiStarAdjustmentObserver kpiStarAdjustmentObserver; |
... | ... | @@ -51,6 +51,7 @@ public class CheckCommandLineRunner implements CommandLineRunner { |
51 | 51 | * 注册监听器 |
52 | 52 | */ |
53 | 53 | public void registerObserver() { |
54 | + EventBusUtil.asyncRegister(evalIndicatorScoreSaveObserver); | |
54 | 55 | EventBusUtil.asyncRegister(kpiStarAdjustmentObserver); |
55 | 56 | EventBusUtil.asyncRegister(paySalaryObserver); |
56 | 57 | EventBusUtil.asyncRegister(kpiGroupChangeObserver); | ... | ... |
fw-morax-server/src/main/resources/application-prd.yml
fw-morax-service/src/main/java/cn/fw/morax/service/biz/ApprovalBizService.java
... | ... | @@ -460,6 +460,7 @@ public class ApprovalBizService { |
460 | 460 | conditions.add(commonService.createShopTypes(shopIds)); |
461 | 461 | Map extDataMap = new HashMap<String, Object>() {{ |
462 | 462 | put("evalIndicatorImportRecordId", record.getId()); |
463 | + put("importType", record.getImportType().getValue()); | |
463 | 464 | }}; |
464 | 465 | FlowDto flowDto = FlowDto.builder() |
465 | 466 | .groupId(user.getGroupId()) | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/RpcCommonService.java
... | ... | @@ -3,10 +3,13 @@ package cn.fw.morax.service.biz; |
3 | 3 | import cn.fw.common.exception.BusinessException; |
4 | 4 | import cn.fw.morax.common.config.DicKeyCofigProperties; |
5 | 5 | import cn.fw.morax.common.config.SpecialIndicatorCodeVal; |
6 | +import cn.fw.morax.common.utils.DateUtil; | |
6 | 7 | import cn.fw.morax.common.utils.PublicUtil; |
7 | 8 | import cn.fw.morax.rpc.ehr.EhrRpcService; |
8 | 9 | import cn.fw.morax.rpc.ehr.dto.PostInfoDTO; |
9 | 10 | import cn.fw.morax.rpc.erp.ErpRpcService; |
11 | +import cn.fw.morax.rpc.erp.dto.HRoleAuthRangeDayVO; | |
12 | +import cn.fw.morax.rpc.erp.dto.HRoleAuthRangeVO; | |
10 | 13 | import cn.fw.morax.rpc.file.FileRpcService; |
11 | 14 | import cn.fw.morax.rpc.oop.OopRpcService; |
12 | 15 | import cn.fw.morax.service.biz.kpi.KpiDictBizService; |
... | ... | @@ -21,6 +24,9 @@ import lombok.extern.slf4j.Slf4j; |
21 | 24 | import org.springframework.data.redis.core.StringRedisTemplate; |
22 | 25 | import org.springframework.stereotype.Service; |
23 | 26 | |
27 | +import java.time.LocalDate; | |
28 | +import java.time.temporal.ChronoUnit; | |
29 | +import java.time.temporal.TemporalAdjusters; | |
24 | 30 | import java.util.ArrayList; |
25 | 31 | import java.util.List; |
26 | 32 | import java.util.stream.Collectors; |
... | ... | @@ -90,4 +96,32 @@ public class RpcCommonService { |
90 | 96 | return matchPostInfos.get(0); |
91 | 97 | } |
92 | 98 | |
99 | + /** | |
100 | + * 角色月度授权情况 | |
101 | + */ | |
102 | + public List<HRoleAuthRangeDayVO> roleMonthlyAuthDay(final Long groupId, final LocalDate calcDate, final String roleCode, final List<Long> shopIds) { | |
103 | + final LocalDate monthlyFirstDate = calcDate.with(TemporalAdjusters.firstDayOfMonth()); | |
104 | + List<HRoleAuthRangeDayVO> rangeDayVos = new ArrayList<>(); | |
105 | + List<HRoleAuthRangeVO> hRoleAuthRangeVos = erpRpcService.queryRoleHistoryAuthRange(groupId, shopIds, roleCode, calcDate); | |
106 | + for (HRoleAuthRangeVO hRoleAuthRangeVO : hRoleAuthRangeVos) { | |
107 | + HRoleAuthRangeDayVO rangeDayVo = PublicUtil.copy(hRoleAuthRangeVO, HRoleAuthRangeDayVO.class); | |
108 | + LocalDate authStartTime = DateUtil.date2LocalDate(hRoleAuthRangeVO.getStartTime()); | |
109 | + rangeDayVo.setStartTime(authStartTime); | |
110 | + //角色授权开始时间 在 月度开始时间之前 | |
111 | + if (monthlyFirstDate.compareTo(authStartTime) > 0) { | |
112 | + rangeDayVo.setStartTime(monthlyFirstDate); | |
113 | + } | |
114 | + //角色授权结束时间 在 计算日期之后 | |
115 | + LocalDate authEndTime = DateUtil.date2LocalDate(hRoleAuthRangeVO.getEndTime()); | |
116 | + rangeDayVo.setEndTime(authEndTime); | |
117 | + if (authEndTime.compareTo(calcDate) > 0) { | |
118 | + rangeDayVo.setEndTime(calcDate); | |
119 | + } | |
120 | + Long authDays = rangeDayVo.getStartTime().until(rangeDayVo.getEndTime(), ChronoUnit.DAYS); | |
121 | + rangeDayVo.setAuthDays(authDays); | |
122 | + rangeDayVos.add(rangeDayVo); | |
123 | + } | |
124 | + return rangeDayVos; | |
125 | + } | |
126 | + | |
93 | 127 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalIndicatorBizService.java
... | ... | @@ -358,6 +358,12 @@ public class EvalIndicatorBizService { |
358 | 358 | break; |
359 | 359 | } |
360 | 360 | } |
361 | + if (PublicUtil.isNotEmpty(dto.getRoleCodes())) { | |
362 | + indicators.setRoleCodes(dto.getRoleCodes()); | |
363 | + } | |
364 | + if (PublicUtil.isNotEmpty(dto.getRoleNames())) { | |
365 | + indicators.setRoleNames(dto.getRoleNames()); | |
366 | + } | |
361 | 367 | return indicators; |
362 | 368 | } |
363 | 369 | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalIndicatorCommonService.java
0 → 100644
1 | +package cn.fw.morax.service.biz.eval; | |
2 | + | |
3 | +import cn.fw.common.exception.BusinessException; | |
4 | +import cn.fw.common.web.auth.LoginAuthBean; | |
5 | +import cn.fw.morax.common.constant.ExcelConstant; | |
6 | +import cn.fw.morax.common.utils.DateUtil; | |
7 | +import cn.fw.morax.common.utils.ExcelDataUtil; | |
8 | +import cn.fw.morax.common.utils.PublicUtil; | |
9 | +import cn.fw.morax.domain.db.eval.EvalIndicator; | |
10 | +import cn.fw.morax.domain.db.eval.EvalIndicatorValue; | |
11 | +import cn.fw.morax.domain.db.salary.SalaryGeneralSettin; | |
12 | +import cn.fw.morax.domain.enums.DataTimeTypeEnum; | |
13 | +import cn.fw.morax.domain.enums.DimensionTypeEnum; | |
14 | +import cn.fw.morax.domain.vo.eval.ShowroomScoreImportValueVO; | |
15 | +import cn.fw.morax.rpc.file.FileRpcService; | |
16 | +import cn.fw.morax.rpc.file.dto.DfsFileDTO; | |
17 | +import cn.fw.morax.rpc.oop.OopRpcService; | |
18 | +import cn.fw.morax.rpc.oop.dto.ShopDTO; | |
19 | +import cn.fw.morax.service.data.eval.EvalIndicatorService; | |
20 | +import cn.fw.morax.service.data.eval.EvalIndicatorValueService; | |
21 | +import cn.fw.morax.service.data.salary.SalaryGeneralSettinService; | |
22 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
23 | +import lombok.RequiredArgsConstructor; | |
24 | +import lombok.extern.slf4j.Slf4j; | |
25 | +import org.apache.poi.ss.formula.functions.T; | |
26 | +import org.apache.poi.ss.usermodel.CellType; | |
27 | +import org.apache.poi.xssf.usermodel.XSSFCell; | |
28 | +import org.apache.poi.xssf.usermodel.XSSFRow; | |
29 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | |
30 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
31 | +import org.springframework.stereotype.Service; | |
32 | +import org.springframework.transaction.annotation.Transactional; | |
33 | +import org.springframework.web.multipart.MultipartFile; | |
34 | + | |
35 | +import java.io.ByteArrayInputStream; | |
36 | +import java.io.IOException; | |
37 | +import java.time.LocalDate; | |
38 | +import java.time.YearMonth; | |
39 | +import java.time.temporal.TemporalAdjusters; | |
40 | +import java.util.ArrayList; | |
41 | +import java.util.Date; | |
42 | +import java.util.List; | |
43 | +import java.util.Map; | |
44 | +import java.util.function.Function; | |
45 | +import java.util.stream.Collectors; | |
46 | + | |
47 | +/** | |
48 | + * @author jiangchao | |
49 | + * @des: | |
50 | + * @date 2024/3/25 17:58 | |
51 | + */ | |
52 | +@Service | |
53 | +@Slf4j | |
54 | +@RequiredArgsConstructor | |
55 | +public class EvalIndicatorCommonService { | |
56 | + | |
57 | + private final SalaryGeneralSettinService salaryGeneralSettinService; | |
58 | + private final EvalIndicatorValueService evalIndicatorValueService; | |
59 | + private final EvalIndicatorService evalIndicatorService; | |
60 | + private final FileRpcService fileRpcService; | |
61 | + private final OopRpcService oopRpcService; | |
62 | + | |
63 | + /** | |
64 | + * 解析excel Fid | |
65 | + */ | |
66 | + public <T> List<T> analysisExcelFid(String fid, Integer startRowIndex, Map<Integer, String> headerAlias, Class<T> tClass) { | |
67 | + List<T> indicatorValues = new ArrayList<>(); | |
68 | + DfsFileDTO dfsFile = fileRpcService.download(fid); | |
69 | + if (PublicUtil.isEmpty(dfsFile)) { | |
70 | + throw new BusinessException("文件下载失败"); | |
71 | + } | |
72 | + try { | |
73 | + XSSFWorkbook wb = new XSSFWorkbook(new ByteArrayInputStream(dfsFile.getData())); | |
74 | + indicatorValues = ExcelDataUtil.analysisExcel(wb, tClass, headerAlias, startRowIndex); | |
75 | + } catch (IOException e) { | |
76 | + log.error("", e); | |
77 | + } | |
78 | + return indicatorValues; | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * 解析excel Fid | |
83 | + */ | |
84 | + public <T> List<T> analysisExcelFid(MultipartFile file, Integer startRowIndex, Map<Integer, String> headerAlias, Class<T> tClass) { | |
85 | + List<T> indicatorValues = new ArrayList<>(); | |
86 | + try { | |
87 | + XSSFWorkbook wb = new XSSFWorkbook(file.getInputStream()); | |
88 | + indicatorValues = ExcelDataUtil.analysisExcel(wb, tClass, headerAlias, startRowIndex); | |
89 | + } catch (IOException e) { | |
90 | + log.error("", e); | |
91 | + } | |
92 | + return indicatorValues; | |
93 | + } | |
94 | + | |
95 | + public Map<String, ShopDTO> getShopNameMap(LoginAuthBean user) { | |
96 | + List<ShopDTO> shops = oopRpcService.queryGroupShops(user.getGroupId()); | |
97 | + Map<String, ShopDTO> evalShopPoolMap = shops.stream() | |
98 | + .collect(Collectors.toMap(ShopDTO::getShortName, Function.identity(), (v1, v2) -> v1)); | |
99 | + return evalShopPoolMap; | |
100 | + } | |
101 | + | |
102 | + public Map<String, EvalIndicator> getNameIndicatorMap(Long groupId) { | |
103 | + List<EvalIndicator> evalIndicators = evalIndicatorService.list(Wrappers.<EvalIndicator>lambdaQuery() | |
104 | + .eq(EvalIndicator::getYn, Boolean.TRUE) | |
105 | + .eq(EvalIndicator::getGroupId, groupId) | |
106 | + .eq(EvalIndicator::getEnable, Boolean.TRUE) | |
107 | + ); | |
108 | + Map<String, EvalIndicator> evalIndicatorMap = evalIndicators.stream() | |
109 | + .collect(Collectors.toMap(EvalIndicator::getName, Function.identity(), (v1, v2) -> v1)); | |
110 | + return evalIndicatorMap; | |
111 | + } | |
112 | + | |
113 | + public DataTimeTypeEnum getExcelType(XSSFSheet sheet) { | |
114 | + XSSFRow firstRow = sheet.getRow(0); | |
115 | + for (int j = 0, cellSize = firstRow.getLastCellNum(); j < cellSize; j++) { | |
116 | + XSSFCell xssfCell = firstRow.getCell(j); | |
117 | + if (CellType.STRING.equals(xssfCell.getCellType()) && | |
118 | + ExcelConstant.STAGE_INDICATOR_EXCEL_IDENTITY_HEADER_NAMES.contains(xssfCell.getStringCellValue())) { | |
119 | + return DataTimeTypeEnum.STAGE; | |
120 | + } | |
121 | + } | |
122 | + return DataTimeTypeEnum.MONTHLY; | |
123 | + } | |
124 | + | |
125 | + public LocalDate convertMonthlyDate(LocalDate importDate) { | |
126 | + //当前月,为今天的数据 | |
127 | + if (YearMonth.now().equals(YearMonth.from(importDate))) { | |
128 | + //不是一号 | |
129 | + if (importDate.getDayOfMonth() == 1) { | |
130 | + return LocalDate.now(); | |
131 | + } | |
132 | + return LocalDate.now().minusDays(1); | |
133 | + } else { | |
134 | + //之前月,取最后一天 | |
135 | + return importDate.with(TemporalAdjusters.lastDayOfMonth()); | |
136 | + } | |
137 | + } | |
138 | + | |
139 | + public Date importApprovalExpTime(Long groupId) { | |
140 | + SalaryGeneralSettin settin = salaryGeneralSettinService.getByGroup(groupId); | |
141 | + if (PublicUtil.isNotEmpty(settin) && PublicUtil.isNotEmpty(settin.getPaymentDate())) { | |
142 | + LocalDate expTime = PublicUtil.getDayOfMonth(YearMonth.now().plusMonths(1), settin.getPaymentDate()); | |
143 | +// LocalDate expTime = LocalDate.now().withDayOfMonth(settin.getPaymentDate()).plusMonths(1); | |
144 | + return DateUtil.localDateTime2Date(expTime.atTime(23, 59, 59)); | |
145 | + } | |
146 | + return DateUtil.localDateTime2Date(LocalDate.now().atTime(23, 59, 59)); | |
147 | + } | |
148 | + | |
149 | + /** | |
150 | + * 保存数据 | |
151 | + */ | |
152 | + @Transactional(rollbackFor = Exception.class) | |
153 | + public void saveIndicatorValue(List<EvalIndicatorValue> evalIndicatorValues) { | |
154 | + //删除当天重复数据 | |
155 | + for (EvalIndicatorValue evalIndicatorValue : evalIndicatorValues) { | |
156 | + List<EvalIndicatorValue> repeatIndicatorValues = evalIndicatorValueService.list(Wrappers.<EvalIndicatorValue>lambdaQuery() | |
157 | + .eq(EvalIndicatorValue::getUserId, evalIndicatorValue.getUserId()) | |
158 | + .eq(EvalIndicatorValue::getShopId, evalIndicatorValue.getShopId()) | |
159 | + .eq(EvalIndicatorValue::getIndicatorCode, evalIndicatorValue.getIndicatorCode()) | |
160 | + .eq(EvalIndicatorValue::getDataDate, evalIndicatorValue.getDataDate()) | |
161 | + .eq(EvalIndicatorValue::getDimensionType, evalIndicatorValue.getDimensionType()) | |
162 | + .eq(EvalIndicatorValue::getYn, Boolean.TRUE) | |
163 | + .select(EvalIndicatorValue::getId) | |
164 | + ); | |
165 | + if (PublicUtil.isNotEmpty(repeatIndicatorValues)) { | |
166 | + evalIndicatorValueService.removeByIds(repeatIndicatorValues.stream().map(EvalIndicatorValue::getId).collect(Collectors.toList())); | |
167 | + } | |
168 | + } | |
169 | + evalIndicatorValueService.insertBatchSomeColumn(evalIndicatorValues); | |
170 | + } | |
171 | + | |
172 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalIndicatorImportBizService.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.exception.BusinessException; | |
5 | +import cn.fw.common.page.AppPage; | |
6 | +import cn.fw.common.web.auth.LoginAuthBean; | |
7 | +import cn.fw.common.web.auth.annotation.CurrentUser; | |
8 | +import cn.fw.morax.common.config.EvalIndicatorVal; | |
9 | +import cn.fw.morax.common.utils.MessageFormatUtil; | |
10 | +import cn.fw.morax.common.utils.PublicUtil; | |
11 | +import cn.fw.morax.domain.db.TemplateFile; | |
12 | +import cn.fw.morax.domain.db.eval.*; | |
13 | +import cn.fw.morax.domain.dto.query.EvalIndicatorImportScoreQueryDTO; | |
14 | +import cn.fw.morax.domain.enums.*; | |
15 | +import cn.fw.morax.domain.vo.eval.*; | |
16 | +import cn.fw.morax.rpc.oop.dto.ShopDTO; | |
17 | +import cn.fw.morax.service.biz.ApprovalBizService; | |
18 | +import cn.fw.morax.service.data.TemplateFileService; | |
19 | +import cn.fw.morax.service.data.eval.*; | |
20 | +import com.alibaba.fastjson.JSON; | |
21 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
22 | +import lombok.RequiredArgsConstructor; | |
23 | +import lombok.extern.slf4j.Slf4j; | |
24 | +import org.apache.commons.collections4.map.MultiKeyMap; | |
25 | +import org.springframework.data.redis.core.BoundValueOperations; | |
26 | +import org.springframework.data.redis.core.StringRedisTemplate; | |
27 | +import org.springframework.stereotype.Service; | |
28 | +import org.springframework.transaction.annotation.Transactional; | |
29 | +import org.springframework.web.bind.annotation.RequestParam; | |
30 | +import org.springframework.web.multipart.MultipartFile; | |
31 | + | |
32 | +import java.time.LocalDate; | |
33 | +import java.time.YearMonth; | |
34 | +import java.time.format.DateTimeFormatter; | |
35 | +import java.util.*; | |
36 | +import java.util.concurrent.TimeUnit; | |
37 | +import java.util.stream.Collectors; | |
38 | + | |
39 | +import static cn.fw.common.businessvalidator.Validator.BV; | |
40 | + | |
41 | +/** | |
42 | + * @author jiangchao | |
43 | + * @des: | |
44 | + * @date 2024/3/22 17:19 | |
45 | + */ | |
46 | +@Service | |
47 | +@Slf4j | |
48 | +@RequiredArgsConstructor | |
49 | +public class EvalIndicatorImportBizService { | |
50 | + | |
51 | + private final EvalIndicatorImportDetailScoreService evalIndicatorImportDetailScoreService; | |
52 | + private final EvalIndicatorImportRecordService evalIndicatorImportRecordService; | |
53 | + private final EvalIndicatorImportMenuService evalIndicatorImportMenuService; | |
54 | + private final EvalIndicatorCommonService evalIndicatorCommonService; | |
55 | + private final EvalIndicatorService evalIndicatorService; | |
56 | + private final StringRedisTemplate stringRedisTemplate; | |
57 | + private final TemplateFileService templateFileService; | |
58 | + private final ApprovalBizService approvalBizService; | |
59 | + private final EvalIndicatorVal evalIndicatorVal; | |
60 | + | |
61 | + /** | |
62 | + * 数据导入指标列表 | |
63 | + */ | |
64 | + public List<EvalIndicatorVO> evalIndicators(LoginAuthBean user) { | |
65 | + final Long groupId = user.getGroupId(); | |
66 | + List<EvalIndicatorImportMenu> evalIndicatorMenus = evalIndicatorImportMenuService.list(Wrappers.<EvalIndicatorImportMenu>lambdaQuery() | |
67 | + .eq(EvalIndicatorImportMenu::getGroupId, groupId) | |
68 | + .eq(EvalIndicatorImportMenu::getYn, Boolean.TRUE) | |
69 | + ); | |
70 | + if (PublicUtil.isEmpty(evalIndicatorMenus)) { | |
71 | + return new ArrayList<>(); | |
72 | + } | |
73 | + List<String> evalIndicatorCodes = evalIndicatorMenus.stream().map(EvalIndicatorImportMenu::getIndicatorCode).collect(Collectors.toList()); | |
74 | + List<EvalIndicator> evalIndicators = evalIndicatorService.list(Wrappers.<EvalIndicator>lambdaQuery() | |
75 | + .in(EvalIndicator::getCode, evalIndicatorCodes) | |
76 | + .eq(EvalIndicator::getYn, Boolean.TRUE) | |
77 | + ); | |
78 | + if (PublicUtil.isEmpty(evalIndicators)) { | |
79 | + return new ArrayList<>(); | |
80 | + } | |
81 | + List<EvalIndicatorVO> evalIndicatorVos = PublicUtil.copyList(evalIndicators, EvalIndicatorVO.class); | |
82 | + return evalIndicatorVos; | |
83 | + } | |
84 | + | |
85 | + /** | |
86 | + * 数据导入指标列表 | |
87 | + */ | |
88 | + public String evalIndicatorTemplateFile(LoginAuthBean user, String indicatorCode) { | |
89 | + final Long groupId = user.getGroupId(); | |
90 | + TemplateFile templateFile = templateFileService.getOne(Wrappers.<TemplateFile>lambdaQuery() | |
91 | + .eq(TemplateFile::getTag, indicatorCode) | |
92 | + .eq(TemplateFile::getType, TemplateFileTypeEnum.EVAL_INDICATOR) | |
93 | + .eq(TemplateFile::getGroupId, groupId) | |
94 | + .eq(TemplateFile::getYn, Boolean.TRUE) | |
95 | + , Boolean.FALSE | |
96 | + ); | |
97 | + if (PublicUtil.isEmpty(templateFile)) { | |
98 | + return null; | |
99 | + } | |
100 | + return templateFile.getFid(); | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * 分页查询 | |
105 | + * | |
106 | + * @param dto | |
107 | + * @return | |
108 | + */ | |
109 | + public AppPage<EvalIndicatorImportRecordVO> importPage(EvalIndicatorImportScoreQueryDTO dto) { | |
110 | + final YearMonth monthly = dto.getMonthly(); | |
111 | + LocalDate startTime = (PublicUtil.isNotEmpty(monthly)) ? monthly.atDay(1) : null; | |
112 | + LocalDate endTime = (PublicUtil.isNotEmpty(monthly)) ? monthly.atEndOfMonth() : null; | |
113 | + PageData<EvalIndicatorImportRecord> pageData = evalIndicatorImportRecordService.page(new PageData<>(dto.getCurrent(), dto.getPageSize()), | |
114 | + Wrappers.<EvalIndicatorImportRecord>lambdaQuery() | |
115 | + .eq(PublicUtil.isNotEmpty(dto.getUserId()), EvalIndicatorImportRecord::getImportUserId, dto.getUserId()) | |
116 | + .apply(PublicUtil.isNotEmpty(dto.getShopId()), MessageFormatUtil.transferWithQuotationMarks("FIND_IN_SET({0}, shop_ids)", dto.getShopId())) | |
117 | + .eq(PublicUtil.isNotEmpty(dto.getIndicatorCode()), EvalIndicatorImportRecord::getIndicatorCode, dto.getIndicatorCode()) | |
118 | + .ge(PublicUtil.isNotEmpty(startTime), EvalIndicatorImportRecord::getDataDate, startTime) | |
119 | + .le(PublicUtil.isNotEmpty(endTime), EvalIndicatorImportRecord::getDataDate, endTime) | |
120 | + .eq(EvalIndicatorImportRecord::getImportType, EvalIndicatorImportTypeEnum.SCORE_ORIGIN_VALUE) | |
121 | + .eq(EvalIndicatorImportRecord::getYn, Boolean.TRUE) | |
122 | + .eq(EvalIndicatorImportRecord::getGroupId, dto.getGroupId()) | |
123 | + .orderByDesc(EvalIndicatorImportRecord::getCreateTime) | |
124 | + ); | |
125 | + return PublicUtil.toPage(pageData, importRecord -> { | |
126 | + EvalIndicatorImportRecordVO importRecordVO = PublicUtil.copy(importRecord, EvalIndicatorImportRecordVO.class); | |
127 | + return importRecordVO; | |
128 | + }); | |
129 | + } | |
130 | + | |
131 | + /** | |
132 | + * 展厅梅花导入数据分页查询 | |
133 | + * | |
134 | + * @param dto | |
135 | + * @return | |
136 | + */ | |
137 | + public AppPage<EvalIndicatorImportDetailScoreVO> showroomImportDetailPage(EvalIndicatorImportScoreQueryDTO dto) { | |
138 | + final YearMonth monthly = dto.getMonthly(); | |
139 | + LocalDate startTime = (PublicUtil.isNotEmpty(monthly)) ? monthly.atDay(1) : null; | |
140 | + LocalDate endTime = (PublicUtil.isNotEmpty(monthly)) ? monthly.atEndOfMonth() : null; | |
141 | + PageData<EvalIndicatorImportDetailScore> pageData = evalIndicatorImportDetailScoreService.page(new PageData<>(dto.getCurrent(), dto.getPageSize()), | |
142 | + Wrappers.<EvalIndicatorImportDetailScore>lambdaQuery() | |
143 | + .eq(PublicUtil.isNotEmpty(dto.getIndicatorCode()), EvalIndicatorImportDetailScore::getIndicatorCode, dto.getIndicatorCode()) | |
144 | + .eq(PublicUtil.isNotEmpty(dto.getShopId()), EvalIndicatorImportDetailScore::getShopId, dto.getShopId()) | |
145 | + .ge(PublicUtil.isNotEmpty(startTime), EvalIndicatorImportDetailScore::getDataDate, startTime) | |
146 | + .le(PublicUtil.isNotEmpty(endTime), EvalIndicatorImportDetailScore::getDataDate, endTime) | |
147 | + .isNull(EvalIndicatorImportDetailScore::getErrorType) | |
148 | + .eq(EvalIndicatorImportDetailScore::getValid, Boolean.TRUE) | |
149 | + .eq(EvalIndicatorImportDetailScore::getYn, Boolean.TRUE) | |
150 | + ); | |
151 | + | |
152 | + return PublicUtil.toPage(pageData, importDetailScore -> { | |
153 | + EvalIndicatorImportDetailScoreVO importDetailScoreVO = PublicUtil.copy(importDetailScore, EvalIndicatorImportDetailScoreVO.class); | |
154 | + return importDetailScoreVO; | |
155 | + }); | |
156 | + } | |
157 | + | |
158 | + @Transactional(rollbackFor = Exception.class) | |
159 | + public EvalIndicatorImportVO uploadShowroomMonthlyData(String fid, MultipartFile file, String indicatorCode, LoginAuthBean user) { | |
160 | + final DataTimeTypeEnum dataTimeType = DataTimeTypeEnum.MONTHLY; | |
161 | + final Long groupId = user.getGroupId(); | |
162 | + EvalIndicator evalIndicator = evalIndicatorService.queryByCode(indicatorCode, Boolean.FALSE); | |
163 | + BV.notNull(evalIndicator, "展厅美化指标不存在,请重试"); | |
164 | + List<YearMonth> importValidMonthlies = new ArrayList<YearMonth>() {{ | |
165 | + add(YearMonth.now()); | |
166 | + add(YearMonth.now().minusMonths(1)); | |
167 | + }}; | |
168 | + | |
169 | + final Map<String, ShopDTO> shopMap = evalIndicatorCommonService.getShopNameMap(user); | |
170 | + Map<Integer, String> headerAlias = this.getShopHeaderNameMap(dataTimeType); | |
171 | + List<ShowroomScoreImportValueVO> indicatorValues = null; | |
172 | + if (PublicUtil.isNotEmpty(fid)) { | |
173 | + indicatorValues = evalIndicatorCommonService.analysisExcelFid(fid, 1, headerAlias, ShowroomScoreImportValueVO.class); | |
174 | + } else { | |
175 | + indicatorValues = evalIndicatorCommonService.analysisExcelFid(file, 1, headerAlias, ShowroomScoreImportValueVO.class); | |
176 | + } | |
177 | + MultiKeyMap<String, String> repeatMap = new MultiKeyMap<>(); | |
178 | + Set<Long> shopIds = new HashSet<>(); | |
179 | + List<EvalIndicatorImportDetailScore> details = new ArrayList<>(); | |
180 | + Integer errorNum = 0; | |
181 | + for (ShowroomScoreImportValueVO shop : indicatorValues) { | |
182 | + EvalIndicatorImportDetailScore importDetailScore = this.convertShopPo(shop, evalIndicator, groupId); | |
183 | + details.add(importDetailScore); | |
184 | + if (PublicUtil.isEmpty(shop.getMonthlyDate())) { | |
185 | + importDetailScore.setErrorType(ImportErrorReasonEnum.TIME_ERROR); | |
186 | + errorNum += 1; | |
187 | + continue; | |
188 | + } | |
189 | + String monthly = DateTimeFormatter.ofPattern("yyyy-MM").format(shop.getMonthlyDate()); | |
190 | + //1. 校验是否重复 | |
191 | + if (repeatMap.containsKey(shop.getShopName(), shop.getGraderStaffName(), monthly)) { | |
192 | + importDetailScore.setErrorType(ImportErrorReasonEnum.REPETITION); | |
193 | + errorNum += 1; | |
194 | + continue; | |
195 | + } | |
196 | + repeatMap.put(shop.getShopName(), shop.getGraderStaffName(), monthly, ""); | |
197 | + if (! shopMap.containsKey(shop.getShopName())) { | |
198 | + importDetailScore.setErrorType(ImportErrorReasonEnum.NO_MATCH_SHOP); | |
199 | + errorNum += 1; | |
200 | + continue; | |
201 | + } | |
202 | + //只能导入近两月的指标数据 | |
203 | + if (PublicUtil.isEmpty(importDetailScore.getDataDate()) || (! importValidMonthlies.contains(YearMonth.from(importDetailScore.getDataDate())))) { | |
204 | + importDetailScore.setErrorType(ImportErrorReasonEnum.TIME_ERROR); | |
205 | + errorNum += 1; | |
206 | + continue; | |
207 | + } | |
208 | + ShopDTO shopDTO = shopMap.get(shop.getShopName()); | |
209 | + shopIds.add(shopDTO.getId()); | |
210 | + importDetailScore.setShopId(shopDTO.getId()); | |
211 | + } | |
212 | + EvalIndicatorImportRecord importRecord = this.createRecord(details, evalIndicator, user, DimensionTypeEnum.SHOP); | |
213 | + importRecord.setErrorNum(errorNum); | |
214 | + importRecord.setNum(indicatorValues.size()); | |
215 | + importRecord.setSuccessNum(indicatorValues.size() - errorNum); | |
216 | + importRecord.setDataTimeType(dataTimeType); | |
217 | + importRecord.setShopIds(new ArrayList<>(shopIds)); | |
218 | + | |
219 | + String key = PublicUtil.getUUID() + user.getUserId(); | |
220 | + stringRedisTemplate.opsForValue().set(evalIndicatorVal.getEvalShowroomBeautificationImport() + key, JSON.toJSONString(importRecord), 1 , TimeUnit.DAYS); | |
221 | + stringRedisTemplate.opsForValue().set(evalIndicatorVal.getEvalShowroomBeautificationImportDetail() + key, JSON.toJSONString(details), 1 , TimeUnit.DAYS); | |
222 | + | |
223 | + EvalIndicatorImportVO<EvalIndicatorImportDetailScore> recordVO = PublicUtil.copy(importRecord, EvalIndicatorImportVO.class); | |
224 | + recordVO.setDetails(details); | |
225 | + recordVO.setKey(key); | |
226 | + return recordVO; | |
227 | + } | |
228 | + | |
229 | + @Transactional(rollbackFor = Exception.class) | |
230 | + public void saveShowroomImportData(String key, LoginAuthBean user) { | |
231 | + BoundValueOperations<String, String> importOperation = stringRedisTemplate.boundValueOps(evalIndicatorVal.getEvalShowroomBeautificationImport() + key); | |
232 | + BoundValueOperations<String, String> importDetailOperation = stringRedisTemplate.boundValueOps(evalIndicatorVal.getEvalShowroomBeautificationImportDetail() + key); | |
233 | + String json = importOperation.get(); | |
234 | + String detailJson = importDetailOperation.get(); | |
235 | + if (PublicUtil.isEmpty(json) || PublicUtil.isEmpty(detailJson)) { | |
236 | + log.error("考评指标导入,redis数据为空,key {},", evalIndicatorVal.getEvalImport() + key); | |
237 | + throw new BusinessException("请求超时,请重新上传"); | |
238 | + } | |
239 | + EvalIndicatorImportRecord record = JSON.parseObject(json, EvalIndicatorImportRecord.class); | |
240 | + final Set<String> uploadIndicatorCodes = new HashSet<String>(){{add(record.getIndicatorCode());}}; | |
241 | + record.setStatus(SettingDraftStatusEnum.RELEASE_APPROVAL); | |
242 | + List<EvalIndicatorImportDetailScore> details = JSON.parseArray(detailJson, EvalIndicatorImportDetailScore.class); | |
243 | + | |
244 | + evalIndicatorImportRecordService.save(record); | |
245 | + final Long recordId = record.getId(); | |
246 | + for (EvalIndicatorImportDetailScore detail : details) { | |
247 | + detail.setRecordId(recordId); | |
248 | + evalIndicatorImportDetailScoreService.save(detail); | |
249 | + } | |
250 | + | |
251 | + List<Long> shopIds = details.stream() | |
252 | + .filter(detail -> PublicUtil.isNotEmpty(detail.getShopId()) && PublicUtil.isEmpty(detail.getErrorType())) | |
253 | + .map(EvalIndicatorImportDetailScore::getShopId) | |
254 | + .collect(Collectors.toList()); | |
255 | + //提交审批 | |
256 | + Date expTime = evalIndicatorCommonService.importApprovalExpTime(user.getGroupId()); | |
257 | + String approvalNo = approvalBizService.applyEvalIndicatorImport(record, shopIds, uploadIndicatorCodes, user, expTime); | |
258 | + record.setApprovalNo(approvalNo); | |
259 | + evalIndicatorImportRecordService.updateById(record); | |
260 | + | |
261 | + //保存到数据库,删除缓存 | |
262 | + stringRedisTemplate.delete(evalIndicatorVal.getEvalShowroomBeautificationImport() + key); | |
263 | + stringRedisTemplate.delete(evalIndicatorVal.getEvalShowroomBeautificationImportDetail() + key); | |
264 | + } | |
265 | + | |
266 | + public EvalIndicatorImportVO scoreImportDetail(Long id) { | |
267 | + EvalIndicatorImportRecord record = evalIndicatorImportRecordService.getById(id); | |
268 | + BV.notNull(record, "考评导入数据记录不能为空"); | |
269 | + | |
270 | + List<EvalIndicatorImportDetailScore> importDetailScores = evalIndicatorImportDetailScoreService.list(Wrappers.<EvalIndicatorImportDetailScore>lambdaQuery() | |
271 | + .eq(EvalIndicatorImportDetailScore::getRecordId, id) | |
272 | + .eq(EvalIndicatorImportDetailScore::getYn, Boolean.TRUE) | |
273 | + ); | |
274 | + List<EvalIndicatorImportDetailScoreVO> detailScoreVos = PublicUtil.copyList(importDetailScores, EvalIndicatorImportDetailScoreVO.class); | |
275 | + | |
276 | + EvalIndicatorImportVO<EvalIndicatorImportDetailScoreVO> recordVO = PublicUtil.copy(record, EvalIndicatorImportVO.class); | |
277 | + recordVO.setDetails(detailScoreVos); | |
278 | + | |
279 | + return recordVO; | |
280 | + } | |
281 | + | |
282 | + public List<EvalIndicatorImportDetailScoreVO> scoreImportDetails(Long id) { | |
283 | + EvalIndicatorImportRecord record = evalIndicatorImportRecordService.getById(id); | |
284 | + BV.notNull(record, "考评导入数据记录不能为空"); | |
285 | + | |
286 | + List<EvalIndicatorImportDetailScore> importDetailScores = evalIndicatorImportDetailScoreService.list(Wrappers.<EvalIndicatorImportDetailScore>lambdaQuery() | |
287 | + .eq(EvalIndicatorImportDetailScore::getRecordId, id) | |
288 | + .eq(EvalIndicatorImportDetailScore::getYn, Boolean.TRUE) | |
289 | + ); | |
290 | + List<EvalIndicatorImportDetailScoreVO> detailScoreVos = PublicUtil.copyList(importDetailScores, EvalIndicatorImportDetailScoreVO.class); | |
291 | + return detailScoreVos; | |
292 | + } | |
293 | + | |
294 | + public EvalIndicatorImportRecord createRecord(List<EvalIndicatorImportDetailScore> details, EvalIndicator evalIndicator, LoginAuthBean user, DimensionTypeEnum dimensionType) { | |
295 | + EvalIndicatorImportRecord importRecord = new EvalIndicatorImportRecord(); | |
296 | + importRecord.setImportType(EvalIndicatorImportTypeEnum.SCORE_ORIGIN_VALUE); | |
297 | + importRecord.setImportUserId(user.getUserId()); | |
298 | + importRecord.setImportUserName(user.getUserName()); | |
299 | + importRecord.setDimensionType(dimensionType); | |
300 | + importRecord.setUploadTime(LocalDate.now()); | |
301 | + importRecord.setGroupId(user.getGroupId()); | |
302 | + importRecord.setYn(Boolean.TRUE); | |
303 | + LocalDate dataDate = details.stream() | |
304 | + .filter(detail -> PublicUtil.isEmpty(detail.getErrorType()) && PublicUtil.isNotEmpty(detail.getDataDate())) | |
305 | + .map(EvalIndicatorImportDetailScore::getDataDate) | |
306 | + .findFirst().orElse(LocalDate.now()); | |
307 | + importRecord.setDataDate(dataDate); | |
308 | + | |
309 | + importRecord.setIndicatorName(evalIndicator.getName()); | |
310 | + importRecord.setIndicatorCode(evalIndicator.getCode()); | |
311 | + return importRecord; | |
312 | + } | |
313 | + | |
314 | + public Map<Integer, String> getShopHeaderNameMap(DataTimeTypeEnum dataTimeType) { | |
315 | + if (DataTimeTypeEnum.MONTHLY.equals(dataTimeType)) { | |
316 | + Map<Integer, String> headerMap = new HashMap<Integer, String>(){{ | |
317 | + put(0, "monthlyDate"); | |
318 | + put(1, "shopName"); | |
319 | + put(2, "score"); | |
320 | + put(3, "totalScore"); | |
321 | + put(4, "graderStaffName"); | |
322 | + }}; | |
323 | + return headerMap; | |
324 | + } | |
325 | + Map<Integer, String> headerMap = new HashMap<Integer, String>(){{ | |
326 | + put(0, "shopName"); | |
327 | + put(1, "indicatorName"); | |
328 | + put(2, "stageIndicatorValue"); | |
329 | + put(3, "startDataDate"); | |
330 | + put(4, "endDataDate"); | |
331 | + put(5, "monthlyIndicatorValue"); | |
332 | + put(6, "monthlyDate"); | |
333 | + }}; | |
334 | + return headerMap; | |
335 | + } | |
336 | + | |
337 | + public EvalIndicatorImportDetailScore convertShopPo(ShowroomScoreImportValueVO shopValue, EvalIndicator evalIndicator, Long groupId) { | |
338 | + Optional<ShowroomScoreImportValueVO> valueOptional = Optional.ofNullable(shopValue); | |
339 | + EvalIndicatorImportDetailScore detail = new EvalIndicatorImportDetailScore(); | |
340 | + detail.setShopName(valueOptional.map(ShowroomScoreImportValueVO::getShopName).orElse("")); | |
341 | + if (PublicUtil.isNotEmpty(shopValue.getMonthlyDate())) { | |
342 | + detail.setDataDate(evalIndicatorCommonService.convertMonthlyDate(shopValue.getMonthlyDate())); | |
343 | + } | |
344 | + detail.setIndicatorCode(evalIndicator.getCode()); | |
345 | + detail.setIndicatorName(evalIndicator.getName()); | |
346 | + detail.setValid(Boolean.FALSE); | |
347 | + detail.setGroupId(groupId); | |
348 | + detail.setScore(shopValue.getScore()); | |
349 | + detail.setTotalScore(shopValue.getTotalScore()); | |
350 | + detail.setGraderStaffName(shopValue.getGraderStaffName()); | |
351 | + return detail; | |
352 | + } | |
353 | + | |
354 | + | |
355 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalIndicatorReportService.java
... | ... | @@ -8,6 +8,7 @@ import cn.fw.morax.common.config.FileVal; |
8 | 8 | import cn.fw.morax.common.constant.ExcelConstant; |
9 | 9 | import cn.fw.morax.common.pojo.event.ApprovalResultEvent; |
10 | 10 | import cn.fw.morax.common.pojo.event.ImportEvalIndicatorEvent; |
11 | +import cn.fw.morax.common.pojo.event.ImportEvalIndicatorScoreEvent; | |
11 | 12 | import cn.fw.morax.common.utils.DateUtil; |
12 | 13 | import cn.fw.morax.common.utils.EventBusUtil; |
13 | 14 | import cn.fw.morax.common.utils.ExcelDataUtil; |
... | ... | @@ -38,7 +39,6 @@ import lombok.Getter; |
38 | 39 | import lombok.RequiredArgsConstructor; |
39 | 40 | import lombok.extern.slf4j.Slf4j; |
40 | 41 | import org.apache.commons.collections4.map.MultiKeyMap; |
41 | -import org.apache.commons.lang3.math.NumberUtils; | |
42 | 42 | import org.apache.poi.ss.usermodel.CellType; |
43 | 43 | import org.apache.poi.xssf.usermodel.XSSFCell; |
44 | 44 | import org.apache.poi.xssf.usermodel.XSSFRow; |
... | ... | @@ -53,7 +53,6 @@ import org.springframework.web.multipart.MultipartFile; |
53 | 53 | |
54 | 54 | import java.io.IOException; |
55 | 55 | import java.math.BigDecimal; |
56 | -import java.math.RoundingMode; | |
57 | 56 | import java.time.LocalDate; |
58 | 57 | import java.time.LocalDateTime; |
59 | 58 | import java.time.LocalTime; |
... | ... | @@ -79,11 +78,12 @@ public class EvalIndicatorReportService { |
79 | 78 | |
80 | 79 | private final EvalIndicatorImportRecordService evalIndicatorImportRecordService; |
81 | 80 | private final EvalIndicatorImportDetailService evalIndicatorImportDetailService; |
82 | - private final ApprovalRecordService approvalRecordService; | |
83 | - private final ApprovalBizService approvalBizService; | |
81 | + private final EvalIndicatorImportKeyValueService evalIndicatorImportKeyValueService; | |
84 | 82 | private final SalaryGeneralSettinService salaryGeneralSettinService; |
83 | + private final ApprovalRecordService approvalRecordService; | |
85 | 84 | private final EvalIndicatorService evalIndicatorService; |
86 | 85 | private final StringRedisTemplate stringRedisTemplate; |
86 | + private final ApprovalBizService approvalBizService; | |
87 | 87 | private final FlowApproveRpc flowApproveRpc; |
88 | 88 | private final EhrRpcService ehrRpcService; |
89 | 89 | private final OopRpcService oopRpcService; |
... | ... | @@ -126,6 +126,7 @@ public class EvalIndicatorReportService { |
126 | 126 | .eq(PublicUtil.isNotEmpty(dto.getIndicatorCode()), EvalIndicatorImportRecord::getIndicatorCode, dto.getIndicatorCode()) |
127 | 127 | .ge(PublicUtil.isNotEmpty(startTime), EvalIndicatorImportRecord::getCreateTime, startTime) |
128 | 128 | .le(PublicUtil.isNotEmpty(endTime), EvalIndicatorImportRecord::getCreateTime, endTime) |
129 | + .eq(EvalIndicatorImportRecord::getImportType, EvalIndicatorImportTypeEnum.VALUE) | |
129 | 130 | .eq(EvalIndicatorImportRecord::getYn, Boolean.TRUE) |
130 | 131 | .eq(EvalIndicatorImportRecord::getGroupId, dto.getGroupId()) |
131 | 132 | .orderByDesc(EvalIndicatorImportRecord::getCreateTime) |
... | ... | @@ -181,7 +182,15 @@ public class EvalIndicatorReportService { |
181 | 182 | if (indicatorUnitMap.containsKey(detailVO.getIndicatorCode())) { |
182 | 183 | detailVO.setUnit(indicatorUnitMap.get(detailVO.getIndicatorCode())); |
183 | 184 | } |
184 | -// detailVO.convertToPercent(); | |
185 | + //key value | |
186 | + List<EvalIndicatorImportKeyValue> keyValues = evalIndicatorImportKeyValueService.list(Wrappers.<EvalIndicatorImportKeyValue>lambdaQuery() | |
187 | + .eq(EvalIndicatorImportKeyValue::getEvalIndicatorImportDetailId, detailVO.getId()) | |
188 | + .eq(EvalIndicatorImportKeyValue::getYn, Boolean.TRUE) | |
189 | + ); | |
190 | + if (PublicUtil.isNotEmpty(keyValues)) { | |
191 | + List<EvalIndicatorImportKeyValueVO> keyValueVos = PublicUtil.copyList(keyValues, EvalIndicatorImportKeyValueVO.class); | |
192 | + detailVO.setKeyValues(keyValueVos); | |
193 | + } | |
185 | 194 | detailVOS.add(detailVO); |
186 | 195 | } |
187 | 196 | } |
... | ... | @@ -272,7 +281,7 @@ public class EvalIndicatorReportService { |
272 | 281 | public EvalIndicatorImportRecordVO uploadStaffIndicator(MultipartFile file, LoginAuthBean user) { |
273 | 282 | final Long groupId = user.getGroupId(); |
274 | 283 | Map<String, EvalIndicator> evalIndicatorMap = this.getNameIndicatorMap(groupId); |
275 | - EvalIndicatorImportRecord importRecord = createRecord(user, DimensionTypeEnum.STAFF); | |
284 | + EvalIndicatorImportRecord importRecord = this.createRecord(user, DimensionTypeEnum.STAFF); | |
276 | 285 | List<EvalIndicatorImportDetail> details = new ArrayList<>(); |
277 | 286 | DataTimeTypeEnum dataTimeType = DataTimeTypeEnum.MONTHLY; |
278 | 287 | List<StaffIndicatorValueVO> indicatorValues = null; |
... | ... | @@ -477,9 +486,17 @@ public class EvalIndicatorReportService { |
477 | 486 | |
478 | 487 | if (result.getAgree()) { |
479 | 488 | //保存指标数据事件 |
480 | - ImportEvalIndicatorEvent importEvalIndicatorEvent = new ImportEvalIndicatorEvent(record.getId() | |
481 | - , record.getGroupId()); | |
482 | - EventBusUtil.asyncPost(importEvalIndicatorEvent); | |
489 | + if (PublicUtil.isEmpty(record.getImportType()) || EvalIndicatorImportTypeEnum.VALUE.equals(record.getImportType())) { | |
490 | + ImportEvalIndicatorEvent importEvalIndicatorEvent = new ImportEvalIndicatorEvent(record.getId() | |
491 | + , record.getGroupId()); | |
492 | + EventBusUtil.asyncPost(importEvalIndicatorEvent); | |
493 | + } | |
494 | + //分数原始数据 | |
495 | + if (EvalIndicatorImportTypeEnum.SCORE_ORIGIN_VALUE.equals(record.getImportType())) { | |
496 | + ImportEvalIndicatorScoreEvent event = new ImportEvalIndicatorScoreEvent(record.getId() | |
497 | + , record.getGroupId()); | |
498 | + EventBusUtil.asyncPost(event); | |
499 | + } | |
483 | 500 | } |
484 | 501 | record.setStatus(draftStatus); |
485 | 502 | evalIndicatorImportRecordService.updateById(record); |
... | ... | @@ -607,6 +624,7 @@ public class EvalIndicatorReportService { |
607 | 624 | public EvalIndicatorImportRecord createRecord(LoginAuthBean user, DimensionTypeEnum dimensionType) { |
608 | 625 | EvalIndicatorImportRecord importRecord = new EvalIndicatorImportRecord(); |
609 | 626 | importRecord.setImportUserId(user.getUserId()); |
627 | + importRecord.setImportType(EvalIndicatorImportTypeEnum.VALUE); | |
610 | 628 | importRecord.setImportUserName(user.getUserName()); |
611 | 629 | importRecord.setDimensionType(dimensionType); |
612 | 630 | importRecord.setUploadTime(LocalDate.now()); | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/component/EvalIndicatorScoreSaveObserver.java
0 → 100644
1 | +package cn.fw.morax.service.component; | |
2 | + | |
3 | +import cn.fw.morax.common.pojo.event.ImportEvalIndicatorScoreEvent; | |
4 | +import cn.fw.morax.common.utils.PublicUtil; | |
5 | +import cn.fw.morax.domain.bo.eval.EvalIndicatorScoreBO; | |
6 | +import cn.fw.morax.domain.db.eval.*; | |
7 | +import cn.fw.morax.domain.enums.DataTypeEnum; | |
8 | +import cn.fw.morax.domain.enums.DimensionTypeEnum; | |
9 | +import cn.fw.morax.rpc.erp.dto.HRoleAuthRangeDayVO; | |
10 | +import cn.fw.morax.service.biz.RpcCommonService; | |
11 | +import cn.fw.morax.service.biz.eval.EvalIndicatorCommonService; | |
12 | +import cn.fw.morax.service.data.eval.*; | |
13 | +import com.alibaba.fastjson.JSON; | |
14 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
15 | +import com.google.common.eventbus.Subscribe; | |
16 | +import lombok.RequiredArgsConstructor; | |
17 | +import lombok.extern.slf4j.Slf4j; | |
18 | +import org.springframework.stereotype.Component; | |
19 | +import org.springframework.transaction.annotation.Transactional; | |
20 | + | |
21 | +import java.math.BigDecimal; | |
22 | +import java.math.RoundingMode; | |
23 | +import java.time.LocalDate; | |
24 | +import java.time.YearMonth; | |
25 | +import java.time.temporal.TemporalAdjusters; | |
26 | +import java.util.*; | |
27 | +import java.util.stream.Collectors; | |
28 | + | |
29 | +@Component | |
30 | +@Slf4j | |
31 | +@RequiredArgsConstructor | |
32 | +public class EvalIndicatorScoreSaveObserver { | |
33 | + | |
34 | + private final RpcCommonService rpcCommonService; | |
35 | + private final EvalIndicatorService evalIndicatorService; | |
36 | + private final EvalIndicatorCommonService evalIndicatorCommonService; | |
37 | + private final EvalIndicatorImportRecordService evalIndicatorImportRecordService; | |
38 | + private final EvalIndicatorImportDetailScoreService evalIndicatorImportDetailScoreService; | |
39 | + | |
40 | + /** | |
41 | + * 保存导入的考评指标 | |
42 | + * | |
43 | + * @param event | |
44 | + */ | |
45 | + @Subscribe | |
46 | + @Transactional(rollbackFor = Exception.class) | |
47 | + public void saveEvalIndicator(ImportEvalIndicatorScoreEvent event) { | |
48 | + //睡10秒保证数据落库 | |
49 | + try { | |
50 | + Thread.sleep(10 * 1000); | |
51 | + } catch (InterruptedException e) { | |
52 | + e.printStackTrace(); | |
53 | + } | |
54 | + final Long recordId = event.getEvalIndicatorImportRecordId(); | |
55 | + EvalIndicatorImportRecord importRecord = evalIndicatorImportRecordService.getById(recordId); | |
56 | + final String indicatorCode = importRecord.getIndicatorCode(); | |
57 | + EvalIndicator evalIndicator = evalIndicatorService.queryByCode(importRecord.getIndicatorCode(), Boolean.FALSE); | |
58 | + final Long groupId = importRecord.getGroupId(); | |
59 | + List<EvalIndicatorImportDetailScore> detailScores = evalIndicatorImportDetailScoreService.list(Wrappers.<EvalIndicatorImportDetailScore>lambdaQuery() | |
60 | + .eq(EvalIndicatorImportDetailScore::getRecordId, recordId) | |
61 | + .isNull(EvalIndicatorImportDetailScore::getErrorType) | |
62 | + .eq(EvalIndicatorImportDetailScore::getYn, Boolean.TRUE) | |
63 | + ); | |
64 | + | |
65 | + Set<YearMonth> monthlies = new HashSet<>(); | |
66 | + for (EvalIndicatorImportDetailScore showroomBeautifyScore : detailScores) { | |
67 | + //月度重复数据删除(打分人员一个月 只能打分一次) | |
68 | + final LocalDate monthlyFirstDate = showroomBeautifyScore.getDataDate().with(TemporalAdjusters.firstDayOfMonth()); | |
69 | + List<EvalIndicatorImportDetailScore> repeatScores = evalIndicatorImportDetailScoreService.list(Wrappers.<EvalIndicatorImportDetailScore>lambdaQuery() | |
70 | + .eq(EvalIndicatorImportDetailScore::getIndicatorCode, showroomBeautifyScore.getIndicatorCode()) | |
71 | + .le(EvalIndicatorImportDetailScore::getDataDate, showroomBeautifyScore.getDataDate()) | |
72 | + .ge(EvalIndicatorImportDetailScore::getDataDate, monthlyFirstDate) | |
73 | + .isNull(EvalIndicatorImportDetailScore::getErrorType) | |
74 | + .eq(EvalIndicatorImportDetailScore::getGraderStaffName, showroomBeautifyScore.getGraderStaffName()) | |
75 | + .eq(EvalIndicatorImportDetailScore::getValid, Boolean.TRUE) | |
76 | + .eq(EvalIndicatorImportDetailScore::getGroupId, groupId) | |
77 | + .ne(EvalIndicatorImportDetailScore::getId, showroomBeautifyScore.getId()) | |
78 | + .eq(EvalIndicatorImportDetailScore::getYn, Boolean.TRUE) | |
79 | + ); | |
80 | + for (EvalIndicatorImportDetailScore repeatScore : repeatScores) { | |
81 | + repeatScore.setValid(Boolean.FALSE); | |
82 | + evalIndicatorImportDetailScoreService.updateById(repeatScore); | |
83 | + } | |
84 | + monthlies.add(YearMonth.from(showroomBeautifyScore.getDataDate())); | |
85 | + showroomBeautifyScore.setValid(Boolean.TRUE); | |
86 | + evalIndicatorImportDetailScoreService.updateById(showroomBeautifyScore); | |
87 | + } | |
88 | + //抽取数据 | |
89 | + for (YearMonth monthly : monthlies) { | |
90 | + LocalDate dataDate = YearMonth.now().compareTo(monthly) == 0 ? LocalDate.now() : monthly.atEndOfMonth(); | |
91 | + List<EvalIndicatorScoreBO> monthlyScoreBos = this.getShopScoreBO(monthly, indicatorCode, dataDate, groupId); | |
92 | + | |
93 | + List<EvalIndicatorValue> shopValues = this.extractShopValue(evalIndicator, dataDate, groupId, monthlyScoreBos); | |
94 | + List<EvalIndicatorValue> staffValues = this.extractUserValue(evalIndicator, dataDate, groupId, monthlyScoreBos); | |
95 | + evalIndicatorCommonService.saveIndicatorValue(shopValues); | |
96 | + evalIndicatorCommonService.saveIndicatorValue(staffValues); | |
97 | + } | |
98 | + } | |
99 | + | |
100 | + public List<EvalIndicatorScoreBO> getShopScoreBO(YearMonth monthly, String indicatorCode, LocalDate dataDate, Long groupId) { | |
101 | + final LocalDate startTime = monthly.atDay(1); | |
102 | + final LocalDate endTime = monthly.atEndOfMonth(); | |
103 | + List<EvalIndicatorImportDetailScore> showroomScores = evalIndicatorImportDetailScoreService.list(Wrappers.<EvalIndicatorImportDetailScore>lambdaQuery() | |
104 | + .eq(EvalIndicatorImportDetailScore::getIndicatorCode, indicatorCode) | |
105 | + .ge(EvalIndicatorImportDetailScore::getDataDate, startTime) | |
106 | + .le(EvalIndicatorImportDetailScore::getDataDate, endTime) | |
107 | + .isNull(EvalIndicatorImportDetailScore::getErrorType) | |
108 | + .eq(EvalIndicatorImportDetailScore::getValid, Boolean.TRUE) | |
109 | + .eq(EvalIndicatorImportDetailScore::getGroupId, groupId) | |
110 | + .eq(EvalIndicatorImportDetailScore::getYn, Boolean.TRUE) | |
111 | + ); | |
112 | + //一个门店 多次打分 | |
113 | + Map<Long, List<EvalIndicatorImportDetailScore>> shopMonthlyShowroomScoreMap = showroomScores.stream(). | |
114 | + collect(Collectors.groupingBy(EvalIndicatorImportDetailScore::getShopId)); | |
115 | + List<EvalIndicatorScoreBO> scoreBOS = new ArrayList<>(); | |
116 | + for (Map.Entry<Long, List<EvalIndicatorImportDetailScore>> entry : shopMonthlyShowroomScoreMap.entrySet()) { | |
117 | + final Long shopId = entry.getKey(); | |
118 | + final List<EvalIndicatorImportDetailScore> shopShowroomScores = entry.getValue(); | |
119 | + BigDecimal score = shopShowroomScores.stream().map(EvalIndicatorImportDetailScore::getScore).reduce(BigDecimal.ZERO, BigDecimal::add); | |
120 | + BigDecimal totalScore = shopShowroomScores.stream().map(EvalIndicatorImportDetailScore::getTotalScore).reduce(BigDecimal.ZERO, BigDecimal::add); | |
121 | + EvalIndicatorScoreBO value = new EvalIndicatorScoreBO(); | |
122 | + value.setShopId(shopId); | |
123 | + value.setScore(score); | |
124 | + value.setTotalScore(totalScore); | |
125 | + value.setDataDate(dataDate); | |
126 | + scoreBOS.add(value); | |
127 | + } | |
128 | + return scoreBOS; | |
129 | + } | |
130 | + | |
131 | + public List<EvalIndicatorValue> extractShopValue(EvalIndicator evalIndicator, LocalDate dataDate, Long groupId, List<EvalIndicatorScoreBO> scoreBos) { | |
132 | + List<EvalIndicatorValue> evalIndicatorValues = new ArrayList<>(); | |
133 | + for (EvalIndicatorScoreBO scoreBO : scoreBos) { | |
134 | + final BigDecimal score = scoreBO.getScore(); | |
135 | + final BigDecimal totalScore = scoreBO.getTotalScore(); | |
136 | + | |
137 | + EvalIndicatorValue indicatorValue = new EvalIndicatorValue(); | |
138 | + indicatorValue.setUserId(-1L); | |
139 | + indicatorValue.setShopId(scoreBO.getShopId()); | |
140 | + indicatorValue.setShopName(scoreBO.getShopName()); | |
141 | + indicatorValue.setIndicatorValue(BigDecimal.ZERO); | |
142 | + indicatorValue.setIndicatorCode(evalIndicator.getCode()); | |
143 | + indicatorValue.setIndicatorName(evalIndicator.getName()); | |
144 | + indicatorValue.setDimensionType(DimensionTypeEnum.SHOP); | |
145 | + if (PublicUtil.isNotEmpty(score) && PublicUtil.isNotEmpty(totalScore) && (totalScore.compareTo(BigDecimal.ZERO) > 0)) { | |
146 | + indicatorValue.setIndicatorValue(score.divide(totalScore, 4, RoundingMode.HALF_UP)); | |
147 | + } | |
148 | + indicatorValue.setDataType(DataTypeEnum.RATIO); | |
149 | + indicatorValue.setDataDate(dataDate); | |
150 | + indicatorValue.setGroupId(groupId); | |
151 | + indicatorValue.setYn(Boolean.TRUE); | |
152 | + evalIndicatorValues.add(indicatorValue); | |
153 | + } | |
154 | + return evalIndicatorValues; | |
155 | + | |
156 | + } | |
157 | + | |
158 | + public List<EvalIndicatorValue> extractUserValue(EvalIndicator evalIndicator, LocalDate dataDate, Long groupId, List<EvalIndicatorScoreBO> scoreBos) { | |
159 | + List<String> roleCodes = evalIndicator.getRoleCodes(); | |
160 | + | |
161 | + List<Long> shopIds = scoreBos.stream().map(EvalIndicatorScoreBO::getShopId).distinct().collect(Collectors.toList()); | |
162 | + Map<Long, Set<Long>> userAuthShopIds = new HashMap<>(); | |
163 | + Map<Long, String> userNameMap = new HashMap<>(); | |
164 | + //角色维度 | |
165 | + for (String roleCode : roleCodes) { | |
166 | + //角色授权天数 | |
167 | + List<HRoleAuthRangeDayVO> authRangeDayVos = rpcCommonService.roleMonthlyAuthDay(groupId, dataDate, roleCode, new ArrayList<>(shopIds)); | |
168 | + //门店角色授权天数 | |
169 | + Map<Long, List<HRoleAuthRangeDayVO>> shopAuths = authRangeDayVos.stream().collect(Collectors.groupingBy(HRoleAuthRangeDayVO::getRangeValue)); | |
170 | + for (Map.Entry<Long, List<HRoleAuthRangeDayVO>> entry : shopAuths.entrySet()) { | |
171 | + //获取最大 角色授权 | |
172 | + log.info("门店角色:{},授权记录:{}", roleCode, JSON.toJSONString(entry.getValue())); | |
173 | + Long maxAuthRangeDay = entry.getValue().stream() | |
174 | + .max(Comparator.comparing(HRoleAuthRangeDayVO::getAuthDays)).map(HRoleAuthRangeDayVO::getAuthDays).get(); | |
175 | + List<HRoleAuthRangeDayVO> maxAuthVos = entry.getValue().stream() | |
176 | + .filter(auth -> maxAuthRangeDay.compareTo(auth.getAuthDays()) == 0).collect(Collectors.toList()); | |
177 | + log.info("门店角色:{},最长天数授权:{}", roleCode, JSON.toJSONString(maxAuthVos)); | |
178 | + for (HRoleAuthRangeDayVO rangeDayVO : maxAuthVos) { | |
179 | + //初始化 | |
180 | + if (! userAuthShopIds.containsKey(rangeDayVO.getUserId())) { | |
181 | + userAuthShopIds.put(rangeDayVO.getUserId(), new HashSet<>()); | |
182 | + } | |
183 | + userNameMap.put(rangeDayVO.getUserId(), rangeDayVO.getUserName()); | |
184 | + userAuthShopIds.get(rangeDayVO.getUserId()).add(rangeDayVO.getRangeValue()); | |
185 | + } | |
186 | + } | |
187 | + } | |
188 | + log.info("角色授权门店:{}", JSON.toJSONString(userAuthShopIds)); | |
189 | + //抽取人员数据 | |
190 | + List<EvalIndicatorValue> evalIndicatorValues = new ArrayList<>(); | |
191 | + for (Map.Entry<Long, Set<Long>> entry : userAuthShopIds.entrySet()) { | |
192 | + final Long userId = entry.getKey(); | |
193 | + final Set<Long> authShopIds = entry.getValue(); | |
194 | + | |
195 | + BigDecimal score = scoreBos.stream().filter(scoreBo -> authShopIds.contains(scoreBo.getShopId())) | |
196 | + .map(EvalIndicatorScoreBO::getScore).reduce(BigDecimal.ZERO, BigDecimal::add); | |
197 | + BigDecimal totalScore = scoreBos.stream().filter(scoreBo -> authShopIds.contains(scoreBo.getShopId())) | |
198 | + .map(EvalIndicatorScoreBO::getTotalScore).reduce(BigDecimal.ZERO, BigDecimal::add); | |
199 | + EvalIndicatorValue value = new EvalIndicatorValue(); | |
200 | + value.setUserId(userId); | |
201 | + value.setUserName(userNameMap.getOrDefault(userId, "")); | |
202 | + value.setShopId(-1L); | |
203 | + value.setShopName(""); | |
204 | + value.setIndicatorValue(BigDecimal.ZERO); | |
205 | + value.setIndicatorCode(evalIndicator.getCode()); | |
206 | + value.setIndicatorName(evalIndicator.getName()); | |
207 | + value.setDimensionType(DimensionTypeEnum.STAFF); | |
208 | + if (PublicUtil.isNotEmpty(score) && PublicUtil.isNotEmpty(totalScore) && (totalScore.compareTo(BigDecimal.ZERO) > 0)) { | |
209 | + value.setIndicatorValue(score.divide(totalScore, 4, RoundingMode.HALF_UP)); | |
210 | + } | |
211 | + value.setDataType(DataTypeEnum.RATIO); | |
212 | + value.setDataDate(dataDate); | |
213 | + value.setGroupId(groupId); | |
214 | + value.setYn(Boolean.TRUE); | |
215 | + evalIndicatorValues.add(value); | |
216 | + } | |
217 | + return evalIndicatorValues; | |
218 | + } | |
219 | + | |
220 | +} | |
0 | 221 | \ No newline at end of file | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/TemplateFileService.java
0 → 100644
1 | +package cn.fw.morax.service.data; | |
2 | + | |
3 | +import cn.fw.morax.domain.db.TemplateFile; | |
4 | +import cn.fw.morax.domain.db.UserResignExamine; | |
5 | +import com.baomidou.mybatisplus.extension.service.IService; | |
6 | + | |
7 | +/** | |
8 | + * 绩效考核离职记录 | |
9 | + * | |
10 | + * @author : kurisu | |
11 | + * @version : 2.0 | |
12 | + * @className : UserResignExamineService | |
13 | + * @description : 绩效考核离职记录 | |
14 | + * @date : 2022-12-29 17:05 | |
15 | + */ | |
16 | +public interface TemplateFileService extends IService<TemplateFile> { | |
17 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalIndicatorImportDetailScoreService.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.dao.orm.ILocalService; | |
5 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportDetailScore; | |
6 | + | |
7 | +/** | |
8 | + * <p> | |
9 | + * 考评指标导入记录 服务类 | |
10 | + * </p> | |
11 | + * | |
12 | + * @author jiangchao | |
13 | + * @since 2023-01-30 | |
14 | + */ | |
15 | +public interface EvalIndicatorImportDetailScoreService extends ILocalService<EvalIndicatorImportDetailScore> { | |
16 | + | |
17 | + | |
18 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalIndicatorImportKeyValueService.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.dao.orm.ILocalService; | |
5 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportKeyValue; | |
6 | +import cn.fw.morax.domain.db.eval.EvalIndicatorScoreStageValue; | |
7 | + | |
8 | +/** | |
9 | + * <p> | |
10 | + * 考评指标导入记录 服务类 | |
11 | + * </p> | |
12 | + * | |
13 | + * @author jiangchao | |
14 | + * @since 2023-01-30 | |
15 | + */ | |
16 | +public interface EvalIndicatorImportKeyValueService extends ILocalService<EvalIndicatorImportKeyValue> { | |
17 | + | |
18 | + | |
19 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalIndicatorImportMenuService.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval; | |
2 | + | |
3 | + | |
4 | +import cn.fw.morax.dao.orm.ILocalService; | |
5 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportMenu; | |
6 | + | |
7 | +/** | |
8 | + * <p> | |
9 | + * 考评指标导入记录 服务类 | |
10 | + * </p> | |
11 | + * | |
12 | + * @author jiangchao | |
13 | + * @since 2023-01-30 | |
14 | + */ | |
15 | +public interface EvalIndicatorImportMenuService extends ILocalService<EvalIndicatorImportMenu> { | |
16 | + | |
17 | + | |
18 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/EvalIndicatorValueService.java
1 | 1 | package cn.fw.morax.service.data.eval; |
2 | 2 | |
3 | 3 | |
4 | +import cn.fw.morax.dao.orm.ILocalService; | |
4 | 5 | import cn.fw.morax.domain.db.eval.EvalIndicatorValue; |
5 | 6 | import cn.fw.morax.domain.enums.DimensionTypeEnum; |
6 | 7 | import cn.fw.morax.domain.vo.kpi.IndicatorUserValueVO; |
... | ... | @@ -19,7 +20,7 @@ import java.util.Set; |
19 | 20 | * @author jiangchao |
20 | 21 | * @since 2022-12-09 |
21 | 22 | */ |
22 | -public interface EvalIndicatorValueService extends IService<EvalIndicatorValue> { | |
23 | +public interface EvalIndicatorValueService extends ILocalService<EvalIndicatorValue> { | |
23 | 24 | |
24 | 25 | /** |
25 | 26 | * 查最新上报数据(一个月内) | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalIndicatorImportDetailScoreServiceImpl.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval.impl; | |
2 | + | |
3 | +import cn.fw.morax.dao.eval.EvalIndicatorImportDetailScoreDao; | |
4 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportDetailScore; | |
5 | +import cn.fw.morax.service.data.eval.EvalIndicatorImportDetailScoreService; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +/** | |
10 | + * <p> | |
11 | + * 考评指标导入记录 服务实现类 | |
12 | + * </p> | |
13 | + * | |
14 | + * @author jiangchao | |
15 | + * @since 2023-02-06 | |
16 | + */ | |
17 | +@Service | |
18 | +public class EvalIndicatorImportDetailScoreServiceImpl extends ServiceImpl<EvalIndicatorImportDetailScoreDao, EvalIndicatorImportDetailScore> | |
19 | + implements EvalIndicatorImportDetailScoreService { | |
20 | + | |
21 | + | |
22 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalIndicatorImportKeyValueServiceImpl.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval.impl; | |
2 | + | |
3 | +import cn.fw.morax.dao.eval.EvalIndicatorImportKeyValueDao; | |
4 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportKeyValue; | |
5 | +import cn.fw.morax.service.data.eval.EvalIndicatorImportKeyValueService; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +/** | |
10 | + * <p> | |
11 | + * 考评指标导入记录 服务实现类 | |
12 | + * </p> | |
13 | + * | |
14 | + * @author jiangchao | |
15 | + * @since 2023-02-06 | |
16 | + */ | |
17 | +@Service | |
18 | +public class EvalIndicatorImportKeyValueServiceImpl extends ServiceImpl<EvalIndicatorImportKeyValueDao, EvalIndicatorImportKeyValue> | |
19 | + implements EvalIndicatorImportKeyValueService { | |
20 | + | |
21 | + | |
22 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/eval/impl/EvalIndicatorImportMenuServiceImpl.java
0 → 100644
1 | +package cn.fw.morax.service.data.eval.impl; | |
2 | + | |
3 | +import cn.fw.morax.dao.eval.EvalIndicatorImportMenuDao; | |
4 | +import cn.fw.morax.domain.db.eval.EvalIndicatorImportMenu; | |
5 | +import cn.fw.morax.service.data.eval.EvalIndicatorImportMenuService; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +/** | |
10 | + * <p> | |
11 | + * 考评指标导入记录 服务实现类 | |
12 | + * </p> | |
13 | + * | |
14 | + * @author jiangchao | |
15 | + * @since 2023-02-06 | |
16 | + */ | |
17 | +@Service | |
18 | +public class EvalIndicatorImportMenuServiceImpl extends ServiceImpl<EvalIndicatorImportMenuDao, EvalIndicatorImportMenu> | |
19 | + implements EvalIndicatorImportMenuService { | |
20 | + | |
21 | + | |
22 | +} | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/data/impl/TemplateFileServiceImpl.java
0 → 100644
1 | +package cn.fw.morax.service.data.impl; | |
2 | + | |
3 | +import cn.fw.morax.dao.TemplateFileDao; | |
4 | +import cn.fw.morax.domain.db.TemplateFile; | |
5 | +import cn.fw.morax.service.data.TemplateFileService; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +/** | |
10 | + * 薪资发放记录 | |
11 | + * | |
12 | + * @author : kurisu | |
13 | + * @version : 1.0 | |
14 | + * @className : PayrollRecordServiceImpl | |
15 | + * @description : 薪资发放记录 | |
16 | + * @date : 2022-05-07 10:55 | |
17 | + */ | |
18 | +@Service | |
19 | +public class TemplateFileServiceImpl extends ServiceImpl<TemplateFileDao, TemplateFile> implements TemplateFileService { | |
20 | + | |
21 | +} | ... | ... |