From 113457a42a77a5315111ef2f533348420fafd481 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Sun, 20 Aug 2023 17:10:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BB=BB=E5=8A=A1=E7=9B=B8?= =?UTF-8?q?=E4=BA=92=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inv/DeviceInspectTakeController.java | 2 +- .../api/dao/inv/DeviceInspectTaskMapper.java | 7 ++-- .../glxp/api/service/sync/HeartService.java | 35 +++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inv/DeviceInspectTakeController.java b/src/main/java/com/glxp/api/controller/inv/DeviceInspectTakeController.java index 48444291..9091a121 100644 --- a/src/main/java/com/glxp/api/controller/inv/DeviceInspectTakeController.java +++ b/src/main/java/com/glxp/api/controller/inv/DeviceInspectTakeController.java @@ -110,7 +110,7 @@ public class DeviceInspectTakeController extends BaseController { @PostMapping("/udiwms/inv/device/inspect/take/delectDeviceInspecTake") public BaseResponse delectDeviceInspecTake(@RequestBody DeviceInspectTaskEntity deviceInspectTaskEntity) { - deviceInspectTaskService.delectDeviceInspectTask(deviceInspectTaskEntity); + deviceInspectTaskService.removeById(deviceInspectTaskEntity.getId()); deviceInspectTaskDetailService.remove(new QueryWrapper().eq("taskOrderIdFk", deviceInspectTaskEntity.getOrderId())); UploadDeviceTake(deviceInspectTaskEntity.getId(), 3); BasicDataRequest basicDataRequest = new BasicDataRequest(); diff --git a/src/main/java/com/glxp/api/dao/inv/DeviceInspectTaskMapper.java b/src/main/java/com/glxp/api/dao/inv/DeviceInspectTaskMapper.java index acbf6c70..9a796cc6 100644 --- a/src/main/java/com/glxp/api/dao/inv/DeviceInspectTaskMapper.java +++ b/src/main/java/com/glxp/api/dao/inv/DeviceInspectTaskMapper.java @@ -1,6 +1,8 @@ package com.glxp.api.dao.inv; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity; import com.glxp.api.entity.inv.DeviceInspectTaskEntity; import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest; import com.glxp.api.req.inv.FilterDeviceInspectTakeRequest; @@ -11,7 +13,6 @@ import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper -public interface DeviceInspectTaskMapper extends BaseMapper { - +public interface DeviceInspectTaskMapper extends BaseMapperPlus { List filterList(FilterDeviceInspectTakeRequest filterDeviceInspectTakeRequest); -} \ No newline at end of file +} diff --git a/src/main/java/com/glxp/api/service/sync/HeartService.java b/src/main/java/com/glxp/api/service/sync/HeartService.java index f6f283a2..278b782b 100644 --- a/src/main/java/com/glxp/api/service/sync/HeartService.java +++ b/src/main/java/com/glxp/api/service/sync/HeartService.java @@ -17,6 +17,8 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.*; import com.glxp.api.dao.basic.*; import com.glxp.api.dao.inout.*; +import com.glxp.api.dao.inv.DeviceInspectTaskDetailMapper; +import com.glxp.api.dao.inv.DeviceInspectTaskMapper; import com.glxp.api.dao.purchase.*; import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao; import com.glxp.api.dto.RelaySyncDto; @@ -1695,6 +1697,10 @@ public class HeartService { case DOCUMENT_TYPE_DATA: this.insertDocumentTypeData(bean.getFileContent()); break; + + case DEVICE_TASK: + this.insertDevTaskData(bean.getFileContent()); + break; } String taskId = bean.getTaskId(); if (StrUtil.isNotBlank(taskId)) { @@ -1848,6 +1854,35 @@ public class HeartService { } } + @Resource + DeviceInspectTaskMapper deviceInspectTaskMapper; + @Resource + DeviceInspectTaskDetailMapper deviceInspectTaskDetailMapper; + + /** + * 插入设备任务更新数据 + */ + @Transactional(propagation = Propagation.NESTED) + public void insertDevTaskData(String content) { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content); + List deviceInspectTaskEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceInspectTaskEntity.class.getSimpleName()), DeviceInspectTaskEntity.class); + List deviceInspectTaskDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceInspectTaskDetailEntity.class.getSimpleName()), DeviceInspectTaskDetailEntity.class); + if (CollectionUtil.isNotEmpty(deviceInspectTaskEntities)) { + for (DeviceInspectTaskEntity deviceInspectTaskEntity : deviceInspectTaskEntities) { + deviceInspectTaskEntity.setUpdateTime(null); + } + deviceInspectTaskMapper.replaceBatchs(deviceInspectTaskEntities); + } + if (CollectionUtil.isNotEmpty(deviceInspectTaskDetailEntities)) { + deviceInspectTaskDetailMapper.replaceBatchs(deviceInspectTaskDetailEntities); + } + + List syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class); + if (CollUtil.isNotEmpty(syncFiles)) { + fileService.download(syncFiles); + } + } + /** * 从UDI自助平台拉取基础数据 */