作者 朱兆平

直接改配解析

@@ -101,6 +101,7 @@ @@ -101,6 +101,7 @@
101 <groupId>com.tianbo</groupId> 101 <groupId>com.tianbo</groupId>
102 <artifactId>util</artifactId> 102 <artifactId>util</artifactId>
103 <version>1.0-SNAPSHOT</version> 103 <version>1.0-SNAPSHOT</version>
  104 + <scope>compile</scope>
104 </dependency> 105 </dependency>
105 <!--util依赖--> 106 <!--util依赖-->
106 107
  1 +package com.tianbo.analysis.dao;
  2 +
  3 +import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface MANIFEST_AIR_CHANGEMapper {
  8 + int deleteByPrimaryKey(String autoid);
  9 +
  10 + int insert(MANIFEST_AIR_CHANGE record);
  11 +
  12 + int insertSelective(MANIFEST_AIR_CHANGE record);
  13 +
  14 + List<MANIFEST_AIR_CHANGE> insertCheckRepeat(MANIFEST_AIR_CHANGE record);
  15 +
  16 + MANIFEST_AIR_CHANGE selectByPrimaryKey(String autoid);
  17 +
  18 + List<MANIFEST_AIR_CHANGE> selectList(MANIFEST_AIR_CHANGE record);
  19 +
  20 + int updateByPrimaryKeySelective(MANIFEST_AIR_CHANGE record);
  21 +
  22 + int updateByPrimaryKey(MANIFEST_AIR_CHANGE record);
  23 +}
@@ -321,6 +321,10 @@ public class CustomXmlHandleThread implements Runnable{ @@ -321,6 +321,10 @@ public class CustomXmlHandleThread implements Runnable{
321 MANIFESTLOSTCHANGE manifestlostchange = new MANIFESTLOSTCHANGE(customReception); 321 MANIFESTLOSTCHANGE manifestlostchange = new MANIFESTLOSTCHANGE(customReception);
322 i= manifestlostchange.secondAnalysisReception(); 322 i= manifestlostchange.secondAnalysisReception();
323 break; 323 break;
  324 + case "MT8024":
  325 + PREPAREMASTER preparemaster1201= new PREPAREMASTER(customReception);
  326 + i = preparemaster1201.masterAnalysisReception();
  327 + break;
324 default: 328 default:
325 break; 329 break;
326 330
  1 +package com.tianbo.analysis.model;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +
  8 +public class MANIFEST_AIR_CHANGE {
  9 + private String autoid;
  10 +
  11 + private String flightno;
  12 +
  13 + private String changeFlightno;
  14 +
  15 + private String waybillnomaster;
  16 +
  17 + private String changeWaybillnomaster;
  18 +
  19 + private String cont;
  20 +
  21 + private Date createdate;
  22 +
  23 + private Date changetime;
  24 +
  25 + private String carrier;
  26 +
  27 + private String changeCarrier;
  28 +
  29 + private String customsCode;
  30 +
  31 + private String receiption;
  32 +
  33 + //批量新增列表
  34 + private List<String> waybillList;
  35 +
  36 +
  37 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  38 + private Date flightDate;
  39 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  40 + private Date changeFlightDate;
  41 +
  42 + public String getAutoid() {
  43 + return autoid;
  44 + }
  45 +
  46 + public void setAutoid(String autoid) {
  47 + this.autoid = autoid == null ? null : autoid.trim();
  48 + }
  49 +
  50 + public String getFlightno() {
  51 + return flightno;
  52 + }
  53 +
  54 + public void setFlightno(String flightno) {
  55 + this.flightno = flightno == null ? null : flightno.trim();
  56 + }
  57 +
  58 + public String getChangeFlightno() {
  59 + return changeFlightno;
  60 + }
  61 +
  62 + public void setChangeFlightno(String changeFlightno) {
  63 + this.changeFlightno = changeFlightno == null ? null : changeFlightno.trim();
  64 + }
  65 +
  66 + public String getWaybillnomaster() {
  67 + return waybillnomaster;
  68 + }
  69 +
  70 + public void setWaybillnomaster(String waybillnomaster) {
  71 + this.waybillnomaster = waybillnomaster == null ? null : waybillnomaster.trim();
  72 + }
  73 +
  74 + public String getChangeWaybillnomaster() {
  75 + return changeWaybillnomaster;
  76 + }
  77 +
  78 + public void setChangeWaybillnomaster(String changeWaybillnomaster) {
  79 + this.changeWaybillnomaster = changeWaybillnomaster == null ? null : changeWaybillnomaster.trim();
  80 + }
  81 +
  82 + public String getCont() {
  83 + return cont;
  84 + }
  85 +
  86 + public void setCont(String cont) {
  87 + this.cont = cont == null ? null : cont.trim();
  88 + }
  89 +
  90 + public Date getCreatedate() {
  91 + return createdate;
  92 + }
  93 +
  94 + public void setCreatedate(Date createdate) {
  95 + this.createdate = createdate;
  96 + }
  97 +
  98 + public Date getChangetime() {
  99 + return changetime;
  100 + }
  101 +
  102 + public void setChangetime(Date changetime) {
  103 + this.changetime = changetime;
  104 + }
  105 +
  106 + public String getCarrier() {
  107 + return carrier;
  108 + }
  109 +
  110 + public void setCarrier(String carrier) {
  111 + this.carrier = carrier == null ? null : carrier.trim();
  112 + }
  113 +
  114 + public String getChangeCarrier() {
  115 + return changeCarrier;
  116 + }
  117 +
  118 + public void setChangeCarrier(String changeCarrier) {
  119 + this.changeCarrier = changeCarrier == null ? null : changeCarrier.trim();
  120 + }
  121 +
  122 + public Date getFlightDate() {
  123 + return flightDate;
  124 + }
  125 +
  126 + public void setFlightDate(Date flightDate) {
  127 + this.flightDate = flightDate;
  128 + }
  129 +
  130 + public Date getChangeFlightDate() {
  131 + return changeFlightDate;
  132 + }
  133 +
  134 + public void setChangeFlightDate(Date changeFlightDate) {
  135 + this.changeFlightDate = changeFlightDate;
  136 + }
  137 +
  138 + public String getCustomsCode() {
  139 + return customsCode;
  140 + }
  141 +
  142 + public void setCustomsCode(String customsCode) {
  143 + this.customsCode = customsCode;
  144 + }
  145 +
  146 + public String getReceiption() {
  147 + return receiption;
  148 + }
  149 +
  150 + public void setReceiption(String receiption) {
  151 + this.receiption = receiption;
  152 + }
  153 +
  154 + public List<String> getWaybillList() {
  155 + return waybillList;
  156 + }
  157 +
  158 + public void setWaybillList(List<String> waybillList) {
  159 + this.waybillList = waybillList;
  160 + }
  161 +
  162 +}
1 package com.tianbo.analysis.service; 1 package com.tianbo.analysis.service;
2 2
  3 +import com.tianbo.analysis.model.CustomReception;
  4 +
3 public interface SendLogService { 5 public interface SendLogService {
4 6
5 int insertSendlog(String type,String reception,String autoId); 7 int insertSendlog(String type,String reception,String autoId);
  8 +
  9 + int updateMT8204(CustomReception customReception);
6 } 10 }
1 package com.tianbo.analysis.service.imp; 1 package com.tianbo.analysis.service.imp;
2 2
  3 +import com.tianbo.analysis.dao.MANIFEST_AIR_CHANGEMapper;
3 import com.tianbo.analysis.dao.SENDLOGMapper; 4 import com.tianbo.analysis.dao.SENDLOGMapper;
  5 +import com.tianbo.analysis.model.CustomReception;
  6 +import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
4 import com.tianbo.analysis.model.SENDLOG; 7 import com.tianbo.analysis.model.SENDLOG;
5 import com.tianbo.analysis.service.SendLogService; 8 import com.tianbo.analysis.service.SendLogService;
  9 +import com.tianbo.analysis.tools.AWBTools;
  10 +import com.tianbo.util.Date.DateUtil;
6 import com.tianbo.util.Helper; 11 import com.tianbo.util.Helper;
7 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
  13 +import org.apache.commons.lang.StringUtils;
8 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
9 15
10 import javax.annotation.Resource; 16 import javax.annotation.Resource;
11 import java.math.BigDecimal; 17 import java.math.BigDecimal;
12 import java.util.Date; 18 import java.util.Date;
  19 +import java.util.List;
13 20
14 @Service 21 @Service
15 @Slf4j 22 @Slf4j
@@ -18,6 +25,9 @@ public class SendLogServiceImp implements SendLogService{ @@ -18,6 +25,9 @@ public class SendLogServiceImp implements SendLogService{
18 @Resource 25 @Resource
19 private SENDLOGMapper sendlogMapper; 26 private SENDLOGMapper sendlogMapper;
20 27
  28 + @Resource
  29 + MANIFEST_AIR_CHANGEMapper manifest_air_changeMapper;
  30 +
21 @Override 31 @Override
22 public int insertSendlog(String type,String reception,String autoId){ 32 public int insertSendlog(String type,String reception,String autoId){
23 SENDLOG sendlog = new SENDLOG(); 33 SENDLOG sendlog = new SENDLOG();
@@ -38,4 +48,21 @@ public class SendLogServiceImp implements SendLogService{ @@ -38,4 +48,21 @@ public class SendLogServiceImp implements SendLogService{
38 48
39 return i; 49 return i;
40 } 50 }
  51 +
  52 + @Override
  53 + public int updateMT8204(CustomReception customReception) {
  54 + MANIFEST_AIR_CHANGE manifest_air_change = new MANIFEST_AIR_CHANGE();
  55 + manifest_air_change.setWaybillnomaster(customReception.getWayBillMaster());
  56 + manifest_air_change.setFlightno(customReception.getFlightNo());
  57 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  58 + manifest_air_change.setFlightDate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  59 + }
  60 +
  61 + List<MANIFEST_AIR_CHANGE> list = manifest_air_changeMapper.selectList(manifest_air_change);
  62 + if (!list.isEmpty()){
  63 + MANIFEST_AIR_CHANGE m = list.get(0);
  64 + return insertSendlog("MT8204",customReception.getResponseText(),m.getAutoid());
  65 + }
  66 + return 0;
  67 + }
41 } 68 }
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.tianbo.analysis.dao.MANIFEST_AIR_CHANGEMapper" >
  4 + <resultMap id="BaseResultMap" type="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" >
  5 + <id column="AUTOID" property="autoid" jdbcType="VARCHAR" />
  6 + <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
  7 + <result column="CHANGE_FLIGHTNO" property="changeFlightno" jdbcType="VARCHAR" />
  8 + <result column="WAYBILLNOMASTER" property="waybillnomaster" jdbcType="VARCHAR" />
  9 + <result column="CHANGE_WAYBILLNOMASTER" property="changeWaybillnomaster" jdbcType="VARCHAR" />
  10 + <result column="CONT" property="cont" jdbcType="VARCHAR" />
  11 + <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" />
  12 + <result column="CHANGETIME" property="changetime" jdbcType="TIMESTAMP" />
  13 + <result column="CARRIER" property="carrier" jdbcType="VARCHAR" />
  14 + <result column="CHANGE_CARRIER" property="changeCarrier" jdbcType="VARCHAR" />
  15 + <result column="CUSTOMS_CODE" property="customsCode" jdbcType="VARCHAR" />
  16 + <result column="RECEIPTION" property="receiption" jdbcType="VARCHAR" />
  17 + <result column="FLIGHT_DATE" property="flightDate" jdbcType="DATE" />
  18 + <result column="CHANGE_FLIGHT_DATE" property="changeFlightDate" jdbcType="DATE" />
  19 + </resultMap>
  20 + <sql id="Base_Column_List" >
  21 + AUTOID, FLIGHTNO, CHANGE_FLIGHTNO, WAYBILLNOMASTER, CHANGE_WAYBILLNOMASTER, CONT,
  22 + CREATEDATE, CHANGETIME, CARRIER, CHANGE_CARRIER, FLIGHT_DATE, CHANGE_FLIGHT_DATE,CUSTOMS_CODE
  23 + </sql>
  24 + <sql id="Custom_Receipt">
  25 + <include refid="Base_Column_List" />
  26 + ,RECEIPTION
  27 + </sql>
  28 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  29 + select
  30 + <include refid="Base_Column_List" />
  31 + from CGONMS.MANIFEST_AIR_CHANGE
  32 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  33 + </select>
  34 + <select id="insertCheckRepeat" parameterType="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" resultMap="BaseResultMap">
  35 + select
  36 + AUTOID
  37 + from CGONMS.MANIFEST_AIR_CHANGE
  38 + where
  39 + FLIGHTNO = #{flightno,jdbcType=VARCHAR}
  40 + and
  41 + FLIGHT_DATE = #{flightDate,jdbcType=DATE}
  42 + and
  43 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  44 + </select>
  45 + <select id="selectList" resultMap="BaseResultMap" parameterType="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" >
  46 +
  47 + SELECT
  48 + <include refid="Custom_Receipt" />
  49 + FROM
  50 + (
  51 + SELECT
  52 + <include refid="Custom_Receipt" />
  53 + FROM
  54 + MANIFEST_AIR_CHANGE t1
  55 + LEFT JOIN (
  56 + SELECT
  57 + RECEIPTION,
  58 + MESSAGEAUTOID,
  59 + ROW_NUMBER () OVER ( PARTITION BY MESSAGEAUTOID ORDER BY CREATEDATE DESC ) rn
  60 + FROM
  61 + SENDLOG
  62 + ) t2 ON t1.AUTOID = t2.MESSAGEAUTOID
  63 + AND t2.rn = 1
  64 + ) t3
  65 + where 1=1
  66 + <if test="flightno != null and flightno != ''">
  67 + and FLIGHTNO = #{flightno,jdbcType=VARCHAR}
  68 + </if>
  69 + <if test="flightDate != null">
  70 + AND FLIGHT_DATE = #{flightDate,jdbcType=DATE}
  71 + </if>
  72 + <if test="waybillnomaster != null and waybillnomaster != ''">
  73 + AND WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  74 + </if>
  75 + order by CREATEDATE desc
  76 + </select>
  77 + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  78 + delete from CGONMS.MANIFEST_AIR_CHANGE
  79 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  80 + </delete>
  81 + <insert id="insert" parameterType="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" >
  82 + insert into CGONMS.MANIFEST_AIR_CHANGE (AUTOID, FLIGHTNO, CHANGE_FLIGHTNO,
  83 + WAYBILLNOMASTER, CHANGE_WAYBILLNOMASTER,
  84 + CONT, CREATEDATE, CHANGETIME,
  85 + CARRIER, CHANGE_CARRIER, FLIGHT_DATE,
  86 + CHANGE_FLIGHT_DATE, CUSTOMS_CODE)
  87 + values (#{autoid,jdbcType=VARCHAR}, #{flightno,jdbcType=VARCHAR}, #{changeFlightno,jdbcType=VARCHAR},
  88 + #{waybillnomaster,jdbcType=VARCHAR}, #{changeWaybillnomaster,jdbcType=VARCHAR},
  89 + #{cont,jdbcType=VARCHAR}, #{createdate,jdbcType=TIMESTAMP}, #{changetime,jdbcType=TIMESTAMP},
  90 + #{carrier,jdbcType=VARCHAR}, #{changeCarrier,jdbcType=VARCHAR}, #{flightDate,jdbcType=DATE},
  91 + #{changeFlightDate,jdbcType=DATE}, #{customsCode,jdbcType=VARCHAR})
  92 + </insert>
  93 + <insert id="insertSelective" parameterType="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" >
  94 + insert into CGONMS.MANIFEST_AIR_CHANGE
  95 + <trim prefix="(" suffix=")" suffixOverrides="," >
  96 + <if test="autoid != null" >
  97 + AUTOID,
  98 + </if>
  99 + <if test="flightno != null" >
  100 + FLIGHTNO,
  101 + </if>
  102 + <if test="changeFlightno != null" >
  103 + CHANGE_FLIGHTNO,
  104 + </if>
  105 + <if test="waybillnomaster != null" >
  106 + WAYBILLNOMASTER,
  107 + </if>
  108 + <if test="changeWaybillnomaster != null" >
  109 + CHANGE_WAYBILLNOMASTER,
  110 + </if>
  111 + <if test="cont != null" >
  112 + CONT,
  113 + </if>
  114 + <if test="createdate != null" >
  115 + CREATEDATE,
  116 + </if>
  117 + <if test="changetime != null" >
  118 + CHANGETIME,
  119 + </if>
  120 + <if test="carrier != null" >
  121 + CARRIER,
  122 + </if>
  123 + <if test="changeCarrier != null" >
  124 + CHANGE_CARRIER,
  125 + </if>
  126 + <if test="flightDate != null" >
  127 + FLIGHT_DATE,
  128 + </if>
  129 + <if test="changeFlightDate != null" >
  130 + CHANGE_FLIGHT_DATE,
  131 + </if>
  132 + <if test="customsCode != null" >
  133 + CUSTOMS_CODE,
  134 + </if>
  135 + </trim>
  136 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  137 + <if test="autoid != null" >
  138 + #{autoid,jdbcType=VARCHAR},
  139 + </if>
  140 + <if test="flightno != null" >
  141 + #{flightno,jdbcType=VARCHAR},
  142 + </if>
  143 + <if test="changeFlightno != null" >
  144 + #{changeFlightno,jdbcType=VARCHAR},
  145 + </if>
  146 + <if test="waybillnomaster != null" >
  147 + #{waybillnomaster,jdbcType=VARCHAR},
  148 + </if>
  149 + <if test="changeWaybillnomaster != null" >
  150 + #{changeWaybillnomaster,jdbcType=VARCHAR},
  151 + </if>
  152 + <if test="cont != null" >
  153 + #{cont,jdbcType=VARCHAR},
  154 + </if>
  155 + <if test="createdate != null" >
  156 + #{createdate,jdbcType=TIMESTAMP},
  157 + </if>
  158 + <if test="changetime != null" >
  159 + #{changetime,jdbcType=TIMESTAMP},
  160 + </if>
  161 + <if test="carrier != null" >
  162 + #{carrier,jdbcType=VARCHAR},
  163 + </if>
  164 + <if test="changeCarrier != null" >
  165 + #{changeCarrier,jdbcType=VARCHAR},
  166 + </if>
  167 + <if test="flightDate != null" >
  168 + #{flightDate,jdbcType=DATE},
  169 + </if>
  170 + <if test="changeFlightDate != null" >
  171 + #{changeFlightDate,jdbcType=DATE},
  172 + </if>
  173 + <if test="customsCode != null" >
  174 + #{customsCode,jdbcType=VARCHAR},
  175 + </if>
  176 + </trim>
  177 + </insert>
  178 + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" >
  179 + update CGONMS.MANIFEST_AIR_CHANGE
  180 + <set >
  181 + <if test="flightno != null" >
  182 + FLIGHTNO = #{flightno,jdbcType=VARCHAR},
  183 + </if>
  184 + <if test="changeFlightno != null" >
  185 + CHANGE_FLIGHTNO = #{changeFlightno,jdbcType=VARCHAR},
  186 + </if>
  187 + <if test="waybillnomaster != null" >
  188 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
  189 + </if>
  190 + <if test="changeWaybillnomaster != null" >
  191 + CHANGE_WAYBILLNOMASTER = #{changeWaybillnomaster,jdbcType=VARCHAR},
  192 + </if>
  193 + <if test="cont != null" >
  194 + CONT = #{cont,jdbcType=VARCHAR},
  195 + </if>
  196 + <if test="createdate != null" >
  197 + CREATEDATE = #{createdate,jdbcType=TIMESTAMP},
  198 + </if>
  199 + <if test="changetime != null" >
  200 + CHANGETIME = #{changetime,jdbcType=TIMESTAMP},
  201 + </if>
  202 + <if test="carrier != null" >
  203 + CARRIER = #{carrier,jdbcType=VARCHAR},
  204 + </if>
  205 + <if test="changeCarrier != null" >
  206 + CHANGE_CARRIER = #{changeCarrier,jdbcType=VARCHAR},
  207 + </if>
  208 + <if test="flightDate != null" >
  209 + FLIGHT_DATE = #{flightDate,jdbcType=DATE},
  210 + </if>
  211 + <if test="changeFlightDate != null" >
  212 + CHANGE_FLIGHT_DATE = #{changeFlightDate,jdbcType=DATE},
  213 + </if>
  214 + <if test="customsCode != null" >
  215 + CUSTOMS_CODE = #{customsCode,jdbcType=VARCHAR},
  216 + </if>
  217 + </set>
  218 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  219 + </update>
  220 + <update id="updateByPrimaryKey" parameterType="com.tianbo.analysis.model.MANIFEST_AIR_CHANGE" >
  221 + update CGONMS.MANIFEST_AIR_CHANGE
  222 + set FLIGHTNO = #{flightno,jdbcType=VARCHAR},
  223 + CHANGE_FLIGHTNO = #{changeFlightno,jdbcType=VARCHAR},
  224 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
  225 + CHANGE_WAYBILLNOMASTER = #{changeWaybillnomaster,jdbcType=VARCHAR},
  226 + CONT = #{cont,jdbcType=VARCHAR},
  227 + CREATEDATE = #{createdate,jdbcType=TIMESTAMP},
  228 + CHANGETIME = #{changetime,jdbcType=TIMESTAMP},
  229 + CARRIER = #{carrier,jdbcType=VARCHAR},
  230 + CHANGE_CARRIER = #{changeCarrier,jdbcType=VARCHAR},
  231 + FLIGHT_DATE = #{flightDate,jdbcType=DATE},
  232 + CHANGE_FLIGHT_DATE = #{changeFlightDate,jdbcType=DATE},
  233 + CUSTOMS_CODE = #{customsCode,jdbcType=VARCHAR}
  234 + where AUTOID = #{autoid,jdbcType=VARCHAR}
  235 + </update>
  236 +</mapper>