Commit 25c2fc6507ad1dafab93ceab7cee932b1f489336
1 parent
ae766fec
v1.1.0 算法调整
Showing
1 changed file
with
11 additions
and
19 deletions
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java
... | ... | @@ -204,6 +204,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
204 | 204 | * 生成跟进记录 |
205 | 205 | * |
206 | 206 | * @param task |
207 | + * @param addDay 二次分配的情况+1天 | |
207 | 208 | */ |
208 | 209 | @Override |
209 | 210 | @Transactional(rollbackFor = Exception.class) |
... | ... | @@ -224,7 +225,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
224 | 225 | record.setPlanTime(planTime); |
225 | 226 | settingBizService.querySettingByType(task.getType(), SettingTypeEnum.EFFECTIVE_TIME, task.getGroupId()) |
226 | 227 | .ifPresent(setting -> { |
227 | - Timestamp timestamp = calDate(setting, record.getPlanTime(), false); | |
228 | + Date timestamp = calDate(setting, record.getPlanTime(), false); | |
228 | 229 | record.setDeadline(timestamp); |
229 | 230 | }); |
230 | 231 | record.setOutTime(Boolean.FALSE); |
... | ... | @@ -237,7 +238,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
237 | 238 | @Override |
238 | 239 | @Transactional(rollbackFor = Exception.class) |
239 | 240 | public void overdueProcessing(FollowRecord record) { |
240 | - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), record.getId().toString(), record.getPlanTime(),record.getShopId()); | |
241 | + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), record.getId().toString(), record.getPlanTime(), record.getShopId()); | |
241 | 242 | todoRpcService.cancel(dto); |
242 | 243 | boolean bool = this.addTaskRecord(record, true); |
243 | 244 | if (bool) { |
... | ... | @@ -321,7 +322,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
321 | 322 | List<Long> idList = new ArrayList<>(); |
322 | 323 | for (FollowRecord record : list) { |
323 | 324 | if (Boolean.TRUE.equals(record.getAddTodo())) { |
324 | - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(),record.getShopId()); | |
325 | + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId()); | |
325 | 326 | todoRpcService.cancel(dto); |
326 | 327 | } |
327 | 328 | idList.add(record.getId()); |
... | ... | @@ -410,7 +411,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
410 | 411 | return; |
411 | 412 | } |
412 | 413 | for (FollowRecord record : list) { |
413 | - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(),record.getShopId()); | |
414 | + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId()); | |
414 | 415 | todoRpcService.complete(dto); |
415 | 416 | record.setFollowTime(new Date()); |
416 | 417 | record.setOutTime(Boolean.FALSE); |
... | ... | @@ -721,7 +722,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
721 | 722 | * @param origin |
722 | 723 | * @return |
723 | 724 | */ |
724 | - protected Timestamp calDate(SettingVO vo, Date origin, boolean reverse) { | |
725 | + protected Date calDate(SettingVO vo, Date origin, boolean reverse) { | |
725 | 726 | if (vo.getDetailValue() == null || vo.getDetailValue() <= 0) { |
726 | 727 | log.info("关键设置数据异常,请检查数据 : settingType[{}] settingId[{}]", vo.getType(), vo.getId()); |
727 | 728 | return null; |
... | ... | @@ -735,9 +736,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
735 | 736 | if (reverse) { |
736 | 737 | value = -1 * value; |
737 | 738 | } |
738 | - Timestamp expired = DateUtil.getExpired(origin, value, getCalendarType(unit)); | |
739 | - if (SettingUnitEnum.DAY.equals(unit) && !DateUtil.isBeforeDawn(expired)) { | |
740 | - expired = DateUtil.getExpired(DateUtil.startDate(expired), 1, Calendar.DATE); | |
739 | + Date expired = DateUtil.getExpired(origin, value, getCalendarType(unit)); | |
740 | + if (SettingUnitEnum.DAY.equals(unit)) { | |
741 | + expired = DateUtil.startDate(expired); | |
741 | 742 | } |
742 | 743 | return expired; |
743 | 744 | } |
... | ... | @@ -783,9 +784,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
783 | 784 | log.info("关键设置数据异常,请检查数据 : settingType[{}] groupId[{}]", SettingTypeEnum.EFFECTIVE_TIME.getName(), record.getGroupId()); |
784 | 785 | return false; |
785 | 786 | } |
786 | - Date originTime = record.getDeadline(); | |
787 | + Date originTime = DateUtil.startDate(record.getDeadline()); | |
787 | 788 | if (!overdue) { |
788 | - originTime = record.getFollowTime(); | |
789 | + originTime = DateUtil.startDate(record.getFollowTime()); | |
789 | 790 | } |
790 | 791 | Date newTime = calDate(fcsetting.get(), originTime, false); |
791 | 792 | if (Objects.isNull(newTime)) { |
... | ... | @@ -835,13 +836,4 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
835 | 836 | record.setCreateTime(DateUtil.localDateTime2Date(LocalDateTime.now())); |
836 | 837 | return record; |
837 | 838 | } |
838 | - | |
839 | - @Deprecated | |
840 | - private Timestamp getValidTime(SettingVO setting, Date origin) { | |
841 | - Timestamp timestamp = calDate(setting, origin, false); | |
842 | - while (!timestamp.after(DateUtil.localDateTime2Date(LocalDateTime.now()))) { | |
843 | - timestamp = calDate(setting, timestamp, false); | |
844 | - } | |
845 | - return timestamp; | |
846 | - } | |
847 | 839 | } | ... | ... |