|
|
@@ -82,4 +82,35 @@ public class WeighbridgePushService {
|
|
|
request.setWeighAmount(record.getWeight());
|
|
|
return request;
|
|
|
}
|
|
|
+
|
|
|
+ public void unloadingPushWeigh(WeighbridgeRecord record) {
|
|
|
+ if (!Boolean.TRUE.equals(weighbridgePushProperties.getEnabled())) {
|
|
|
+ log.debug("外部系统地磅数据推送未启用,跳过推送");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (Objects.isNull(record) || Objects.isNull(record.getId())) {
|
|
|
+ log.warn("外部系统地磅数据推送参数为空,跳过推送");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ BaseResult response = null;
|
|
|
+ try {
|
|
|
+ WaybillOrderProcessParam request = buildPushRequest(record);
|
|
|
+ log.info("外部系统地磅数据推送开始,记录ID: {}, 请求参数: {}",
|
|
|
+ record.getId(), JSON.toJSONString( request));
|
|
|
+ response = weighbridgePushClient.unloadingPushWeigh(request);
|
|
|
+ log.info("外部系统地磅数据推送完成,记录ID: {}, 响应码: {}, 响应消息: {}",
|
|
|
+ record.getId(),
|
|
|
+ Objects.nonNull(response) ? response.getCode() : null,
|
|
|
+ Objects.nonNull(response) ? response.getMessage() : null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("外部系统地磅数据推送异常,记录ID: {}, 车牌号: {}",
|
|
|
+ record.getId(), record.getLicensePlate(), e);
|
|
|
+ throw new IotException("外部系统地磅数据推送异常");
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(response) && !response.isSuccess()){
|
|
|
+ log.error("外部系统地磅数据推送失败,记录ID: {}, 车牌号: {}",
|
|
|
+ record.getId(), record.getLicensePlate());
|
|
|
+ throw new IotException("外部系统地磅数据推送失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|