正在显示
1 个修改的文件
包含
72 行增加
和
8 行删除
@@ -30,6 +30,62 @@ import java.text.SimpleDateFormat | @@ -30,6 +30,62 @@ import java.text.SimpleDateFormat | ||
30 | */ | 30 | */ |
31 | class G2X21Notice extends Script implements ChannelCheckScript{ | 31 | class G2X21Notice extends Script implements ChannelCheckScript{ |
32 | private final Logger log = LoggerFactory.getLogger(getClass()); | 32 | private final Logger log = LoggerFactory.getLogger(getClass()); |
33 | + | ||
34 | + private static final String X21Template = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + | ||
35 | + "<GATHER_INFO AREA_ID=\"#{area_id}\" CHNL_NO=\"#{chnl_no}\" I_E_TYPE=\"#{ie_flag}\" SEQ_NO=\"#{session_id}\">\n" + | ||
36 | + " <IC>\n" + | ||
37 | + " <DR_IC_NO/>\n" + | ||
38 | + " <IC_DR_CUSTOMS_NO/>\n" + | ||
39 | + " <IC_CO_CUSTOMS_NO/>\n" + | ||
40 | + " <IC_BILL_NO/>\n" + | ||
41 | + " <IC_GROSS_WT/>\n" + | ||
42 | + " <IC_VE_CUSTOMS_NO/>\n" + | ||
43 | + " <IC_VE_NAME/>\n" + | ||
44 | + " <IC_CONTA_ID/>\n" + | ||
45 | + " <IC_ESEAL_ID/>\n" + | ||
46 | + " <IC_EX_DATA/>\n" + | ||
47 | + " </IC>\n" + | ||
48 | + " <WEIGHT>\n" + | ||
49 | + " <GROSS_WT>#{gross_wt}</GROSS_WT>\n" + | ||
50 | + " </WEIGHT>\n" + | ||
51 | + " <CAR>\n" + | ||
52 | + " <VE_NAME>#{ve_license_no}</VE_NAME>\n" + | ||
53 | + " <CAR_EC_NO>#{rfid_id}</CAR_EC_NO>\n" + | ||
54 | + " <CAR_EC_NO2/>\n" + | ||
55 | + " <VE_CUSTOMS_NO/>\n" + | ||
56 | + " <VE_WT/>\n" + | ||
57 | + " </CAR>\n" + | ||
58 | + " <CONTA>\n" + | ||
59 | + " <CONTA_NUM/>\n" + | ||
60 | + " <CONTA_RECO>1</CONTA_RECO>\n" + | ||
61 | + " <CONTA_MODEL_F/>\n" + | ||
62 | + " <CONTA_MODEL_B/>\n" + | ||
63 | + " <CONTA_ID_F/>\n" + | ||
64 | + " <CONTA_ID_B/>\n" + | ||
65 | + " </CONTA>\n" + | ||
66 | + " <SEAL>\n" + | ||
67 | + " <ESEAL_ID/>\n" + | ||
68 | + " </SEAL>\n" + | ||
69 | + " <BAR_CODE>#{bar_code}</BAR_CODE>\n" + | ||
70 | + " </GATHER_INFO>"; | ||
71 | + | ||
72 | + /** | ||
73 | + * 海关发送报文封装模板 | ||
74 | + */ | ||
75 | + public static final String HAIGUAN_MQ_TEMPLATE = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + | ||
76 | + "<DxpMsg xmlns=\"http://www.chinaport.gov.cn/dxp\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ver=\"1.0\">\n" + | ||
77 | + " <TransInfo>\n" + | ||
78 | + " <CopMsgId>#{CopMsgId}</CopMsgId>\n" + | ||
79 | + " <SenderId>GDXPKK0000000002</SenderId>\n" + | ||
80 | + " <MsgType>#{MsgType}</MsgType>\n" + | ||
81 | + " <CreatTime>#{CreatTime}</CreatTime>\n" + | ||
82 | + " <ReceiverIds>\n" + | ||
83 | + " <ReceiverId>GJCKK00000000001</ReceiverId>\n" + | ||
84 | + " </ReceiverIds>\n" + | ||
85 | + " </TransInfo>\n" + | ||
86 | + " <Data>#{Data}</Data>\n" + | ||
87 | + "</DxpMsg>"; | ||
88 | + | ||
33 | @Override | 89 | @Override |
34 | Object run() { | 90 | Object run() { |
35 | return null | 91 | return null |
@@ -74,12 +130,12 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | @@ -74,12 +130,12 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | ||
74 | record(info,true,"已转金二验放-[SEQN]:"+info.getSeqno(),null); | 130 | record(info,true,"已转金二验放-[SEQN]:"+info.getSeqno(),null); |
75 | log.info("[G2-ROUTER-SUCCESS]-已转特殊区域验放路由成功-规则验放成功-需要忽略下方报错,SEQNO:{}",info.getSeqno()); | 131 | log.info("[G2-ROUTER-SUCCESS]-已转特殊区域验放路由成功-规则验放成功-需要忽略下方报错,SEQNO:{}",info.getSeqno()); |
76 | }else{ | 132 | }else{ |
77 | - record(info,true,"特殊区域接口访问失败",null); | 133 | + record(info,false,"特殊区域接口访问失败",null); |
78 | log.error("[G2-X81-API-ERR]-特殊区域接口访问出错") | 134 | log.error("[G2-X81-API-ERR]-特殊区域接口访问出错") |
79 | } | 135 | } |
80 | }else { | 136 | }else { |
81 | - record(info,true,"金二验放失败,未有相关通道流转申请信息",null); | ||
82 | - CommandClient.Client(info,"金二验放失败,未有相关通道流转申请信息"); | 137 | + record(info,false,"特殊区域验放失败,未有相关通道流转申请信息",null); |
138 | + CommandClient.Client(info,"特殊区域验放失败,未有相关通道流转申请信息"); | ||
83 | } | 139 | } |
84 | 140 | ||
85 | }catch (Exception e){ | 141 | }catch (Exception e){ |
@@ -121,7 +177,7 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | @@ -121,7 +177,7 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | ||
121 | log.info("[SERVICE-API-RES]-{}",JSON.toJSONString(resultJson)) | 177 | log.info("[SERVICE-API-RES]-{}",JSON.toJSONString(resultJson)) |
122 | 178 | ||
123 | if ("200".equals(resultJson.getCode())){ | 179 | if ("200".equals(resultJson.getCode())){ |
124 | - JSONObject jsonObject = resultJson.getData(); | 180 | + JSONObject jsonObject = (JSONObject) resultJson.getData(); |
125 | int total = jsonObject.getInteger("total"); | 181 | int total = jsonObject.getInteger("total"); |
126 | if (total>0){ | 182 | if (total>0){ |
127 | JSONArray jsonArray = jsonObject.getJSONArray("list"); | 183 | JSONArray jsonArray = jsonObject.getJSONArray("list"); |
@@ -131,16 +187,24 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | @@ -131,16 +187,24 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | ||
131 | JSONObject yard = chanel.getJSONObject("yard"); | 187 | JSONObject yard = chanel.getJSONObject("yard"); |
132 | String stationG2 = yard.getString("stationIdG2"); | 188 | String stationG2 = yard.getString("stationIdG2"); |
133 | log.info("[G2-YARD]-{}",stationG2); | 189 | log.info("[G2-YARD]-{}",stationG2); |
190 | + String rfidNo = ve.getVeCustomsNo(); | ||
191 | + if (StringUtils.isEmpty(rfidNo)){ | ||
192 | + log.error("[VE-RFID-NO-ERR]:车辆-{}电子车牌信息未备案",gatherInfo.getVename()); | ||
193 | + record(gatherInfo,false,"车辆电子车牌信息未备案",null); | ||
194 | + }else { | ||
134 | //todo: 这里取的是车辆备案电子车牌字段.实际上 IC卡号应该是一个字段 | 195 | //todo: 这里取的是车辆备案电子车牌字段.实际上 IC卡号应该是一个字段 |
135 | - log.info("[VE-RFID-NO]:车辆电子车牌号:{}",ve.getVeCustomsNo()); | 196 | + log.info("[VE-RFID-NO]:车辆电子车牌号:{}",rfidNo); |
197 | + } | ||
198 | + | ||
136 | 199 | ||
137 | - String x21XML= G2X81Template.X21Template.replace("#{ie_flag}",gatherInfo.getIetype()) | 200 | + //各脚本维护各脚本的模板吧 |
201 | + String x21XML= X21Template.replace("#{ie_flag}",gatherInfo.getIetype()) | ||
138 | .replace("#{area_id}",stationG2) | 202 | .replace("#{area_id}",stationG2) |
139 | .replace("#{chnl_no}",channelG2) | 203 | .replace("#{chnl_no}",channelG2) |
140 | .replace("#{session_id}",gatherInfo.getSeqno()) | 204 | .replace("#{session_id}",gatherInfo.getSeqno()) |
141 | .replace("#{ve_license_no}",gatherInfo.getVename()) | 205 | .replace("#{ve_license_no}",gatherInfo.getVename()) |
142 | .replace("#{gross_wt}",gatherInfo.getGrosswt().toString()) | 206 | .replace("#{gross_wt}",gatherInfo.getGrosswt().toString()) |
143 | - .replace("#{rfid_id}",ve.getVeCustomsNo()) | 207 | + .replace("#{rfid_id}",rfidNo) |
144 | .replace("#{ve_wt}",ve.getSelfWt()) | 208 | .replace("#{ve_wt}",ve.getSelfWt()) |
145 | .replace("#{bar_code}",gatherInfo.getBarcode()); | 209 | .replace("#{bar_code}",gatherInfo.getBarcode()); |
146 | log.info("[X21]-{}",x21XML); | 210 | log.info("[X21]-{}",x21XML); |
@@ -163,7 +227,7 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | @@ -163,7 +227,7 @@ class G2X21Notice extends Script implements ChannelCheckScript{ | ||
163 | String base64EncodeToString = Base64.getEncoder().encodeToString(xmlStr.getBytes(Charset.forName("utf-8"))); | 227 | String base64EncodeToString = Base64.getEncoder().encodeToString(xmlStr.getBytes(Charset.forName("utf-8"))); |
164 | log.info("[SEND-BASE64-ENCODE]-{}",base64EncodeToString) | 228 | log.info("[SEND-BASE64-ENCODE]-{}",base64EncodeToString) |
165 | 229 | ||
166 | - return G2X81Template.mq_template.replace("#{CopMsgId}",copMsgId) | 230 | + return HAIGUAN_MQ_TEMPLATE.replace("#{CopMsgId}",copMsgId) |
167 | .replace("#{CreatTime}",creatTime) | 231 | .replace("#{CreatTime}",creatTime) |
168 | .replace("#{MsgType}","QNLZ") | 232 | .replace("#{MsgType}","QNLZ") |
169 | .replace("#{Data}",base64EncodeToString); | 233 | .replace("#{Data}",base64EncodeToString); |
-
请 注册 或 登录 后发表评论