作者 朱兆平

如果金二状态为关闭状态,则不用处理X22放行指令.

@@ -3,6 +3,7 @@ package com.sy.service.router; @@ -3,6 +3,7 @@ package com.sy.service.router;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.sy.bwAnalysis.CommandInfoAnalysis; 4 import com.sy.bwAnalysis.CommandInfoAnalysis;
5 import com.sy.bwAssist.Message; 5 import com.sy.bwAssist.Message;
  6 +import com.sy.model.G2Bean;
6 import com.sy.model.GatherInfo; 7 import com.sy.model.GatherInfo;
7 import com.sy.model.LandBusinessTypeList; 8 import com.sy.model.LandBusinessTypeList;
8 import com.sy.model.CommandInfoX22; 9 import com.sy.model.CommandInfoX22;
@@ -20,6 +21,14 @@ import org.springframework.stereotype.Service; @@ -20,6 +21,14 @@ import org.springframework.stereotype.Service;
20 @Slf4j 21 @Slf4j
21 public class MessageRouterX22 implements MessageRouter { 22 public class MessageRouterX22 implements MessageRouter {
22 23
  24 + /**
  25 + * 金二与本地认证兼容性开关
  26 + * Y 是金二业务必须走金二
  27 + * N 车辆扫二维码或本地和金二都可进出区验放
  28 + */
  29 + @Autowired
  30 + private G2Bean g2Bean;
  31 +
23 @Autowired 32 @Autowired
24 private RedisService redisService; 33 private RedisService redisService;
25 34
@@ -44,47 +53,56 @@ public class MessageRouterX22 implements MessageRouter { @@ -44,47 +53,56 @@ public class MessageRouterX22 implements MessageRouter {
44 @Override 53 @Override
45 public void route(Message message) { 54 public void route(Message message) {
46 try { 55 try {
47 - log.info("处理X22:CommandInfo"); 56 + log.info("[X22]-处理CommandInfo;\n[switch]-G2开关状态:[{}]",g2Bean.getOnoff());
48 CommandInfoAnalysis commandInfoAnalysis = new CommandInfoAnalysis(); 57 CommandInfoAnalysis commandInfoAnalysis = new CommandInfoAnalysis();
49 CommandInfoX22 commandInfoX22 = commandInfoAnalysis.toJavaBean(message); 58 CommandInfoX22 commandInfoX22 = commandInfoAnalysis.toJavaBean(message);
50 59
51 - if (commandInfoX22!=null){  
52 - /**  
53 - * 根据SEQNO 读取缓存 确定是否金二指令  
54 - */  
55 - GatherInfo gatherInfo = readCacheWithSeqno(commandInfoX22);  
56 - //是金二指令  
57 - if (gatherInfo!=null && gatherInfo.getChnlno().equals(commandInfoX22.getChnlNo())){ 60 + /**
  61 + * 如果金二验放关闭,则不用再处理X22指令报文.
  62 + */
  63 + if (g2Bean.getOnoff()) {
  64 + if (commandInfoX22!=null){
58 /** 65 /**
59 - * 1. 判断指令是否放行 66 + * 根据SEQNO 读取缓存 确定是否金二指令
60 */ 67 */
61 - if (commandInfoX22.getCheckResult().equals(CODE_RELEASE_I) || commandInfoX22.getCheckResult().equals(CODE_RELEASE_E)) {  
62 - /**  
63 - * todo:第一种.收到G2指令直接放行.并记录过卡与流转申请的核销  
64 - */  
65 -  
66 -  
67 - /**  
68 - * 第二种,结合本地指令进行放行.  
69 - */  
70 - record(gatherInfo,true,commandInfoX22.getOpHint(),null);  
71 - GatherInfoHandle gatherInfoHandle = new GatherInfoHandle();  
72 - gatherInfoHandle.handel(gatherInfo);  
73 - return;  
74 - }else { 68 + GatherInfo gatherInfo = readCacheWithSeqno(commandInfoX22);
  69 + //是金二指令
  70 + if (gatherInfo!=null && gatherInfo.getChnlno().equals(commandInfoX22.getChnlNo())){
75 /** 71 /**
76 - * 是金二指令,但是是未放行指令  
77 - * 记录未放行原因.  
78 - * 通知卡口 72 + * 1. 判断指令是否放行
79 */ 73 */
80 - CommandClient.Client(gatherInfo,commandInfoX22.getOpHint());  
81 - record(gatherInfo,false,gatherInfo.getSeqno()+"-金二验放失败:"+commandInfoX22.getOpHint(),null); 74 + if (commandInfoX22.getCheckResult().equals(CODE_RELEASE_I) || commandInfoX22.getCheckResult().equals(CODE_RELEASE_E)) {
  75 + /**
  76 + * todo:第一种.收到G2指令直接放行.并记录过卡与流转申请的核销
  77 + */
  78 +
  79 +
  80 + /**
  81 + * 第二种,结合本地指令进行放行.
  82 + */
  83 + record(gatherInfo,true,commandInfoX22.getOpHint(),null);
  84 + GatherInfoHandle gatherInfoHandle = new GatherInfoHandle();
  85 + gatherInfoHandle.handel(gatherInfo);
  86 + return;
  87 + }else {
  88 + /**
  89 + * 是金二指令,但是是未放行指令
  90 + * 记录未放行原因.
  91 + * 通知卡口
  92 + */
  93 + CommandClient.Client(gatherInfo,commandInfoX22.getOpHint());
  94 + record(gatherInfo,false,gatherInfo.getSeqno()+"-金二验放失败:"+commandInfoX22.getOpHint(),null);
  95 + }
  96 + }
  97 + else{
  98 + log.info("[X22-ERROR]:未找到对应的SEQNO:[{}]及通道的过卡缓存数据,不属于金二验放指令,不进行处理",commandInfoX22.getSeqNo());
82 } 99 }
83 } 100 }
84 - else{  
85 - log.info("[X22-ERROR]:未找到对应的SEQNO:[{}]及通道的过卡缓存数据,不属于金二验放指令,不进行处理",commandInfoX22.getSeqNo());  
86 - } 101 + }else{
  102 + log.info("[X22]-金二开关状态为{}关闭,本地验放不处理X22指令.",g2Bean.getOnoff());
87 } 103 }
  104 +
  105 +
88 }catch (Exception e){ 106 }catch (Exception e){
89 log.error("[X22-ERROR]:",e); 107 log.error("[X22-ERROR]:",e);
90 } 108 }