From da7a4d799034ca244467665827bae91ca3c0252c Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 16 八月 2024 10:31:55 +0800
Subject: [PATCH] feat:数据中心展示
---
ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
index a6c611b..b2fbbba 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
@@ -80,6 +80,9 @@
workOrderList.stream().filter(item -> {
return StringUtils.hasText(item.getSerialNumber()) && Objects.nonNull(item.getStatus()) && StringUtils.hasText(item.getErrorType());
});
+ if (CollectionUtils.isEmpty(workOrderList)) {
+ return Boolean.TRUE;
+ }
List<String> serialNumberList = workOrderList.stream().map(WorkOrder::getSerialNumber).collect(Collectors.toList());
// 鏌ュ嚭鏁版嵁搴撲腑鍥芥爣鐮佸搴旂殑鏈畬鎴愮殑宸ュ崟
List<WorkOrder> inDatabaseWorkOrderList = new LambdaQueryChainWrapper<>(baseMapper)
@@ -102,6 +105,8 @@
errorType = errorType + "," + workOrder.getErrorType();
databaseWorkOrder.setErrorType(errorType);
databaseWorkOrder.setStatus(WorkOrderStatusEnum.DISTRIBUTED);
+ Date now = new Date();
+ databaseWorkOrder.setUpdateTime(now);
baseMapper.updateById(databaseWorkOrder);
updateNum++;
// 鍚屾椂鏂板涓�涓繍缁村鐞嗕俊鎭紝琛ㄦ槑姝ゅ伐鍗曡璋冩暣 TODO
@@ -122,8 +127,14 @@
// 鏌ュ嚭閲嶇偣鐐逛綅銆佹櫘閫氱偣浣嶇殑澶勭悊鏃堕棿
SysConfig important = configMapper.checkConfigKeyUnique("important.wordkorder.time");
SysConfig normal = configMapper.checkConfigKeyUnique("normal.wordkorder.alarm.time");
+ // 濡傛灉鍗冲皢鐢熸垚宸ュ崟锛屼絾鏄澶囧浗鏍囩爜鏌ヤ笉鍒扮偣浣嶏紝鍒欎笉娣诲姞锛�
+ List<WorkOrder> notAddList = new ArrayList<>();
for (WorkOrder workOrder : waitAddList) {
YwPoint point = pointMapping.get(workOrder.getSerialNumber());
+ if (Objects.isNull(point)) {
+ notAddList.add(workOrder);
+ continue;
+ }
workOrder.setWorkOrderNo(IdUtils.timeAddRandomNO(5));
workOrder.setUnitId(Math.toIntExact(point.getUnitId()));
if (point.getImportantTag() || point.getImportantCommandImageTag()) {
@@ -131,6 +142,10 @@
} else {
workOrder.setProcessingPeriod(Integer.valueOf(normal.getConfigValue()));
}
+ }
+ waitAddList.removeAll(notAddList);
+ if (CollectionUtils.isEmpty(waitAddList)) {
+ return Boolean.TRUE;
}
this.saveBatch(waitAddList);
// 濡傛灉鏄洿鎺ヤ笅鍙戯紝娣诲姞涓嬪彂璁板綍
@@ -140,6 +155,9 @@
workOrderDistributeRecord.setWorkOrderId(item.getId());
workOrderDistributeRecord.setDistributeWay(WorkOrderDistributeWayEnum.DIRECT_DISTRIBUTE);
workOrderDistributeRecord.setUserId(1L);
+ Date now = new Date();
+ workOrderDistributeRecord.setCreateTime(now);
+ workOrderDistributeRecord.setUpdateTime(now);
return workOrderDistributeRecord;
}).collect(Collectors.toList());
workOrderDistributeRecordMapper.insertBatch(distributedRecordList);
@@ -159,6 +177,9 @@
entity.setWorkOrderNo(IdUtils.timeAddRandomNO(5));
entity.setCreateTime(DateUtils.getNowDate());
entity.setStatus(WorkOrderStatusEnum.WAIT_DISTRIBUTE);
+ Date now = new Date();
+ entity.setCreateTime(now);
+ entity.setUpdateTime(now);
if(baseMapper.insert(entity) > 0) {
return Result.ok("娣诲姞鎴愬姛");
}
@@ -174,10 +195,11 @@
public Result update(WorkOrderForm form) {
WorkOrder entity = baseMapper.selectById(form.getId());
-
// 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
BeanUtils.copyProperties(form, entity);
+ Date now = new Date();
+ entity.setUpdateTime(now);
if (baseMapper.updateById(entity) > 0) {
return Result.ok("淇敼鎴愬姛");
}
--
Gitblit v1.8.0