Commit 554c0be5dbec770611bb891db03a604ec82a8cd1
1 parent
e1778851
feature(*): 修改属性
修改属性
Showing
8 changed files
with
88 additions
and
30 deletions
fw-morax-dao/src/main/resources/mapper/eval/EvalIndicatorImportDetailDao.xml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <!-- 通用查询映射结果 --> |
6 | 6 | <resultMap id="BaseResultMap" type="cn.fw.morax.domain.db.eval.EvalIndicatorImportDetail"> |
7 | 7 | <result column="id" property="id"/> |
8 | -<!-- <result column="dimension_type" property="dimensionType"/>--> | |
8 | + <result column="dimension_type" property="dimensionType"/> | |
9 | 9 | <result column="user_id" property="userId"/> |
10 | 10 | <result column="user_name" property="userName"/> |
11 | 11 | <result column="shop_id" property="shopId"/> |
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | <result column="indicator_name" property="indicatorName"/> |
14 | 14 | <result column="indicator_code" property="indicatorCode"/> |
15 | 15 | <result column="indicator_value" property="indicatorValue"/> |
16 | - <result column="value_type" property="valueType"/> | |
16 | + <result column="data_type" property="dataType"/> | |
17 | 17 | <result column="data_date" property="dataDate"/> |
18 | 18 | <result column="group_id" property="groupId"/> |
19 | 19 | <result column="yn" property="yn"/> |
... | ... | @@ -21,6 +21,35 @@ |
21 | 21 | <result column="update_time" property="updateTime"/> |
22 | 22 | </resultMap> |
23 | 23 | |
24 | +<!-- <select id="getDetailValue" resultType="cn.fw.morax.domain.db.eval.EvalIndicatorImportDetail">--> | |
25 | +<!-- select--> | |
26 | +<!-- t1.id,--> | |
27 | +<!-- t1.user_id,--> | |
28 | +<!-- t1.user_name,--> | |
29 | +<!-- t1.shop_id,--> | |
30 | +<!-- t1.shop_name,--> | |
31 | +<!-- t1.indicator_name,--> | |
32 | +<!-- t1.indicator_code,--> | |
33 | +<!-- t1.indicator_value,--> | |
34 | +<!-- t1.value_type,--> | |
35 | +<!-- t1.data_date,--> | |
36 | +<!-- t1.error_type,--> | |
37 | +<!-- t1.group_id--> | |
38 | +<!-- FROM--> | |
39 | +<!-- eval_indicator_import_detail t1--> | |
40 | +<!---- left join eval_indicator_value t2 on t1.indicator_name = t2.code and t2.yn = 1--> | |
41 | +<!-- where--> | |
42 | +<!-- t1.record_id = #{recordId}--> | |
43 | +<!-- AND t1.yn = 1--> | |
44 | +<!-- <if test="querySuccess != null and querySuccess = true">--> | |
45 | +<!-- AND t1.error_type IS NULL--> | |
46 | +<!-- </if>--> | |
47 | +<!-- <if test="queryError != null and querySuccess = true">--> | |
48 | +<!-- AND t1.error_type IS NOT NULL--> | |
49 | +<!-- </if>--> | |
50 | +<!-- </select>--> | |
51 | + | |
52 | + | |
24 | 53 | <select id="getLastUserValue" resultType="cn.fw.morax.domain.db.eval.EvalIndicatorImportDetail"> |
25 | 54 | select |
26 | 55 | t1.id, | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorImportDetail.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.morax.domain.enums.DataTypeEnum; | |
4 | 5 | import cn.fw.morax.domain.enums.DimensionTypeEnum; |
5 | 6 | import cn.fw.morax.domain.enums.ImportErrorReasonEnum; |
6 | 7 | import cn.fw.morax.domain.enums.IndicatorValueTypeEnum; |
... | ... | @@ -76,9 +77,9 @@ public class EvalIndicatorImportDetail extends BaseAuditableTimeEntity<EvalIndic |
76 | 77 | private BigDecimal indicatorValue; |
77 | 78 | |
78 | 79 | /** |
79 | - * 类型:1: 百分比 2:数量 3:条件值 4:金额 | |
80 | + * 数据类型;1:数量 2:百分比 3:金额 | |
80 | 81 | */ |
81 | - private IndicatorValueTypeEnum valueType; | |
82 | + private DataTypeEnum dataType; | |
82 | 83 | |
83 | 84 | /** |
84 | 85 | * 数据日期 |
... | ... | @@ -99,4 +100,14 @@ public class EvalIndicatorImportDetail extends BaseAuditableTimeEntity<EvalIndic |
99 | 100 | * 错误提示 |
100 | 101 | */ |
101 | 102 | private ImportErrorReasonEnum errorType; |
103 | + | |
104 | + | |
105 | +// public IndicatorValueTypeEnum convertType() { | |
106 | +// IndicatorValueTypeEnum valueType = IndicatorValueTypeEnum.RATIO; | |
107 | +// if (DataTypeEnum.QUANTITY.equals(this.dataType)) { | |
108 | +// valueType = IndicatorValueTypeEnum.QUANTITY; | |
109 | +// } | |
110 | +// | |
111 | +// } | |
112 | + | |
102 | 113 | } | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/eval/EvalIndicatorValue.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.morax.domain.enums.DataTypeEnum; | |
4 | 5 | import cn.fw.morax.domain.enums.DimensionTypeEnum; |
5 | 6 | import cn.fw.morax.domain.enums.IndicatorValueTypeEnum; |
6 | 7 | import com.baomidou.mybatisplus.annotation.TableLogic; |
... | ... | @@ -70,10 +71,15 @@ public class EvalIndicatorValue extends BaseAuditableTimeEntity<EvalIndicatorVal |
70 | 71 | */ |
71 | 72 | private BigDecimal indicatorValue; |
72 | 73 | |
74 | +// /** | |
75 | +// * 类型:1: 百分比 2:数量 3:条件值 4:金额 | |
76 | +// */ | |
77 | +// private IndicatorValueTypeEnum valueType; | |
78 | + | |
73 | 79 | /** |
74 | - * 类型:1: 百分比 2:数量 3:条件值 4:金额 | |
80 | + * 数据类型;1:数量 2:百分比 3:金额 | |
75 | 81 | */ |
76 | - private IndicatorValueTypeEnum valueType; | |
82 | + private DataTypeEnum dataType; | |
77 | 83 | |
78 | 84 | /** |
79 | 85 | * 数据日期 | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportDetailVO.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.morax.common.constant.Constant; | |
5 | +import cn.fw.morax.common.utils.PublicUtil; | |
6 | +import cn.fw.morax.domain.enums.DataTypeEnum; | |
7 | +import cn.fw.morax.domain.enums.ImportErrorReasonEnum; | |
4 | 8 | import cn.fw.morax.domain.enums.IndicatorValueTypeEnum; |
9 | +import cn.fw.morax.domain.enums.TargetTypeEnum; | |
5 | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
6 | 11 | import lombok.Data; |
7 | 12 | import lombok.EqualsAndHashCode; |
8 | 13 | import lombok.experimental.Accessors; |
9 | 14 | |
15 | +import java.math.BigDecimal; | |
10 | 16 | import java.time.LocalDate; |
11 | 17 | |
12 | 18 | /** |
... | ... | @@ -26,7 +32,7 @@ public class EvalIndicatorImportDetailVO { |
26 | 32 | /** |
27 | 33 | * 维度类型 1:人员 2:门店 |
28 | 34 | */ |
29 | -// private Integer dimensionType; | |
35 | + private Integer dimensionType; | |
30 | 36 | |
31 | 37 | /** |
32 | 38 | * 导入id |
... | ... | @@ -66,12 +72,12 @@ public class EvalIndicatorImportDetailVO { |
66 | 72 | /** |
67 | 73 | * 指标业务值 |
68 | 74 | */ |
69 | - private String indicatorValue; | |
75 | + private BigDecimal indicatorValue; | |
70 | 76 | |
71 | 77 | /** |
72 | - * 类型:1: 百分比 2:数量 3:条件值 4:金额 | |
78 | + * 数据类型;1:数量 2:百分比 3:金额 | |
73 | 79 | */ |
74 | - private IndicatorValueTypeEnum valueType; | |
80 | + private DataTypeEnum dataType; | |
75 | 81 | |
76 | 82 | /** |
77 | 83 | * 数据日期 |
... | ... | @@ -91,5 +97,17 @@ public class EvalIndicatorImportDetailVO { |
91 | 97 | /** |
92 | 98 | * 错误提示 |
93 | 99 | */ |
94 | - private String errorMsg; | |
100 | + private ImportErrorReasonEnum errorType; | |
101 | + | |
102 | + /** | |
103 | + * 转换为百分数展示 | |
104 | + */ | |
105 | + public void convertToPercent(){ | |
106 | + if (PublicUtil.isNotEmpty(this.getDataType()) && DataTypeEnum.RATIO.equals(this.getDataType())) { | |
107 | + if (PublicUtil.isNotEmpty(this.getIndicatorValue())) { | |
108 | + this.setIndicatorValue(this.getIndicatorValue().multiply(Constant.ONE_HUNDRED)); | |
109 | + } | |
110 | + } | |
111 | + } | |
112 | + | |
95 | 113 | } | ... | ... |
fw-morax-domain/src/main/java/cn/fw/morax/domain/vo/eval/EvalIndicatorImportRecordVO.java
... | ... | @@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode; |
9 | 9 | import lombok.experimental.Accessors; |
10 | 10 | |
11 | 11 | import java.time.LocalDate; |
12 | +import java.util.Date; | |
12 | 13 | |
13 | 14 | /** |
14 | 15 | * <p> |
... | ... | @@ -96,9 +97,7 @@ public class EvalIndicatorImportRecordVO{ |
96 | 97 | private Long groupId; |
97 | 98 | |
98 | 99 | /** |
99 | - * 逻辑删除 | |
100 | + * 创建时间 | |
100 | 101 | */ |
101 | - @TableLogic | |
102 | - private Boolean yn; | |
103 | - | |
102 | + private Date createTime; | |
104 | 103 | } | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/CommonService.java
... | ... | @@ -10,6 +10,7 @@ import cn.fw.morax.domain.db.eval.EvalIndicatorValue; |
10 | 10 | import cn.fw.morax.domain.db.kpi.IndicatorUserValue; |
11 | 11 | import cn.fw.morax.domain.db.kpi.KpiGroup; |
12 | 12 | import cn.fw.morax.domain.dto.AbstractLaddersDto; |
13 | +import cn.fw.morax.domain.enums.DataTypeEnum; | |
13 | 14 | import cn.fw.morax.domain.enums.IndicatorValueTypeEnum; |
14 | 15 | import cn.fw.morax.domain.enums.SettingDraftStatusEnum; |
15 | 16 | import cn.fw.morax.domain.enums.SettingDraftTypeEnum; |
... | ... | @@ -282,13 +283,8 @@ public class CommonService { |
282 | 283 | return BigDecimal.ZERO; |
283 | 284 | } |
284 | 285 | BigDecimal value = BigDecimal.ZERO; |
285 | - //条件计算类型 是车系id:销售台数 | |
286 | - if (IndicatorValueTypeEnum.CONDITION.equals(indicatorValue.getValueType())) { | |
287 | - return value; | |
288 | - } | |
289 | 286 | try { |
290 | - JSONObject jsonObject = JSONObject.parseObject(indicatorValue.getIndicatorValue()); | |
291 | - value = Optional.ofNullable(jsonObject.getBigDecimal(indicatorCode)).orElse(BigDecimal.ZERO); | |
287 | + value = Optional.ofNullable(indicatorValue.getIndicatorValue()).orElse(BigDecimal.ZERO); | |
292 | 288 | } catch (Exception e) { |
293 | 289 | log.error("[{}]指标值转化失败", indicatorCode, e); |
294 | 290 | } |
... | ... | @@ -328,13 +324,9 @@ public class CommonService { |
328 | 324 | public BigDecimal queryEvalIndicatorValueVO(String indicatorCode, EvalIndicatorValue indicatorUserValue) { |
329 | 325 | BigDecimal value = BigDecimal.ZERO; |
330 | 326 | //条件计算类型 是车系id:销售台数 |
331 | - if (IndicatorValueTypeEnum.CONDITION.equals(indicatorUserValue.getValueType())) { | |
332 | - return value; | |
333 | - } | |
334 | 327 | try { |
335 | - JSONObject jsonObject = JSONObject.parseObject(indicatorUserValue.getIndicatorValue()); | |
336 | - value = Optional.ofNullable(jsonObject.getBigDecimal(indicatorCode)).orElse(BigDecimal.ZERO); | |
337 | - if (IndicatorValueTypeEnum.RATIO.equals(indicatorUserValue.getValueType())) { | |
328 | + value = Optional.ofNullable(indicatorUserValue.getIndicatorValue()).orElse(BigDecimal.ZERO); | |
329 | + if (DataTypeEnum.RATIO.equals(indicatorUserValue.getDataType())) { | |
338 | 330 | value = value.multiply(Constant.ONE_HUNDRED); |
339 | 331 | } |
340 | 332 | } catch (Exception e) { | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalIndicatorReportService.java
... | ... | @@ -13,6 +13,7 @@ import cn.fw.morax.domain.db.eval.*; |
13 | 13 | import cn.fw.morax.domain.dto.query.EvalIndicatorImportQueryDTO; |
14 | 14 | import cn.fw.morax.domain.enums.DimensionTypeEnum; |
15 | 15 | import cn.fw.morax.domain.enums.ImportErrorReasonEnum; |
16 | +import cn.fw.morax.domain.enums.IndicatorValueTypeEnum; | |
16 | 17 | import cn.fw.morax.domain.enums.SettingStatusEnum; |
17 | 18 | import cn.fw.morax.domain.vo.eval.*; |
18 | 19 | import cn.fw.morax.service.biz.CommonService; |
... | ... | @@ -102,7 +103,6 @@ public class EvalIndicatorReportService { |
102 | 103 | LambdaQueryWrapper wrappers = Wrappers.<EvalIndicatorImportDetail>lambdaQuery() |
103 | 104 | .eq(EvalIndicatorImportDetail::getRecordId, id) |
104 | 105 | .eq(EvalIndicatorImportDetail::getYn, Boolean.TRUE); |
105 | - | |
106 | 106 | if (PublicUtil.isNotEmpty(querySuccess)) { |
107 | 107 | if (querySuccess) { |
108 | 108 | wrappers.isNotNull("error_type"); |
... | ... | @@ -118,6 +118,7 @@ public class EvalIndicatorReportService { |
118 | 118 | List<EvalIndicatorImportDetailVO> detailVOS = Lists.newArrayListWithCapacity(details.size()); |
119 | 119 | for (EvalIndicatorImportDetail detail : details) { |
120 | 120 | EvalIndicatorImportDetailVO detailVO = PublicUtil.copy(detail, EvalIndicatorImportDetailVO.class); |
121 | + detailVO.convertToPercent(); | |
121 | 122 | detailVOS.add(detailVO); |
122 | 123 | } |
123 | 124 | return detailVOS; |
... | ... | @@ -170,6 +171,7 @@ public class EvalIndicatorReportService { |
170 | 171 | importDetail.setIndicatorCode(evalIndicator.getCode()); |
171 | 172 | importDetail.setIndicatorName(evalIndicator.getName()); |
172 | 173 | importDetail.setIndicatorValue(new BigDecimal(staff.getIndicatorValue())); |
174 | + importDetail.setDataType(evalIndicator.getDataType()); | |
173 | 175 | } else { |
174 | 176 | importDetail.setErrorType(ImportErrorReasonEnum.NO_MATCH_INDICATOR); |
175 | 177 | errorNum += 1; |
... | ... | @@ -237,6 +239,7 @@ public class EvalIndicatorReportService { |
237 | 239 | importDetail.setIndicatorCode(evalIndicator.getCode()); |
238 | 240 | importDetail.setIndicatorName(evalIndicator.getName()); |
239 | 241 | importDetail.setIndicatorValue(new BigDecimal(shop.getIndicatorValue())); |
242 | + importDetail.setDataType(evalIndicator.getDataType()); | |
240 | 243 | } else { |
241 | 244 | importDetail.setErrorType(ImportErrorReasonEnum.NO_MATCH_INDICATOR); |
242 | 245 | errorNum += 1; | ... | ... |
fw-morax-service/src/main/java/cn/fw/morax/service/component/EvalIndicatorSaveObserver.java
... | ... | @@ -91,7 +91,7 @@ public class EvalIndicatorSaveObserver { |
91 | 91 | indicatorValue.setIndicatorCode(shopDetail.getIndicatorCode()); |
92 | 92 | indicatorValue.setIndicatorName(shopDetail.getIndicatorName()); |
93 | 93 | indicatorValue.setIndicatorValue(shopDetail.getIndicatorValue()); |
94 | - indicatorValue.setValueType(shopDetail.getValueType()); | |
94 | + indicatorValue.setDataType(shopDetail.getDataType()); | |
95 | 95 | indicatorValue.setDataDate(dataDate); |
96 | 96 | indicatorValue.setGroupId(shopDetail.getGroupId()); |
97 | 97 | indicatorValue.setYn(Boolean.TRUE); |
... | ... | @@ -106,7 +106,7 @@ public class EvalIndicatorSaveObserver { |
106 | 106 | indicatorValue.setIndicatorCode(shopDetail.getIndicatorCode()); |
107 | 107 | indicatorValue.setIndicatorName(shopDetail.getIndicatorName()); |
108 | 108 | indicatorValue.setIndicatorValue(shopDetail.getIndicatorValue()); |
109 | - indicatorValue.setValueType(shopDetail.getValueType()); | |
109 | + indicatorValue.setDataType(shopDetail.getDataType()); | |
110 | 110 | indicatorValue.setDataDate(dataDate); |
111 | 111 | indicatorValue.setGroupId(shopDetail.getGroupId()); |
112 | 112 | indicatorValue.setYn(Boolean.TRUE); | ... | ... |