|
@@ -161,7 +161,7 @@ public class WeighbridgeRecordManage {
|
|
|
data.setVoice_message("数据上报成功");
|
|
data.setVoice_message("数据上报成功");
|
|
|
licensePlateValidateResponse.setData(data);
|
|
licensePlateValidateResponse.setData(data);
|
|
|
log.info("地磅数据保存成功 - ID: {}, 车牌: {}", record.getId(), record.getLicensePlate());
|
|
log.info("地磅数据保存成功 - ID: {}, 车牌: {}", record.getId(), record.getLicensePlate());
|
|
|
- if (StringUtils.equals(WeighbridgeYsEnum.NO2.getCode(),record.getWeighbridgeCode())){
|
|
|
|
|
|
|
+ if (StringUtils.equals(WeighbridgeYsEnum.NO1.getCode(),record.getWeighbridgeCode())){
|
|
|
externalWeighbridgePushService.pushWeighbridgeRecord(record);
|
|
externalWeighbridgePushService.pushWeighbridgeRecord(record);
|
|
|
}else {
|
|
}else {
|
|
|
//todo 推送下山地磅数据
|
|
//todo 推送下山地磅数据
|
|
@@ -204,7 +204,7 @@ public class WeighbridgeRecordManage {
|
|
|
photoUrls != null ? photoUrls.split(",").length : 0);
|
|
photoUrls != null ? photoUrls.split(",").length : 0);
|
|
|
record.setPhotoUrls(photoUrls);
|
|
record.setPhotoUrls(photoUrls);
|
|
|
// 更新数据库中的图片URL
|
|
// 更新数据库中的图片URL
|
|
|
- updatePhotoUrls(record.getId(), photoUrls);
|
|
|
|
|
|
|
+ updatePhotoUrls(record.getId(), photoUrls,record.getLicensePlate());
|
|
|
})
|
|
})
|
|
|
.exceptionally(throwable -> {
|
|
.exceptionally(throwable -> {
|
|
|
log.error("异步上传图片失败,车牌号: {}", request.getLicensePlate(), throwable);
|
|
log.error("异步上传图片失败,车牌号: {}", request.getLicensePlate(), throwable);
|
|
@@ -221,7 +221,7 @@ public class WeighbridgeRecordManage {
|
|
|
log.info("Base64图片保存完成,车牌号: {},照片数量: {}", request.getLicensePlate(),
|
|
log.info("Base64图片保存完成,车牌号: {},照片数量: {}", request.getLicensePlate(),
|
|
|
photoUrls != null ? photoUrls.split(",").length : 0);
|
|
photoUrls != null ? photoUrls.split(",").length : 0);
|
|
|
record.setPhotoUrls(photoUrls);
|
|
record.setPhotoUrls(photoUrls);
|
|
|
- updatePhotoUrls(record.getId(), photoUrls);
|
|
|
|
|
|
|
+ updatePhotoUrls(record.getId(), photoUrls, request.getLicensePlate());
|
|
|
})
|
|
})
|
|
|
.exceptionally(throwable -> {
|
|
.exceptionally(throwable -> {
|
|
|
log.error("异步保存Base64图片失败,车牌号: {}", request.getLicensePlate(), throwable);
|
|
log.error("异步保存Base64图片失败,车牌号: {}", request.getLicensePlate(), throwable);
|
|
@@ -299,7 +299,7 @@ public class WeighbridgeRecordManage {
|
|
|
/**
|
|
/**
|
|
|
* 异步更新图片URL
|
|
* 异步更新图片URL
|
|
|
*/
|
|
*/
|
|
|
- private void updatePhotoUrls(Long recordId, String photoUrls) {
|
|
|
|
|
|
|
+ private void updatePhotoUrls(Long recordId, String photoUrls,String licensePlate) {
|
|
|
// 更新记录的图片URL
|
|
// 更新记录的图片URL
|
|
|
String processedPhotoUrls = processImagePaths(photoUrls);
|
|
String processedPhotoUrls = processImagePaths(photoUrls);
|
|
|
log.info("处理前的图片路径-原图url: {},处理图片路径 - 图片URL: {}", photoUrls, processedPhotoUrls);
|
|
log.info("处理前的图片路径-原图url: {},处理图片路径 - 图片URL: {}", photoUrls, processedPhotoUrls);
|
|
@@ -308,6 +308,9 @@ public class WeighbridgeRecordManage {
|
|
|
updateRecord.setPhotoUrls(processedPhotoUrls);
|
|
updateRecord.setPhotoUrls(processedPhotoUrls);
|
|
|
log.info("更新图片URL - ID: {}, 图片URL: {}", recordId, processedPhotoUrls);
|
|
log.info("更新图片URL - ID: {}, 图片URL: {}", recordId, processedPhotoUrls);
|
|
|
weighbridgeRecordService.updateById(updateRecord);
|
|
weighbridgeRecordService.updateById(updateRecord);
|
|
|
|
|
+
|
|
|
|
|
+ //开始将地磅数据推送到外部系统 todo 目前先在图片上传完成后推送,后续可以调整为上报数据成功后立即推送,图片URL作为后续补充信息推送
|
|
|
|
|
+ externalWeighbridgePushService.pushWeighbridgeUrlRecord(licensePlate,photoUrls);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -711,4 +714,43 @@ public class WeighbridgeRecordManage {
|
|
|
response.setData(data);
|
|
response.setData(data);
|
|
|
return response;
|
|
return response;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public LicensePlateValidateResponse manualWeighBridgePushV2(Integer id) {
|
|
|
|
|
+ log.info("开始处理手动称重推送,记录ID:{}", id);
|
|
|
|
|
+
|
|
|
|
|
+ // 1. 校验参数合法性
|
|
|
|
|
+ if (Objects.isNull(id)) {
|
|
|
|
|
+ log.warn("手动称重推送参数校验失败,记录ID为空");
|
|
|
|
|
+ throw new IotException("手动称重推送参数不合法,id为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 查询地磅记录
|
|
|
|
|
+ WeighbridgeRecord weighbridgeRecord = weighbridgeRecordService.getById(id);
|
|
|
|
|
+ if (Objects.isNull(weighbridgeRecord)) {
|
|
|
|
|
+ log.warn("手动称重推送查询记录失败,未找到ID为 {} 的地磅记录数据", id);
|
|
|
|
|
+ throw new IotException("手动称重推送失败,数据不存在,ID: " + id);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("查询到地磅记录 - ID: {}, 车牌: {}, 地磅编号: {}, 重量: {}",
|
|
|
|
|
+ weighbridgeRecord.getId(), weighbridgeRecord.getLicensePlate(), weighbridgeRecord.getWeighbridgeCode(), weighbridgeRecord.getWeight());
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 调用外部服务推送记录
|
|
|
|
|
+ try {
|
|
|
|
|
+ log.info("开始调用外部服务推送地磅记录,ID: {}", id);
|
|
|
|
|
+ externalWeighbridgePushService.pushWeighbridgeRecord(weighbridgeRecord);
|
|
|
|
|
+ log.info("外部服务推送地磅记录成功,ID: {}", id);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("手动称重推送外部服务调用异常,记录ID: {}, 车牌: {}", id, weighbridgeRecord.getLicensePlate(), e);
|
|
|
|
|
+ throw new IotException("手动称重推送异常,ID: " + id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 4. 构造成功响应
|
|
|
|
|
+ LicensePlateValidateResponse licensePlateValidateResponse = new LicensePlateValidateResponse();
|
|
|
|
|
+ licensePlateValidateResponse.setStatus(true);
|
|
|
|
|
+ licensePlateValidateResponse.setCode(200);
|
|
|
|
|
+ licensePlateValidateResponse.setMessage("手动称重推送成功");
|
|
|
|
|
+ licensePlateValidateResponse.setData(new LicensePlateValidateResponse.Data());
|
|
|
|
|
+ log.info("手动称重推送处理完成,返回成功响应,记录ID: {}", id);
|
|
|
|
|
+
|
|
|
|
|
+ return licensePlateValidateResponse;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|