|
@@ -88,6 +88,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
@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]*$";
|
|
|
@Resource
|
|
|
private ApiTokenUtils apiTokenUtils;
|
|
|
@Resource
|
|
@@ -143,11 +144,24 @@ public class GeoHazardMonitorTokenController {
|
|
|
jsonObject.put("data", "客户端编号不能为空");
|
|
|
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);
|
|
|
if (!ObjectUtils.isEmpty(serviceOne)) {
|
|
|
String clientSecret = SM4Utils.decryptData_ECB(serviceOne.getClientSecret(), "4370780c9a8c43e5");
|
|
|
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) {
|
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
@@ -199,6 +213,53 @@ public class GeoHazardMonitorTokenController {
|
|
|
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) {
|
|
|
reqMsgAlarmVo.setAlarmTime(reqMsgAlarmVo.getAlarmTime() * 1000);
|
|
|
}
|
|
@@ -247,6 +308,18 @@ public class GeoHazardMonitorTokenController {
|
|
|
Files[] files1 = reqMsgAlarmVo.getFiles();
|
|
|
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");
|
|
|
+ }
|
|
|
+ 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.setAlarmId(msgAlarm.getAlarmId());
|
|
|
msgAlarmExt.setAlarmAttPath(files1[i].fileUrl);
|
|
@@ -337,6 +410,30 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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<>();
|
|
|
wrapper.eq(MsgAlarm::getAlarmId, releaseAlarmVo.getAlarmId());
|
|
|
MsgAlarm msgAlarm = msgAlarmService.getOne(wrapper);
|
|
@@ -396,6 +493,59 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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();
|
|
|
BeanUtils.copyProperties(heartbeatVo, vehiclePosition);
|
|
|
LambdaQueryWrapper<BaseTerminal> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -435,6 +585,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
camera.ge(BaseCameraManagement::getBeginMile, list.get(0).getAlarmMile());
|
|
|
camera.le(BaseCameraManagement::getEndMile, list.get(0).getAlarmMile());
|
|
|
camera.eq(BaseCameraManagement::getLineDir, heartbeatVo.getLineDir());
|
|
|
+ camera.eq(BaseCameraManagement::getRailwayCode,heartbeatVo.getRailwayCode());
|
|
|
camera.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(camera);
|
|
|
List<AlarmListVo> listVos = new ArrayList<>();
|
|
@@ -481,6 +632,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
ment.ge(BaseCameraManagement::getBeginMile, list.get(i).getAlarmMile());
|
|
|
ment.le(BaseCameraManagement::getEndMile, list.get(i).getAlarmMile());
|
|
|
ment.eq(BaseCameraManagement::getLineDir, heartbeatVo.getLineDir());
|
|
|
+ ment.eq(BaseCameraManagement::getRailwayCode,heartbeatVo.getRailwayCode());
|
|
|
ment.orderByAsc(BaseCameraManagement::getInstallMile);
|
|
|
if (i == 0) {
|
|
|
wrapper.last("limit 1,1000000");
|
|
@@ -589,6 +741,18 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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("alarmId", terminalIgnoreVo.getAlarmId());
|
|
|
LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -645,6 +809,12 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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<>();
|
|
|
if (!ObjectUtils.isEmpty(cameraVo.getRailwayCode())) {
|
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, cameraVo.getRailwayCode());
|
|
@@ -725,7 +895,18 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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>();
|
|
|
lw.eq(BaseCameraManagement::getCameraCode, cameraPlayVo.getCameraCode());
|
|
|
BaseCameraManagement one = baseCameraManagementService.getOne(lw);
|
|
@@ -766,6 +947,12 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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<>();
|
|
|
if (!ObjectUtils.isEmpty(cameraVo.getRailwayCode())) {
|
|
|
wrapper.eq(MsgAlarm::getRailwayCode, cameraVo.getRailwayCode());
|
|
@@ -842,6 +1029,18 @@ public class GeoHazardMonitorTokenController {
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
String s = SM4Utils.decryptData_ECB(parameter, "4370780c9a8c43e5");
|
|
|
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<>();
|
|
|
wrapper.eq(MsgAlarm::getAlarmId, terminalIgnoreVo.getAlarmId());
|
|
|
MsgAlarm one = msgAlarmService.getOne(wrapper);
|