|
@@ -34,6 +34,7 @@ import com.ozs.entity.vo.CameraPlayVo;
|
|
import com.ozs.entity.vo.CameraVo;
|
|
import com.ozs.entity.vo.CameraVo;
|
|
import com.ozs.entity.vo.Files;
|
|
import com.ozs.entity.vo.Files;
|
|
import com.ozs.entity.vo.HeartbeatVo;
|
|
import com.ozs.entity.vo.HeartbeatVo;
|
|
|
|
+import com.ozs.entity.vo.ParameterVo;
|
|
import com.ozs.entity.vo.QueryAlarmVo;
|
|
import com.ozs.entity.vo.QueryAlarmVo;
|
|
import com.ozs.entity.vo.ReleaseAlarmVo;
|
|
import com.ozs.entity.vo.ReleaseAlarmVo;
|
|
import com.ozs.entity.vo.ReqMsgAlarmVo;
|
|
import com.ozs.entity.vo.ReqMsgAlarmVo;
|
|
@@ -88,6 +89,7 @@ import java.util.concurrent.TimeUnit;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class GeoHazardMonitorTokenController {
|
|
public class GeoHazardMonitorTokenController {
|
|
public static final String PATTERN = "^([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)$";
|
|
public static final String PATTERN = "^([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)$";
|
|
|
|
+ public static final String PATTERNS = "^[0-9]*$";
|
|
@Resource
|
|
@Resource
|
|
private ApiTokenUtils apiTokenUtils;
|
|
private ApiTokenUtils apiTokenUtils;
|
|
@Resource
|
|
@Resource
|
|
@@ -143,11 +145,24 @@ public class GeoHazardMonitorTokenController {
|
|
jsonObject.put("data", "客户端编号不能为空");
|
|
jsonObject.put("data", "客户端编号不能为空");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
}
|
|
}
|
|
|
|
+ if (!ObjectUtils.isEmpty(svcAddress.getGrantType())) {
|
|
|
|
+ if (!svcAddress.getGrantType().toString().matches(PATTERNS)) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "授权类型填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "授权类型不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
SvcAddress serviceOne = svcAddressService.getOne(lw);
|
|
SvcAddress serviceOne = svcAddressService.getOne(lw);
|
|
if (!ObjectUtils.isEmpty(serviceOne)) {
|
|
if (!ObjectUtils.isEmpty(serviceOne)) {
|
|
String clientSecret = SM4Utils.decryptData_ECB(serviceOne.getClientSecret(), "4370780c9a8c43e5");
|
|
String clientSecret = SM4Utils.decryptData_ECB(serviceOne.getClientSecret(), "4370780c9a8c43e5");
|
|
if (clientSecret.equals(svcAddress.getClientSecret())) {
|
|
if (clientSecret.equals(svcAddress.getClientSecret())) {
|
|
- ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken(svcAddress.getGrantType(), svcAddress.getClientId(), svcAddress.getClientSecret());
|
|
|
|
|
|
+ ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken(svcAddress.getGrantType().toString(), svcAddress.getClientId(), svcAddress.getClientSecret());
|
|
if (objects.size() > 0) {
|
|
if (objects.size() > 0) {
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
@@ -183,13 +198,13 @@ public class GeoHazardMonitorTokenController {
|
|
*/
|
|
*/
|
|
@PostMapping("/api/alarm")
|
|
@PostMapping("/api/alarm")
|
|
@Transactional
|
|
@Transactional
|
|
- public String alarm(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String alarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
ReqMsgAlarmVo reqMsgAlarmVo = JSON.parseObject(s, ReqMsgAlarmVo.class);
|
|
ReqMsgAlarmVo reqMsgAlarmVo = JSON.parseObject(s, ReqMsgAlarmVo.class);
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmAttr())) {
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmAttr())) {
|
|
if (!reqMsgAlarmVo.getAlarmAttr().matches(PATTERN)) {
|
|
if (!reqMsgAlarmVo.getAlarmAttr().matches(PATTERN)) {
|
|
@@ -199,6 +214,53 @@ public class GeoHazardMonitorTokenController {
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (!reqMsgAlarmVo.getAlarmMile().toString().matches(PATTERNS)) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警里程位置填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ 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");
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
|
+ if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmRailway())) {
|
|
|
|
+ queryWrapper.eq(BaseRailwayManagement::getRailwayCode, reqMsgAlarmVo.getAlarmRailway());
|
|
|
|
+ }
|
|
|
|
+ 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");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmId())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警的唯一标识不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmTime())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警时间不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ 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");
|
|
|
|
+ }
|
|
|
|
+ if (!reqMsgAlarmVo.getAlarmLevel().toString().matches(PATTERNS)) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警级别填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
if (reqMsgAlarmVo.getAlarmTime().toString().length() == 10) {
|
|
if (reqMsgAlarmVo.getAlarmTime().toString().length() == 10) {
|
|
reqMsgAlarmVo.setAlarmTime(reqMsgAlarmVo.getAlarmTime() * 1000);
|
|
reqMsgAlarmVo.setAlarmTime(reqMsgAlarmVo.getAlarmTime() * 1000);
|
|
}
|
|
}
|
|
@@ -223,7 +285,7 @@ public class GeoHazardMonitorTokenController {
|
|
lw.eq(MsgAlarm::getAlarmId, reqMsgAlarmVo.getAlarmId());
|
|
lw.eq(MsgAlarm::getAlarmId, reqMsgAlarmVo.getAlarmId());
|
|
}
|
|
}
|
|
MsgAlarm alarm = msgAlarmService.getOne(lw);
|
|
MsgAlarm alarm = msgAlarmService.getOne(lw);
|
|
- if (ObjectUtils.isEmpty(alarm)){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(alarm)) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "没有该报警唯一标识的报警信息");
|
|
jsonObject.put("data", "没有该报警唯一标识的报警信息");
|
|
@@ -247,6 +309,18 @@ public class GeoHazardMonitorTokenController {
|
|
Files[] files1 = reqMsgAlarmVo.getFiles();
|
|
Files[] files1 = reqMsgAlarmVo.getFiles();
|
|
if (files1.length > 0) {
|
|
if (files1.length > 0) {
|
|
for (int i = 0; i < files1.length; i++) {
|
|
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");
|
|
|
|
+ }
|
|
|
|
+ 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");
|
|
|
|
+ }
|
|
MsgAlarmExt msgAlarmExt = new MsgAlarmExt();
|
|
MsgAlarmExt msgAlarmExt = new MsgAlarmExt();
|
|
msgAlarmExt.setAlarmId(msgAlarm.getAlarmId());
|
|
msgAlarmExt.setAlarmId(msgAlarm.getAlarmId());
|
|
msgAlarmExt.setAlarmAttPath(files1[i].fileUrl);
|
|
msgAlarmExt.setAlarmAttPath(files1[i].fileUrl);
|
|
@@ -324,19 +398,43 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 报警解除接口
|
|
* 报警解除接口
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/releaseAlarm")
|
|
@PostMapping("/api/releaseAlarm")
|
|
- public String releaseAlarm(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String releaseAlarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
ReleaseAlarmVo releaseAlarmVo = JSON.parseObject(s, ReleaseAlarmVo.class);
|
|
ReleaseAlarmVo releaseAlarmVo = JSON.parseObject(s, ReleaseAlarmVo.class);
|
|
|
|
+ if (ObjectUtils.isEmpty(releaseAlarmVo.getAlarmId())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警的唯一标识不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(releaseAlarmVo.getReleaseTime())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "解除报警时间不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(releaseAlarmVo.getReleaseContent())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "解除原因不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(releaseAlarmVo.getReleaseTime())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "解除人不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(MsgAlarm::getAlarmId, releaseAlarmVo.getAlarmId());
|
|
wrapper.eq(MsgAlarm::getAlarmId, releaseAlarmVo.getAlarmId());
|
|
MsgAlarm msgAlarm = msgAlarmService.getOne(wrapper);
|
|
MsgAlarm msgAlarm = msgAlarmService.getOne(wrapper);
|
|
@@ -379,29 +477,82 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 车载心跳机制交互
|
|
* 车载心跳机制交互
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/terminal/heartbeat")
|
|
@PostMapping("/api/terminal/heartbeat")
|
|
@Transactional
|
|
@Transactional
|
|
- public String heartbeat(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String heartbeat(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
Map<String, Object> twoMap = new HashMap<>();
|
|
Map<String, Object> twoMap = new HashMap<>();
|
|
int distance = 0;
|
|
int distance = 0;
|
|
RespHeartbeatVo respHeartbeatVo = new RespHeartbeatVo();
|
|
RespHeartbeatVo respHeartbeatVo = new RespHeartbeatVo();
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
HeartbeatVo heartbeatVo = JSON.parseObject(s, HeartbeatVo.class);
|
|
HeartbeatVo heartbeatVo = JSON.parseObject(s, HeartbeatVo.class);
|
|
|
|
+ if (ObjectUtils.isEmpty(heartbeatVo.getTerminalCode())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "车载终端编码不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (!heartbeatVo.getCurrentMile().toString().matches(PATTERNS)) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "当前里程位置填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(heartbeatVo.getLatitude())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "当前所在纬度不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(heartbeatVo.getLongitude())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "当前所在经度不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> railway = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
|
+ if (!ObjectUtils.isEmpty(heartbeatVo.getRailwayCode())) {
|
|
|
|
+ railway.eq(BaseRailwayManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
|
|
+ }
|
|
|
|
+ BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(railway);
|
|
|
|
+ if (ObjectUtils.isEmpty(baseRailwayManagement)) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "填写的线路编码不存在");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (heartbeatVo.getLineDir() != 1 && heartbeatVo.getLineDir() != 2) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "行别填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (!heartbeatVo.getVisualDistance().toString().matches(PATTERNS)) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "司机目视距离填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (heartbeatVo.getSignalStrength() != 1 && heartbeatVo.getSignalStrength() != 2) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "信号强度填写错误");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
VehiclePosition vehiclePosition = new VehiclePosition();
|
|
VehiclePosition vehiclePosition = new VehiclePosition();
|
|
BeanUtils.copyProperties(heartbeatVo, vehiclePosition);
|
|
BeanUtils.copyProperties(heartbeatVo, vehiclePosition);
|
|
LambdaQueryWrapper<BaseTerminal> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BaseTerminal> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(BaseTerminal::getTerminalCode, vehiclePosition.getTerminalCode());
|
|
wrapper.eq(BaseTerminal::getTerminalCode, vehiclePosition.getTerminalCode());
|
|
BaseTerminal baseTerminal = baseTerminalService.getOne(wrapper);
|
|
BaseTerminal baseTerminal = baseTerminalService.getOne(wrapper);
|
|
- if (ObjectUtils.isEmpty(baseTerminal)){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(baseTerminal)) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "关联表中没有改终端编码的信息");
|
|
jsonObject.put("data", "关联表中没有改终端编码的信息");
|
|
@@ -435,12 +586,13 @@ public class GeoHazardMonitorTokenController {
|
|
camera.ge(BaseCameraManagement::getBeginMile, list.get(0).getAlarmMile());
|
|
camera.ge(BaseCameraManagement::getBeginMile, list.get(0).getAlarmMile());
|
|
camera.le(BaseCameraManagement::getEndMile, list.get(0).getAlarmMile());
|
|
camera.le(BaseCameraManagement::getEndMile, list.get(0).getAlarmMile());
|
|
camera.eq(BaseCameraManagement::getLineDir, heartbeatVo.getLineDir());
|
|
camera.eq(BaseCameraManagement::getLineDir, heartbeatVo.getLineDir());
|
|
|
|
+ camera.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
camera.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
camera.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(camera);
|
|
List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(camera);
|
|
List<AlarmListVo> listVos = new ArrayList<>();
|
|
List<AlarmListVo> listVos = new ArrayList<>();
|
|
if (baseCameraManagementList.size() > 0) {
|
|
if (baseCameraManagementList.size() > 0) {
|
|
//获取视频点播地址
|
|
//获取视频点播地址
|
|
- String playFlv = CameraUtil.getPlayFlv(baseCameraManagementList.get(0).getCameraCode(), baseCameraManagementList.get(0).getChannel(), false);
|
|
|
|
|
|
+ String playFlv = CameraUtil.getPlayFlvRtsp(baseCameraManagementList.get(0).getCameraCode(), baseCameraManagementList.get(0).getChannel(), false);
|
|
respHeartbeatVo.setCurrentStream(playFlv);
|
|
respHeartbeatVo.setCurrentStream(playFlv);
|
|
respHeartbeatVo.setIsAlarm(1);
|
|
respHeartbeatVo.setIsAlarm(1);
|
|
respHeartbeatVo.setCameraCode(baseCameraManagementList.get(0).getCameraCode());
|
|
respHeartbeatVo.setCameraCode(baseCameraManagementList.get(0).getCameraCode());
|
|
@@ -457,7 +609,7 @@ public class GeoHazardMonitorTokenController {
|
|
LambdaQueryWrapper<MsgAlarmExt> ext = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MsgAlarmExt> ext = new LambdaQueryWrapper<>();
|
|
ext.eq(MsgAlarmExt::getAlarmId, list.get(0).getAlarmId());
|
|
ext.eq(MsgAlarmExt::getAlarmId, list.get(0).getAlarmId());
|
|
MsgAlarmExt one = msgAlarmExtService.getOne(ext);
|
|
MsgAlarmExt one = msgAlarmExtService.getOne(ext);
|
|
- if (ObjectUtils.isEmpty(one)){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(one)) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "没有该报警ID的关联信息");
|
|
jsonObject.put("data", "没有该报警ID的关联信息");
|
|
@@ -481,6 +633,7 @@ public class GeoHazardMonitorTokenController {
|
|
ment.ge(BaseCameraManagement::getBeginMile, list.get(i).getAlarmMile());
|
|
ment.ge(BaseCameraManagement::getBeginMile, list.get(i).getAlarmMile());
|
|
ment.le(BaseCameraManagement::getEndMile, list.get(i).getAlarmMile());
|
|
ment.le(BaseCameraManagement::getEndMile, list.get(i).getAlarmMile());
|
|
ment.eq(BaseCameraManagement::getLineDir, heartbeatVo.getLineDir());
|
|
ment.eq(BaseCameraManagement::getLineDir, heartbeatVo.getLineDir());
|
|
|
|
+ ment.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
|
|
ment.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
ment.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
wrapper.last("limit 1,1000000");
|
|
wrapper.last("limit 1,1000000");
|
|
@@ -489,7 +642,7 @@ public class GeoHazardMonitorTokenController {
|
|
List<BaseCameraManagement> baseList = baseCameraManagementService.list(camera);
|
|
List<BaseCameraManagement> baseList = baseCameraManagementService.list(camera);
|
|
if (baseList.size() > 0) {
|
|
if (baseList.size() > 0) {
|
|
for (int o = 0; o < baseList.size(); o++) {
|
|
for (int o = 0; o < baseList.size(); o++) {
|
|
- String flv = CameraUtil.getPlayFlv(baseList.get(o).getCameraCode(), baseList.get(o).getChannel(), false);
|
|
|
|
|
|
+ String flv = CameraUtil.getPlayFlvRtsp(baseList.get(o).getCameraCode(), baseList.get(o).getChannel(), false);
|
|
AlarmListVo alarmListVo = new AlarmListVo();
|
|
AlarmListVo alarmListVo = new AlarmListVo();
|
|
//alarmList对象
|
|
//alarmList对象
|
|
alarmListVo.setCameraStream(flv);
|
|
alarmListVo.setCameraStream(flv);
|
|
@@ -534,17 +687,12 @@ public class GeoHazardMonitorTokenController {
|
|
base.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
base.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
base.last("limit 4");
|
|
base.last("limit 4");
|
|
List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
|
|
List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
|
|
- String flv = CameraUtil.getPlayFlv(list1.get(0).getCameraCode(), list1.get(0).getChannel(), false);
|
|
|
|
|
|
+ CameraUtil.invite(list1.get(0).getCameraCode(), list1.get(0).getChannel());
|
|
|
|
+ String flv = CameraUtil.getPlayFlvRtsp(list1.get(0).getCameraCode(), list1.get(0).getChannel(), false);
|
|
for (BaseCameraManagement baseCameraManagement : list1) {
|
|
for (BaseCameraManagement baseCameraManagement : list1) {
|
|
- String flv1 = CameraUtil.getPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), false);
|
|
|
|
|
|
+ String flv1 = CameraUtil.getPlayFlvRtsp(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel(), false);
|
|
twoMap.put(baseCameraManagement.getCameraCode(), flv1);
|
|
twoMap.put(baseCameraManagement.getCameraCode(), flv1);
|
|
- String invite = CameraUtil.invite(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
|
|
|
|
- if (!"304".equals(invite) && !"200".equals(invite)) {
|
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
|
- jsonObject.put("message", "失败");
|
|
|
|
- jsonObject.put("data", "视频邀约失败,视频中心没有该相机编码或通道编码的摄像头!!!");
|
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
- }
|
|
|
|
|
|
+ CameraUtil.invite(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
|
|
}
|
|
}
|
|
respHeartbeatVo.setCurrentStream(flv);
|
|
respHeartbeatVo.setCurrentStream(flv);
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
@@ -575,20 +723,32 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 司机忽略报警接口
|
|
* 司机忽略报警接口
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/terminal/ignore")
|
|
@PostMapping("/api/terminal/ignore")
|
|
- public String terminalIgnore(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String terminalIgnore(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
TerminalIgnoreVo terminalIgnoreVo = JSON.parseObject(s, TerminalIgnoreVo.class);
|
|
TerminalIgnoreVo terminalIgnoreVo = JSON.parseObject(s, TerminalIgnoreVo.class);
|
|
|
|
+ if (ObjectUtils.isEmpty(terminalIgnoreVo.getTerminalCode())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "车载终端编码不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(terminalIgnoreVo.getAlarmId())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警唯一UUID不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
map.put("terminalCode", terminalIgnoreVo.getTerminalCode());
|
|
map.put("terminalCode", terminalIgnoreVo.getTerminalCode());
|
|
map.put("alarmId", terminalIgnoreVo.getAlarmId());
|
|
map.put("alarmId", terminalIgnoreVo.getAlarmId());
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -632,19 +792,25 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 获取所有的相机列表接口定义
|
|
* 获取所有的相机列表接口定义
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/query/camera")
|
|
@PostMapping("/api/query/camera")
|
|
- public String camera(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String camera(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
CameraVo cameraVo = JSON.parseObject(s, CameraVo.class);
|
|
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), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<>();
|
|
if (!ObjectUtils.isEmpty(cameraVo.getRailwayCode())) {
|
|
if (!ObjectUtils.isEmpty(cameraVo.getRailwayCode())) {
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode());
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode());
|
|
@@ -653,7 +819,7 @@ public class GeoHazardMonitorTokenController {
|
|
wrapper.eq(BaseCameraManagement::getLineDir, cameraVo.getLineDir());
|
|
wrapper.eq(BaseCameraManagement::getLineDir, cameraVo.getLineDir());
|
|
}
|
|
}
|
|
List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
|
|
List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
|
|
- if (list.size()<=0){
|
|
|
|
|
|
+ if (list.size() <= 0) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "没有该线路编码或行别的相机信息");
|
|
jsonObject.put("data", "没有该线路编码或行别的相机信息");
|
|
@@ -665,7 +831,7 @@ public class GeoHazardMonitorTokenController {
|
|
queryWrapper.eq(BaseRailwayManagement::getRailwayCode, baseCameraManagement.getRailwayCode());
|
|
queryWrapper.eq(BaseRailwayManagement::getRailwayCode, baseCameraManagement.getRailwayCode());
|
|
}
|
|
}
|
|
BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
|
|
BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
|
|
- if (ObjectUtils.isEmpty(baseRailwayManagement)){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(baseRailwayManagement)) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "没有该线路编码的线路信息");
|
|
jsonObject.put("data", "没有该线路编码的线路信息");
|
|
@@ -711,21 +877,32 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 点播功能接口定义(直播流)
|
|
* 点播功能接口定义(直播流)
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/camera/play")
|
|
@PostMapping("/api/camera/play")
|
|
- public String cameraPlay(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String cameraPlay(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
CameraPlayVo cameraPlayVo = JSON.parseObject(s, CameraPlayVo.class);
|
|
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), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(cameraPlayVo.getCameraCode())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "相机编码不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
lw.eq(BaseCameraManagement::getCameraCode, cameraPlayVo.getCameraCode());
|
|
lw.eq(BaseCameraManagement::getCameraCode, cameraPlayVo.getCameraCode());
|
|
BaseCameraManagement one = baseCameraManagementService.getOne(lw);
|
|
BaseCameraManagement one = baseCameraManagementService.getOne(lw);
|
|
@@ -735,7 +912,7 @@ public class GeoHazardMonitorTokenController {
|
|
jsonObject.put("data", "没有该相机编码的相机");
|
|
jsonObject.put("data", "没有该相机编码的相机");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
}
|
|
}
|
|
- String flv = CameraUtil.getPlayFlv(one.getCameraCode(), one.getChannel());
|
|
|
|
|
|
+ String flv = CameraUtil.getPlayFlvRtsp(one.getCameraCode(), one.getChannel(),false);
|
|
map.put("url", flv);
|
|
map.put("url", flv);
|
|
jsonObject.put("resultCode", 1);
|
|
jsonObject.put("resultCode", 1);
|
|
jsonObject.put("message", "ok");
|
|
jsonObject.put("message", "ok");
|
|
@@ -753,19 +930,25 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 获取报警列表(已解除和未解除)
|
|
* 获取报警列表(已解除和未解除)
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/query/alarm")
|
|
@PostMapping("/api/query/alarm")
|
|
- public String queryAlarm(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String queryAlarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
CameraVo cameraVo = JSON.parseObject(s, CameraVo.class);
|
|
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), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
if (!ObjectUtils.isEmpty(cameraVo.getRailwayCode())) {
|
|
if (!ObjectUtils.isEmpty(cameraVo.getRailwayCode())) {
|
|
wrapper.eq(MsgAlarm::getRailwayCode, cameraVo.getRailwayCode());
|
|
wrapper.eq(MsgAlarm::getRailwayCode, cameraVo.getRailwayCode());
|
|
@@ -774,7 +957,7 @@ public class GeoHazardMonitorTokenController {
|
|
wrapper.eq(MsgAlarm::getLineDir, cameraVo.getLineDir());
|
|
wrapper.eq(MsgAlarm::getLineDir, cameraVo.getLineDir());
|
|
}
|
|
}
|
|
List<MsgAlarm> list = msgAlarmService.list(wrapper);
|
|
List<MsgAlarm> list = msgAlarmService.list(wrapper);
|
|
- if (list.size()<=0){
|
|
|
|
|
|
+ if (list.size() <= 0) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "没有该报警线路或行别的报警信息");
|
|
jsonObject.put("data", "没有该报警线路或行别的报警信息");
|
|
@@ -793,7 +976,7 @@ public class GeoHazardMonitorTokenController {
|
|
LambdaQueryWrapper<MsgAlarmExt> alarm = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MsgAlarmExt> alarm = new LambdaQueryWrapper<>();
|
|
alarm.eq(MsgAlarmExt::getAlarmId, msgAlarm.getAlarmId());
|
|
alarm.eq(MsgAlarmExt::getAlarmId, msgAlarm.getAlarmId());
|
|
List<MsgAlarmExt> list1 = msgAlarmExtService.list(alarm);
|
|
List<MsgAlarmExt> list1 = msgAlarmExtService.list(alarm);
|
|
- if (list1.size()<=0){
|
|
|
|
|
|
+ if (list1.size() <= 0) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "没有该报警唯一标识的扩展信息");
|
|
jsonObject.put("data", "没有该报警唯一标识的扩展信息");
|
|
@@ -827,21 +1010,33 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 获取报警回放
|
|
* 获取报警回放
|
|
*
|
|
*
|
|
- * @param parameter
|
|
|
|
|
|
+ * @param parameterVo
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/api/alarm/play")
|
|
@PostMapping("/api/alarm/play")
|
|
- public String alarmPlay(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
|
|
|
|
+ public String alarmPlay(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
String urls = null;
|
|
String urls = null;
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
- log.info("parameter:{}", parameter);
|
|
|
|
|
|
+ log.info("parameter:{}", parameterVo);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
- String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
|
|
|
+ String s = SM4Utils.decryptData_ECB(parameterVo.getParameter(), "4370780c9a8c43e5");
|
|
TerminalIgnoreVo terminalIgnoreVo = JSON.parseObject(s, TerminalIgnoreVo.class);
|
|
TerminalIgnoreVo terminalIgnoreVo = JSON.parseObject(s, TerminalIgnoreVo.class);
|
|
|
|
+ if (ObjectUtils.isEmpty(terminalIgnoreVo.getTerminalCode())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "车载终端编码不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(terminalIgnoreVo.getAlarmId())) {
|
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
|
+ jsonObject.put("data", "报警唯一UUID不能为空");
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
|
+ }
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(MsgAlarm::getAlarmId, terminalIgnoreVo.getAlarmId());
|
|
wrapper.eq(MsgAlarm::getAlarmId, terminalIgnoreVo.getAlarmId());
|
|
MsgAlarm one = msgAlarmService.getOne(wrapper);
|
|
MsgAlarm one = msgAlarmService.getOne(wrapper);
|
|
@@ -904,7 +1099,13 @@ public class GeoHazardMonitorTokenController {
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
JSONObject res = new JSONObject();
|
|
JSONObject res = new JSONObject();
|
|
res.put("terminalCode", "001");
|
|
res.put("terminalCode", "001");
|
|
- res.put("alarmId","42010001541320001115");
|
|
|
|
|
|
+ res.put("currentMile", 2000);
|
|
|
|
+ res.put("longitude", "200");
|
|
|
|
+ res.put("latitude", "300");
|
|
|
|
+ res.put("railwayCode", "JT01");
|
|
|
|
+ res.put("lineDir", 1);
|
|
|
|
+ res.put("visualDistance", 500);
|
|
|
|
+ res.put("signalStrength", 1);
|
|
String s = SM4Utils.encryptData_ECB(JSONObject.toJSONString(res), "4370780c9a8c43e5");
|
|
String s = SM4Utils.encryptData_ECB(JSONObject.toJSONString(res), "4370780c9a8c43e5");
|
|
System.out.println(s);
|
|
System.out.println(s);
|
|
}
|
|
}
|