...
|
...
|
@@ -3,14 +3,14 @@ package com.sy.service.router; |
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.sy.bwAnalysis.GatherInfoAnalysis;
|
|
|
import com.sy.bwAssist.Message;
|
|
|
import com.sy.mapper.LandListDao;
|
|
|
import com.sy.mapper.LandRouterConfigDao;
|
|
|
import com.sy.model.G2Bean;
|
|
|
import com.sy.model.GatherInfo;
|
|
|
import com.sy.model.LandBusinessTypeList;
|
|
|
import com.sy.model.LandRouterConfig;
|
|
|
import com.sy.model.*;
|
|
|
import com.sy.service.CommandLogService;
|
|
|
import com.sy.service.CustomsLockService;
|
|
|
import com.sy.service.LandBusListService;
|
|
|
import com.sy.service.RedisService;
|
|
|
import com.sy.service.feigin.LockFeignService;
|
|
|
import com.sy.service.impl.GatherInfoHandle;
|
|
|
import com.sy.socket.CommandClient;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
...
|
...
|
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.net.ConnectException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -49,6 +50,24 @@ public class MessageRouterX21 implements MessageRouter { |
|
|
@Autowired
|
|
|
private CommandLogService commandLogService;
|
|
|
|
|
|
@Autowired
|
|
|
private CustomsLockService customsLockService;
|
|
|
|
|
|
@Autowired
|
|
|
private LockFeignService lockFeignService;
|
|
|
|
|
|
@Resource
|
|
|
private LandListDao landListDao;
|
|
|
|
|
|
/**
|
|
|
* 入场标识
|
|
|
*/
|
|
|
private static String IN_TYPE="I";
|
|
|
/**
|
|
|
* 离场标识
|
|
|
*/
|
|
|
private static String OUT_TYPE="E";
|
|
|
|
|
|
@Override
|
|
|
public void route(Message message) {
|
|
|
log.info("处理X21:gatherInfo,[switch]-G2开关状态:[{}]",g2Bean.getOnoff());
|
...
|
...
|
@@ -202,14 +221,73 @@ public class MessageRouterX21 implements MessageRouter { |
|
|
* 本地处理
|
|
|
*/
|
|
|
private void X21Local(GatherInfo info){
|
|
|
//先判定关锁业务
|
|
|
if (lockHandle(info)) {
|
|
|
log.info("[{}]-关锁通知,等待回调",info.getBarcode());
|
|
|
}else {
|
|
|
GatherInfoHandle gatherInfoHandle = new GatherInfoHandle();
|
|
|
gatherInfoHandle.handel(info);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 车辆过卡指令日志记录
|
|
|
*/
|
|
|
private void record(GatherInfo info,boolean result,String reason,LandBusinessTypeList landBusinessTypeList){
|
|
|
commandLogService.commandlog(info,result,reason,landBusinessTypeList,null,0.0,0.0,0.0,0.0);
|
|
|
}
|
|
|
|
|
|
//关锁施解封通知判定
|
|
|
private boolean lockHandle(GatherInfo info){
|
|
|
//需要关锁业务通知
|
|
|
if (customsLockService.lockNoticeCheck(info)){
|
|
|
|
|
|
/**
|
|
|
* 关锁号申请检查
|
|
|
* 根据二维码查申请是否有关锁信息,没有查到实体返回null
|
|
|
*/
|
|
|
LandList landList = landListDao.selectLockInfoByBarcode(info.getBarcode());
|
|
|
if (landList!=null && StringUtils.isNotEmpty(landList.getLockNum())) {
|
|
|
log.info("[LOCK-CHECK]-流转申请携带关锁,二维码:{}",info.getBarcode());
|
|
|
|
|
|
NoticeLock noticeLock = new NoticeLock();
|
|
|
noticeLock.barcode = info.getBarcode();
|
|
|
noticeLock.areaId = info.getAreaid();
|
|
|
noticeLock.chnlNo = info.getChnlno();
|
|
|
noticeLock.vehicleNo = info.getVename();
|
|
|
|
|
|
//1. 判定是上锁通知还是解锁通知
|
|
|
if (OUT_TYPE.equals(info.getIetype()) && customsLockService.lockCheck(info)) {
|
|
|
//写入缓存
|
|
|
customsLockService.cacheWrite(info);
|
|
|
//接口通知
|
|
|
noticeLock.lockNo =landList.getLockNum();
|
|
|
noticeLock.type = "1";
|
|
|
LockFeignResponse lockFeignResponse = lockFeignService.noticeLock(noticeLock);
|
|
|
log.info("[LOCK-API-RSP]-关锁通知接口返回,code:{},message:{},success:{}",lockFeignResponse.code,lockFeignResponse.message,lockFeignResponse.success);
|
|
|
record(info,false,"关锁施封通知中,等待下一步指令",null);
|
|
|
return true;
|
|
|
}else {
|
|
|
if (IN_TYPE.equals(info.getIetype()) && customsLockService.unLockCheck(info)) {
|
|
|
customsLockService.cacheWrite(info);
|
|
|
|
|
|
//接口通知
|
|
|
noticeLock.lockNo =landList.getLockNum();
|
|
|
noticeLock.type = "2";
|
|
|
LockFeignResponse lockFeignResponse = lockFeignService.noticeLock(noticeLock);
|
|
|
log.info("[LOCK-API-RSP]-关锁通知接口返回,code:{},message:{},success:{}",lockFeignResponse.code,lockFeignResponse.message,lockFeignResponse.success);
|
|
|
record(info,false,"关锁解封通知中,等待下一步指令",null);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
CommandClient.Client(info,"流转业务-未申请关锁号");
|
|
|
record(info,false,"业务异常:流转业务-未申请关锁号",null);
|
|
|
//这里需要返回true,是关锁业务,但是中断,不抬杆不放行,给予关锁业务异常通知
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
} |
...
|
...
|
|