|
@@ -2,12 +2,15 @@ package com.ozs.web.controller.sdk;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.ozs.common.core.domain.entity.SysDept;
|
|
|
import com.ozs.common.utils.MinioUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.stateSecrets.SM4Utils;
|
|
|
import com.ozs.common.utils.uuid.IdUtils;
|
|
|
import com.ozs.entity.BaseCameraManagement;
|
|
|
+import com.ozs.entity.BaseRailwayManagement;
|
|
|
import com.ozs.service.BaseCameraManagementService;
|
|
|
+import com.ozs.service.BaseRailwayManagementService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -25,7 +28,7 @@ import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
public class UploadController {
|
|
|
-
|
|
|
+ public static final String PATTERN = "^[0-9]*$";
|
|
|
@Value("${minio.bucketName}")
|
|
|
private String bucketName;
|
|
|
|
|
@@ -35,6 +38,8 @@ public class UploadController {
|
|
|
BaseCameraManagementService baseCameraManagementService;
|
|
|
@Value("${base.imgUrl}")
|
|
|
private String imgUrl;
|
|
|
+ @Autowired
|
|
|
+ private BaseRailwayManagementService baseRailwayManagementService;
|
|
|
|
|
|
|
|
|
@PostMapping("/api/putFile")
|
|
@@ -52,6 +57,29 @@ public class UploadController {
|
|
|
jsonObject.put("data", "不能上传空文件哦");
|
|
|
return jsonObject;
|
|
|
}
|
|
|
+ if (lineDir!=1&&lineDir!=2){
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "行别填写错误");
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+ if (!alarmMile.toString().matches(PATTERN)) {
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "报警里程位置填写格式不正确");
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
+ if (!ObjectUtils.isEmpty(alarmRailway)) {
|
|
|
+ queryWrapper.eq(BaseRailwayManagement::getRailwayCode, alarmRailway);
|
|
|
+ }
|
|
|
+ BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
|
|
|
+ if (ObjectUtils.isEmpty(baseRailwayManagement)){
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "填写的报警线路编码不存在");
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
//图片保存路径
|
|
|
//String fileUploadPath ="/"+userId+"/image";
|
|
|
String uploadFile = null;
|