|
|
@@ -1,9 +1,13 @@
|
|
|
package com.platform.manage;
|
|
|
|
|
|
+import com.platform.api.request.LicensePlateValidateRequest;
|
|
|
import com.platform.api.request.WeighbridgePushRequest;
|
|
|
+import com.platform.entity.ValidateLicensePlate;
|
|
|
import com.platform.entity.WeighbridgeRecord;
|
|
|
import com.platform.enums.ErrorCodeEnum;
|
|
|
import com.platform.exception.IotException;
|
|
|
+import com.platform.response.LicensePlateValidateResponse;
|
|
|
+import com.platform.service.ValidateLicensePlateService;
|
|
|
import com.platform.service.WeighbridgeRecordService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -27,6 +31,8 @@ public class WeighbridgeRecordManage {
|
|
|
|
|
|
private final WeighbridgeRecordService weighbridgeRecordService;
|
|
|
|
|
|
+ private final ValidateLicensePlateService validateLicensePlateService;
|
|
|
+
|
|
|
/**
|
|
|
* 处理地磅过磅数据上报
|
|
|
* @param request 地磅上报请求参数
|
|
|
@@ -121,4 +127,39 @@ public class WeighbridgeRecordManage {
|
|
|
throw new IotException(ErrorCodeEnum.PARAM_ERROR, "时间戳格式错误,仅支持10位秒级或13位毫秒级时间戳");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 车牌验证
|
|
|
+ * @param request 地磅上报请求参数
|
|
|
+ * @return 是否保存成功
|
|
|
+ */
|
|
|
+ public LicensePlateValidateResponse handleValidateLicensePlate(LicensePlateValidateRequest request) {
|
|
|
+ log.info("车牌验证, 车牌:{}, 地磅编号:{}, 时间戳:{}", request.getLicensePlate(), request.getWeighbridgeCode(), request.getTimestamp());
|
|
|
+ LicensePlateValidateResponse response = new LicensePlateValidateResponse();
|
|
|
+ //查询车牌是不存在
|
|
|
+ ValidateLicensePlate validateLicensePlate = validateLicensePlateService.queryByLicensePlate(request.getLicensePlate());
|
|
|
+ if (validateLicensePlate != null) {
|
|
|
+ response.setStatus(Boolean.TRUE);
|
|
|
+ response.setCode(200);
|
|
|
+ response.setMessage("上报成功,请放行");
|
|
|
+
|
|
|
+ response.setData(new LicensePlateValidateResponse.Data());
|
|
|
+ response.getData().setTimestamp(System.currentTimeMillis());
|
|
|
+ response.getData().setScreen_message("车辆请下磅");
|
|
|
+ response.getData().setVoice_message("车辆请下磅");
|
|
|
+ response.getData().setWarning(null);
|
|
|
+ } else {
|
|
|
+ response.setStatus(Boolean.FALSE);
|
|
|
+ response.setCode(400);
|
|
|
+ response.setMessage("上报异常,请稍后");
|
|
|
+
|
|
|
+ response.setData(new LicensePlateValidateResponse.Data());
|
|
|
+ response.getData().setTimestamp(System.currentTimeMillis());
|
|
|
+ response.getData().setScreen_message("数据上报异常,请联系管理员");
|
|
|
+ response.getData().setVoice_message("数据上报异常,请联系管理员");
|
|
|
+ response.getData().setWarning(null);
|
|
|
+ }
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
}
|