正在显示
6 个修改的文件
包含
62 行增加
和
63 行删除
@@ -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://10.50.7.60: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 |
@@ -40,13 +40,13 @@ public class IMF_Tesk { | @@ -40,13 +40,13 @@ public class IMF_Tesk { | ||
40 | /** | 40 | /** |
41 | * 往IMF发送报文 | 41 | * 往IMF发送报文 |
42 | */ | 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 | -// } | 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 | + } | ||
50 | 50 | ||
51 | } | 51 | } |
52 | if (!LOGIN_OK){ | 52 | if (!LOGIN_OK){ |
@@ -10,27 +10,29 @@ import org.apache.log4j.Logger; | @@ -10,27 +10,29 @@ import org.apache.log4j.Logger; | ||
10 | import java.io.File; | 10 | import java.io.File; |
11 | import java.util.List; | 11 | import java.util.List; |
12 | 12 | ||
13 | -public class KAKO_Sender extends Thread{ | 13 | +public class KAKO_Sender extends Thread { |
14 | 14 | ||
15 | protected static final Logger logger = Logger.getLogger(KAKO_Sender.class); | 15 | protected static final Logger logger = Logger.getLogger(KAKO_Sender.class); |
16 | - public static boolean isrunning; | 16 | + public static boolean isrunning; |
17 | private IMFClient client; | 17 | private IMFClient client; |
18 | private String content; | 18 | private String content; |
19 | + | ||
19 | public KAKO_Sender(IMFClient client) { | 20 | public KAKO_Sender(IMFClient client) { |
20 | this.client = client; | 21 | this.client = client; |
21 | } | 22 | } |
23 | + | ||
22 | public KAKO_Sender(IMFClient client, String content) { | 24 | public KAKO_Sender(IMFClient client, String content) { |
23 | this.client = client; | 25 | this.client = client; |
24 | this.content = content; | 26 | this.content = content; |
25 | } | 27 | } |
26 | 28 | ||
27 | - public void run(){ | 29 | + public void run() { |
28 | try { | 30 | try { |
29 | - String sendDir = FileTool.readProperties("sendDirectory"); | 31 | + String sendDir = FileTool.readProperties("sendDirectory"); |
30 | String SNDR = FileTool.readProperties("loginname"); | 32 | String SNDR = FileTool.readProperties("loginname"); |
31 | - String TYPE = FileTool.readProperties("TYPE"); | ||
32 | - String STYP = FileTool.readProperties("STYP"); | ||
33 | - String RCVR = FileTool.readProperties("RCVR"); | 33 | + String TYPE = FileTool.readProperties("TYPE"); |
34 | + String STYP = FileTool.readProperties("STYP"); | ||
35 | + String RCVR = FileTool.readProperties("RCVR"); | ||
34 | // String DDTM = new DateTimeConverter().dateFormat(); | 36 | // String DDTM = new DateTimeConverter().dateFormat(); |
35 | // String SEQN = DDTM; | 37 | // String SEQN = DDTM; |
36 | 38 | ||
@@ -38,34 +40,37 @@ public class KAKO_Sender extends Thread{ | @@ -38,34 +40,37 @@ public class KAKO_Sender extends Thread{ | ||
38 | logger.info("IMFClient has been closed"); | 40 | logger.info("IMFClient has been closed"); |
39 | return; | 41 | return; |
40 | } | 42 | } |
41 | - isrunning=true; | ||
42 | - if(IMF_Tesk.LOGIN_OK){ | ||
43 | - while (true){ | ||
44 | - List<File> files = FileTool.readDirectoryFiles(new File(sendDir)); | ||
45 | - for (File file:files) { | ||
46 | - String fileContent = FileTool.readfile(file); | ||
47 | - String sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,new DateTimeConverter().dateFormat(),new DateTimeConverter().dateFormat(),fileContent); | ||
48 | - String returnMsg = this.client.sendMSG(sendMsg); | ||
49 | - //发送成功处理,删除已发送成功的目录下的文件 | ||
50 | - if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
51 | - FileUtils.forceDelete(file); | ||
52 | - } | ||
53 | - } | 43 | + isrunning = true; |
44 | + if (IMF_Tesk.LOGIN_OK) { | ||
45 | + List<File> files = FileTool.readDirectoryFiles(new File(sendDir)); | ||
46 | + for (File file : files) { | ||
47 | + String fileContent = ""; | ||
54 | try { | 48 | try { |
55 | - Thread.sleep(500L); | ||
56 | - } catch (InterruptedException var3) { | ||
57 | - var3.printStackTrace(); | ||
58 | - | 49 | + fileContent = FileTool.readfile(file); |
50 | + } catch (Exception e) { | ||
51 | + FileUtils.forceDelete(file); | ||
52 | + continue; | ||
53 | + } | ||
54 | + String sendMsg = MakeImfMeta.makeImfDocument(SNDR, RCVR, TYPE, STYP, new DateTimeConverter().dateFormat(), new DateTimeConverter().dateFormat(), fileContent); | ||
55 | + String returnMsg = this.client.sendMSG(sendMsg); | ||
56 | + //发送成功处理,删除已发送成功的目录下的文件 | ||
57 | + String msg = "<CODE>9</CODE>"; | ||
58 | + if (returnMsg.contains(msg)) { | ||
59 | + FileUtils.forceDelete(file); | ||
59 | } | 60 | } |
60 | } | 61 | } |
62 | + try { | ||
63 | + Thread.sleep(500L); | ||
64 | + } catch (InterruptedException var3) { | ||
65 | + var3.printStackTrace(); | ||
61 | 66 | ||
67 | + } | ||
62 | } | 68 | } |
63 | - | ||
64 | - }catch (Exception var14) { | 69 | + } catch (Exception var14) { |
65 | var14.printStackTrace(); | 70 | var14.printStackTrace(); |
66 | logger.info(var14.getMessage()); | 71 | logger.info(var14.getMessage()); |
67 | } | 72 | } |
68 | - isrunning=false; | 73 | + isrunning = false; |
69 | logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>"); | 74 | logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>"); |
70 | } | 75 | } |
71 | } | 76 | } |
@@ -83,6 +83,9 @@ public class LogicOperation { | @@ -83,6 +83,9 @@ public class LogicOperation { | ||
83 | * @Result 计算卡口采集数据并发送报文 | 83 | * @Result 计算卡口采集数据并发送报文 |
84 | */ | 84 | */ |
85 | public static boolean operation(GatherInfo info) { | 85 | public static boolean operation(GatherInfo info) { |
86 | + if("综保区".equals(info.getAreaid())){ | ||
87 | + //todo 加综保区的判断逻辑 | ||
88 | + } | ||
86 | PropertyConfigurator.configure("config/log4j.properties"); | 89 | PropertyConfigurator.configure("config/log4j.properties"); |
87 | boolean result = false; | 90 | boolean result = false; |
88 | //转为double类型 | 91 | //转为double类型 |
@@ -4,8 +4,7 @@ import com.sy.model.LandBusinessTypeList; | @@ -4,8 +4,7 @@ import com.sy.model.LandBusinessTypeList; | ||
4 | import com.sy.utils.DateTimeConverter; | 4 | import com.sy.utils.DateTimeConverter; |
5 | import com.sy.utils.FileTool; | 5 | import com.sy.utils.FileTool; |
6 | 6 | ||
7 | -import java.io.FileWriter; | ||
8 | -import java.io.IOException; | 7 | +import java.io.*; |
9 | 8 | ||
10 | /** | 9 | /** |
11 | * @author | 10 | * @author |
@@ -18,12 +17,19 @@ public class VeManifestRelation { | @@ -18,12 +17,19 @@ public class VeManifestRelation { | ||
18 | 17 | ||
19 | public static boolean createFile(LandBusinessTypeList landBusinessTypeList){ | 18 | public static boolean createFile(LandBusinessTypeList landBusinessTypeList){ |
20 | boolean flag = false; | 19 | boolean flag = false; |
21 | - FileWriter fileWriter; | 20 | +// FileWriter fileWriter; |
21 | + File file; | ||
22 | try { | 22 | try { |
23 | - fileWriter = new FileWriter(veManifestDirectory+new DateTimeConverter().dateFormat()+".xml"); | ||
24 | - fileWriter.write(new VeManifestRelation().getMsg(landBusinessTypeList)); | ||
25 | - fileWriter.flush(); | ||
26 | - fileWriter.close(); | 23 | +// fileWriter = new FileWriter(veManifestDirectory+new DateTimeConverter().dateFormat()+".xml"); |
24 | +// | ||
25 | +// fileWriter.write(new VeManifestRelation().getMsg(landBusinessTypeList)); | ||
26 | +// fileWriter.flush(); | ||
27 | +// fileWriter.close(); | ||
28 | + file = new File(veManifestDirectory+new DateTimeConverter().dateFormat()+".xml"); | ||
29 | + Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8")); | ||
30 | + writer.write(new VeManifestRelation().getMsg(landBusinessTypeList)); | ||
31 | + writer.flush(); | ||
32 | + writer.close(); | ||
27 | flag = true; | 33 | flag = true; |
28 | }catch (IOException e){ | 34 | }catch (IOException e){ |
29 | e.printStackTrace(); | 35 | e.printStackTrace(); |
src/main/java/com/sy/test.java
已删除
100644 → 0
1 | -package com.sy; | ||
2 | - | ||
3 | -/** | ||
4 | - * @author | ||
5 | - * @time 2019-${MOUTH}-06 17:59 | ||
6 | - */ | ||
7 | -public class test { | ||
8 | - | ||
9 | - // private static LogicOperation logicOperation =new LogicOperation(); | ||
10 | - | ||
11 | -/* public static void main(String[] args) { | ||
12 | - double a = logicOperation.GoodsWt("172-26481560,172-26481593,172-26481604,172-26481545,172-26481582,172-26481556,172-26481571","I"); | ||
13 | - System.out.printf("%.1f",a); | ||
14 | - }*/ | ||
15 | -} |
-
请 注册 或 登录 后发表评论