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 | 18 +++++++++++++++++-
1 files changed, 17 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 3899c27..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
@@ -128,6 +133,7 @@
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()));
@@ -138,6 +144,9 @@
}
}
waitAddList.removeAll(notAddList);
+ if (CollectionUtils.isEmpty(waitAddList)) {
+ return Boolean.TRUE;
+ }
this.saveBatch(waitAddList);
// 濡傛灉鏄洿鎺ヤ笅鍙戯紝娣诲姞涓嬪彂璁板綍
if (WorkOrderStatusEnum.DISTRIBUTED.equals(waitAddList.get(0).getStatus())) {
@@ -146,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);
@@ -165,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("娣诲姞鎴愬姛");
}
@@ -180,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