Ver Fonte

提交修改地磅接口校验

chenxiaofei há 4 meses atrás
pai
commit
fe5d83d0fd

+ 5 - 4
iot-platform-manager/src/main/java/com/platform/api/controller/WeighbridgeController.java

@@ -14,6 +14,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.math.BigDecimal;
 
+
 /**
  * 地磅数据上报接口
  * @author cxf
@@ -33,10 +34,10 @@ public class WeighbridgeController {
     @Operation(summary = "地磅过磅数据上报", description = "接收地磅设备上报的过磅数据和图片")
     @PostMapping("/weighBridgePush")
     public LicensePlateValidateResponse weighBridgePush(
-            @Parameter(description = "车牌号", required = true) @RequestParam("licensePlate") String licensePlate,
-            @Parameter(description = "地磅编号", required = true) @RequestParam("weighbridgeCode") String weighbridgeCode,
-            @Parameter(description = "称重重量(吨)", required = true) @RequestParam("grossWeight") BigDecimal grossWeight,
-            @Parameter(description = "时间戳(秒或毫秒)", required = true) @RequestParam("timestamp") Long timestamp,
+            @Parameter(description = "车牌号") @RequestParam("licensePlate") String licensePlate,
+            @Parameter(description = "地磅编号") @RequestParam("weighbridgeCode") String weighbridgeCode,
+            @Parameter(description = "称重重量(吨)") @RequestParam("grossWeight") BigDecimal grossWeight,
+            @Parameter(description = "时间戳(秒或毫秒)") @RequestParam("timestamp") Long timestamp,
             @Parameter(description = "处理标签") @RequestParam(value = "tag", required = false) String tag,
             @Parameter(description = "车辆照片") @RequestParam(value = "images[]", required = false) MultipartFile[] images
     ) {

+ 3 - 0
iot-platform-manager/src/main/java/com/platform/api/manager/WeighbridgeRecordManage.java

@@ -56,6 +56,9 @@ public class WeighbridgeRecordManage {
                 request.getGrossWeight(), 
                 request.getTimestamp());
         LicensePlateValidateResponse licensePlateValidateResponse = new LicensePlateValidateResponse();
+        if (StringUtils.isAnyBlank(request.getLicensePlate(), request.getWeighbridgeCode()) || Objects.isNull(request.getGrossWeight()) || Objects.isNull(request.getTimestamp())) {
+            return getLicensePlateValidateResponse(request, licensePlateValidateResponse);
+        }
         //查询车牌是否在验证列表中
         ValidateLicensePlate validateLicensePlate = validateLicensePlateService.queryByLicensePlate(request.getLicensePlate());
         try {

+ 0 - 0
iot-platform-manager/src/main/resources/log4j2.xml