作者 朱兆平

JSON格式的回执解析。

@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 web: 3 web:
4 upload-path: upload/ 4 upload-path: upload/
5 server: 5 server:
6 - port: 11112 6 + port: 11113
7 servlet: 7 servlet:
8 context-path: ${SERVER_CONTEXTPATH:} 8 context-path: ${SERVER_CONTEXTPATH:}
9 spring: 9 spring:
@@ -53,10 +53,10 @@ spring: @@ -53,10 +53,10 @@ spring:
53 #username=CGOETL 53 #username=CGOETL
54 #password=1q2w3e4r 54 #password=1q2w3e4r
55 #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码 55 #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码
56 -# url: jdbc:mysql://118.31.66.166:3306/station?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8  
57 - url: jdbc:mysql://8.131.245.248:3306/zz_logistics?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8  
58 - username: root  
59 - password: ZZdsly123 56 + url: jdbc:mysql://118.31.66.166:3306/WLPT_NMMS?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
  57 +# url: jdbc:mysql://8.131.245.248:3306/zz_logistics?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
  58 + username: 110
  59 + password: QAHqCJf2kFYCLirM
60 driver-class-name: com.mysql.cj.jdbc.Driver 60 driver-class-name: com.mysql.cj.jdbc.Driver
61 #配置初始化大小/最小/最大 61 #配置初始化大小/最小/最大
62 druid: 62 druid:
@@ -118,7 +118,7 @@ management: @@ -118,7 +118,7 @@ management:
118 118
119 mybatis: 119 mybatis:
120 mapper-locations: classpath:mapping/*.xml 120 mapper-locations: classpath:mapping/*.xml
121 - type-aliases-package: com.sunyo.usercenter.heartbeat.model 121 + type-aliases-package: com.tianbo.messagebus.model
122 pagehelper: 122 pagehelper:
123 #auto-dialect: true 123 #auto-dialect: true
124 #auto-runtime-dialect: true 124 #auto-runtime-dialect: true
@@ -157,7 +157,7 @@ message-bus: @@ -157,7 +157,7 @@ message-bus:
157 #报文接收地址 157 #报文接收地址
158 get-url: http://36.134.143.171:8083/api/kafka-server-consumer/kafka/receive 158 get-url: http://36.134.143.171:8083/api/kafka-server-consumer/kafka/receive
159 auth: 159 auth:
160 - username: yangyucheng 160 + username: CETC
161 password: 111111 161 password: 111111
162 #心跳间隔时间默认10秒,单位毫秒 162 #心跳间隔时间默认10秒,单位毫秒
163 heartbit-interval: 10000 163 heartbit-interval: 10000
@@ -144,6 +144,32 @@ @@ -144,6 +144,32 @@
144 </filter> 144 </filter>
145 </appender> 145 </appender>
146 146
  147 + <!-- 时间滚动输出 level为 trace 日志 -->
  148 + <appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  149 + <!-- 正在记录的日志文件的路径及文件名 -->
  150 + <file>${log.path}/log_trace.log</file>
  151 + <!--日志文件输出格式-->
  152 + <encoder>
  153 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
  154 + <charset>UTF-8</charset> <!-- 此处设置字符集 -->
  155 + </encoder>
  156 + <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
  157 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  158 + <fileNamePattern>${log.path}/trace/log-trace-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  159 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  160 + <maxFileSize>100MB</maxFileSize>
  161 + </timeBasedFileNamingAndTriggeringPolicy>
  162 + <!--日志文件保留天数-->
  163 + <maxHistory>15</maxHistory>
  164 + </rollingPolicy>
  165 + <!-- 此日志文件只记录trace级别的 -->
  166 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  167 + <level>TRACE</level>
  168 + <onMatch>ACCEPT</onMatch>
  169 + <onMismatch>DENY</onMismatch>
  170 + </filter>
  171 + </appender>
  172 +
147 <!-- 173 <!--
148 <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 174 <logger>用来设置某一个包或者具体的某一个类的日志打印级别、
149 以及指定<appender>。<logger>仅有一个name属性, 175 以及指定<appender>。<logger>仅有一个name属性,
@@ -169,17 +195,17 @@ @@ -169,17 +195,17 @@
169 不能设置为INHERITED或者同义词NULL。默认是DEBUG 195 不能设置为INHERITED或者同义词NULL。默认是DEBUG
170 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 196 可以包含零个或多个元素,标识这个appender将会添加到这个logger。
171 --> 197 -->
172 - <logger name="com.sunyo.usercenter.heartbeat.dao" level="debug" />  
173 <!--开发环境:打印控制台--> 198 <!--开发环境:打印控制台-->
174 <springProfile name="dev"> 199 <springProfile name="dev">
175 - <logger name="org.apache.tomcat" level="info" />  
176 - <logger name="com.sunyo.usercenter.heartbeat" level="debug" /> 200 + <logger name="com.tianbo.messagebus.service.MessageBusProcessor" level="ALL" />
  201 + <logger name="com.tianbo.messagebus.dao" level="DEBUG" />
177 <root level="INFO"> 202 <root level="INFO">
178 <appender-ref ref="CONSOLE" /> 203 <appender-ref ref="CONSOLE" />
179 <appender-ref ref="DEBUG_FILE" /> 204 <appender-ref ref="DEBUG_FILE" />
180 <appender-ref ref="INFO_FILE" /> 205 <appender-ref ref="INFO_FILE" />
181 <appender-ref ref="WARN_FILE" /> 206 <appender-ref ref="WARN_FILE" />
182 <appender-ref ref="ERROR_FILE" /> 207 <appender-ref ref="ERROR_FILE" />
  208 + <appender-ref ref="TRACE_FILE" />
183 </root> 209 </root>
184 </springProfile> 210 </springProfile>
185 211
@@ -194,4 +220,4 @@ @@ -194,4 +220,4 @@
194 </root> 220 </root>
195 </springProfile> 221 </springProfile>
196 222
197 -</configuration>  
  223 +</configuration>
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <packaging>jar</packaging> 6 <packaging>jar</packaging>
7 <groupId>com.tianbo</groupId> 7 <groupId>com.tianbo</groupId>
8 <artifactId>messagebus-trans-message</artifactId> 8 <artifactId>messagebus-trans-message</artifactId>
9 - <version>1.0-feign</version> 9 + <version>1.0-parse</version>
10 <description>消息转发服务</description> 10 <description>消息转发服务</description>
11 11
12 <parent> 12 <parent>
@@ -21,7 +21,8 @@ @@ -21,7 +21,8 @@
21 <spring-cloud.version>Hoxton.SR9</spring-cloud.version> 21 <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
22 <swagger2_version>2.9.2</swagger2_version> 22 <swagger2_version>2.9.2</swagger2_version>
23 <fastjson_version>1.2.73</fastjson_version> 23 <fastjson_version>1.2.73</fastjson_version>
24 - <lombok_sersion>1.18.6</lombok_sersion> 24 + <lombok_sersion>1.18.16</lombok_sersion>
  25 + <druid.version>1.1.9</druid.version>
25 </properties> 26 </properties>
26 27
27 <dependencies> 28 <dependencies>
@@ -48,21 +49,49 @@ @@ -48,21 +49,49 @@
48 <groupId>org.springframework.cloud</groupId> 49 <groupId>org.springframework.cloud</groupId>
49 <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> 50 <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
50 </dependency> 51 </dependency>
  52 +
  53 + <!--数据库相关-->
  54 + <dependency>
  55 + <groupId>mysql</groupId>
  56 + <artifactId>mysql-connector-java</artifactId>
  57 + <scope>runtime</scope>
  58 + <version>8.0.15</version>
  59 + </dependency>
  60 + <dependency>
  61 + <groupId>com.alibaba</groupId>
  62 + <artifactId>druid</artifactId>
  63 + <version>${druid.version}</version>
  64 + </dependency>
  65 + <dependency>
  66 + <groupId>org.springframework.boot</groupId>
  67 + <artifactId>spring-boot-starter-jdbc</artifactId>
  68 + </dependency>
  69 + <dependency>
  70 + <groupId>org.mybatis.spring.boot</groupId>
  71 + <artifactId>mybatis-spring-boot-starter</artifactId>
  72 + <version>2.2.0</version>
  73 + </dependency>
  74 + <dependency>
  75 + <groupId>org.mybatis</groupId>
  76 + <artifactId>mybatis</artifactId>
  77 + <version>3.4.6</version>
  78 + </dependency>
  79 + <!--数据库相关-->
  80 +
51 <dependency> 81 <dependency>
52 <groupId>com.alibaba</groupId> 82 <groupId>com.alibaba</groupId>
53 <artifactId>fastjson</artifactId> 83 <artifactId>fastjson</artifactId>
54 <version>${fastjson_version}</version> 84 <version>${fastjson_version}</version>
55 </dependency> 85 </dependency>
56 <dependency> 86 <dependency>
  87 + <groupId>com.tianbo</groupId>
  88 + <artifactId>util</artifactId>
  89 + <version>1.0-SNAPSHOT</version>
  90 + </dependency>
  91 + <dependency>
57 <groupId>org.springframework.boot</groupId> 92 <groupId>org.springframework.boot</groupId>
58 <artifactId>spring-boot-starter-test</artifactId> 93 <artifactId>spring-boot-starter-test</artifactId>
59 <scope>test</scope> 94 <scope>test</scope>
60 - <exclusions>  
61 - <exclusion>  
62 - <groupId>org.junit.vintage</groupId>  
63 - <artifactId>junit-vintage-engine</artifactId>  
64 - </exclusion>  
65 - </exclusions>  
66 </dependency> 95 </dependency>
67 </dependencies> 96 </dependencies>
68 <dependencyManagement> 97 <dependencyManagement>
@@ -82,6 +111,17 @@ @@ -82,6 +111,17 @@
82 <groupId>org.springframework.boot</groupId> 111 <groupId>org.springframework.boot</groupId>
83 <artifactId>spring-boot-maven-plugin</artifactId> 112 <artifactId>spring-boot-maven-plugin</artifactId>
84 </plugin> 113 </plugin>
  114 + <!-- mybatis generator 自动生成代码插件 -->
  115 + <plugin>
  116 + <groupId>org.mybatis.generator</groupId>
  117 + <artifactId>mybatis-generator-maven-plugin</artifactId>
  118 + <version>1.3.2</version>
  119 + <configuration>
  120 + <configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
  121 + <overwrite>true</overwrite>
  122 + <verbose>true</verbose>
  123 + </configuration>
  124 + </plugin>
85 </plugins> 125 </plugins>
86 </build> 126 </build>
87 </project> 127 </project>
1 package com.tianbo.messagebus; 1 package com.tianbo.messagebus;
2 2
  3 +import org.mybatis.spring.annotation.MapperScan;
3 import org.springframework.boot.SpringApplication; 4 import org.springframework.boot.SpringApplication;
4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5 import org.springframework.boot.autoconfigure.SpringBootApplication;
5 import org.springframework.boot.web.client.RestTemplateBuilder; 6 import org.springframework.boot.web.client.RestTemplateBuilder;
@@ -15,6 +16,7 @@ import org.springframework.web.client.RestTemplate; @@ -15,6 +16,7 @@ import org.springframework.web.client.RestTemplate;
15 @EnableEurekaClient 16 @EnableEurekaClient
16 @EnableFeignClients 17 @EnableFeignClients
17 @EnableScheduling 18 @EnableScheduling
  19 +@MapperScan("com.tianbo.messagebus.dao")
18 public class MessageTransApplication { 20 public class MessageTransApplication {
19 21
20 public static void main(String[] args) { 22 public static void main(String[] args) {
@@ -3,6 +3,8 @@ package com.tianbo.messagebus.controller; @@ -3,6 +3,8 @@ package com.tianbo.messagebus.controller;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.tianbo.messagebus.controller.response.ResultJson; 5 import com.tianbo.messagebus.controller.response.ResultJson;
  6 +import com.tianbo.messagebus.dao.CUSTOM_RESPONSEMapper;
  7 +import com.tianbo.messagebus.model.CUSTOM_RESPONSE;
6 import com.tianbo.messagebus.model.HEADER; 8 import com.tianbo.messagebus.model.HEADER;
7 import com.tianbo.messagebus.model.MSG; 9 import com.tianbo.messagebus.model.MSG;
8 import com.tianbo.messagebus.model.MSGS; 10 import com.tianbo.messagebus.model.MSGS;
@@ -30,9 +32,15 @@ public class HeartbeatController implements Serializable { @@ -30,9 +32,15 @@ public class HeartbeatController implements Serializable {
30 @Autowired 32 @Autowired
31 KafkaReciveApi kafkaReciveApi; 33 KafkaReciveApi kafkaReciveApi;
32 34
  35 + @Resource
  36 + public CUSTOM_RESPONSEMapper custom_responseMapper_nmms20;
  37 +
33 @Autowired 38 @Autowired
34 KafkaSendApi kafkaSendApi; 39 KafkaSendApi kafkaSendApi;
35 40
  41 + @Resource
  42 + CUSTOM_RESPONSEMapper custom_responseMapper;
  43 +
36 @Autowired 44 @Autowired
37 private HttpServletRequest request; 45 private HttpServletRequest request;
38 46
@@ -82,4 +90,10 @@ public class HeartbeatController implements Serializable { @@ -82,4 +90,10 @@ public class HeartbeatController implements Serializable {
82 log.info(response.toString()); 90 log.info(response.toString());
83 } 91 }
84 92
  93 +
  94 + @PostMapping("parse")
  95 + public void parse(@RequestBody CUSTOM_RESPONSE custom_response){
  96 + int i = custom_responseMapper.insertSelective(custom_response);
  97 + log.info("插入数据为{}",i);
  98 + }
85 } 99 }
  1 +package com.tianbo.messagebus.dao;
  2 +
  3 +
  4 +import com.tianbo.messagebus.model.CUSTOM_RESPONSE;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface CUSTOM_RESPONSEMapper {
  9 + int deleteByPrimaryKey(String id);
  10 +
  11 + int insert(CUSTOM_RESPONSE record);
  12 +
  13 + int insertSelective(CUSTOM_RESPONSE record);
  14 +
  15 + CUSTOM_RESPONSE selectByPrimaryKey(String id);
  16 +
  17 + List<CUSTOM_RESPONSE> selectByCustomMsgId(String cusmsgid);
  18 +
  19 + int updateByPrimaryKeySelective(CUSTOM_RESPONSE record);
  20 +
  21 + int updateByPrimaryKeyWithBLOBs(CUSTOM_RESPONSE record);
  22 +
  23 + int updateByPrimaryKey(CUSTOM_RESPONSE record);
  24 +}
  1 +package com.tianbo.messagebus.model;
  2 +
  3 +import com.tianbo.messagebus.dao.CUSTOM_RESPONSEMapper;
  4 +import com.tianbo.messagebus.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import org.apache.commons.lang.StringUtils;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +
  10 +import javax.annotation.Resource;
  11 +import java.math.BigDecimal;
  12 +import java.util.Date;
  13 +import java.util.List;
  14 +import java.util.UUID;
  15 +
  16 +public class CUSTOM_RESPONSE {
  17 +
  18 + private String id;
  19 +
  20 + private Date flightdate;
  21 +
  22 + private String flightno;
  23 +
  24 + private String carrier;
  25 +
  26 + private String awbano;
  27 +
  28 + private String awbhno;
  29 +
  30 + private String bustype;
  31 +
  32 + private Date busdate;
  33 +
  34 + private BigDecimal busweight;
  35 +
  36 + private Integer buspiece;
  37 +
  38 + private String opertype;
  39 +
  40 + private String cusmsgid;
  41 +
  42 + private String cussenderid;
  43 +
  44 + private String cusreciverid;
  45 +
  46 + private String cusversion;
  47 +
  48 + private String cusfunctioncode;
  49 +
  50 + private Date cusresrcvtime;
  51 +
  52 + private Date cusressendtime;
  53 +
  54 + private String cusrescode;
  55 +
  56 + private String cusresstatus;
  57 +
  58 + private String operusername;
  59 +
  60 + private String opersystemname;
  61 +
  62 + private String operreason;
  63 +
  64 + private String operperson;
  65 +
  66 + private String opertel;
  67 +
  68 + private String cusrestext;
  69 +
  70 + public String getId() {
  71 + return id;
  72 + }
  73 +
  74 + public void setId(String id) {
  75 + this.id = id == null ? null : id.trim();
  76 + }
  77 +
  78 + public Date getFlightdate() {
  79 + return flightdate;
  80 + }
  81 +
  82 + public void setFlightdate(Date flightdate) {
  83 + this.flightdate = flightdate;
  84 + }
  85 +
  86 + public String getFlightno() {
  87 + return flightno;
  88 + }
  89 +
  90 + public void setFlightno(String flightno) {
  91 + this.flightno = flightno == null ? null : flightno.trim();
  92 + }
  93 +
  94 + public String getCarrier() {
  95 + return carrier;
  96 + }
  97 +
  98 + public void setCarrier(String carrier) {
  99 + this.carrier = carrier == null ? null : carrier.trim();
  100 + }
  101 +
  102 + public String getAwbano() {
  103 + return awbano;
  104 + }
  105 +
  106 + public void setAwbano(String awbano) {
  107 + this.awbano = awbano == null ? null : awbano.trim();
  108 + }
  109 +
  110 + public String getAwbhno() {
  111 + return awbhno;
  112 + }
  113 +
  114 + public void setAwbhno(String awbhno) {
  115 + this.awbhno = awbhno == null ? null : awbhno.trim();
  116 + }
  117 +
  118 + public String getBustype() {
  119 + return bustype;
  120 + }
  121 +
  122 + public void setBustype(String bustype) {
  123 + this.bustype = bustype == null ? null : bustype.trim();
  124 + }
  125 +
  126 + public Date getBusdate() {
  127 + return busdate;
  128 + }
  129 +
  130 + public void setBusdate(Date busdate) {
  131 + this.busdate = busdate;
  132 + }
  133 +
  134 + public BigDecimal getBusweight() {
  135 + return busweight;
  136 + }
  137 +
  138 + public void setBusweight(BigDecimal busweight) {
  139 + this.busweight = busweight;
  140 + }
  141 +
  142 + public Integer getBuspiece() {
  143 + return buspiece;
  144 + }
  145 +
  146 + public void setBuspiece(Integer buspiece) {
  147 + this.buspiece = buspiece;
  148 + }
  149 +
  150 + public String getOpertype() {
  151 + return opertype;
  152 + }
  153 +
  154 + public void setOpertype(String opertype) {
  155 + this.opertype = opertype == null ? null : opertype.trim();
  156 + }
  157 +
  158 + public String getCusmsgid() {
  159 + return cusmsgid;
  160 + }
  161 +
  162 + public void setCusmsgid(String cusmsgid) {
  163 + this.cusmsgid = cusmsgid == null ? null : cusmsgid.trim();
  164 + }
  165 +
  166 + public String getCussenderid() {
  167 + return cussenderid;
  168 + }
  169 +
  170 + public void setCussenderid(String cussenderid) {
  171 + this.cussenderid = cussenderid == null ? null : cussenderid.trim();
  172 + }
  173 +
  174 + public String getCusreciverid() {
  175 + return cusreciverid;
  176 + }
  177 +
  178 + public void setCusreciverid(String cusreciverid) {
  179 + this.cusreciverid = cusreciverid == null ? null : cusreciverid.trim();
  180 + }
  181 +
  182 + public String getCusversion() {
  183 + return cusversion;
  184 + }
  185 +
  186 + public void setCusversion(String cusversion) {
  187 + this.cusversion = cusversion == null ? null : cusversion.trim();
  188 + }
  189 +
  190 + public String getCusfunctioncode() {
  191 + return cusfunctioncode;
  192 + }
  193 +
  194 + public void setCusfunctioncode(String cusfunctioncode) {
  195 + this.cusfunctioncode = cusfunctioncode == null ? null : cusfunctioncode.trim();
  196 + }
  197 +
  198 + public Date getCusresrcvtime() {
  199 + return cusresrcvtime;
  200 + }
  201 +
  202 + public void setCusresrcvtime(Date cusresrcvtime) {
  203 + this.cusresrcvtime = cusresrcvtime;
  204 + }
  205 +
  206 + public Date getCusressendtime() {
  207 + return cusressendtime;
  208 + }
  209 +
  210 + public void setCusressendtime(Date cusressendtime) {
  211 + this.cusressendtime = cusressendtime;
  212 + }
  213 +
  214 + public String getCusrescode() {
  215 + return cusrescode;
  216 + }
  217 +
  218 + public void setCusrescode(String cusrescode) {
  219 + this.cusrescode = cusrescode == null ? null : cusrescode.trim();
  220 + }
  221 +
  222 + public String getCusresstatus() {
  223 + return cusresstatus;
  224 + }
  225 +
  226 + public void setCusresstatus(String cusresstatus) {
  227 + this.cusresstatus = cusresstatus == null ? null : cusresstatus.trim();
  228 + }
  229 +
  230 + public String getOperusername() {
  231 + return operusername;
  232 + }
  233 +
  234 + public void setOperusername(String operusername) {
  235 + this.operusername = operusername == null ? null : operusername.trim();
  236 + }
  237 +
  238 + public String getOpersystemname() {
  239 + return opersystemname;
  240 + }
  241 +
  242 + public void setOpersystemname(String opersystemname) {
  243 + this.opersystemname = opersystemname == null ? null : opersystemname.trim();
  244 + }
  245 +
  246 + public String getOperreason() {
  247 + return operreason;
  248 + }
  249 +
  250 + public void setOperreason(String operreason) {
  251 + this.operreason = operreason == null ? null : operreason.trim();
  252 + }
  253 +
  254 + public String getOperperson() {
  255 + return operperson;
  256 + }
  257 +
  258 + public void setOperperson(String operperson) {
  259 + this.operperson = operperson == null ? null : operperson.trim();
  260 + }
  261 +
  262 + public String getOpertel() {
  263 + return opertel;
  264 + }
  265 +
  266 + public void setOpertel(String opertel) {
  267 + this.opertel = opertel == null ? null : opertel.trim();
  268 + }
  269 +
  270 + public String getCusrestext() {
  271 + return cusrestext;
  272 + }
  273 +
  274 + public void setCusrestext(String cusrestext) {
  275 + this.cusrestext = cusrestext == null ? null : cusrestext.trim();
  276 + }
  277 +
  278 + public CUSTOM_RESPONSE() {
  279 +
  280 + }
  281 +
  282 + /**
  283 + * 海关回执实体与系统回执实体转换
  284 + * @param customReception
  285 + */
  286 + public CUSTOM_RESPONSE(CustomReception customReception) {
  287 + this.id = UUID.randomUUID().toString();
  288 + this.awbano = AWBTools.awbFormat(customReception.getWayBillMaster());
  289 +
  290 + //取分单号
  291 + if (!StringUtils.isEmpty(customReception.getWayBillSecond())){
  292 + String[] awbhArr = customReception.getWayBillSecond().split("_");
  293 + this.awbhno = awbhArr[1];
  294 + }
  295 +
  296 +
  297 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  298 + this.setFlightno(flightInfo[1]);
  299 + this.setCarrier(flightInfo[0]);
  300 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  301 + this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  302 + }
  303 + this.cusrestext = customReception.getResponseText();
  304 + this.cusrescode = customReception.getResponseCode();
  305 + this.bustype = customReception.getMessageType();
  306 + this.cusfunctioncode = customReception.getFunctionCode();
  307 + this.operusername = "SYSTEM";
  308 + this.cusmsgid = customReception.getMessageID();
  309 + this.opertype = "回执";
  310 + this.cussenderid = customReception.getSenderID();
  311 + this.cusreciverid = customReception.getReceiverID();
  312 + this.cusresrcvtime = new Date();
  313 + this.cusressendtime = DateUtil.formatByyyyyMMddHHmmss(customReception.getSendTime());
  314 + this.cusversion = customReception.getVersion();
  315 +
  316 + //单独存储下回执内容中的回执业务代码
  317 + if(this.cusrescode!= "0" && this.cusrestext!= null && this.cusrestext.length()>5){
  318 + this.cusresstatus = customReception.getResponseText().substring(0,5);
  319 + }
  320 + }
  321 +
  322 + @Override
  323 + public String toString() {
  324 + return "CUSTOM_RESPONSE{" +
  325 + "id='" + id + '\'' +
  326 + ", flightdate=" + flightdate +
  327 + ", flightno='" + flightno + '\'' +
  328 + ", carrier='" + carrier + '\'' +
  329 + ", awbano='" + awbano + '\'' +
  330 + ", awbhno='" + awbhno + '\'' +
  331 + ", bustype='" + bustype + '\'' +
  332 + ", busdate=" + busdate +
  333 + ", busweight=" + busweight +
  334 + ", buspiece=" + buspiece +
  335 + ", opertype='" + opertype + '\'' +
  336 + ", cusmsgid='" + cusmsgid + '\'' +
  337 + ", cussenderid='" + cussenderid + '\'' +
  338 + ", cusreciverid='" + cusreciverid + '\'' +
  339 + ", cusversion='" + cusversion + '\'' +
  340 + ", cusfunctioncode='" + cusfunctioncode + '\'' +
  341 + ", cusresrcvtime=" + cusresrcvtime +
  342 + ", cusressendtime=" + cusressendtime +
  343 + ", cusrescode='" + cusrescode + '\'' +
  344 + ", cusresstatus='" + cusresstatus + '\'' +
  345 + ", operusername='" + operusername + '\'' +
  346 + ", opersystemname='" + opersystemname + '\'' +
  347 + ", operreason='" + operreason + '\'' +
  348 + ", operperson='" + operperson + '\'' +
  349 + ", opertel='" + opertel + '\'' +
  350 + ", cusrestext='" + cusrestext + '\'' +
  351 + '}';
  352 + }
  353 +}
  1 +package com.tianbo.messagebus.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class CustomReception {
  7 + //回执报头
  8 + private String messageID;
  9 + private String functionCode;
  10 + private String messageType;
  11 + private String senderID;
  12 + private String receiverID;
  13 + private String sendTime;
  14 + private String version;
  15 +
  16 + //一般业务回执
  17 + private String flightNo;
  18 + private String flightDate;
  19 + private String wayBillMaster;
  20 + private String wayBillSecond;
  21 + private String responseCode;
  22 + private String responseText;
  23 +
  24 + //国际转运回执
  25 + private String importFlightDate;
  26 + private String importFlightNo;
  27 + private String importWaybillMaster;
  28 + private String exportFlightDate;
  29 + private String exportFlightNo;
  30 + private String exportWaybillMaster;
  31 +
  32 + public CustomReception(String messageType,
  33 + String flightNo,
  34 + String flightDate,
  35 + String wayBillMaster,
  36 + String wayBillSecond,
  37 + String responseCode,
  38 + String responseText,
  39 + String messageID,
  40 + String sendTime,
  41 + String senderID,
  42 + String receiverID,
  43 + String version,
  44 + String functionCode){
  45 + this.messageType = messageType;
  46 + this.flightNo = flightNo;
  47 + this.flightDate = flightDate;
  48 + this.wayBillMaster = wayBillMaster;
  49 + this.wayBillSecond = wayBillSecond;
  50 + this.responseCode = responseCode;
  51 + this.responseText = responseText;
  52 + this.messageID = messageID;
  53 + this.sendTime = sendTime;
  54 + this.senderID =senderID;
  55 + this.receiverID = receiverID;
  56 + this.version = version;
  57 + this.functionCode = functionCode;
  58 + }
  59 +
  60 + public CustomReception(String messageType,
  61 + String importFlightNo,
  62 + String importFlightDate,
  63 + String importWaybillMaster,
  64 + String transResponseCode,
  65 + String transResponseText,
  66 + String messageID,
  67 + String sendTime,
  68 + String senderID,
  69 + String receiverID,
  70 + String version,
  71 + String functionCode){
  72 + this.messageType = messageType;
  73 + this.importFlightNo = importFlightNo;
  74 + this.importFlightDate = importFlightDate;
  75 + this.importWaybillMaster = importWaybillMaster;
  76 + this.responseCode = transResponseCode;
  77 + this.responseText = transResponseText;
  78 + this.messageID = messageID;
  79 + this.sendTime = sendTime;
  80 + this.senderID =senderID;
  81 + this.receiverID = receiverID;
  82 + this.version = version;
  83 + this.functionCode = functionCode;
  84 + }
  85 +}
  1 +package com.tianbo.messagebus.service;
  2 +
  3 +import com.tianbo.messagebus.dao.CUSTOM_RESPONSEMapper;
  4 +import com.tianbo.messagebus.model.CUSTOM_RESPONSE;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import javax.annotation.Resource;
  8 +import java.util.List;
  9 +
  10 +@Service
  11 +public class Custom_Response_Service {
  12 +
  13 + @Resource
  14 + public CUSTOM_RESPONSEMapper custom_responseMapper_nmms20;
  15 +
  16 + /**
  17 + * 回执入库
  18 + * @return
  19 + */
  20 + public int secondAnalysisReception(CUSTOM_RESPONSE custom_response) {
  21 + //更新分单回执
  22 + int i = custom_responseMapper_nmms20.insertSelective(custom_response);
  23 + return i;
  24 +
  25 + }
  26 +
  27 + /**
  28 + * 出错报文的适配问题,
  29 + * @return
  30 + */
  31 + public CUSTOM_RESPONSE getWaybillInfoByCutomResponse(CUSTOM_RESPONSE custom_response){
  32 + List<CUSTOM_RESPONSE> res_list = custom_responseMapper_nmms20.selectByCustomMsgId(custom_response.getCusmsgid());
  33 + if (res_list.size()>0){
  34 + CUSTOM_RESPONSE result = res_list.get(0);
  35 + custom_response.setAwbano(result.getAwbano());
  36 +
  37 + custom_response.setAwbhno(result.getAwbhno());
  38 + custom_response.setFlightdate(result.getFlightdate());
  39 + custom_response.setCarrier(result.getCarrier());
  40 + custom_response.setFlightno( result.getFlightno());
  41 + }
  42 + return custom_response;
  43 +
  44 + }
  45 +
  46 + public CUSTOM_RESPONSE selectByPrimaryKey(String id){
  47 + return custom_responseMapper_nmms20.selectByPrimaryKey(id);
  48 + }
  49 +}
@@ -4,17 +4,13 @@ import com.alibaba.fastjson.JSON; @@ -4,17 +4,13 @@ import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
5 import com.alibaba.fastjson.JSONObject; 5 import com.alibaba.fastjson.JSONObject;
6 import com.tianbo.messagebus.controller.response.ResultJson; 6 import com.tianbo.messagebus.controller.response.ResultJson;
7 -import com.tianbo.messagebus.model.HEADER;  
8 -import com.tianbo.messagebus.model.MSG;  
9 -import com.tianbo.messagebus.model.MSGS; 7 +import com.tianbo.messagebus.model.*;
10 import com.tianbo.messagebus.myinterface.KafkaReciveApi; 8 import com.tianbo.messagebus.myinterface.KafkaReciveApi;
11 import com.tianbo.messagebus.myinterface.KafkaSendApi; 9 import com.tianbo.messagebus.myinterface.KafkaSendApi;
12 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
13 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.beans.factory.annotation.Value; 12 import org.springframework.beans.factory.annotation.Value;
15 import org.springframework.http.*; 13 import org.springframework.http.*;
16 -import org.springframework.scheduling.annotation.Async;  
17 -import org.springframework.scheduling.annotation.EnableAsync;  
18 import org.springframework.scheduling.annotation.Scheduled; 14 import org.springframework.scheduling.annotation.Scheduled;
19 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
20 import org.springframework.util.LinkedMultiValueMap; 16 import org.springframework.util.LinkedMultiValueMap;
@@ -94,6 +90,9 @@ public class MessageBusProcessor { @@ -94,6 +90,9 @@ public class MessageBusProcessor {
94 @Autowired 90 @Autowired
95 KafkaSendApi kafkaSendApi; 91 KafkaSendApi kafkaSendApi;
96 92
  93 + @Autowired
  94 + Custom_Response_Service custom_response_service;
  95 +
97 /** 96 /**
98 * 发起登录,存储token 97 * 发起登录,存储token
99 * 98 *
@@ -398,39 +397,138 @@ public class MessageBusProcessor { @@ -398,39 +397,138 @@ public class MessageBusProcessor {
398 /** 397 /**
399 * feigin从服务直接获取消息 398 * feigin从服务直接获取消息
400 */ 399 */
401 - @Scheduled(fixedRate = 1000) 400 + @Scheduled(fixedRate = 5000)
402 public void getDataFromFeigin(){ 401 public void getDataFromFeigin(){
403 402
404 - log.info("1-开始执行获取任务");  
405 - ResultJson<List<String>> listResultJson = kafkaReciveApi.recive("HYYW");  
406 - log.info("2-获取结果为:{},数量为:{}",listResultJson.toString(),listResultJson.getData().size());  
407 - if ("200".equals(listResultJson.getCode()) && listResultJson.getData()!=null && listResultJson.getData().size()>0){  
408 - log.info("3-开始处理获取数据");  
409 - List<String> dataList = listResultJson.getData();  
410 - for (int i = 0; i <dataList.size() ; i++) {  
411 - String msg = dataList.get(i);  
412 - log.info("4-循环处理消息[{}]--->{}<---",i,msg);  
413 - JSONObject rootJson = JSON.parseObject(msg);  
414 - JSONObject msgJson = rootJson.getJSONObject("MSG");  
415 - JSONObject body = msgJson.getJSONObject("BODY");  
416 -  
417 - HEADER msgHeader = msgJson.getObject("HEADER",HEADER.class);  
418 -  
419 - MSG transMsg= new MSG();  
420 - String transBody = body.toJSONString();  
421 - transMsg.setHEADER(msgHeader);  
422 - transMsg.setBODY(transBody);  
423 -  
424 - log.info("5-开始转发消息");  
425 - boolean sendResult = sendMsgByFeign(transMsg);  
426 - if(!sendResult){  
427 - log.error("!!!!!!消息--->{}<---转发失败!!!!!!,尝试重发",transMsg.toString());  
428 - //todo:消息备份或者重发?  
429 - reTrySend(transMsg); 403 + try{
  404 +
  405 + //初始化数据库
  406 + CUSTOM_RESPONSE test = custom_response_service.selectByPrimaryKey("111");
  407 + log.info("1-开始执行获取任务,获取账号为:{}",USER_NAME);
  408 + if(!StringUtils.isEmpty(USER_NAME)){
  409 +
  410 + ResultJson<List<String>> listResultJson = kafkaReciveApi.recive(USER_NAME);
  411 + log.info("2-获取结果为:{},数量为:{}",listResultJson.toString(),listResultJson.getData().size());
  412 + if ("200".equals(listResultJson.getCode()) && listResultJson.getData()!=null && listResultJson.getData().size()>0){
  413 + log.info("3-开始处理获取数据");
  414 + List<String> dataList = listResultJson.getData();
  415 + for (int i = 0; i <dataList.size() ; i++) {
  416 + String msg = dataList.get(i);
  417 + log.info("4-循环处理消息[{}]--->{}<---",i,msg);
  418 + JSONObject rootJson = JSON.parseObject(msg);
  419 + JSONObject msgJson = rootJson.getJSONObject("MSG");
  420 +
  421 + //回执实体
  422 + JSONObject body = msgJson.getJSONObject("BODY");
  423 +
  424 + //报头
  425 + HEADER msgHeader = msgJson.getObject("HEADER",HEADER.class);
  426 +
  427 + //判断类型
  428 + if ("CDHZ".equals(msgHeader.getSTYPE())){
  429 + log.info("@[一]@消息为舱单回执");
  430 + CUSTOM_RESPONSE custom_response_nmms2 = new CUSTOM_RESPONSE();
  431 + //判断回执类型
  432 + JSONObject Manifest = body.getJSONObject("Manifest");
  433 + JSONObject head = Manifest.getJSONObject("Head");
  434 + String messageType = head.getString("MessageType");
  435 + String messageID = head.getString("MessageID");
  436 + String sendTime = head.getString("SendTime");
  437 + String senderID = head.getString("SenderID");
  438 + String receiverID = head.getString("ReceiverID");
  439 + Integer version = head.getInteger("Version");
  440 + Integer functionCode = head.getInteger("FunctionCode");
  441 +
  442 +
  443 + if("MT2201".equals(messageType) || "MT9999".equals(messageType)){
  444 + log.info("@[二]@开始解析:{}",messageType);
  445 + // 航班信息
  446 + JSONObject response = Manifest.getJSONObject("Response");
  447 + JSONObject borderTransportMeans = response.getJSONObject("BorderTransportMeans");
  448 +
  449 + String flightNo = "UNKONW";
  450 + String flightDate = "20101010";
  451 +
  452 + String journeyid = borderTransportMeans.getString("JourneyID");
  453 +
  454 +
  455 +
  456 +
  457 + //运单信息
  458 + JSONObject consignment = response.getJSONObject("Consignment");
  459 +
  460 + JSONObject responseType = consignment.getJSONObject("ResponseType");
  461 + JSONObject transportContractDocument = consignment.getJSONObject("TransportContractDocument");
  462 + JSONObject associatedTransportDocument = consignment.getJSONObject("AssociatedTransportDocument");
  463 +
  464 + //回执代码
  465 + Integer responseCode = responseType.getIntValue("Code");
  466 + //回执内容
  467 + String responseText = responseType.getString("Text");
  468 +
  469 + Long waybillMaster = transportContractDocument.getLong("ID");
  470 +
  471 + String waybillSecond="";
  472 +
  473 + if (associatedTransportDocument!=null){
  474 + waybillSecond = associatedTransportDocument.getString("ID");
  475 + }
  476 +
  477 +
  478 + CustomReception customReception = new CustomReception( messageType,
  479 + flightNo,
  480 + flightDate,
  481 + waybillMaster.toString(),
  482 + waybillSecond,
  483 + responseCode.toString(),
  484 + responseText,
  485 + messageID,
  486 + sendTime,
  487 + senderID,
  488 + receiverID,
  489 + version.toString(),
  490 + functionCode.toString());
  491 +
  492 +
  493 + /**
  494 + * 如果回执中没有携带航班信息节点,说明是出错报文
  495 + * 到发送日志表根据messageid 找到相应的发送日志报文的航班及运单信息,再进行解析
  496 + */
  497 + if(!org.apache.commons.lang.StringUtils.isEmpty(journeyid)){
  498 +
  499 + String[] flightList = journeyid.split("/");
  500 + if(flightList.length > 0){
  501 + flightNo = flightList[0];
  502 + flightDate = flightList[1];
  503 +
  504 + log.info("@[三]@航班信息为:{}",journeyid);
  505 + customReception.setFlightNo(flightNo);
  506 + customReception.setFlightDate(flightDate);
  507 + }
  508 + custom_response_nmms2 = new CUSTOM_RESPONSE(customReception);
  509 + }else {
  510 + custom_response_nmms2 = new CUSTOM_RESPONSE(customReception);
  511 + custom_response_nmms2 = custom_response_service.getWaybillInfoByCutomResponse(custom_response_nmms2);
  512 + }
  513 + log.info("[(三.一)]{{}",custom_response_nmms2);
  514 +
  515 + int ii = custom_response_service.secondAnalysisReception(custom_response_nmms2);
  516 +
  517 + log.info("@[四]@回执解析完毕[{}]\n@@^PARSE SUCCESS^@@",ii);
  518 +
  519 + }
  520 + }
  521 + }
430 } 522 }
431 } 523 }
  524 +
  525 +
  526 + }catch (Exception e){
  527 + log.error("!!!处理消息出错:{}!!!",e.toString());
  528 + e.printStackTrace();
432 } 529 }
433 530
  531 +
434 } 532 }
435 533
436 /** 534 /**
  1 +package com.tianbo.messagebus.tools;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +
  5 +public class AWBTools {
  6 +
  7 + public static String awbFormat(String awbNo) {
  8 + if (!StringUtils.isEmpty(awbNo)) {
  9 + StringBuffer stringBuffer = new StringBuffer(awbNo);
  10 + stringBuffer.insert(3, "-");
  11 + awbNo = stringBuffer.toString();
  12 + return awbNo;
  13 + }
  14 + return "";
  15 + }
  16 +
  17 + /**
  18 + * 将航班号拆分成承运人及航班
  19 + * @param flightNo
  20 + * @return 返回数组 [0]为承运人 [1]为航班号
  21 + */
  22 + public static String[] splitFlight(String flightNo){
  23 + String[] flight = {"UNKONW","UNKONW"};
  24 + if (!StringUtils.isEmpty(flightNo) && flightNo.length()>2){
  25 + flight[0] = flightNo.substring(0,2);
  26 + flight[1] = flightNo.substring(2);
  27 + }
  28 + return flight;
  29 + }
  30 +
  31 + /**
  32 + * 拆分航班号与航班日期 CV7302/20190826
  33 + * @param flightNoAndDate
  34 + * @return [0] CV7302 [1]20190826
  35 + */
  36 + public static String[] splitFlightAndDate(String flightNoAndDate){
  37 + String[] flight = {"UNKONW","UNKONW"};
  38 + if(!StringUtils.isEmpty(flightNoAndDate)){
  39 + String[] flightList = flightNoAndDate.split("/");
  40 + if(flightList.length > 0){
  41 + flight[0] = flightList[0];
  42 + flight[1] = flightList[1];
  43 + }
  44 + }
  45 + return flight;
  46 + }
  47 +
  48 + /**
  49 + * 将海关回执中的response code 转换成新舱单1.0数据库中的相关状态,相关状态码参考readme.md
  50 + * @param rspCode
  51 + * @return
  52 + */
  53 + public static String transCusRspCode(String rspCode){
  54 + String nmsCode = "03";
  55 + switch (rspCode){
  56 + case "01":
  57 + nmsCode="04";
  58 + break;
  59 + case "02":
  60 + nmsCode="03";
  61 + break;
  62 + case "03":
  63 + nmsCode="03";
  64 + break;
  65 + case "11":
  66 + nmsCode="04";
  67 + break;
  68 + case "12":
  69 + nmsCode="03";
  70 + break;
  71 + case "13":
  72 + nmsCode="03";
  73 + break;
  74 + default:
  75 + nmsCode="03";
  76 + break;
  77 + }
  78 + return nmsCode;
  79 + }
  80 +}
  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.messagebus.dao.CUSTOM_RESPONSEMapper" >
  4 + <resultMap id="BaseResultMap" type="com.tianbo.messagebus.model.CUSTOM_RESPONSE" >
  5 + <id column="id" property="id" jdbcType="VARCHAR" />
  6 + <result column="flightDate" property="flightdate" jdbcType="DATE" />
  7 + <result column="flightNo" property="flightno" jdbcType="VARCHAR" />
  8 + <result column="carrier" property="carrier" jdbcType="VARCHAR" />
  9 + <result column="awbaNo" property="awbano" jdbcType="VARCHAR" />
  10 + <result column="awbhNo" property="awbhno" jdbcType="VARCHAR" />
  11 + <result column="busType" property="bustype" jdbcType="VARCHAR" />
  12 + <result column="busDate" property="busdate" jdbcType="TIMESTAMP" />
  13 + <result column="busWeight" property="busweight" jdbcType="DECIMAL" />
  14 + <result column="busPiece" property="buspiece" jdbcType="INTEGER" />
  15 + <result column="operType" property="opertype" jdbcType="VARCHAR" />
  16 + <result column="cusMsgId" property="cusmsgid" jdbcType="VARCHAR" />
  17 + <result column="cusSenderId" property="cussenderid" jdbcType="VARCHAR" />
  18 + <result column="cusReciverId" property="cusreciverid" jdbcType="VARCHAR" />
  19 + <result column="cusVersion" property="cusversion" jdbcType="VARCHAR" />
  20 + <result column="cusFunctionCode" property="cusfunctioncode" jdbcType="VARCHAR" />
  21 + <result column="cusResRcvTime" property="cusresrcvtime" jdbcType="TIMESTAMP" />
  22 + <result column="cusResSendTime" property="cusressendtime" jdbcType="TIMESTAMP" />
  23 + <result column="cusResCode" property="cusrescode" jdbcType="VARCHAR" />
  24 + <result column="cusResStatus" property="cusresstatus" jdbcType="VARCHAR" />
  25 + <result column="operUserName" property="operusername" jdbcType="VARCHAR" />
  26 + <result column="operSystemName" property="opersystemname" jdbcType="VARCHAR" />
  27 + <result column="operReason" property="operreason" jdbcType="VARCHAR" />
  28 + <result column="operPerson" property="operperson" jdbcType="VARCHAR" />
  29 + <result column="operTel" property="opertel" jdbcType="VARCHAR" />
  30 + </resultMap>
  31 + <resultMap id="ResultMapWithBLOBs" type="com.tianbo.messagebus.model.CUSTOM_RESPONSE" extends="BaseResultMap" >
  32 + <result column="cusResText" property="cusrestext" jdbcType="LONGVARCHAR" />
  33 + </resultMap>
  34 + <sql id="Base_Column_List" >
  35 + id, flightDate, flightNo, carrier, awbaNo, awbhNo, busType, busDate, busWeight, busPiece,
  36 + operType, cusMsgId, cusSenderId, cusReciverId, cusVersion, cusFunctionCode, cusResRcvTime,
  37 + cusResSendTime, cusResCode, cusResStatus, operUserName, operSystemName, operReason,
  38 + operPerson, operTel
  39 + </sql>
  40 + <sql id="Blob_Column_List" >
  41 + cusResText
  42 + </sql>
  43 + <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
  44 + select
  45 + <include refid="Base_Column_List" />
  46 + ,
  47 + <include refid="Blob_Column_List" />
  48 + from CUSTOM_RESPONSE
  49 + where id = #{id,jdbcType=VARCHAR}
  50 + </select>
  51 + <select id="selectByCustomMsgId" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
  52 + select
  53 + <include refid="Base_Column_List" />
  54 + ,
  55 + <include refid="Blob_Column_List" />
  56 + from CUSTOM_RESPONSE
  57 + where cusMsgId = #{cusmsgid,jdbcType=VARCHAR}
  58 + </select>
  59 + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  60 + delete from CUSTOM_RESPONSE
  61 + where id = #{id,jdbcType=VARCHAR}
  62 + </delete>
  63 + <insert id="insert" parameterType="com.tianbo.messagebus.model.CUSTOM_RESPONSE" >
  64 + insert into CUSTOM_RESPONSE (id, flightDate, flightNo,
  65 + carrier, awbaNo, awbhNo,
  66 + busType, busDate, busWeight,
  67 + busPiece, operType, cusMsgId,
  68 + cusSenderId, cusReciverId, cusVersion,
  69 + cusFunctionCode, cusResRcvTime, cusResSendTime,
  70 + cusResCode, cusResStatus, operUserName,
  71 + operSystemName, operReason, operPerson,
  72 + operTel, cusResText)
  73 + values (#{id,jdbcType=VARCHAR}, #{flightdate,jdbcType=DATE}, #{flightno,jdbcType=VARCHAR},
  74 + #{carrier,jdbcType=VARCHAR}, #{awbano,jdbcType=VARCHAR}, #{awbhno,jdbcType=VARCHAR},
  75 + #{bustype,jdbcType=VARCHAR}, #{busdate,jdbcType=TIMESTAMP}, #{busweight,jdbcType=DECIMAL},
  76 + #{buspiece,jdbcType=INTEGER}, #{opertype,jdbcType=VARCHAR}, #{cusmsgid,jdbcType=VARCHAR},
  77 + #{cussenderid,jdbcType=VARCHAR}, #{cusreciverid,jdbcType=VARCHAR}, #{cusversion,jdbcType=VARCHAR},
  78 + #{cusfunctioncode,jdbcType=VARCHAR}, #{cusresrcvtime,jdbcType=TIMESTAMP}, #{cusressendtime,jdbcType=TIMESTAMP},
  79 + #{cusrescode,jdbcType=VARCHAR}, #{cusresstatus,jdbcType=VARCHAR}, #{operusername,jdbcType=VARCHAR},
  80 + #{opersystemname,jdbcType=VARCHAR}, #{operreason,jdbcType=VARCHAR}, #{operperson,jdbcType=VARCHAR},
  81 + #{opertel,jdbcType=VARCHAR}, #{cusrestext,jdbcType=LONGVARCHAR})
  82 + </insert>
  83 + <insert id="insertSelective" parameterType="com.tianbo.messagebus.model.CUSTOM_RESPONSE" >
  84 + insert into CUSTOM_RESPONSE
  85 + <trim prefix="(" suffix=")" suffixOverrides="," >
  86 + <if test="id != null" >
  87 + id,
  88 + </if>
  89 + <if test="flightdate != null" >
  90 + flightDate,
  91 + </if>
  92 + <if test="flightno != null" >
  93 + flightNo,
  94 + </if>
  95 + <if test="carrier != null" >
  96 + carrier,
  97 + </if>
  98 + <if test="awbano != null" >
  99 + awbaNo,
  100 + </if>
  101 + <if test="awbhno != null" >
  102 + awbhNo,
  103 + </if>
  104 + <if test="bustype != null" >
  105 + busType,
  106 + </if>
  107 + <if test="busdate != null" >
  108 + busDate,
  109 + </if>
  110 + <if test="busweight != null" >
  111 + busWeight,
  112 + </if>
  113 + <if test="buspiece != null" >
  114 + busPiece,
  115 + </if>
  116 + <if test="opertype != null" >
  117 + operType,
  118 + </if>
  119 + <if test="cusmsgid != null" >
  120 + cusMsgId,
  121 + </if>
  122 + <if test="cussenderid != null" >
  123 + cusSenderId,
  124 + </if>
  125 + <if test="cusreciverid != null" >
  126 + cusReciverId,
  127 + </if>
  128 + <if test="cusversion != null" >
  129 + cusVersion,
  130 + </if>
  131 + <if test="cusfunctioncode != null" >
  132 + cusFunctionCode,
  133 + </if>
  134 + <if test="cusresrcvtime != null" >
  135 + cusResRcvTime,
  136 + </if>
  137 + <if test="cusressendtime != null" >
  138 + cusResSendTime,
  139 + </if>
  140 + <if test="cusrescode != null" >
  141 + cusResCode,
  142 + </if>
  143 + <if test="cusresstatus != null" >
  144 + cusResStatus,
  145 + </if>
  146 + <if test="operusername != null" >
  147 + operUserName,
  148 + </if>
  149 + <if test="opersystemname != null" >
  150 + operSystemName,
  151 + </if>
  152 + <if test="operreason != null" >
  153 + operReason,
  154 + </if>
  155 + <if test="operperson != null" >
  156 + operPerson,
  157 + </if>
  158 + <if test="opertel != null" >
  159 + operTel,
  160 + </if>
  161 + <if test="cusrestext != null" >
  162 + cusResText,
  163 + </if>
  164 + </trim>
  165 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  166 + <if test="id != null" >
  167 + #{id,jdbcType=VARCHAR},
  168 + </if>
  169 + <if test="flightdate != null" >
  170 + #{flightdate,jdbcType=DATE},
  171 + </if>
  172 + <if test="flightno != null" >
  173 + #{flightno,jdbcType=VARCHAR},
  174 + </if>
  175 + <if test="carrier != null" >
  176 + #{carrier,jdbcType=VARCHAR},
  177 + </if>
  178 + <if test="awbano != null" >
  179 + #{awbano,jdbcType=VARCHAR},
  180 + </if>
  181 + <if test="awbhno != null" >
  182 + #{awbhno,jdbcType=VARCHAR},
  183 + </if>
  184 + <if test="bustype != null" >
  185 + #{bustype,jdbcType=VARCHAR},
  186 + </if>
  187 + <if test="busdate != null" >
  188 + #{busdate,jdbcType=TIMESTAMP},
  189 + </if>
  190 + <if test="busweight != null" >
  191 + #{busweight,jdbcType=DECIMAL},
  192 + </if>
  193 + <if test="buspiece != null" >
  194 + #{buspiece,jdbcType=INTEGER},
  195 + </if>
  196 + <if test="opertype != null" >
  197 + #{opertype,jdbcType=VARCHAR},
  198 + </if>
  199 + <if test="cusmsgid != null" >
  200 + #{cusmsgid,jdbcType=VARCHAR},
  201 + </if>
  202 + <if test="cussenderid != null" >
  203 + #{cussenderid,jdbcType=VARCHAR},
  204 + </if>
  205 + <if test="cusreciverid != null" >
  206 + #{cusreciverid,jdbcType=VARCHAR},
  207 + </if>
  208 + <if test="cusversion != null" >
  209 + #{cusversion,jdbcType=VARCHAR},
  210 + </if>
  211 + <if test="cusfunctioncode != null" >
  212 + #{cusfunctioncode,jdbcType=VARCHAR},
  213 + </if>
  214 + <if test="cusresrcvtime != null" >
  215 + #{cusresrcvtime,jdbcType=TIMESTAMP},
  216 + </if>
  217 + <if test="cusressendtime != null" >
  218 + #{cusressendtime,jdbcType=TIMESTAMP},
  219 + </if>
  220 + <if test="cusrescode != null" >
  221 + #{cusrescode,jdbcType=VARCHAR},
  222 + </if>
  223 + <if test="cusresstatus != null" >
  224 + #{cusresstatus,jdbcType=VARCHAR},
  225 + </if>
  226 + <if test="operusername != null" >
  227 + #{operusername,jdbcType=VARCHAR},
  228 + </if>
  229 + <if test="opersystemname != null" >
  230 + #{opersystemname,jdbcType=VARCHAR},
  231 + </if>
  232 + <if test="operreason != null" >
  233 + #{operreason,jdbcType=VARCHAR},
  234 + </if>
  235 + <if test="operperson != null" >
  236 + #{operperson,jdbcType=VARCHAR},
  237 + </if>
  238 + <if test="opertel != null" >
  239 + #{opertel,jdbcType=VARCHAR},
  240 + </if>
  241 + <if test="cusrestext != null" >
  242 + #{cusrestext,jdbcType=LONGVARCHAR},
  243 + </if>
  244 + </trim>
  245 + </insert>
  246 + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.messagebus.model.CUSTOM_RESPONSE" >
  247 + update CUSTOM_RESPONSE
  248 + <set >
  249 + <if test="flightdate != null" >
  250 + flightDate = #{flightdate,jdbcType=DATE},
  251 + </if>
  252 + <if test="flightno != null" >
  253 + flightNo = #{flightno,jdbcType=VARCHAR},
  254 + </if>
  255 + <if test="carrier != null" >
  256 + carrier = #{carrier,jdbcType=VARCHAR},
  257 + </if>
  258 + <if test="awbano != null" >
  259 + awbaNo = #{awbano,jdbcType=VARCHAR},
  260 + </if>
  261 + <if test="awbhno != null" >
  262 + awbhNo = #{awbhno,jdbcType=VARCHAR},
  263 + </if>
  264 + <if test="bustype != null" >
  265 + busType = #{bustype,jdbcType=VARCHAR},
  266 + </if>
  267 + <if test="busdate != null" >
  268 + busDate = #{busdate,jdbcType=TIMESTAMP},
  269 + </if>
  270 + <if test="busweight != null" >
  271 + busWeight = #{busweight,jdbcType=DECIMAL},
  272 + </if>
  273 + <if test="buspiece != null" >
  274 + busPiece = #{buspiece,jdbcType=INTEGER},
  275 + </if>
  276 + <if test="opertype != null" >
  277 + operType = #{opertype,jdbcType=VARCHAR},
  278 + </if>
  279 + <if test="cusmsgid != null" >
  280 + cusMsgId = #{cusmsgid,jdbcType=VARCHAR},
  281 + </if>
  282 + <if test="cussenderid != null" >
  283 + cusSenderId = #{cussenderid,jdbcType=VARCHAR},
  284 + </if>
  285 + <if test="cusreciverid != null" >
  286 + cusReciverId = #{cusreciverid,jdbcType=VARCHAR},
  287 + </if>
  288 + <if test="cusversion != null" >
  289 + cusVersion = #{cusversion,jdbcType=VARCHAR},
  290 + </if>
  291 + <if test="cusfunctioncode != null" >
  292 + cusFunctionCode = #{cusfunctioncode,jdbcType=VARCHAR},
  293 + </if>
  294 + <if test="cusresrcvtime != null" >
  295 + cusResRcvTime = #{cusresrcvtime,jdbcType=TIMESTAMP},
  296 + </if>
  297 + <if test="cusressendtime != null" >
  298 + cusResSendTime = #{cusressendtime,jdbcType=TIMESTAMP},
  299 + </if>
  300 + <if test="cusrescode != null" >
  301 + cusResCode = #{cusrescode,jdbcType=VARCHAR},
  302 + </if>
  303 + <if test="cusresstatus != null" >
  304 + cusResStatus = #{cusresstatus,jdbcType=VARCHAR},
  305 + </if>
  306 + <if test="operusername != null" >
  307 + operUserName = #{operusername,jdbcType=VARCHAR},
  308 + </if>
  309 + <if test="opersystemname != null" >
  310 + operSystemName = #{opersystemname,jdbcType=VARCHAR},
  311 + </if>
  312 + <if test="operreason != null" >
  313 + operReason = #{operreason,jdbcType=VARCHAR},
  314 + </if>
  315 + <if test="operperson != null" >
  316 + operPerson = #{operperson,jdbcType=VARCHAR},
  317 + </if>
  318 + <if test="opertel != null" >
  319 + operTel = #{opertel,jdbcType=VARCHAR},
  320 + </if>
  321 + <if test="cusrestext != null" >
  322 + cusResText = #{cusrestext,jdbcType=LONGVARCHAR},
  323 + </if>
  324 + </set>
  325 + where id = #{id,jdbcType=VARCHAR}
  326 + </update>
  327 + <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tianbo.messagebus.model.CUSTOM_RESPONSE" >
  328 + update CUSTOM_RESPONSE
  329 + set flightDate = #{flightdate,jdbcType=DATE},
  330 + flightNo = #{flightno,jdbcType=VARCHAR},
  331 + carrier = #{carrier,jdbcType=VARCHAR},
  332 + awbaNo = #{awbano,jdbcType=VARCHAR},
  333 + awbhNo = #{awbhno,jdbcType=VARCHAR},
  334 + busType = #{bustype,jdbcType=VARCHAR},
  335 + busDate = #{busdate,jdbcType=TIMESTAMP},
  336 + busWeight = #{busweight,jdbcType=DECIMAL},
  337 + busPiece = #{buspiece,jdbcType=INTEGER},
  338 + operType = #{opertype,jdbcType=VARCHAR},
  339 + cusMsgId = #{cusmsgid,jdbcType=VARCHAR},
  340 + cusSenderId = #{cussenderid,jdbcType=VARCHAR},
  341 + cusReciverId = #{cusreciverid,jdbcType=VARCHAR},
  342 + cusVersion = #{cusversion,jdbcType=VARCHAR},
  343 + cusFunctionCode = #{cusfunctioncode,jdbcType=VARCHAR},
  344 + cusResRcvTime = #{cusresrcvtime,jdbcType=TIMESTAMP},
  345 + cusResSendTime = #{cusressendtime,jdbcType=TIMESTAMP},
  346 + cusResCode = #{cusrescode,jdbcType=VARCHAR},
  347 + cusResStatus = #{cusresstatus,jdbcType=VARCHAR},
  348 + operUserName = #{operusername,jdbcType=VARCHAR},
  349 + operSystemName = #{opersystemname,jdbcType=VARCHAR},
  350 + operReason = #{operreason,jdbcType=VARCHAR},
  351 + operPerson = #{operperson,jdbcType=VARCHAR},
  352 + operTel = #{opertel,jdbcType=VARCHAR},
  353 + cusResText = #{cusrestext,jdbcType=LONGVARCHAR}
  354 + where id = #{id,jdbcType=VARCHAR}
  355 + </update>
  356 + <update id="updateByPrimaryKey" parameterType="com.tianbo.messagebus.model.CUSTOM_RESPONSE" >
  357 + update CUSTOM_RESPONSE
  358 + set flightDate = #{flightdate,jdbcType=DATE},
  359 + flightNo = #{flightno,jdbcType=VARCHAR},
  360 + carrier = #{carrier,jdbcType=VARCHAR},
  361 + awbaNo = #{awbano,jdbcType=VARCHAR},
  362 + awbhNo = #{awbhno,jdbcType=VARCHAR},
  363 + busType = #{bustype,jdbcType=VARCHAR},
  364 + busDate = #{busdate,jdbcType=TIMESTAMP},
  365 + busWeight = #{busweight,jdbcType=DECIMAL},
  366 + busPiece = #{buspiece,jdbcType=INTEGER},
  367 + operType = #{opertype,jdbcType=VARCHAR},
  368 + cusMsgId = #{cusmsgid,jdbcType=VARCHAR},
  369 + cusSenderId = #{cussenderid,jdbcType=VARCHAR},
  370 + cusReciverId = #{cusreciverid,jdbcType=VARCHAR},
  371 + cusVersion = #{cusversion,jdbcType=VARCHAR},
  372 + cusFunctionCode = #{cusfunctioncode,jdbcType=VARCHAR},
  373 + cusResRcvTime = #{cusresrcvtime,jdbcType=TIMESTAMP},
  374 + cusResSendTime = #{cusressendtime,jdbcType=TIMESTAMP},
  375 + cusResCode = #{cusrescode,jdbcType=VARCHAR},
  376 + cusResStatus = #{cusresstatus,jdbcType=VARCHAR},
  377 + operUserName = #{operusername,jdbcType=VARCHAR},
  378 + operSystemName = #{opersystemname,jdbcType=VARCHAR},
  379 + operReason = #{operreason,jdbcType=VARCHAR},
  380 + operPerson = #{operperson,jdbcType=VARCHAR},
  381 + operTel = #{opertel,jdbcType=VARCHAR}
  382 + where id = #{id,jdbcType=VARCHAR}
  383 + </update>
  384 +</mapper>