作者 zhangFan

add veManifestRealtion

@@ -14,15 +14,15 @@ spring.mvc.view.suffix=/WEB-INF/jsp/ @@ -14,15 +14,15 @@ spring.mvc.view.suffix=/WEB-INF/jsp/
14 #\u6620\u5C04\u540E\u7F00 14 #\u6620\u5C04\u540E\u7F00
15 spring.mvc.view.prefix=.jsp 15 spring.mvc.view.prefix=.jsp
16 #\u8BBE\u7F6E\u672C\u5730\u6570\u636E\u6E90 16 #\u8BBE\u7F6E\u672C\u5730\u6570\u636E\u6E90
17 -#spring.datasource.username=root  
18 -#spring.datasource.password=root  
19 -#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver  
20 -#spring.datasource.url=jdbc:mysql://localhost:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai  
21 -#\u8BBE\u7F6E\u7EBF\u4E0A\u6570\u636E\u6E90 17 +spring.datasource.username=root
  18 +spring.datasource.password=root
22 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 19 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
23 spring.datasource.url=jdbc:mysql://localhost:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai 20 spring.datasource.url=jdbc:mysql://localhost:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai
24 -spring.datasource.username=station  
25 -spring.datasource.password=station@10.50.7.70 21 +#\u8BBE\u7F6E\u7EBF\u4E0A\u6570\u636E\u6E90
  22 +#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  23 +#spring.datasource.url=jdbc:mysql://localhost:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai
  24 +#spring.datasource.username=station
  25 +#spring.datasource.password=station@10.50.7.70
26 #\u8FDE\u63A5\u6C60\u7C7B 26 #\u8FDE\u63A5\u6C60\u7C7B
27 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource 27 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
28 #\u8FDE\u63A5\u6C60\u914D\u7F6E\uFF0C\u56E0\u4E3Aspringboot\u9ED8\u8BA4\u662F\u5F00\u542F\u4E86\u8FDE\u63A5\u6C60\u7684\uFF0C\u5B83\u6709\u9ED8\u8BA4\u914D\u7F6E\uFF0C\u8FD9\u4E00\u6BB5\u53EF\u4EE5\u5FFD\u7565 28 #\u8FDE\u63A5\u6C60\u914D\u7F6E\uFF0C\u56E0\u4E3Aspringboot\u9ED8\u8BA4\u662F\u5F00\u542F\u4E86\u8FDE\u63A5\u6C60\u7684\uFF0C\u5B83\u6709\u9ED8\u8BA4\u914D\u7F6E\uFF0C\u8FD9\u4E00\u6BB5\u53EF\u4EE5\u5FFD\u7565
1 #\u767B\u5F55\u8D26\u53F7 1 #\u767B\u5F55\u8D26\u53F7
2 -loginname = KKW1 2 +loginname = KAOR
3 #\u5361\u53E3\u6570\u636E\u63A5\u6536KKW1\uFF0C\u5361\u53E3\u53D1\u9001\u6570\u636EKAKO\uFF0C\u653E\u884C\u62A5\u6587 KKFX 3 #\u5361\u53E3\u6570\u636E\u63A5\u6536KKW1\uFF0C\u5361\u53E3\u53D1\u9001\u6570\u636EKAKO\uFF0C\u653E\u884C\u62A5\u6587 KKFX
4 #\u767B\u5F55\u5BC6\u7801 4 #\u767B\u5F55\u5BC6\u7801
5 -loginpass = KKW1 5 +loginpass=KAOR
6 #\u53D1\u9001\u62A5\u6587\u76EE\u5F55,\u76F8\u5BF9\u7A0B\u5E8F\u76EE\u5F55 6 #\u53D1\u9001\u62A5\u6587\u76EE\u5F55,\u76F8\u5BF9\u7A0B\u5E8F\u76EE\u5F55
7 -readDirectory = D:/bw/sendDirectory 7 +sendDirectory=D:/bw/sendDirectory
8 #\u63A5\u6536\u5B58\u50A8\u62A5\u6587\u76EE\u5F55 8 #\u63A5\u6536\u5B58\u50A8\u62A5\u6587\u76EE\u5F55
9 -bakDirectory = D:/bw/receiveDirectory 9 +receiveDirectory=D:/bw/receiveDirectory
  10 +#\u8F66\u5355\u5173\u7CFB\u62A5\u6587\u76EE\u5F55
  11 +veManifestDirectory=D:/bw/veManifestDirectory
10 12
11 #IMF MEAT\u62A5\u5934\u914D\u7F6E 13 #IMF MEAT\u62A5\u5934\u914D\u7F6E
12 RCVR= 14 RCVR=
13 -TYPE=KAKO 15 +TYPE=KAOR
14 STYP=CARM 16 STYP=CARM
15 17
16 #\u8F7D\u91CD\u4E0E\u79F0\u91CD\u7684\u53EF\u63A7\u8303\u56F4 ?% 18 #\u8F7D\u91CD\u4E0E\u79F0\u91CD\u7684\u53EF\u63A7\u8303\u56F4 ?%
此 diff 太大无法显示。
@@ -413,13 +413,6 @@ @@ -413,13 +413,6 @@
413 <artifactId>httpclient</artifactId> 413 <artifactId>httpclient</artifactId>
414 <version>4.5.5</version> 414 <version>4.5.5</version>
415 </dependency> 415 </dependency>
416 -<!--  
417 - <dependency>  
418 - <groupId>org.springframework</groupId>  
419 - <artifactId>spring-context</artifactId>  
420 - <version>5.2.0.M1</version>  
421 - </dependency>  
422 --->  
423 416
424 417
425 </dependencies> 418 </dependencies>
@@ -7,6 +7,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; @@ -7,6 +7,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
7 7
8 @SpringBootApplication 8 @SpringBootApplication
9 @EnableScheduling 9 @EnableScheduling
  10 +//不连接数据库开启服务
  11 +//@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
10 //@EnableEurekaClient 12 //@EnableEurekaClient
11 @MapperScan(value = "com.sy.mapper") 13 @MapperScan(value = "com.sy.mapper")
12 public class AnalysisImfApplication { 14 public class AnalysisImfApplication {
@@ -26,21 +26,27 @@ public class IMF_Tesk { @@ -26,21 +26,27 @@ public class IMF_Tesk {
26 26
27 27
28 if (client != null) { 28 if (client != null) {
  29 + /**
  30 + * 从IMF接收报文
  31 + */
29 if (!KAKO_Reader.isrunning) { 32 if (!KAKO_Reader.isrunning) {
30 KAKO_Reader kako_reader = new KAKO_Reader(client); 33 KAKO_Reader kako_reader = new KAKO_Reader(client);
31 kako_reader.start(); 34 kako_reader.start();
32 - logger.info("*********KAKO读取线程已开启***********"); 35 + logger.info("*********读取线程已开启***********");
33 } else { 36 } else {
34 - logger.info("*********KAKO读取线程已开启-不再启动线程*********"); 37 + logger.info("*********读取线程已开启-不再启动线程*********");
35 } 38 }
36 39
37 - /* if(!KAKO_Sender.isrunning){  
38 - KAKO_Sender kako_sender = new KAKO_Sender(client);  
39 - kako_sender.start();  
40 - logger.info("<<<<<<<<<KAKO发送线程已开启>>>>>>>>>>>>");  
41 - }else {  
42 - logger.info("<<<<<<<<<KAKO发送线程已开启-不再启动线程>>>>>>>>>>>>");  
43 - }*/ 40 + /**
  41 + * 往IMF发送报文
  42 + */
  43 +// if(!KAKO_Sender.isrunning){
  44 +// KAKO_Sender kako_sender = new KAKO_Sender(client);
  45 +// kako_sender.start();
  46 +// logger.info("<<<<<<<<<KAKO发送线程已开启>>>>>>>>>>>>");
  47 +// }else {
  48 +// logger.info("<<<<<<<<<KAKO发送线程已开启-不再启动线程>>>>>>>>>>>>");
  49 +// }
44 50
45 } 51 }
46 if (!LOGIN_OK){ 52 if (!LOGIN_OK){
@@ -23,6 +23,9 @@ public class KAKO_Reader extends Thread{ @@ -23,6 +23,9 @@ public class KAKO_Reader extends Thread{
23 if (message != null) { 23 if (message != null) {
24 // logger.info(message); 24 // logger.info(message);
25 AnalysisRoute.analysis(message); 25 AnalysisRoute.analysis(message);
  26 +// if(message.indexOf("<TYPE>CARM</TYPE>") > 0){
  27 +// this.client.sendMSG();
  28 +// }
26 } 29 }
27 } 30 }
28 else { 31 else {
@@ -26,13 +26,13 @@ public class KAKO_Sender extends Thread{ @@ -26,13 +26,13 @@ public class KAKO_Sender extends Thread{
26 26
27 public void run(){ 27 public void run(){
28 try { 28 try {
29 - String sendDir = FileTool.readProperties("readDirectory"); 29 + String sendDir = FileTool.readProperties("sendDirectory");
30 String SNDR = FileTool.readProperties("loginname"); 30 String SNDR = FileTool.readProperties("loginname");
31 String TYPE = FileTool.readProperties("TYPE"); 31 String TYPE = FileTool.readProperties("TYPE");
32 String STYP = FileTool.readProperties("STYP"); 32 String STYP = FileTool.readProperties("STYP");
33 String RCVR = FileTool.readProperties("RCVR"); 33 String RCVR = FileTool.readProperties("RCVR");
34 - String DDTM = DateTimeConverter.dateFormat();  
35 - String SEQN = DDTM; 34 +// String DDTM = new DateTimeConverter().dateFormat();
  35 +// String SEQN = DDTM;
36 36
37 if (this.client == null) { 37 if (this.client == null) {
38 logger.info("IMFClient has been closed"); 38 logger.info("IMFClient has been closed");
@@ -44,7 +44,7 @@ public class KAKO_Sender extends Thread{ @@ -44,7 +44,7 @@ public class KAKO_Sender extends Thread{
44 List<File> files = FileTool.readDirectoryFiles(new File(sendDir)); 44 List<File> files = FileTool.readDirectoryFiles(new File(sendDir));
45 for (File file:files) { 45 for (File file:files) {
46 String fileContent = FileTool.readfile(file); 46 String fileContent = FileTool.readfile(file);
47 - String sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,DDTM,SEQN,fileContent); 47 + String sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,new DateTimeConverter().dateFormat(),new DateTimeConverter().dateFormat(),fileContent);
48 String returnMsg = this.client.sendMSG(sendMsg); 48 String returnMsg = this.client.sendMSG(sendMsg);
49 //发送成功处理,删除已发送成功的目录下的文件 49 //发送成功处理,删除已发送成功的目录下的文件
50 if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ 50 if(returnMsg.indexOf("<CODE>9</CODE>")>=0){
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
5 import com.alibaba.fastjson.JSONArray; 5 import com.alibaba.fastjson.JSONArray;
6 import com.sy.crossDomain.buildBarCode; 6 import com.sy.crossDomain.buildBarCode;
7 import com.sy.model.*; 7 import com.sy.model.*;
  8 +import com.sy.relation.VeManifestRelation;
8 import com.sy.service.EnterCancelServer; 9 import com.sy.service.EnterCancelServer;
9 import com.sy.service.LandBusListService; 10 import com.sy.service.LandBusListService;
10 import com.sy.service.LandRoadVeService; 11 import com.sy.service.LandRoadVeService;
@@ -181,6 +182,9 @@ public class LogicOperation { @@ -181,6 +182,9 @@ public class LogicOperation {
181 checkResult = check || checkMainfest; 182 checkResult = check || checkMainfest;
182 } 183 }
183 184
  185 + if("查验货".equals(list.getCocode())){
  186 + checkResult = true;
  187 + }
184 //宽进 188 //宽进
185 if ("I".equals(info.getIetype())) { 189 if ("I".equals(info.getIetype())) {
186 if (check == false && checkResult == false) { 190 if (check == false && checkResult == false) {
@@ -240,6 +244,12 @@ public class LogicOperation { @@ -240,6 +244,12 @@ public class LogicOperation {
240 } 244 }
241 result = true; 245 result = true;
242 } 246 }
  247 + if(list.getMasterList().length()>0){
  248 + boolean flag = VeManifestRelation.createFile(list);
  249 + if(flag){
  250 + logger.info(">>>>>>>>>>-----车单关系报文生成成功-----<<<<<<<<<<<<");
  251 + }
  252 + }
243 } else { 253 } else {
244 sendError(info); 254 sendError(info);
245 logger.error("------->>>>>>>二维码数据异常,请使用正确的二维码数据<<<<<<<-----"); 255 logger.error("------->>>>>>>二维码数据异常,请使用正确的二维码数据<<<<<<<-----");
@@ -309,7 +319,7 @@ public class LogicOperation { @@ -309,7 +319,7 @@ public class LogicOperation {
309 if (!(waybill.indexOf("-") != -1)) { 319 if (!(waybill.indexOf("-") != -1)) {
310 waybill = waybill.substring(0, 3) + "-" + waybill.substring(3); 320 waybill = waybill.substring(0, 3) + "-" + waybill.substring(3);
311 } 321 }
312 - String url = "http://10.50.3.64:8080/tj/orig/orig?waybill=" + waybill + "&imp=" + imp; 322 + String url = "http://10.50.3.82:8081/orig/orig?waybill=" + waybill + "&imp=" + imp;
313 // String url = "http://tjfx.15miaoo.com:8003/tj/orig/orig?waybill=" + waybill + "&imp=" + imp; 323 // String url = "http://tjfx.15miaoo.com:8003/tj/orig/orig?waybill=" + waybill + "&imp=" + imp;
314 StringBuilder json = new StringBuilder(); 324 StringBuilder json = new StringBuilder();
315 Map map = null; 325 Map map = null;
  1 +package com.sy.relation;
  2 +
  3 +import com.sy.model.LandBusinessTypeList;
  4 +import com.sy.utils.DateTimeConverter;
  5 +import com.sy.utils.FileTool;
  6 +
  7 +import java.io.FileWriter;
  8 +import java.io.IOException;
  9 +
  10 +/**
  11 + * @author
  12 + * @time 2019-08-07 10:10
  13 + * @Desc 车与主单关系报文
  14 + */
  15 +public class VeManifestRelation {
  16 +
  17 + private static String veManifestDirectory = FileTool.readProperties("veManifestDirectory");
  18 +
  19 + public static boolean createFile(LandBusinessTypeList landBusinessTypeList){
  20 + boolean flag = false;
  21 + FileWriter fileWriter;
  22 + try {
  23 + fileWriter = new FileWriter(veManifestDirectory+new DateTimeConverter().dateFormat()+".xml");
  24 + fileWriter.write(new VeManifestRelation().getMsg(landBusinessTypeList));
  25 + fileWriter.flush();
  26 + fileWriter.close();
  27 + flag = true;
  28 + }catch (IOException e){
  29 + e.printStackTrace();
  30 + }
  31 + return flag;
  32 + }
  33 +
  34 + /**
  35 + * 生成车单报文
  36 + * @param landBusinessTypeList
  37 + * @return
  38 + */
  39 + public String getMsg(LandBusinessTypeList landBusinessTypeList){
  40 + StringBuffer buffer = new StringBuffer();
  41 + buffer.append("<CONTENT>");
  42 + buffer.append("<VENAME>"+"</VENAME>");
  43 + buffer.append("<MANIFESTS>");
  44 + String [] manifests = getManifests(landBusinessTypeList.getMasterList());
  45 + for (String manifest : manifests){
  46 + buffer.append("<MANIFEST>"+manifest+"</MANIFEST>");
  47 + }
  48 + buffer.append("</MANIFESTS>");
  49 + buffer.append("<STATION>"+landBusinessTypeList.getEndstation()+"</STATION>");
  50 + buffer.append("<ASILE>"+landBusinessTypeList.getAisle()+"</ASILE>");
  51 + buffer.append("<TYPE>"+landBusinessTypeList.getBusinesstype()+"</TYPE>");
  52 + buffer.append("<OPTM>"+new DateTimeConverter().dateFormat() +"</OPTM>");
  53 + return buffer.toString();
  54 + }
  55 +
  56 + public String [] getManifests(String manifest){
  57 + return manifest.split(",");
  58 + }
  59 +}
@@ -53,13 +53,11 @@ public class DateTimeConverter extends AbstractSingleValueConverter { @@ -53,13 +53,11 @@ public class DateTimeConverter extends AbstractSingleValueConverter {
53 return dateFormat.format(new Date()); 53 return dateFormat.format(new Date());
54 } 54 }
55 55
56 - public static String dateFormat() {  
57 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");  
58 - return simpleDateFormat.format(new Date()); 56 + public String dateFormat() {
  57 + return dateFormat.format(new Date());
59 } 58 }
60 - public static String dateTimeFormat() {  
61 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
62 - return simpleDateFormat.format(new Date()); 59 + public String dateTimeFormat() {
  60 + return DATETIME_FORMAT.format(new Date());
63 } 61 }
64 public static String getDay() { 62 public static String getDay() {
65 return date.format(new Date()); 63 return date.format(new Date());
@@ -65,7 +65,7 @@ public final class FileTool { @@ -65,7 +65,7 @@ public final class FileTool {
65 } 65 }
66 66
67 public static void writeFileToBak(String content){ 67 public static void writeFileToBak(String content){
68 - String bakDir = readProperties("bakDirectory"); 68 + String bakDir = readProperties("receiveDirectory");
69 StringBuffer stringBuffer = new StringBuffer(); 69 StringBuffer stringBuffer = new StringBuffer();
70 stringBuffer.append(bakDir).append("/").append(UUIDCreate.getUUID()).append(".txt"); 70 stringBuffer.append(bakDir).append("/").append(UUIDCreate.getUUID()).append(".txt");
71 71
@@ -74,8 +74,13 @@ @@ -74,8 +74,13 @@
74 <!-- <table tableName="ResMessage" domainObjectName="RESMESSAGE" enableCountByExample="false" 74 <!-- <table tableName="ResMessage" domainObjectName="RESMESSAGE" enableCountByExample="false"
75 enableUpdateByExample="false" 75 enableUpdateByExample="false"
76 enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> 76 enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
77 - <table tableName="entercancel" domainObjectName="ENTERCANCCEL" enableCountByExample="false" 77 +<!-- <table tableName="entercancel" domainObjectName="ENTERCANCCEL" enableCountByExample="false"
78 enableUpdateByExample="false" 78 enableUpdateByExample="false"
79 - enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> 79 + enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
  80 + </table>-->
  81 + <table tableName="t_air_repertory" domainObjectName="T_AIR_REPERTORY" enableCountByExample="false"
  82 + enableUpdateByExample="false"
  83 + enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
  84 + </table>
80 </context> 85 </context>
81 </generatorConfiguration> 86 </generatorConfiguration>
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 select 70 select
71 <include refid="Base_Column_List" /> 71 <include refid="Base_Column_List" />
72 from land_businesstype_list 72 from land_businesstype_list
73 - where BARCODE = #{barcode,jdbcType=VARCHAR} 73 + where BARCODE = #{barcode,jdbcType=VARCHAR} AND ISVALID = "0"
74 </select> 74 </select>
75 75
76 <select id="selectMessageId" parameterType="java.lang.String" resultMap="BaseResultMap"> 76 <select id="selectMessageId" parameterType="java.lang.String" resultMap="BaseResultMap">