Commit 91f5438390093870bb1d472beaf18d3be6970d40

Authored by 张志伟
2 parents fabca67c 41b33b12

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

fw-valhalla-common/src/main/java/cn/fw/valhalla/common/utils/StringUtils.java
... ... @@ -520,8 +520,8 @@ public final class StringUtils {
520 520 System.out.println(toUUID("1"));
521 521 System.out.println(removePrefix("abcd123", "ab"));
522 522 System.out.println(removeSuffix("abcd123", "123"));
523   - System.out.println(toColumnName("usernameid"));
524   - System.out.println(getFieldString(toColumnName("userNameId")));
  523 + System.out.println(toColumnName("usernameId"));
  524 + System.out.println(getFieldString("user_name_id"));
525 525 System.out.println(repeat("?", 10, ","));
526 526 length("AAA中国()111222bb");
527 527 }
... ...
fw-valhalla-dao/src/main/resources/mapper/FollowTaskMapper.xml
... ... @@ -11,19 +11,19 @@
11 11 ifnull(t2.plate_no, t3.plate_no) plate_no,
12 12 t1.type type,
13 13 t1.changed redistribution,
14   - t1.finish_user user_id,
15   - t1.finish_shop shop_id,
  14 + case t1.finished when 1 then t1.finish_user when 0 then t1.follow_user end user_id,
  15 + case t1.finished when 1 then t1.finish_shop when 0 then t1.follow_shop end shop_id,
16 16 (select count(1) from follow_record t4
17 17 where t4.task_id = t1.id
18   - and t4.user_id = t1.finish_user
  18 + and t4.user_id = if(t1.finished = 1, t1.finish_user, t1.follow_user)
19 19 and t4.follow_time is not null ) times,
20   - TIMESTAMPDIFF(DAY, now(), t1.deadline) remaining,
  20 + TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
21 21 case t1.finished
22 22 when 1 then 2
23 23 when 0 then 3
24 24 end state,
25 25 t1.finish_time finish_time,
26   - t1.deadline defeat_time,
  26 + case t1.finished when 1 then null when 0 then t1.deadline end defeat_time,
27 27 (select count(1) from approve_record t5 where t5.data_id = t1.id and t5.passed = 1)!= 0 initiative,
28 28 t1.group_id group_id,
29 29 t2.id customer_id,
... ... @@ -36,9 +36,9 @@
36 36 left join accident_pool t3 on t1.customer_id = t3.id
37 37 where t1.state = 3
38 38 and ((t1.finished = 0 and
39   - DATE_FORMAT(t1.deadline, '%Y-%m-%d') between #{condition.startTime} and #{condition.endTime}) or
  39 + t1.deadline >= #{condition.startTime} and t1.deadline < #{condition.endTime}) or
40 40 (t1.finished = 1 and
41   - DATE_FORMAT(t1.finish_time, '%Y-%m-%d') between #{condition.startTime} and #{condition.endTime}))
  41 + t1.finish_time >= #{condition.startTime} and t1.finish_time < #{condition.endTime}))
42 42  
43 43 union
44 44 SELECT t1.id,
... ... @@ -51,7 +51,7 @@
51 51 where t4.task_id = t1.id
52 52 and t4.user_id = t1.origin_user
53 53 and t4.follow_time is not null) times,
54   - TIMESTAMPDIFF(DAY, now(), t1.deadline) remaining,
  54 + TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
55 55 case t1.changed
56 56 when 1 then 3
57 57 when 0 then if(t1.finished = 0, 3, 2)
... ... @@ -69,10 +69,11 @@
69 69 left join customer t2 on t1.customer_id = t2.id
70 70 left join accident_pool t3 on t1.customer_id = t3.id
71 71 where t1.state = 3
  72 + and t1.type != 3
72 73 and ((t1.finished = 0 and
73   - DATE_FORMAT(t1.deadline, '%Y-%m-%d') between #{condition.startTime} and #{condition.endTime}) or
  74 + t1.deadline >= #{condition.startTime} and t1.deadline < #{condition.endTime}) or
74 75 (t1.finished = 1 and
75   - DATE_FORMAT(t1.finish_time, '%Y-%m-%d') between #{condition.startTime} and #{condition.endTime}))
  76 + t1.finish_time >= #{condition.startTime} and t1.finish_time < #{condition.endTime}))
76 77  
77 78 union
78 79 SELECT t1.id,
... ... @@ -85,11 +86,11 @@
85 86 where t4.task_id = t1.id
86 87 and t4.user_id = t1.finish_user
87 88 and t4.follow_time is not null) times,
88   - TIMESTAMPDIFF(DAY, now(), t1.deadline) remaining,
  89 + TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
89 90 1 state,
90 91 t1.finish_time finish_time,
91 92 null defeat_time,
92   - null initiative,
  93 + false initiative,
93 94 t1.group_id group_id,
94 95 t2.id customer_id,
95 96 t1.origin_shop,
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowPoolListVO.java
1 1 package cn.fw.valhalla.domain.vo.follow;
2 2  
  3 +import cn.fw.valhalla.domain.enums.FollowTypeEnum;
3 4 import lombok.Data;
4 5  
5 6 import java.util.Date;
... ... @@ -63,10 +64,17 @@ public class FollowPoolListVO {
63 64 */
64 65 private String defeatDesc;
65 66  
66   - public Integer getRemaining() {
  67 + public String getRemaining() {
67 68 if (Objects.isNull(remaining)) {
68 69 return null;
69 70 }
70   - return remaining <= 0 ? 0 : remaining;
  71 + StringBuilder sb = new StringBuilder();
  72 + int num = remaining <= 0 ? 0 : remaining;
  73 + if (FollowTypeEnum.AC.getValue().equals(type)) {
  74 + sb.append(num).append("小时");
  75 + } else {
  76 + sb.append(num / 24).append("天");
  77 + }
  78 + return sb.toString();
71 79 }
72 80 }
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/CommonController.java
... ... @@ -42,7 +42,7 @@ public class CommonController {
42 42 }
43 43  
44 44 @GetMapping("/staff/list")
45   - public Message<List<PostUserVO>> save(@NotNull(message = "服务站ID不能为空") final Long shopId,
  45 + public Message<List<PostUserVO>> list(@NotNull(message = "服务站ID不能为空") final Long shopId,
46 46 @NotNull(message = "跟进类型ID不能为空") final Integer type) {
47 47 final String msg = "查询跟进人员[app/common/staff/list]";
48 48 try {
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowPoolBizService.java
... ... @@ -41,7 +41,6 @@ import static cn.fw.common.businessvalidator.Validator.BV;
41 41 @Service
42 42 public class FollowPoolBizService {
43 43 private final FollowTaskService followTaskService;
44   - private final FollowRecordService followRecordService;
45 44 private final PublicPoolService publicPoolService;
46 45 private final OopService oopService;
47 46 private final UserService userService;
... ... @@ -49,12 +48,10 @@ public class FollowPoolBizService {
49 48  
50 49 @Autowired
51 50 public FollowPoolBizService(final FollowTaskService followTaskService,
52   - final FollowRecordService followRecordService,
53 51 final PublicPoolService publicPoolService,
54 52 final OopService oopService,
55 53 final UserService userService) {
56 54 this.followTaskService = followTaskService;
57   - this.followRecordService = followRecordService;
58 55 this.publicPoolService = publicPoolService;
59 56 this.oopService = oopService;
60 57 this.userService = userService;
... ... @@ -142,9 +139,11 @@ public class FollowPoolBizService {
142 139 }
143 140 boolean inSection = DateUtil.sub(queryVO.getEndTime(), queryVO.getStartTime(), "d") <= MONTH_DAY;
144 141 BV.isTrue(inSection, () -> "暂不支持查询超过一个月区间的数据");
  142 + boolean d = DateUtil.sub(queryVO.getEndTime(), queryVO.getStartTime(), "d") >= 0;
  143 + BV.isTrue(d, () -> "截止时间必须大于开始时间");
145 144 if (Objects.nonNull(queryVO.getOrder()) && StringUtils.isValid(queryVO.getOrderAtt())) {
146 145 StringBuilder sb = new StringBuilder(" order by ");
147   - sb.append(queryVO.getOrderAtt());
  146 + sb.append(StringUtils.toColumnName(queryVO.getOrderAtt()).toLowerCase());
148 147 if (queryVO.getOrder() == 1) {
149 148 sb.append(" asc ");
150 149 } else {
... ...