|
@@ -15,6 +15,7 @@ import com.ozs.common.utils.stateSecrets.SM4Utils;
|
|
|
import com.ozs.config.Constant;
|
|
|
import com.ozs.entity.BaseCameraManagement;
|
|
|
import com.ozs.entity.BaseRailwayManagement;
|
|
|
+import com.ozs.entity.BaseRouteMassage;
|
|
|
import com.ozs.entity.BaseTerminal;
|
|
|
import com.ozs.entity.BaseUser;
|
|
|
import com.ozs.entity.BaseVehicleTerminal;
|
|
@@ -50,6 +51,7 @@ import com.ozs.mapper.MsgHeartbeatAlarmMessageMapper;
|
|
|
import com.ozs.mapper.SkynetHeartbeatLogMapper;
|
|
|
import com.ozs.service.BaseCameraManagementService;
|
|
|
import com.ozs.service.BaseRailwayManagementService;
|
|
|
+import com.ozs.service.BaseRouteMassageService;
|
|
|
import com.ozs.service.BaseTerminalService;
|
|
|
import com.ozs.service.BaseUserService;
|
|
|
import com.ozs.service.BaseVehicleTerminalService;
|
|
@@ -94,7 +96,7 @@ import java.util.stream.Collectors;
|
|
|
* @author Administrator
|
|
|
*/
|
|
|
@RestController
|
|
|
-@Slf4j
|
|
|
+//@Slf4j
|
|
|
public class GeoHazardMonitorTokenController {
|
|
|
public static final String PATTERN = "^([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)$";
|
|
|
public static final String PATTERNS = "^[0-9]*$";
|
|
@@ -136,6 +138,9 @@ public class GeoHazardMonitorTokenController {
|
|
|
private AlarmHeartbeatLogMapper alarmHeartbeatLogMapper;
|
|
|
@Resource
|
|
|
private MsgHeartbeatAlarmMessageMapper msgHearbeatAlarmMessageMapper;
|
|
|
+ @Resource
|
|
|
+ private BaseRouteMassageService baseRouteMassageService;
|
|
|
+
|
|
|
@Value("${base.env}")
|
|
|
private String env;
|
|
|
@Value("${sdk.publish}")
|
|
@@ -218,8 +223,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String alarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) throws Exception {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -282,7 +287,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (reqMsgAlarmVo.getAlarmTime().toString().length() == 10) {
|
|
|
reqMsgAlarmVo.setAlarmTime(reqMsgAlarmVo.getAlarmTime() * 1000);
|
|
|
}
|
|
|
- log.info("reqMsgAlarmVo:{}", reqMsgAlarmVo);
|
|
|
+ //log.info("reqMsgAlarmVo:{}", reqMsgAlarmVo);
|
|
|
|
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getAlarmMile())) {
|
|
@@ -292,7 +297,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
wrapper.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
}
|
|
|
List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(wrapper);
|
|
|
- log.info("baseCameraManagement:{}", baseCameraManagementList);
|
|
|
+ //log.info("baseCameraManagement:{}", baseCameraManagementList);
|
|
|
if (baseCameraManagementList.size() <= 0) {
|
|
|
jsonObject.put("resultCode", 0);
|
|
|
jsonObject.put("message", "失败");
|
|
@@ -312,10 +317,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
BeanUtils.copyProperties(reqMsgAlarmVo, msgAlarmVice);
|
|
|
msgAlarm.setCreateBy(admin.getUserId());
|
|
|
msgAlarm.setUpdateBy(admin.getUserId());
|
|
|
- log.info("时间++++ long ---- " + reqMsgAlarmVo.getAlarmTime());
|
|
|
- log.info("时间++++" + new Date(reqMsgAlarmVo.getAlarmTime()));
|
|
|
+ //log.info("时间++++ long ---- " + reqMsgAlarmVo.getAlarmTime());
|
|
|
+ //log.info("时间++++" + new Date(reqMsgAlarmVo.getAlarmTime()));
|
|
|
msgAlarm.setAlarmTime(new Date(reqMsgAlarmVo.getAlarmTime()));
|
|
|
- log.info("时间++++get" + msgAlarm.getAlarmTime());
|
|
|
+ //log.info("时间++++get" + msgAlarm.getAlarmTime());
|
|
|
msgAlarm.setRailwayCode(reqMsgAlarmVo.getAlarmRailway());
|
|
|
String source = split[split.length - 2];
|
|
|
msgAlarm.setSource(source);
|
|
@@ -348,11 +353,11 @@ public class GeoHazardMonitorTokenController {
|
|
|
msgAlarmVice.setAlarmTime(new Date(reqMsgAlarmVo.getAlarmTime()));
|
|
|
msgAlarmFrequencyService.save(msgAlarmVice);
|
|
|
|
|
|
- log.info("alarmJSON :{}", JSON.toJSONString(msgAlarm));
|
|
|
- log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>" + msgAlarm);
|
|
|
+ //log.info("alarmJSON :{}", JSON.toJSONString(msgAlarm));
|
|
|
+ //log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>" + msgAlarm);
|
|
|
String result = HttpClientUtil.postJson(sdkUrl, JSON.toJSONString(msgAlarm));
|
|
|
- log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>>>" + result);
|
|
|
- log.info("result:{}", result);
|
|
|
+ //log.info("->>>>>>>>>>>>>>>>>>>>>>>>>>>>" + result);
|
|
|
+ //log.info("result:{}", result);
|
|
|
|
|
|
List<String> collect = baseCameraManagementList.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
|
|
|
List<SysDictData> data = dictTypeService.selectDictDataByType("alarm_play_time_value");
|
|
@@ -387,8 +392,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
@PostMapping("/api/releaseAlarm")
|
|
|
public String releaseAlarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -475,8 +480,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
int type = 0;
|
|
|
RespHeartbeatVo respHeartbeatVo = new RespHeartbeatVo();
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -797,6 +802,13 @@ public class GeoHazardMonitorTokenController {
|
|
|
twoMap.put("currentStream", playFlv);
|
|
|
twoMap.put("cameraCode", list1.get(0).getCameraCode());
|
|
|
respHeartbeatVo.setCurrentStream(playFlv);
|
|
|
+ //赋值--股道
|
|
|
+ List<BaseRouteMassage> list = baseRouteMassageService.list();
|
|
|
+ if (!ObjectUtils.isEmpty(list)) {
|
|
|
+ if (list.get(0).getMileagePosition() - heartbeatVo.getCurrentMile() <= 500 && list.get(0).getMileagePosition() - heartbeatVo.getCurrentMile() >= 0) {
|
|
|
+ respHeartbeatVo.setRouteTrack(list.get(0).getRouteStationTrack());
|
|
|
+ }
|
|
|
+ }
|
|
|
respHeartbeatVo.setIsAlarm(2);
|
|
|
respHeartbeatVo.setCameraCode(list1.get(0).getCameraCode());
|
|
|
respHeartbeatVo.setAlarmList(null);
|
|
@@ -837,8 +849,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
public String terminalIgnore(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -907,8 +919,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
@PostMapping("/api/query/camera")
|
|
|
public String camera(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -922,9 +934,9 @@ public class GeoHazardMonitorTokenController {
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
|
|
|
}
|
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode())
|
|
|
- .and(w1 ->w1.eq(BaseCameraManagement::getMonitoringDirection, cameraVo.getLineDir())
|
|
|
- .or(w2 -> w2.eq(BaseCameraManagement::getMonitoringDirection, 3)));
|
|
|
+ wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode())
|
|
|
+ .and(w1 -> w1.eq(BaseCameraManagement::getMonitoringDirection, cameraVo.getLineDir())
|
|
|
+ .or(w2 -> w2.eq(BaseCameraManagement::getMonitoringDirection, 3)));
|
|
|
wrapper.eq(BaseCameraManagement::getEnableOrNot, 1);
|
|
|
wrapper.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
|
|
@@ -993,8 +1005,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
public String cameraPlay(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -1058,8 +1070,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
@PostMapping("/api/query/alarm")
|
|
|
public String queryAlarm(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -1138,8 +1150,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
String urls = null;
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -1209,8 +1221,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
@PostMapping("/api/skynet/heartbeat")
|
|
|
public String skynetHeartbeat(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -1285,8 +1297,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
@PostMapping("/api/alarm/heartbeat")
|
|
|
public String alarmHeartbeat(@RequestBody ParameterVo parameterVo, HttpServletRequest request) {
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
- log.info("token:{}", token);
|
|
|
- log.info("parameter:{}", parameterVo);
|
|
|
+ //log.info("token:{}", token);
|
|
|
+ //log.info("parameter:{}", parameterVo);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String[] split = token.split("-");
|
|
@@ -1352,7 +1364,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
obj.put("data", heartbeatVoCH);
|
|
|
//code
|
|
|
obj.put("code", 151);
|
|
|
- log.info("【websocket消息】 机车地址信息:" + obj.toJSONString());
|
|
|
+ //log.info("【websocket消息】 机车地址信息:" + obj.toJSONString());
|
|
|
return obj.toJSONString();
|
|
|
}
|
|
|
|
|
@@ -1369,4 +1381,48 @@ public class GeoHazardMonitorTokenController {
|
|
|
String s1 = JSONObject.toJSONString(vo);
|
|
|
return SM4Utils.encryptData_ECB(s1, "4370780c9a8c43e5");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加进路信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/api/addRouteMassage")
|
|
|
+ public String addRouteMassage(@RequestBody BaseRouteMassage baseRouteMassage) {
|
|
|
+ if (!ObjectUtils.isEmpty(baseRouteMassage) && !ObjectUtils.isEmpty(baseRouteMassage.getStationCode())) {
|
|
|
+ BaseRouteMassage one = baseRouteMassageService.getOne(new LambdaQueryWrapper<BaseRouteMassage>().eq(BaseRouteMassage::getStationCode, baseRouteMassage.getStationCode()));
|
|
|
+ if (!ObjectUtils.isEmpty(one)) {
|
|
|
+ return "车站编码已存在!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ baseRouteMassage.setCreateTime(new Date());
|
|
|
+ baseRouteMassage.setStationName("博野站");
|
|
|
+ baseRouteMassageService.save(baseRouteMassage);
|
|
|
+ return "200";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询进路信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/api/getRouteMassageList")
|
|
|
+ public List<BaseRouteMassage> getRouteMassageList() {
|
|
|
+ return baseRouteMassageService.list();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除进路信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/api/deleteRouteMassage")
|
|
|
+ public String deleteRouteMassage(@RequestBody BaseRouteMassage baseRouteMassage) {
|
|
|
+ if (!ObjectUtils.isEmpty(baseRouteMassage) && !ObjectUtils.isEmpty(baseRouteMassage.getId())) {
|
|
|
+ baseRouteMassageService.removeById(baseRouteMassage.getId());
|
|
|
+ return "200";
|
|
|
+ } else {
|
|
|
+ return "ID不存在";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|