|
@@ -196,14 +196,10 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
|
|
|
@GetMapping("/alarm/{id}")
|
|
|
@ApiOperation("报警推送假数据")
|
|
|
- public String alarm(@PathVariable Long id) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
+ public AjaxResult alarm(@PathVariable Long id) {
|
|
|
MsgAlarmTemporary msgAlarmTemporary = msgAlarmTemporaryService.getById(id);
|
|
|
if (msgAlarmTemporary.getStare()==2){
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "数据已模拟,不能再次使用");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("数据已模拟,不能再次使用");
|
|
|
}
|
|
|
ReqMsgAlarmVo reqMsgAlarmVo = new ReqMsgAlarmVo();
|
|
|
com.ozs.common.utils.bean.BeanUtils.copyProperties(msgAlarmTemporary, reqMsgAlarmVo);
|
|
@@ -216,23 +212,14 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
reqMsgAlarmVo.setFiles(files2);
|
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmAttr())) {
|
|
|
if (!reqMsgAlarmVo.getAlarmAttr().matches(PATTERN)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "你填写的报警病害属性不符合规则!!!");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("你填写的报警病害属性不符合规则!!!");
|
|
|
}
|
|
|
}
|
|
|
if (!reqMsgAlarmVo.getAlarmMile().toString().matches(PATTERNS)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "报警里程位置填写错误");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("报警里程位置填写错误");
|
|
|
}
|
|
|
if (reqMsgAlarmVo.getLineDir() != 1 && reqMsgAlarmVo.getLineDir() != 2) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "行别填写错误");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("行别填写错误");
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmRailway())) {
|
|
@@ -240,34 +227,19 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
}
|
|
|
BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
|
|
|
if (ObjectUtils.isEmpty(baseRailwayManagement)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "填写的报警线路编码不存在");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("填写的报警线路编码不存在");
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmId())) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "报警的唯一标识不能为空");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("报警的唯一标识不能为空");
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmTime())) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "报警时间不能为空");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("报警时间不能为空");
|
|
|
}
|
|
|
if (reqMsgAlarmVo.getAlarmType() < 1 || reqMsgAlarmVo.getAlarmType() > 3) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "报警病害类型填写错误");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("报警病害类型填写错误");
|
|
|
}
|
|
|
if (!reqMsgAlarmVo.getAlarmLevel().toString().matches(PATTERNS)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "报警级别填写错误");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("报警级别填写错误");
|
|
|
}
|
|
|
if (reqMsgAlarmVo.getAlarmTime().toString().length() == 10) {
|
|
|
reqMsgAlarmVo.setAlarmTime(reqMsgAlarmVo.getAlarmTime() * 1000);
|
|
@@ -282,10 +254,7 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
}
|
|
|
List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper);
|
|
|
if (baseCameraManagementList.size() <= 0) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "报警里程位置没有可用的相机!!!");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("报警里程位置没有可用的相机!!!");
|
|
|
}
|
|
|
LambdaQueryWrapper<MsgAlarm> lw = new LambdaQueryWrapper<MsgAlarm>();
|
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmId())) {
|
|
@@ -308,16 +277,10 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
if (files1.length > 0) {
|
|
|
for (int i = 0; i < files1.length; i++) {
|
|
|
if (ObjectUtils.isEmpty(files1[i].fileUrl)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "上传文件地址不能为空");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("上传文件地址不能为空");
|
|
|
}
|
|
|
if (files1[i].fileType < 1 || files1[i].fileType > 3) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "文件类型填写错误");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("文件类型填写错误");
|
|
|
}
|
|
|
MsgAlarmExt msgAlarmExt = new MsgAlarmExt();
|
|
|
msgAlarmExt.setAlarmId(msgAlarm.getAlarmId());
|
|
@@ -340,22 +303,13 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
baseCameraManagement.setTaskId(start);
|
|
|
baseCameraManagement.setUpdateBy(admin.getUserId());
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "视频录制失败:请确认流是否存在!!!");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("视频录制失败:请确认流是否存在!!!");
|
|
|
}
|
|
|
if (!baseCameraManagementService.updateById(baseCameraManagement)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "开启录制视频失败!!!");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("开启录制视频失败!!!");
|
|
|
}
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "视频邀约失败,视频中心没有该相机编码或通道编码的摄像头!!!");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.error("视频邀约失败,视频中心没有该相机编码或通道编码的摄像头!!!");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -367,11 +321,8 @@ public class MsgAlarmTemporaryController extends BaseController {
|
|
|
msgAlarmVice.setRailwayCode(reqMsgAlarmVo.getAlarmRailway());
|
|
|
msgAlarmFrequencyService.save(msgAlarmVice);
|
|
|
}
|
|
|
- jsonObject.put("resultCode", 1);
|
|
|
- jsonObject.put("message", "ok");
|
|
|
- jsonObject.put("data", null);
|
|
|
msgAlarmTemporary.setStare(2);
|
|
|
msgAlarmTemporaryService.updateById(msgAlarmTemporary);
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
}
|