根据订单编号获取航线文件

修改订单状态逻辑,实现超时逻辑根据drone_flight状态更新任务状态,当主动点击已到达则直接修改订单状态
This commit is contained in:
2025-04-10 09:36:33 +08:00
parent c727fc0c1f
commit 178ed9fc02
6 changed files with 252 additions and 112 deletions
+5
View File
@@ -94,6 +94,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.25</version>
</dependency>
</dependencies>
<build>
@@ -126,7 +126,6 @@ public class ApiDeviceController {
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(controlMessageConstant.CONTROL_MESSAGE_MAP.get(control), JsonObject.class);
JsonObject data = jsonObject.getAsJsonObject("data");
// 设置订单信息
data.addProperty("order_no", orderNo);
@@ -134,7 +133,7 @@ public class ApiDeviceController {
Map<String, Object> wayResult = orderCenterService.getWaylineByOrderNo(orderNo);
String waylineFilePath = MapUtil.getStrValue(wayResult, "waylineFilePath");
String waylineId = MapUtil.getStrValue(wayResult, "waylineId");
log.info("waylineFilePath:{}, waylineId:{}", waylineFilePath, waylineId);
data.addProperty("wayline_link_url", waylineFilePath);
LineFile lineFile = lineFileService.findLineFileByWaylineId(waylineId);
Assert.notNull(lineFile,"航线文件签名不正确");
@@ -28,7 +28,7 @@ public class DeviceImportListener implements ReadListener<AgeDeviceExcel> {
validateData(data);
// 转换为实体
AgeDevice device = data.convertToDevice();
AgeDevice device = data.toDevice();
// 设置默认值
if (device.getCreateTime() == null) {
@@ -11,7 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.collection.CollUtil;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
@@ -68,15 +68,18 @@ public class AgeDeviceServiceImpl extends SuperServiceImpl<AgeDeviceMapper, AgeD
@Transactional(rollbackFor = Exception.class)
@Override
public boolean importDevices(List<AgeDevice> deviceList) {
if (CollUtil.isEmpty(deviceList)) {
if (CollectionUtils.isEmpty(deviceList)) {
return false;
}
try {
// 批量保存,每批100条
int batchSize = 100;
List<List<AgeDevice>> partition = CollUtil.partition(deviceList, batchSize);
for (List<AgeDevice> batch : partition) {
int totalSize = deviceList.size();
for (int i = 0; i < totalSize; i += batchSize) {
int endIndex = Math.min(i + batchSize, totalSize);
List<AgeDevice> batch = deviceList.subList(i, endIndex);
this.saveBatch(batch, batchSize);
}
return true;