Commit f8056835c28abd092f862d4183bdd090c36613da

Authored by 张志伟
2 parents 54a49929 8c89bf6a

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

fw-valhalla-dao/src/main/resources/mapper/SecretReportHistoryMapper.xml
... ... @@ -52,6 +52,9 @@
52 52 <if test="condition.taskType !=null">
53 53 and t1.task_type = #{condition.taskType}
54 54 </if>
  55 + <if test="condition.callType !=null">
  56 + and t1.call_type = #{condition.callType}
  57 + </if>
55 58 <if test="condition.startTime1 !=null">
56 59 and t1.call_time >= #{condition.startTime1}
57 60 </if>
... ... @@ -101,6 +104,9 @@
101 104 <if test="condition.taskType !=null">
102 105 and t1.task_type = #{condition.taskType}
103 106 </if>
  107 + <if test="condition.callType !=null">
  108 + and t1.call_type = #{condition.callType}
  109 + </if>
104 110 <if test="condition.startTime1 !=null">
105 111 and t1.call_time >= #{condition.startTime1}
106 112 </if>
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowDetailVO.java
... ... @@ -23,6 +23,7 @@ public class FollowDetailVO {
23 23 * 档案id
24 24 */
25 25 private Long customerId;
  26 + private Integer type;
26 27 /**
27 28 * 名称
28 29 */
... ...
fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/TodoRpcService.java
... ... @@ -17,10 +17,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
17 17 import org.springframework.stereotype.Service;
18 18 import org.springframework.util.CollectionUtils;
19 19  
20   -import java.util.ArrayList;
21   -import java.util.List;
22   -import java.util.Objects;
23   -import java.util.Optional;
  20 +import java.util.*;
24 21 import java.util.stream.Collectors;
25 22  
26 23 /**
... ... @@ -163,28 +160,27 @@ public class TodoRpcService {
163 160 }
164 161 return Optional.of(dto);
165 162 } catch (Exception e) {
166   - log.error("缓存设置信息失败 key[{}]", key, e);
  163 + log.error("缓存信息获取失败 key[{}]", key, e);
167 164 return Optional.empty();
168 165 }
169 166 }
170 167  
171   - public List<BackLogItemDTO> getAllFromCache(final String key) {
  168 + public Collection<BackLogItemDTO> getAllFromCache(final String key) {
172 169 try {
173 170 Boolean hasKey = redisTemplate.hasKey(key);
174 171 if (!Boolean.TRUE.equals(hasKey)) {
175   - return new ArrayList<>();
  172 + return new HashSet<>();
176 173 }
177 174 BoundListOperations<String, String> ops = redisTemplate.boundListOps(key);
178 175 List<String> stringList = ops.range(0, -1);
  176 + redisTemplate.delete(key);
179 177 if (CollectionUtils.isEmpty(stringList)) {
180   - return new ArrayList<>();
  178 + return new HashSet<>();
181 179 }
182   - List<BackLogItemDTO> dtos = stringList.stream().map(str -> JSONObject.parseObject(str, BackLogItemDTO.class)).collect(Collectors.toList());
183   - redisTemplate.delete(key);
184   - return dtos;
  180 + return stringList.stream().map(str -> JSONObject.parseObject(str, BackLogItemDTO.class)).collect(Collectors.toSet());
185 181 } catch (Exception e) {
186   - log.error("缓存设置信息失败 key[{}]", key, e);
187   - return new ArrayList<>();
  182 + log.error("缓存信息获取失败 key[{}]", key, e);
  183 + return new HashSet<>();
188 184 }
189 185 }
190 186  
... ...
fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/dto/BackLogItemDTO.java
1 1 package cn.fw.valhalla.rpc.erp.dto;
2 2  
3 3 import lombok.Data;
  4 +import lombok.EqualsAndHashCode;
4 5 import lombok.ToString;
5 6  
6 7 import java.util.Date;
... ... @@ -14,6 +15,7 @@ import java.util.Objects;
14 15 */
15 16 @Data
16 17 @ToString
  18 +@EqualsAndHashCode
17 19 public class BackLogItemDTO {
18 20 /**
19 21 * 发送次数
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/FollowController.java
... ... @@ -82,14 +82,11 @@ public class FollowController {
82 82  
83 83 @GetMapping("/approve/detail")
84 84 @IgnoreAuth
85   - public Message<FollowDetailVO> approveDetail(@NotNull(message = "跟进记录id不能为空") final Long recordId,
86   - @NotNull(message = "跟进类型不能为空") final Integer type) {
  85 + public Message<FollowDetailVO> approveDetail(@NotNull(message = "跟进记录id不能为空") final Long recordId, final Integer type) {
87 86 final String msg = "查询跟进战败审批详情[follow/approve/detail]";
88 87 try {
89 88 log.info("{}: param[{} {}]", msg, recordId, type);
90   - FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type);
91   - BV.notNull(typeEnum, "跟进类型不正确");
92   - FollowDetailVO detailVO = followBizService.approveDetail(recordId, typeEnum);
  89 + FollowDetailVO detailVO = followBizService.approveDetail(recordId, type);
93 90 return success(detailVO, data -> log.info("{}", data));
94 91 } catch (Exception ex) {
95 92 handleException(ex, e -> log.error("{}失败:param[{} {}]", msg, recordId, type, e));
... ... @@ -99,14 +96,11 @@ public class FollowController {
99 96  
100 97 @GetMapping("/todo/record")
101 98 @IgnoreAuth
102   - public Message<List<FollowRecordVO>> todoRecord(@NotNull(message = "跟进任务id不能为空") final Long taskId,
103   - @NotNull(message = "跟进类型不能为空") final Integer type) {
  99 + public Message<List<FollowRecordVO>> todoRecord(@NotNull(message = "跟进任务id不能为空") final Long taskId, final Integer type) {
104 100 final String msg = "查询跟进历史记录[follow/todo/record]";
105 101 try {
106 102 log.info("{}: param[{} {}]", msg, taskId, type);
107   - FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type);
108   - BV.notNull(typeEnum, "跟进类型不正确");
109   - return success(followBizService.todoRecord(taskId, typeEnum), data -> log.info("{}", data));
  103 + return success(followBizService.todoRecord(taskId, type), data -> log.info("{}", data));
110 104 } catch (Exception ex) {
111 105 handleException(ex, e -> log.error("{}失败:param[{} {}]", msg, taskId, type, e));
112 106 return failureWithMessage(QUERY_FAILURE);
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/FollowRecordTask.java
... ... @@ -22,9 +22,9 @@ import org.springframework.util.CollectionUtils;
22 22  
23 23 import java.time.LocalDateTime;
24 24 import java.util.ArrayList;
  25 +import java.util.Collection;
25 26 import java.util.List;
26 27 import java.util.Objects;
27   -import java.util.Optional;
28 28  
29 29 /**
30 30 * @author : kurisu
... ... @@ -125,21 +125,21 @@ public class FollowRecordTask {
125 125 /**
126 126 * 完成待办的重试
127 127 */
128   - @Scheduled(initialDelay = 1500, fixedRate = 1000)
  128 + @Scheduled(initialDelay = 1500, fixedRate = 15 * 1000)
129 129 public void retryCompleteTodoItem() {
130 130 String key = todoRpcService.generateKey(TodoRpcService.TodoOperationEnum.COMPLETE);
131   - Optional<BackLogItemDTO> fromCache = todoRpcService.getOneFromCache(key);
132   - fromCache.ifPresent(todoRpcService::complete);
  131 + Collection<BackLogItemDTO> all = todoRpcService.getAllFromCache(key);
  132 + all.forEach(todoRpcService::complete);
133 133 }
134 134  
135 135 /**
136 136 * 取消待办的重试
137 137 */
138   - @Scheduled(initialDelay = 1000, fixedRate = 1000)
  138 + @Scheduled(initialDelay = 1000, fixedRate = 10 * 1000)
139 139 public void retryCancelTodoItem() {
140 140 String key = todoRpcService.generateKey(TodoRpcService.TodoOperationEnum.CANCEL);
141   - Optional<BackLogItemDTO> fromCache = todoRpcService.getOneFromCache(key);
142   - fromCache.ifPresent(todoRpcService::cancel);
  141 + Collection<BackLogItemDTO> all = todoRpcService.getAllFromCache(key);
  142 + all.forEach(todoRpcService::cancel);
143 143 }
144 144  
145 145  
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AccidentPoolBizService.java
... ... @@ -4,6 +4,7 @@ import cn.fw.common.cache.locker.DistributedLocker;
4 4 import cn.fw.common.web.auth.LoginAuthBean;
5 5 import cn.fw.valhalla.common.constant.RoleCode;
6 6 import cn.fw.valhalla.common.utils.DateUtil;
  7 +import cn.fw.valhalla.common.utils.StringUtils;
7 8 import cn.fw.valhalla.domain.db.customer.AccidentPool;
8 9 import cn.fw.valhalla.domain.db.customer.Customer;
9 10 import cn.fw.valhalla.domain.db.follow.FollowRecord;
... ... @@ -80,6 +81,9 @@ public class AccidentPoolBizService {
80 81 BV.isTrue(Boolean.TRUE.equals(pair.getKey()), () -> "请勿重复提交");
81 82 boolean repetition = isRepetition(currentUser.getGroupId(), poolDTO.getPlateNo());
82 83 BV.isFalse(repetition, () -> "该记录已存在,请勿重复添加");
  84 + if (StringUtils.isEmpty(poolDTO.getMobile())) {
  85 + poolDTO.setMobile(poolDTO.getReportMobile());
  86 + }
83 87 AccidentPool pool = conversion2db(poolDTO, currentUser);
84 88 pool.setShopId(poolDTO.getShopId());
85 89 pool.setShopName(poolDTO.getShopName());
... ... @@ -276,11 +280,7 @@ public class AccidentPoolBizService {
276 280 record.setAddTodo(Boolean.FALSE);
277 281 record.setGroupId(task.getGroupId());
278 282 record.setShopId(task.getFollowShop());
279   - settingBizService.querySettingByType(FollowTypeEnum.AC, SettingTypeEnum.LIMITATION, task.getGroupId())
280   - .ifPresent(r -> {
281   - Timestamp expired = DateUtil.getExpired(task.getBeginTime(), r.getDetailValue(), getCalendarType(Objects.requireNonNull(SettingUnitEnum.ofValue(r.getUnit()))));
282   - record.setLimitTime(expired);
283   - });
  283 + record.setLimitTime(record.getDeadline());
284 284 followRecordService.queryAndSave(record);
285 285 }
286 286 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java
... ... @@ -139,9 +139,15 @@ public class FollowBizService {
139 139 * @param type
140 140 * @return
141 141 */
142   - public List<FollowRecordVO> todoRecord(Long taskId, FollowTypeEnum type) {
143   - FollowStrategy strategy = followMap.get(type);
144   - Assert.notNull(strategy, "strategy cannot be null");
  142 + public List<FollowRecordVO> todoRecord(Long taskId, Integer type) {
  143 + FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type);
  144 + if (Objects.isNull(typeEnum)) {
  145 + FollowTask task = followTaskService.getById(taskId);
  146 + BV.notNull(task, () -> "跟进任务不存在");
  147 + typeEnum = task.getType();
  148 + }
  149 + FollowStrategy strategy = followMap.get(typeEnum);
  150 + BV.notNull(strategy, () -> "跟进类型不正确");
145 151 return strategy.getRecordList(taskId);
146 152 }
147 153  
... ... @@ -216,10 +222,17 @@ public class FollowBizService {
216 222 * @param type
217 223 * @return
218 224 */
219   - public FollowDetailVO approveDetail(Long id, FollowTypeEnum type) {
220   - FollowStrategy strategy = followMap.get(type);
221   - Assert.notNull(strategy, "strategy cannot be null");
  225 + public FollowDetailVO approveDetail(Long id, Integer type) {
  226 + FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type);
  227 + if (Objects.isNull(typeEnum)) {
  228 + FollowRecord record = followRecordService.getById(id);
  229 + BV.notNull(record, () -> "跟进记录不存在");
  230 + typeEnum = record.getType();
  231 + }
  232 + FollowStrategy strategy = followMap.get(typeEnum);
  233 + BV.notNull(strategy, () -> "跟进类型不正确");
222 234 FollowDetailVO detail = strategy.getDetail(id);
  235 + detail.setType(typeEnum.getValue());
223 236 ApproveRecord approveRecord = approveRecordService.getOne(Wrappers.<ApproveRecord>lambdaQuery()
224 237 .eq(ApproveRecord::getDataId, detail.getTaskId())
225 238 .last("limit 1")
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java
... ... @@ -95,7 +95,7 @@ public class ACFollowStrategy extends AbstractFollowStrategy {
95 95 vo.setId(followRecord.getId());
96 96 vo.setTaskId(followRecord.getTaskId());
97 97 vo.setHadCall(count > 0 || !ValidationUtils.checkMobile(vo.getReportMobile()));
98   - vo.setDeadline(Objects.isNull(followRecord.getLimitTime()) ? followRecord.getDeadline() : followRecord.getLimitTime());
  98 + vo.setDeadline(followRecord.getDeadline());
99 99 return vo;
100 100 }
101 101  
... ...