正在显示
4 个修改的文件
包含
79 行增加
和
12 行删除
@@ -8,6 +8,7 @@ public enum ChannelEnum { | @@ -8,6 +8,7 @@ public enum ChannelEnum { | ||
8 | WEST_EX_1 ("4604000000","4604333322"), | 8 | WEST_EX_1 ("4604000000","4604333322"), |
9 | NORTH_K1_IN_1 ("4604600000","4604601010"), | 9 | NORTH_K1_IN_1 ("4604600000","4604601010"), |
10 | NORTH_K1_EX_1 ("4604600000","4604600010"), | 10 | NORTH_K1_EX_1 ("4604600000","4604600010"), |
11 | + NORTH_K1_IN_2 ("4604600000","4604601011"), | ||
11 | NORTH_K1_EX_2 ("4604600000","4604600011"), | 12 | NORTH_K1_EX_2 ("4604600000","4604600011"), |
12 | NORTH_K3_IN_1 ("4604600000","4604601030"), | 13 | NORTH_K3_IN_1 ("4604600000","4604601030"), |
13 | NORTH_K3_EX_1 ("4604600000","4604600030"), | 14 | NORTH_K3_EX_1 ("4604600000","4604600030"), |
1 | +package com.sy.task; | ||
2 | + | ||
3 | +import com.sy.bwAnalysis.MessageAnalysis; | ||
4 | +import com.sy.bwAssist.Message; | ||
5 | +import com.sy.service.router.MessageRouter; | ||
6 | +import com.sy.service.router.RouterContext; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.PostConstruct; | ||
12 | + | ||
13 | +/** | ||
14 | + * 本地报文处理器 | ||
15 | + */ | ||
16 | +@Component | ||
17 | +public class LocalFileTaskHandle implements Runnable{ | ||
18 | + | ||
19 | + private static LocalFileTaskHandle localFileTaskHandle; | ||
20 | + | ||
21 | + private String message; | ||
22 | + | ||
23 | + @Qualifier("X21") | ||
24 | + @Autowired | ||
25 | + private MessageRouter messageRouterX21; | ||
26 | + | ||
27 | + @Qualifier("X22") | ||
28 | + @Autowired | ||
29 | + private MessageRouter messageRouterX22; | ||
30 | + | ||
31 | + @PostConstruct | ||
32 | + public void init() { | ||
33 | + localFileTaskHandle = this; | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public void run() { | ||
38 | + String string = message.replace("Msg","MSG"); | ||
39 | + MessageAnalysis analysis = new MessageAnalysis(); | ||
40 | + Message message = analysis.readTicketsXml(string); | ||
41 | + | ||
42 | + | ||
43 | + mesageHandle(message); | ||
44 | + } | ||
45 | + | ||
46 | + public void mesageHandle(Message message){ | ||
47 | + if ("CARM".equals(message.getMeta().getSmType())) { | ||
48 | + //策略判断 | ||
49 | + if(message.getComInfo() !=null){ | ||
50 | + RouterContext routerContext = new RouterContext(localFileTaskHandle.messageRouterX22); | ||
51 | + routerContext.executeStrategy(message); | ||
52 | + }else{ | ||
53 | + RouterContext routerContext = new RouterContext(localFileTaskHandle.messageRouterX21); | ||
54 | + routerContext.executeStrategy(message); | ||
55 | + } | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + public void setMessage(String message) { | ||
60 | + this.message = message; | ||
61 | + } | ||
62 | +} |
@@ -42,7 +42,7 @@ public class TaskAnalysis { | @@ -42,7 +42,7 @@ public class TaskAnalysis { | ||
42 | String readDir = receptDir; | 42 | String readDir = receptDir; |
43 | 43 | ||
44 | //初始化线程池 | 44 | //初始化线程池 |
45 | - ThreadPoolExecutor threadPool = XMLThreadPoolFactory.instance("file-read"); | 45 | + ThreadPoolExecutor threadPool = XMLThreadPoolFactory.instance("fileR"); |
46 | 46 | ||
47 | try { | 47 | try { |
48 | File fileDirectory = new File(readDir); | 48 | File fileDirectory = new File(readDir); |
@@ -73,10 +73,14 @@ public class TaskAnalysis { | @@ -73,10 +73,14 @@ public class TaskAnalysis { | ||
73 | 73 | ||
74 | private void threadJbob(File file,CountDownLatch latch,String transToCfps,ThreadPoolExecutor threadPool){ | 74 | private void threadJbob(File file,CountDownLatch latch,String transToCfps,ThreadPoolExecutor threadPool){ |
75 | try{ | 75 | try{ |
76 | - AnalysisRoute analysisRoute=new AnalysisRoute(); | 76 | +// AnalysisRoute analysisRoute=new AnalysisRoute(); |
77 | String message = com.sy.utils.FileTool.readfile(file,"UTF-8"); | 77 | String message = com.sy.utils.FileTool.readfile(file,"UTF-8"); |
78 | - analysisRoute.setMessage(message); | ||
79 | - threadPool.execute(analysisRoute); | 78 | + |
79 | + LocalFileTaskHandle localFileTaskHandle = new LocalFileTaskHandle(); | ||
80 | + localFileTaskHandle.setMessage(message); | ||
81 | + threadPool.execute(localFileTaskHandle); | ||
82 | +// analysisRoute.setMessage(message); | ||
83 | +// threadPool.execute(analysisRoute); | ||
80 | FileUtils.moveFileToDirectory(file,new File("bw/handled/"),true); | 84 | FileUtils.moveFileToDirectory(file,new File("bw/handled/"),true); |
81 | }catch (Exception e){ | 85 | }catch (Exception e){ |
82 | log.error("线程解析出错{}",e.toString()); | 86 | log.error("线程解析出错{}",e.toString()); |
@@ -43,9 +43,9 @@ public class GatherInfoHandleImplTest { | @@ -43,9 +43,9 @@ public class GatherInfoHandleImplTest { | ||
43 | private LandListDao landListDao; | 43 | private LandListDao landListDao; |
44 | 44 | ||
45 | //车牌号 | 45 | //车牌号 |
46 | - private String voNo = "豫K823A9"; | 46 | + private String voNo = "豫NT0267"; |
47 | //二维码 | 47 | //二维码 |
48 | - private static String BARCODE = "932-4b18-8931-bd28b4e9abc7"; | 48 | + private static String BARCODE = "2e1-43ce-bf14-bc0d4fb8b877"; |
49 | //场站编号 | 49 | //场站编号 |
50 | private String areaID = "4604600000"; | 50 | private String areaID = "4604600000"; |
51 | 51 | ||
@@ -164,9 +164,9 @@ public class GatherInfoHandleImplTest { | @@ -164,9 +164,9 @@ public class GatherInfoHandleImplTest { | ||
164 | //过卡重量 | 164 | //过卡重量 |
165 | String cross_weight= String.valueOf(5724); | 165 | String cross_weight= String.valueOf(5724); |
166 | //场站编号 | 166 | //场站编号 |
167 | - String areaID = ChannelEnum.NORTH_K1_IN_1.getArea(); | 167 | + String areaID = ChannelEnum.NORTH_K1_IN_2.getArea(); |
168 | //通道编号 | 168 | //通道编号 |
169 | - String chnlNo = ChannelEnum.NORTH_K1_IN_1.getChannel(); | 169 | + String chnlNo = ChannelEnum.NORTH_K1_IN_2.getChannel(); |
170 | //进出场类型I/E | 170 | //进出场类型I/E |
171 | String ie = "I"; | 171 | String ie = "I"; |
172 | //二维码 | 172 | //二维码 |
@@ -197,7 +197,7 @@ public class GatherInfoHandleImplTest { | @@ -197,7 +197,7 @@ public class GatherInfoHandleImplTest { | ||
197 | PropertyConfigurator.configure("config/log4j.properties"); | 197 | PropertyConfigurator.configure("config/log4j.properties"); |
198 | 198 | ||
199 | //过卡重量 | 199 | //过卡重量 |
200 | - String cross_weight= String.valueOf(4622); | 200 | + String cross_weight= String.valueOf(11000); |
201 | //场站编号 | 201 | //场站编号 |
202 | String areaID = ChannelEnum.NORTH_K1_EX_2.getArea(); | 202 | String areaID = ChannelEnum.NORTH_K1_EX_2.getArea(); |
203 | //通道编号 | 203 | //通道编号 |
@@ -229,9 +229,9 @@ public class GatherInfoHandleImplTest { | @@ -229,9 +229,9 @@ public class GatherInfoHandleImplTest { | ||
229 | */ | 229 | */ |
230 | @Test | 230 | @Test |
231 | public void X22Test(){ | 231 | public void X22Test(){ |
232 | - X22_COMMANDINFO_XML= X22_COMMANDINFO_XML.replace("${AREA_ID}",ChannelEnum.NORTH_K1_IN_1.getArea()) | ||
233 | - .replace("${CHNL_NO}",ChannelEnum.NORTH_K1_IN_1.getChannel()) | ||
234 | - .replace("${I_E_TYPE}","E") | 232 | + X22_COMMANDINFO_XML= X22_COMMANDINFO_XML.replace("${AREA_ID}",ChannelEnum.NORTH_K1_IN_2.getArea()) |
233 | + .replace("${CHNL_NO}",ChannelEnum.NORTH_K1_IN_2.getChannel()) | ||
234 | + .replace("${I_E_TYPE}","I") | ||
235 | .replace("${SEQ_NO}","20220624063118000004") | 235 | .replace("${SEQ_NO}","20220624063118000004") |
236 | .replace("${CHECK_RESULT}",CHCEK_RESULT_CODE_E_SUC) | 236 | .replace("${CHECK_RESULT}",CHCEK_RESULT_CODE_E_SUC) |
237 | .replace("${OP_HINT}",RESULT_CODE_DES_SUC); | 237 | .replace("${OP_HINT}",RESULT_CODE_DES_SUC); |
-
请 注册 或 登录 后发表评论