Ver código fonte

车牌验证接口

donglang 4 meses atrás
pai
commit
f9ef14c84b

+ 10 - 1
iot-platform-manager/src/main/java/com/platform/manage/WeighbridgeRecordManage.java

@@ -161,9 +161,17 @@ public class WeighbridgeRecordManage {
     public LicensePlateValidateResponse handleValidateLicensePlate(LicensePlateValidateRequest request) {
         log.info("车牌验证, 车牌:{}, 地磅编号:{}, 时间戳:{}", request.getLicensePlate(), request.getWeighbridgeCode(), request.getTimestamp());
         LicensePlateValidateResponse response = new LicensePlateValidateResponse();
+        ValidateLicensePlate validateLicensePlate;
         //查询车牌是不存在
-        ValidateLicensePlate validateLicensePlate = validateLicensePlateService.queryByLicensePlate(request.getLicensePlate(), request.getUuid());
+        try {
+            validateLicensePlate = validateLicensePlateService.queryByLicensePlate(request.getLicensePlate(), request.getUuid());
+        } catch (Exception e) {
+            log.error("识别车牌异常,请重新识别或联系管理员", e);
+            throw new IotException(ErrorCodeEnum.SYSTEM_ERROR, "识别车牌异常,请重新识别或联系管理员: " + e.getMessage());
+        }
+
         if (validateLicensePlate != null) {
+            log.info("识别车牌成功,车辆请上磅");
             response.setStatus(Boolean.TRUE);
             response.setCode(200);
             response.setMessage("识别车牌成功,车辆请上磅");
@@ -174,6 +182,7 @@ public class WeighbridgeRecordManage {
             response.getData().setVoice_message("识别成功,车辆请上磅");
             response.getData().setWarning(null);
         } else {
+            log.info("识别车牌失败");
             response.setStatus(Boolean.FALSE);
             response.setCode(400);
             response.setMessage("识别车牌异常,请重新识别或联系管理员");