|
@@ -1,6 +1,8 @@
|
|
package com.aidex.common.gps.server.impl;
|
|
package com.aidex.common.gps.server.impl;
|
|
|
|
|
|
import com.aidex.common.app.domain.vo.SysWharfVO;
|
|
import com.aidex.common.app.domain.vo.SysWharfVO;
|
|
|
|
+import com.aidex.common.constant.CacheConstants;
|
|
|
|
+import com.aidex.common.core.redis.RedisCache;
|
|
import com.aidex.common.gps.domain.PushAlarmEntity;
|
|
import com.aidex.common.gps.domain.PushAlarmEntity;
|
|
import com.aidex.common.gps.domain.PushLocationEntity;
|
|
import com.aidex.common.gps.domain.PushLocationEntity;
|
|
import com.aidex.common.gps.server.IGpsPlushService;
|
|
import com.aidex.common.gps.server.IGpsPlushService;
|
|
@@ -13,8 +15,10 @@ import com.aidex.common.plush.service.SysShipExtendService;
|
|
import com.aidex.common.utils.StringUtils;
|
|
import com.aidex.common.utils.StringUtils;
|
|
import com.aidex.common.utils.dist.CalcDist;
|
|
import com.aidex.common.utils.dist.CalcDist;
|
|
import com.aidex.common.utils.file.ImageUtils;
|
|
import com.aidex.common.utils.file.ImageUtils;
|
|
|
|
+import com.aidex.framework.cache.CacheUtil;
|
|
import com.aidex.framework.cache.ConfigUtils;
|
|
import com.aidex.framework.cache.ConfigUtils;
|
|
import com.aidex.system.domain.SysWharf;
|
|
import com.aidex.system.domain.SysWharf;
|
|
|
|
+import com.aidex.system.service.SysShipService;
|
|
import com.aidex.system.service.SysWharfService;
|
|
import com.aidex.system.service.SysWharfService;
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -41,25 +45,32 @@ public class GpsPlushService implements IGpsPlushService {
|
|
private GpsLocationPlushService gpsLocationPlushService;
|
|
private GpsLocationPlushService gpsLocationPlushService;
|
|
@Autowired
|
|
@Autowired
|
|
private GpsAlarmPlushService gpsAlarmPlushService;
|
|
private GpsAlarmPlushService gpsAlarmPlushService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysShipService sysShipService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
|
public void plush(String method, String serialNumber, String data){
|
|
public void plush(String method, String serialNumber, String data){
|
|
- log.info("接受数据方式:"+method+"接收数据:"+data);
|
|
|
|
- if(StringUtils.isEmpty(data))
|
|
|
|
- return;
|
|
|
|
- // 只接收报警和位置 其他数据丢弃
|
|
|
|
- if(method.equals(METHOD.ALARM)){
|
|
|
|
- List<PushAlarmEntity> pushAlarmEntities = JSONArray.parseArray(data).toList(PushAlarmEntity.class);
|
|
|
|
- alarmSource(pushAlarmEntities);
|
|
|
|
- }
|
|
|
|
- if(method.equals(METHOD.LOCATION)){
|
|
|
|
- List<PushLocationEntity> pushAlarmEntities = JSONArray.parseArray(data).toList(PushLocationEntity.class);
|
|
|
|
- locationSource(pushAlarmEntities);
|
|
|
|
|
|
+ try {
|
|
|
|
+ // 只接收报警和位置 其他数据丢弃
|
|
|
|
+ if(method.equals(METHOD.ALARM)){
|
|
|
|
+ List<PushAlarmEntity> pushAlarmEntities = JSONArray.parseArray(data).toList(PushAlarmEntity.class);
|
|
|
|
+ alarmSource(pushAlarmEntities);
|
|
|
|
+ }
|
|
|
|
+ if(method.equals(METHOD.LOCATION)){
|
|
|
|
+ List<PushLocationEntity> pushAlarmEntities = JSONArray.parseArray(data).toList(PushLocationEntity.class);
|
|
|
|
+ locationSource(pushAlarmEntities);
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("PLUSH_GPS: 推送数据接收错误!错误原因:"+e.getMessage());
|
|
|
|
+ log.error("PLUSH_GPS: 推送数据方法:"+method+" 推送数据: "+ data);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void alarmSource(List<PushAlarmEntity> alarmEntities){
|
|
private void alarmSource(List<PushAlarmEntity> alarmEntities){
|
|
- List<SysWharf> sysWharfs = sysWharfService.findList(new SysWharf());
|
|
|
|
- List<SysShipExtend> sysShipExtends = sysShipExtendService.findList(new SysShipExtend());
|
|
|
|
|
|
+ List<SysWharf> sysWharfs = sysWharfService.findListByCache(new SysWharf());
|
|
|
|
+ List<SysShipExtend> sysShipExtends = sysShipExtendService.findListByCache(new SysShipExtend());
|
|
String[] forward = ConfigUtils.getConfigByKey("forward.direction").getConfigValue().split("-");
|
|
String[] forward = ConfigUtils.getConfigByKey("forward.direction").getConfigValue().split("-");
|
|
// 获取反向条件
|
|
// 获取反向条件
|
|
String[] reverse = ConfigUtils.getConfigByKey("reverse.direction").getConfigValue().split("-");
|
|
String[] reverse = ConfigUtils.getConfigByKey("reverse.direction").getConfigValue().split("-");
|
|
@@ -89,6 +100,8 @@ public class GpsPlushService implements IGpsPlushService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (alarmEntity.getClassify().equals(CLASSIFY.OUT)) {
|
|
if (alarmEntity.getClassify().equals(CLASSIFY.OUT)) {
|
|
|
|
+ String surpKey = sysShipService.getShipSurplusSeat(updateShipExtend.getShipId(),15);
|
|
|
|
+ redisCache.set(CacheConstants.SYS_SURPLUS_KEY+updateShipExtend.getShipId(),surpKey);
|
|
SysWharfVO stopWharf = getLoccationNearly(sysWharfs,alarmEntity.getMapLat(),alarmEntity.getMapLon());
|
|
SysWharfVO stopWharf = getLoccationNearly(sysWharfs,alarmEntity.getMapLat(),alarmEntity.getMapLon());
|
|
if (stopWharf != null) {
|
|
if (stopWharf != null) {
|
|
updateShipExtend.setIsStop(0L);
|
|
updateShipExtend.setIsStop(0L);
|
|
@@ -139,7 +152,7 @@ public class GpsPlushService implements IGpsPlushService {
|
|
}
|
|
}
|
|
|
|
|
|
private void locationSource(List<PushLocationEntity> locationEntities){
|
|
private void locationSource(List<PushLocationEntity> locationEntities){
|
|
- List<SysShipExtend> sysShipExtends = sysShipExtendService.findList(new SysShipExtend());
|
|
|
|
|
|
+ List<SysShipExtend> sysShipExtends = sysShipExtendService.findListByCache(new SysShipExtend());
|
|
String[] forward = ConfigUtils.getConfigByKey("forward.direction").getConfigValue().split("-");
|
|
String[] forward = ConfigUtils.getConfigByKey("forward.direction").getConfigValue().split("-");
|
|
// 获取反向条件
|
|
// 获取反向条件
|
|
String[] reverse = ConfigUtils.getConfigByKey("reverse.direction").getConfigValue().split("-");
|
|
String[] reverse = ConfigUtils.getConfigByKey("reverse.direction").getConfigValue().split("-");
|