Commit a0ae5a6dff75ac34b7999803801f1489420e369c

Authored by 张志伟
2 parents 428123aa e001d1e4

Merge remote-tracking branch 'origin/dev' into test

fw-valhalla-common/src/main/java/cn/fw/valhalla/common/enums/DefeatTypeEnum.java 0 → 100644
  1 +package cn.fw.valhalla.common.enums;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonCreator;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * @author : kurisu
  8 + * @className : DefeatTypeEnum
  9 + * @description : 战败类型
  10 + * @date: 2020-10-16 17:56
  11 + */
  12 +public enum DefeatTypeEnum {
  13 + /**
  14 + * 主动战败
  15 + */
  16 + A(1, "主动战败"),
  17 + /**
  18 + * 到期划走
  19 + */
  20 + B(2, "到期划走"),
  21 + /**
  22 + * 到期战败
  23 + */
  24 + C(3, "到期战败");
  25 +
  26 + /**
  27 + * 值
  28 + */
  29 + private final Integer value;
  30 + /**
  31 + * 名称
  32 + */
  33 + @Getter
  34 + private final String name;
  35 +
  36 + DefeatTypeEnum(final Integer value, final String name) {
  37 + this.value = value;
  38 + this.name = name;
  39 + }
  40 +
  41 + /**
  42 + * 根据枚举值获取枚举对象
  43 + */
  44 + @JsonCreator
  45 + public static DefeatTypeEnum ofValue(final Integer value) {
  46 + for (final DefeatTypeEnum typeEnum : DefeatTypeEnum.values()) {
  47 + if (typeEnum.value.equals(value)) {
  48 + return typeEnum;
  49 + }
  50 + }
  51 + return null;
  52 + }
  53 +}
... ...
fw-valhalla-dao/src/main/resources/mapper/FollowTaskMapper.xml
... ... @@ -24,7 +24,8 @@
24 24 end state,
25 25 t1.finish_time finish_time,
26 26 case t1.finished when 1 then null when 0 then t1.deadline end defeat_time,
27   - (select count(1) from approve_record t5 where t5.data_id = t1.id and t5.passed = 1)!= 0 initiative,
  27 + if((select count(1) from approve_record t5
  28 + where t5.data_id = t1.id and t5.passed = 1) != 0, 1, 3) initiative,
28 29 t1.group_id group_id,
29 30 t2.id customer_id,
30 31 t1.origin_shop,
... ... @@ -44,7 +45,7 @@
44 45 SELECT t1.id,
45 46 ifnull(t2.plate_no, t3.plate_no) plate_no,
46 47 t1.type type,
47   - t1.changed redistribution,
  48 + 0 redistribution,
48 49 t1.origin_user user_id,
49 50 t1.origin_shop shop_id,
50 51 (select count(1) from follow_record t4
... ... @@ -58,7 +59,8 @@
58 59 end state,
59 60 t1.finish_time finish_time,
60 61 t1.change_user_time defeat_time,
61   - (select count(1) from approve_record t5 where t5.data_id = t1.id and t5.passed = 1)!= 0 initiative,
  62 + if((select count(1) from approve_record t5
  63 + where t5.data_id = t1.id and t5.passed = 1) != 0, 1, 2) initiative,
62 64 t1.group_id group_id,
63 65 t2.id customer_id,
64 66 t1.origin_shop,
... ... @@ -84,13 +86,13 @@
84 86 t1.follow_shop shop_id,
85 87 (select count(1) from follow_record t4
86 88 where t4.task_id = t1.id
87   - and t4.user_id = t1.finish_user
  89 + and t4.user_id = t1.follow_user
88 90 and t4.follow_time is not null) times,
89 91 TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
90 92 1 state,
91 93 t1.finish_time finish_time,
92 94 null defeat_time,
93   - false initiative,
  95 + null initiative,
94 96 t1.group_id group_id,
95 97 t2.id customer_id,
96 98 t1.origin_shop,
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/FollowPoolDTO.java
... ... @@ -57,9 +57,9 @@ public class FollowPoolDTO {
57 57 */
58 58 private Date defeatTime;
59 59 /**
60   - * 主动放弃
  60 + * 战败类型
61 61 */
62   - private Boolean initiative;
  62 + private Integer initiative;
63 63 /**
64 64 * 集团id
65 65 */
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowPoolBizService.java
... ... @@ -2,6 +2,7 @@ package cn.fw.valhalla.service.bus.follow;
2 2  
3 3 import cn.fw.common.page.AppPage;
4 4 import cn.fw.common.web.auth.LoginAuthBean;
  5 +import cn.fw.valhalla.common.enums.DefeatTypeEnum;
5 6 import cn.fw.valhalla.common.utils.DateUtil;
6 7 import cn.fw.valhalla.common.utils.StringUtils;
7 8 import cn.fw.valhalla.domain.db.PublicPool;
... ... @@ -116,18 +117,18 @@ public class FollowPoolBizService {
116 117 if (Objects.nonNull(shop)) {
117 118 vo.setShopName(shop.getShopName());
118 119 }
119   - if (Boolean.TRUE.equals(poolDTO.getInitiative())) {
120   - vo.setDefeatType("主动战败");
121   - }
122   - if (poolDTO.getState() == 3 && Boolean.FALSE.equals(poolDTO.getInitiative())) {
123   - vo.setDefeatType("到期划走");
  120 + DefeatTypeEnum defeatTypeEnum = DefeatTypeEnum.ofValue(poolDTO.getInitiative());
  121 + if (Objects.nonNull(defeatTypeEnum) && poolDTO.getState() == 3) {
  122 + vo.setDefeatType(defeatTypeEnum.getName());
124 123 }
  124 +
125 125 if (Boolean.TRUE.equals(poolDTO.getFinished()) && !poolDTO.getOriginShop().equals(poolDTO.getFinishShop())) {
126 126 vo.setDefeatDesc("集团内战败");
127 127 }
128   - if (TaskStateEnum.END.getValue().equals(poolDTO.getOriginState()) && Boolean.FALSE.equals(poolDTO.getFinished())) {
129   - vo.setDefeatDesc("集团外战败");
  128 + if (poolDTO.getState() == 3 && DefeatTypeEnum.B.equals(defeatTypeEnum)) {
  129 + vo.setDefeatDesc("系统划走");
130 130 }
  131 +
131 132 return vo;
132 133 }
133 134  
... ...