|
@@ -15,6 +15,8 @@ import com.ozs.service.entity.MsgAlarm;
|
|
|
import com.ozs.service.service.BaseCameraManagementService;
|
|
|
import com.ozs.service.service.BaseRailwayManagementService;
|
|
|
import com.ozs.service.service.MsgAlarmService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -36,6 +38,7 @@ import java.util.Map;
|
|
|
@RestController
|
|
|
public class UploadController {
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(UploadController.class);
|
|
|
@Value("${minio.bucketName}")
|
|
|
private String bucketName;
|
|
|
|
|
@@ -145,13 +148,25 @@ public class UploadController {
|
|
|
}
|
|
|
//"/"+railwayName+"/"+installMiles+"/"+ LocalDate.now().getYear() +"/"+ LocalDate.now().getMonthValue() +"/"+LocalDate.now().getDayOfMonth()+ "/"+ LocalTime.now().getHour()
|
|
|
BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(wrapper);
|
|
|
+ if (ObjectUtils.isEmpty(baseCameraManagement)) {
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "没有该相机编码的相机");
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
String filename = cameraCode + "-" +
|
|
|
DateTime.now().toString("yyyyMMddHHmmss") + stream.getOriginalFilename().substring(stream.getOriginalFilename().lastIndexOf("."));
|
|
|
BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(new LambdaQueryWrapper<BaseRailwayManagement>()
|
|
|
.eq(BaseRailwayManagement::getRailwayCode, baseCameraManagement.getRailwayCode()));
|
|
|
+ if (ObjectUtils.isEmpty(baseRailwayManagement)) {
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "该相机编码没有线路名称");
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
String imgName = "alarm_picture"+ "/"+baseRailwayManagement.getRailwayName() + "/" + AppendUtils.stringAppend(baseCameraManagement.getInstallMile()) + "/" + LocalDate.now().getYear() + "/" + LocalDate.now().getMonthValue() + "/" + LocalDate.now().getDayOfMonth() + "/" + LocalTime.now().getHour() + "/" + filename;
|
|
|
minioUtils.minIoClientUpload(stream.getInputStream(), imgName);
|
|
|
- uploadFile = imgUrl +"alarm_picture"+ "/" + baseRailwayManagement.getRailwayName() + "/" + AppendUtils.stringAppend(baseCameraManagement.getInstallMile()) + "/" + LocalDate.now().getYear() + "/" + LocalDate.now().getMonthValue() + "/" + LocalDate.now().getDayOfMonth() + "/" + LocalTime.now().getHour() + "/" + filename;
|
|
|
+ uploadFile = imgUrl +"/alarm_picture"+ "/" + baseRailwayManagement.getRailwayName() + "/" + AppendUtils.stringAppend(baseCameraManagement.getInstallMile()) + "/" + LocalDate.now().getYear() + "/" + LocalDate.now().getMonthValue() + "/" + LocalDate.now().getDayOfMonth() + "/" + LocalTime.now().getHour() + "/" + filename;
|
|
|
}
|
|
|
} else {
|
|
|
jsonObject.put("resultCode", 2);
|