|
@@ -841,23 +841,19 @@ public class GeoHazardMonitorTokenController {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
log.info("token:{}", token);
|
|
|
log.info("parameter:{}", parameterVo);
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
+ AjaxResult ajaxResult1 = null;
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
|
String key = split[split.length - 1];
|
|
|
if (ObjectUtils.isEmpty(parameterVo)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "parameterVo参数不能为空");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "parameterVo参数不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
|
CameraVo cameraVo = JSON.parseObject(s, CameraVo.class);
|
|
|
if (ObjectUtils.isEmpty(cameraVo.getTerminalCode())) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "车载终端编码不能为空");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "车载终端编码不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<>();
|
|
|
if (!ObjectUtils.isEmpty(cameraVo.getLineDir())) {
|
|
@@ -869,10 +865,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
wrapper.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
|
|
|
if (list.size() <= 0) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "没有该线路编码或行别的相机信息");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "没有该线路编码或行别的相机信息");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
for (BaseCameraManagement baseCameraManagement : list) {
|
|
|
LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
@@ -881,10 +875,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
}
|
|
|
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), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "没有该线路编码的线路信息");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
baseCameraManagement.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
}
|
|
@@ -909,16 +901,11 @@ public class GeoHazardMonitorTokenController {
|
|
|
BeanUtils.copyProperties(baseCameraManagement, respCameraVo);
|
|
|
cameraVos.add(respCameraVo);
|
|
|
}
|
|
|
-
|
|
|
- jsonObject.put("resultCode", 1);
|
|
|
- jsonObject.put("message", "ok");
|
|
|
- jsonObject.put("data", cameraVos);
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(1, "ok",cameraVos);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode", 2);
|
|
|
- jsonObject.put("message", "token验证失败");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return JSONObject.toJSONString(jsonObject);
|
|
|
+ ajaxResult1 = new AjaxResult(2, "token验证失败");
|
|
|
+ return JSONObject.toJSONString(ajaxResult1);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -935,39 +922,31 @@ public class GeoHazardMonitorTokenController {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
log.info("token:{}", token);
|
|
|
log.info("parameter:{}", parameterVo);
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
+ AjaxResult ajaxResult1 = null;
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
|
String key = split[split.length - 1];
|
|
|
if (ObjectUtils.isEmpty(parameterVo)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "parameterVo参数不能为空");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "parameterVo参数不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), key);
|
|
|
CameraPlayVo cameraPlayVo = JSON.parseObject(s, CameraPlayVo.class);
|
|
|
if (ObjectUtils.isEmpty(cameraPlayVo.getTerminalCode())) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "车载终端编码不能为空");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "车载终端编码不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(cameraPlayVo.getCameraCode())) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "相机编码不能为空");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "相机编码不能为空");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
lw.eq(BaseCameraManagement::getCameraCode, cameraPlayVo.getCameraCode());
|
|
|
lw.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
BaseCameraManagement one = baseCameraManagementService.getOne(lw);
|
|
|
if (ObjectUtils.isEmpty(one)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "没有该相机编码的相机或已离线");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "没有该相机编码的相机或已离线");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
//获取视频点播地址
|
|
|
CamerasVo camerasVo = new CamerasVo();
|
|
@@ -975,21 +954,15 @@ public class GeoHazardMonitorTokenController {
|
|
|
camerasVo.setCameraIndexCode(one.getCameraCode());
|
|
|
String playFlv = cameraUtil.apiPreviewURLs(camerasVo);
|
|
|
if ("1".equals(playFlv)) {
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "失败");
|
|
|
- jsonObject.put("data", "天网实时流接口调用失败");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(0, "天网实时流接口调用失败");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
}
|
|
|
map.put("url", playFlv);
|
|
|
- jsonObject.put("resultCode", 1);
|
|
|
- jsonObject.put("message", "ok");
|
|
|
- jsonObject.put("data", map);
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
+ ajaxResult1 = new AjaxResult(1, "ok",map);
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(ajaxResult1), key);
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode", 2);
|
|
|
- jsonObject.put("message", "token验证失败");
|
|
|
- jsonObject.put("data", "");
|
|
|
- return JSONObject.toJSONString(jsonObject);
|
|
|
+ ajaxResult1 = new AjaxResult(2, "token验证失败");
|
|
|
+ return JSONObject.toJSONString(ajaxResult1);
|
|
|
}
|
|
|
}
|
|
|
|