...
|
...
|
@@ -30,6 +30,62 @@ import java.text.SimpleDateFormat |
|
|
*/
|
|
|
class G2X21Notice extends Script implements ChannelCheckScript{
|
|
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
private static final String X21Template = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<GATHER_INFO AREA_ID=\"#{area_id}\" CHNL_NO=\"#{chnl_no}\" I_E_TYPE=\"#{ie_flag}\" SEQ_NO=\"#{session_id}\">\n" +
|
|
|
" <IC>\n" +
|
|
|
" <DR_IC_NO/>\n" +
|
|
|
" <IC_DR_CUSTOMS_NO/>\n" +
|
|
|
" <IC_CO_CUSTOMS_NO/>\n" +
|
|
|
" <IC_BILL_NO/>\n" +
|
|
|
" <IC_GROSS_WT/>\n" +
|
|
|
" <IC_VE_CUSTOMS_NO/>\n" +
|
|
|
" <IC_VE_NAME/>\n" +
|
|
|
" <IC_CONTA_ID/>\n" +
|
|
|
" <IC_ESEAL_ID/>\n" +
|
|
|
" <IC_EX_DATA/>\n" +
|
|
|
" </IC>\n" +
|
|
|
" <WEIGHT>\n" +
|
|
|
" <GROSS_WT>#{gross_wt}</GROSS_WT>\n" +
|
|
|
" </WEIGHT>\n" +
|
|
|
" <CAR>\n" +
|
|
|
" <VE_NAME>#{ve_license_no}</VE_NAME>\n" +
|
|
|
" <CAR_EC_NO>#{rfid_id}</CAR_EC_NO>\n" +
|
|
|
" <CAR_EC_NO2/>\n" +
|
|
|
" <VE_CUSTOMS_NO/>\n" +
|
|
|
" <VE_WT/>\n" +
|
|
|
" </CAR>\n" +
|
|
|
" <CONTA>\n" +
|
|
|
" <CONTA_NUM/>\n" +
|
|
|
" <CONTA_RECO>1</CONTA_RECO>\n" +
|
|
|
" <CONTA_MODEL_F/>\n" +
|
|
|
" <CONTA_MODEL_B/>\n" +
|
|
|
" <CONTA_ID_F/>\n" +
|
|
|
" <CONTA_ID_B/>\n" +
|
|
|
" </CONTA>\n" +
|
|
|
" <SEAL>\n" +
|
|
|
" <ESEAL_ID/>\n" +
|
|
|
" </SEAL>\n" +
|
|
|
" <BAR_CODE>#{bar_code}</BAR_CODE>\n" +
|
|
|
" </GATHER_INFO>";
|
|
|
|
|
|
/**
|
|
|
* 海关发送报文封装模板
|
|
|
*/
|
|
|
public static final String HAIGUAN_MQ_TEMPLATE = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
|
|
|
"<DxpMsg xmlns=\"http://www.chinaport.gov.cn/dxp\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ver=\"1.0\">\n" +
|
|
|
" <TransInfo>\n" +
|
|
|
" <CopMsgId>#{CopMsgId}</CopMsgId>\n" +
|
|
|
" <SenderId>GDXPKK0000000002</SenderId>\n" +
|
|
|
" <MsgType>#{MsgType}</MsgType>\n" +
|
|
|
" <CreatTime>#{CreatTime}</CreatTime>\n" +
|
|
|
" <ReceiverIds>\n" +
|
|
|
" <ReceiverId>GJCKK00000000001</ReceiverId>\n" +
|
|
|
" </ReceiverIds>\n" +
|
|
|
" </TransInfo>\n" +
|
|
|
" <Data>#{Data}</Data>\n" +
|
|
|
"</DxpMsg>";
|
|
|
|
|
|
@Override
|
|
|
Object run() {
|
|
|
return null
|
...
|
...
|
@@ -74,12 +130,12 @@ class G2X21Notice extends Script implements ChannelCheckScript{ |
|
|
record(info,true,"已转金二验放-[SEQN]:"+info.getSeqno(),null);
|
|
|
log.info("[G2-ROUTER-SUCCESS]-已转特殊区域验放路由成功-规则验放成功-需要忽略下方报错,SEQNO:{}",info.getSeqno());
|
|
|
}else{
|
|
|
record(info,true,"特殊区域接口访问失败",null);
|
|
|
record(info,false,"特殊区域接口访问失败",null);
|
|
|
log.error("[G2-X81-API-ERR]-特殊区域接口访问出错")
|
|
|
}
|
|
|
}else {
|
|
|
record(info,true,"金二验放失败,未有相关通道流转申请信息",null);
|
|
|
CommandClient.Client(info,"金二验放失败,未有相关通道流转申请信息");
|
|
|
record(info,false,"特殊区域验放失败,未有相关通道流转申请信息",null);
|
|
|
CommandClient.Client(info,"特殊区域验放失败,未有相关通道流转申请信息");
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
...
|
...
|
@@ -121,7 +177,7 @@ class G2X21Notice extends Script implements ChannelCheckScript{ |
|
|
log.info("[SERVICE-API-RES]-{}",JSON.toJSONString(resultJson))
|
|
|
|
|
|
if ("200".equals(resultJson.getCode())){
|
|
|
JSONObject jsonObject = resultJson.getData();
|
|
|
JSONObject jsonObject = (JSONObject) resultJson.getData();
|
|
|
int total = jsonObject.getInteger("total");
|
|
|
if (total>0){
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
...
|
...
|
@@ -131,16 +187,24 @@ class G2X21Notice extends Script implements ChannelCheckScript{ |
|
|
JSONObject yard = chanel.getJSONObject("yard");
|
|
|
String stationG2 = yard.getString("stationIdG2");
|
|
|
log.info("[G2-YARD]-{}",stationG2);
|
|
|
String rfidNo = ve.getVeCustomsNo();
|
|
|
if (StringUtils.isEmpty(rfidNo)){
|
|
|
log.error("[VE-RFID-NO-ERR]:车辆-{}电子车牌信息未备案",gatherInfo.getVename());
|
|
|
record(gatherInfo,false,"车辆电子车牌信息未备案",null);
|
|
|
}else {
|
|
|
//todo: 这里取的是车辆备案电子车牌字段.实际上 IC卡号应该是一个字段
|
|
|
log.info("[VE-RFID-NO]:车辆电子车牌号:{}",ve.getVeCustomsNo());
|
|
|
log.info("[VE-RFID-NO]:车辆电子车牌号:{}",rfidNo);
|
|
|
}
|
|
|
|
|
|
|
|
|
String x21XML= G2X81Template.X21Template.replace("#{ie_flag}",gatherInfo.getIetype())
|
|
|
//各脚本维护各脚本的模板吧
|
|
|
String x21XML= X21Template.replace("#{ie_flag}",gatherInfo.getIetype())
|
|
|
.replace("#{area_id}",stationG2)
|
|
|
.replace("#{chnl_no}",channelG2)
|
|
|
.replace("#{session_id}",gatherInfo.getSeqno())
|
|
|
.replace("#{ve_license_no}",gatherInfo.getVename())
|
|
|
.replace("#{gross_wt}",gatherInfo.getGrosswt().toString())
|
|
|
.replace("#{rfid_id}",ve.getVeCustomsNo())
|
|
|
.replace("#{rfid_id}",rfidNo)
|
|
|
.replace("#{ve_wt}",ve.getSelfWt())
|
|
|
.replace("#{bar_code}",gatherInfo.getBarcode());
|
|
|
log.info("[X21]-{}",x21XML);
|
...
|
...
|
@@ -163,7 +227,7 @@ class G2X21Notice extends Script implements ChannelCheckScript{ |
|
|
String base64EncodeToString = Base64.getEncoder().encodeToString(xmlStr.getBytes(Charset.forName("utf-8")));
|
|
|
log.info("[SEND-BASE64-ENCODE]-{}",base64EncodeToString)
|
|
|
|
|
|
return G2X81Template.mq_template.replace("#{CopMsgId}",copMsgId)
|
|
|
return HAIGUAN_MQ_TEMPLATE.replace("#{CopMsgId}",copMsgId)
|
|
|
.replace("#{CreatTime}",creatTime)
|
|
|
.replace("#{MsgType}","QNLZ")
|
|
|
.replace("#{Data}",base64EncodeToString);
|
...
|
...
|
|