From fa2ebfb41b354f862fecac18c179a9f9c2539100 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期六, 21 九月 2024 09:26:32 +0800
Subject: [PATCH] #
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
index 8962a76..456e4d9 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
@@ -3,10 +3,13 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
+import com.zy.asrs.framework.common.DateUtils;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wms.asrs.entity.*;
import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType;
import com.zy.asrs.wms.asrs.service.*;
+import com.zy.asrs.wms.system.entity.Dict;
+import com.zy.asrs.wms.system.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -35,6 +38,8 @@
private OrderService orderService;
@Autowired
private OrderDetlService orderDetlService;
+ @Autowired
+ private DictService dictService;
@Scheduled(cron = "0/3 * * * * ? ")
@Transactional
@@ -53,6 +58,7 @@
//淇濆瓨浠诲姟鍘嗗彶妗�
TaskLog taskLog = new TaskLog();
taskLog.sync(task);
+ taskLog.setId(null);
if (!taskLogService.save(taskLog)) {
throw new CoolException("淇濆瓨浠诲姟鍘嗗彶妗eけ璐�");
}
@@ -70,6 +76,8 @@
for (TaskDetl taskDetl : taskDetls) {
TaskDetlLog taskDetlLog = new TaskDetlLog();
taskDetlLog.sync(taskDetl);
+ taskDetlLog.setId(null);
+ taskDetlLog.setTaskId(taskLog.getId());
if (!taskDetlLogService.save(taskDetlLog)) {
throw new CoolException("淇濆瓨浠诲姟鏄庣粏鍘嗗彶妗eけ璐�");
}
@@ -80,6 +88,8 @@
//鏄庣粏鎵╁睍瀛楁鏁版嵁淇濆瓨鑷冲巻鍙叉。
TaskDetlFieldLog taskDetlFieldLog = new TaskDetlFieldLog();
taskDetlFieldLog.sync(detlField);
+ taskDetlFieldLog.setId(null);
+ taskDetlFieldLog.setDetlId(taskDetlLog.getId());
if (!taskDetlFieldLogService.save(taskDetlFieldLog)) {
throw new CoolException("鏄庣粏鎵╁睍瀛楁杞巻鍙叉。妗堝け璐�");
}
@@ -100,6 +110,10 @@
//鏇存柊璁㈠崟淇℃伅
for (TaskDetl taskDetl : taskDetls) {
+ if (taskDetl.getDetlId() == null) {
+ continue;
+ }
+
OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId());
if (orderDetl == null) {
throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦�");
@@ -145,18 +159,31 @@
public void outExecute() {
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
try {
- //鑾峰彇鍏ュ簱瀹屾垚浠诲姟
- List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 200));
+ //鑾峰彇鍑哄簱瀹屾垚浠诲姟
+ List<Task> list = taskService.list(new LambdaQueryWrapper<Task>()
+ .eq(Task::getTaskSts, 200)
+ .in(Task::getTaskType, 101, 53, 57));
if (list.isEmpty()) {
return;
}
+ Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "taskLogDiffDays").eq(Dict::getStatus, 1));
+ if(dict == null) {
+ return;
+ }
for (Task task : list) {
+ int diff = DateUtils.diff(task.getCreateTime(), new Date());
+ int taskLogDiffDays = Integer.parseInt(dict.getValue());
+ if (diff < taskLogDiffDays) {
+ continue;
+ }
+
Long hostId = task.getHostId();
//淇濆瓨浠诲姟鍘嗗彶妗�
TaskLog taskLog = new TaskLog();
taskLog.sync(task);
+ taskLog.setId(null);
if (!taskLogService.save(taskLog)) {
throw new CoolException("淇濆瓨浠诲姟鍘嗗彶妗eけ璐�");
}
@@ -174,6 +201,8 @@
for (TaskDetl taskDetl : taskDetls) {
TaskDetlLog taskDetlLog = new TaskDetlLog();
taskDetlLog.sync(taskDetl);
+ taskDetlLog.setId(null);
+ taskDetlLog.setTaskId(taskLog.getId());
if (!taskDetlLogService.save(taskDetlLog)) {
throw new CoolException("淇濆瓨浠诲姟鏄庣粏鍘嗗彶妗eけ璐�");
}
@@ -184,6 +213,8 @@
//鏄庣粏鎵╁睍瀛楁鏁版嵁淇濆瓨鑷冲巻鍙叉。
TaskDetlFieldLog taskDetlFieldLog = new TaskDetlFieldLog();
taskDetlFieldLog.sync(detlField);
+ taskDetlFieldLog.setId(null);
+ taskDetlFieldLog.setDetlId(taskDetlLog.getId());
if (!taskDetlFieldLogService.save(taskDetlFieldLog)) {
throw new CoolException("鏄庣粏鎵╁睍瀛楁杞巻鍙叉。妗堝け璐�");
}
@@ -204,6 +235,10 @@
//鏇存柊璁㈠崟淇℃伅
for (TaskDetl taskDetl : taskDetls) {
+ if (taskDetl.getDetlId() == null) {
+ continue;
+ }
+
OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId());
if (orderDetl == null) {
throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦�");
--
Gitblit v1.9.1