1 配置文件增加金二配置节点
2 pom增加配置文件热更新模块 3 X21过卡信息金二判定,策略模式 4 X22放行信息金二判定 5 优化本地验放抬杆指令
正在显示
32 个修改的文件
包含
1359 行增加
和
243 行删除
@@ -68,6 +68,11 @@ feign.httpclient.enabled=true | @@ -68,6 +68,11 @@ feign.httpclient.enabled=true | ||
68 | feign.hystrix.enabled=true | 68 | feign.hystrix.enabled=true |
69 | # 请求连接超时时间(毫秒) | 69 | # 请求连接超时时间(毫秒) |
70 | feign.httpclient.connection-timeout=3000 | 70 | feign.httpclient.connection-timeout=3000 |
71 | + | ||
72 | +# 这个是刷新接口 | ||
73 | +#curl -X POST http://localhost:8080/actuator/refresh | ||
74 | +management.endpoints.web.exposure.include=refresh | ||
75 | + | ||
71 | #码头接口通知地址,注意尾部带/符号 | 76 | #码头接口通知地址,注意尾部带/符号 |
72 | wharf.interface.host=http://10.50.3.66:1983/ | 77 | wharf.interface.host=http://10.50.3.66:1983/ |
73 | #新舱单运单查询数据接口,注意尾部带/符号 | 78 | #新舱单运单查询数据接口,注意尾部带/符号 |
@@ -75,3 +80,6 @@ nmms.interface.host=http://10.50.3.82:8081/ | @@ -75,3 +80,6 @@ nmms.interface.host=http://10.50.3.82:8081/ | ||
75 | #新舱单网站内网接口,注意尾部带/符号 | 80 | #新舱单网站内网接口,注意尾部带/符号 |
76 | nmms.site.host=http://10.50.3.61:90 | 81 | nmms.site.host=http://10.50.3.61:90 |
77 | custom.receptDirectory= bw/read/ | 82 | custom.receptDirectory= bw/read/ |
83 | + | ||
84 | +devdebug=true | ||
85 | +g2.switch=true |
@@ -5,11 +5,11 @@ | @@ -5,11 +5,11 @@ | ||
5 | 5 | ||
6 | <groupId>com.sy</groupId> | 6 | <groupId>com.sy</groupId> |
7 | <artifactId>analysis_imf</artifactId> | 7 | <artifactId>analysis_imf</artifactId> |
8 | - <version>2.12-BH-SNAPSHOT</version> | 8 | + <version>3.0-BH-SNAPSHOT</version> |
9 | <packaging>jar</packaging> | 9 | <packaging>jar</packaging> |
10 | 10 | ||
11 | <name>analysis_imf</name> | 11 | <name>analysis_imf</name> |
12 | - <description>Demo project for Spring Boot</description> | 12 | + <description>北货集成金二抬杆指令判定</description> |
13 | 13 | ||
14 | <parent> | 14 | <parent> |
15 | <groupId>org.springframework.boot</groupId> | 15 | <groupId>org.springframework.boot</groupId> |
@@ -27,6 +27,17 @@ | @@ -27,6 +27,17 @@ | ||
27 | 27 | ||
28 | <dependencies> | 28 | <dependencies> |
29 | 29 | ||
30 | + <!-- 配置文件热加载--> | ||
31 | + <dependency> | ||
32 | + <groupId>org.springframework.cloud</groupId> | ||
33 | + <artifactId>spring-cloud-starter-config</artifactId> | ||
34 | + <version>2.1.0.RELEASE</version> | ||
35 | + </dependency> | ||
36 | + <dependency> | ||
37 | + <groupId>org.springframework.boot</groupId> | ||
38 | + <artifactId>spring-boot-starter-actuator</artifactId> | ||
39 | + </dependency> | ||
40 | + | ||
30 | <dependency> | 41 | <dependency> |
31 | <groupId>org.springframework.boot</groupId> | 42 | <groupId>org.springframework.boot</groupId> |
32 | <artifactId>spring-boot-starter-jdbc</artifactId> | 43 | <artifactId>spring-boot-starter-jdbc</artifactId> |
@@ -5,11 +5,11 @@ import com.sy.logic.LiftBar; | @@ -5,11 +5,11 @@ import com.sy.logic.LiftBar; | ||
5 | import com.sy.logic.LogicOperation; | 5 | import com.sy.logic.LogicOperation; |
6 | import com.sy.model.*; | 6 | import com.sy.model.*; |
7 | import com.sy.service.*; | 7 | import com.sy.service.*; |
8 | -import com.sy.service.impl.GatherInfoServiceImpl; | ||
9 | import org.apache.commons.lang.StringUtils; | 8 | import org.apache.commons.lang.StringUtils; |
10 | import org.apache.log4j.Logger; | 9 | import org.apache.log4j.Logger; |
11 | import org.apache.log4j.PropertyConfigurator; | 10 | import org.apache.log4j.PropertyConfigurator; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
13 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
14 | 14 | ||
15 | import javax.annotation.PostConstruct; | 15 | import javax.annotation.PostConstruct; |
@@ -31,8 +31,9 @@ public class AnalysisRoute implements Runnable{ | @@ -31,8 +31,9 @@ public class AnalysisRoute implements Runnable{ | ||
31 | @Autowired | 31 | @Autowired |
32 | private CLRService clrService; | 32 | private CLRService clrService; |
33 | 33 | ||
34 | + @Qualifier("GatherInfoService") | ||
34 | @Autowired | 35 | @Autowired |
35 | - private GatherInfoServiceImpl infoService; | 36 | + private GatherInfoService infoService; |
36 | 37 | ||
37 | @Autowired | 38 | @Autowired |
38 | private CommandInfoService commandService; | 39 | private CommandInfoService commandService; |
@@ -94,7 +95,7 @@ public class AnalysisRoute implements Runnable{ | @@ -94,7 +95,7 @@ public class AnalysisRoute implements Runnable{ | ||
94 | String stype = message.getMeta().getSmType(); | 95 | String stype = message.getMeta().getSmType(); |
95 | if (stype.equals("CARM")) { | 96 | if (stype.equals("CARM")) { |
96 | if(message.getComInfo() !=null){ | 97 | if(message.getComInfo() !=null){ |
97 | - commandInfo info = commandInfoAnalysis.toJavaBean(message); | 98 | + CommandInfoX22 info = commandInfoAnalysis.toJavaBean(message); |
98 | route.commandService.save(info); | 99 | route.commandService.save(info); |
99 | }else{ | 100 | }else{ |
100 | //处理车辆过磅数据,结合申请数据,判定是否抬杆 | 101 | //处理车辆过磅数据,结合申请数据,判定是否抬杆 |
@@ -3,13 +3,13 @@ package com.sy.bwAnalysis; | @@ -3,13 +3,13 @@ package com.sy.bwAnalysis; | ||
3 | import com.sy.bwAssist.commandInfo.CommandInfo; | 3 | import com.sy.bwAssist.commandInfo.CommandInfo; |
4 | import com.sy.bwAssist.Message; | 4 | import com.sy.bwAssist.Message; |
5 | import com.sy.bwAssist.Meta; | 5 | import com.sy.bwAssist.Meta; |
6 | -import com.sy.model.commandInfo; | 6 | +import com.sy.model.CommandInfoX22; |
7 | 7 | ||
8 | 8 | ||
9 | public class CommandInfoAnalysis { | 9 | public class CommandInfoAnalysis { |
10 | 10 | ||
11 | - public commandInfo toJavaBean(Message msg) { | ||
12 | - commandInfo bean = new commandInfo(); | 11 | + public CommandInfoX22 toJavaBean(Message msg) { |
12 | + CommandInfoX22 bean = new CommandInfoX22(); | ||
13 | CommandInfo info = msg.getComInfo(); | 13 | CommandInfo info = msg.getComInfo(); |
14 | Meta meta = msg.getMeta(); | 14 | Meta meta = msg.getMeta(); |
15 | bean.setSender(meta.getSender()); | 15 | bean.setSender(meta.getSender()); |
1 | -package com.sy.bwAnalysis; | ||
2 | - | ||
3 | -import com.sy.bwAssist.Message; | ||
4 | -import com.sy.model.GatherInfo; | ||
5 | -import com.sy.model.commandInfo; | ||
6 | -import org.apache.commons.lang.NullArgumentException; | ||
7 | -import org.apache.commons.lang.StringUtils; | ||
8 | -import org.springframework.stereotype.Component; | ||
9 | - | ||
10 | -/** | ||
11 | - * 车辆过卡报文处理器 | ||
12 | - * @author mrz | ||
13 | - */ | ||
14 | -@Component | ||
15 | -public class GatherInfoHandle implements Runnable{ | ||
16 | - | ||
17 | - private String message; | ||
18 | - | ||
19 | - public String getMessage() { | ||
20 | - return message; | ||
21 | - } | ||
22 | - | ||
23 | - public void setMessage(String message) { | ||
24 | - /** | ||
25 | - * 1). 非空验证 | ||
26 | - */ | ||
27 | - if (StringUtils.isNotEmpty(message)){ | ||
28 | - this.message = message; | ||
29 | - }else { | ||
30 | - throw new NullArgumentException("报文内容为空"); | ||
31 | - } | ||
32 | - | ||
33 | - } | ||
34 | - | ||
35 | - | ||
36 | - | ||
37 | - @Override | ||
38 | - public void run() { | ||
39 | - | ||
40 | - /** | ||
41 | - * 一. 报文处理 | ||
42 | - */ | ||
43 | - stypConfirmAndRoute(); | ||
44 | - | ||
45 | - | ||
46 | - | ||
47 | - } | ||
48 | - | ||
49 | - /** | ||
50 | - * 1). 通过将xml转实体类进行验证, | ||
51 | - * 同时验证报文的合法性, | ||
52 | - * 转换失败会throw 异常出来 | ||
53 | - */ | ||
54 | - private Message xmlTransToBean(){ | ||
55 | - message = message.replace("Msg","MSG"); | ||
56 | - MessageAnalysis analysis = new MessageAnalysis(); | ||
57 | - return analysis.readTicketsXml(message); | ||
58 | - } | ||
59 | - | ||
60 | - /** | ||
61 | - * XML报文类型判断 | ||
62 | - * 通过META节点的STYP节点判定 | ||
63 | - */ | ||
64 | - private void stypConfirmAndRoute(){ | ||
65 | - Message messageBean = xmlTransToBean(); | ||
66 | - String stype = messageBean.getMeta().getSmType(); | ||
67 | - | ||
68 | - if ("CARM".equals(stype)) { | ||
69 | - if(messageBean.getComInfo() !=null){ | ||
70 | - CommandInfoAnalysis commandInfoAnalysis = new CommandInfoAnalysis(); | ||
71 | - commandInfo info = commandInfoAnalysis.toJavaBean(messageBean); | ||
72 | - /** | ||
73 | - * x22 commandInfo抬杆指令报文的处理 | ||
74 | - */ | ||
75 | - }else{ | ||
76 | - /** | ||
77 | - * x21 gatherInfo通道采集报文的处理 | ||
78 | - */ | ||
79 | - GatherInfoAnalysis gatherInfoAnalysis = new GatherInfoAnalysis(); | ||
80 | - GatherInfo info = gatherInfoAnalysis.toJavaBean(messageBean); | ||
81 | - | ||
82 | - } | ||
83 | - } | ||
84 | - } | ||
85 | -} |
@@ -147,6 +147,7 @@ public class LiftBar { | @@ -147,6 +147,7 @@ public class LiftBar { | ||
147 | return result; | 147 | return result; |
148 | } | 148 | } |
149 | if("Y".equals(ve.getVeState())){ | 149 | if("Y".equals(ve.getVeState())){ |
150 | + logger.info(BLACKLIST+vaName); | ||
150 | sendBw(info,false,BLACKLIST + vaName,new LandBusinessTypeList(),listinfos); | 151 | sendBw(info,false,BLACKLIST + vaName,new LandBusinessTypeList(),listinfos); |
151 | return result; | 152 | return result; |
152 | } | 153 | } |
@@ -381,7 +382,11 @@ public class LiftBar { | @@ -381,7 +382,11 @@ public class LiftBar { | ||
381 | logic.listService.updateById(list); | 382 | logic.listService.updateById(list); |
382 | 383 | ||
383 | //进出场申请业务表对应场站的卡口失效 | 384 | //进出场申请业务表对应场站的卡口失效 |
384 | - logic.listService.updateisvalid(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),list.getTurnoverflag()); | 385 | + if("I".equals(info.getIetype())){ |
386 | + logic.listService.updateisvalid(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),list.getTurnoverflag()); | ||
387 | + }else{ | ||
388 | + logic.listService.updateisvalid(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),null); | ||
389 | + } | ||
385 | 390 | ||
386 | //判断是否为最后一个场站,若是最后个场站申请为出,二维码失效 | 391 | //判断是否为最后一个场站,若是最后个场站申请为出,二维码失效 |
387 | int count=logic.listService.selectlaststation(list.getTrailerFrameNo(),list.getBarcode()); | 392 | int count=logic.listService.selectlaststation(list.getTrailerFrameNo(),list.getBarcode()); |
@@ -461,7 +466,7 @@ public class LiftBar { | @@ -461,7 +466,7 @@ public class LiftBar { | ||
461 | flag = true; | 466 | flag = true; |
462 | } else { | 467 | } else { |
463 | CommandClient.Client(info, reason); | 468 | CommandClient.Client(info, reason); |
464 | - logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<=============="); | 469 | + logger.info("=============>>>>>>>>"+reason+"<<<<<<<<<=============="); |
465 | } | 470 | } |
466 | commandlog(info,check,reason,land,list_infos); | 471 | commandlog(info,check,reason,land,list_infos); |
467 | return flag; | 472 | return flag; |
@@ -497,7 +502,7 @@ public class LiftBar { | @@ -497,7 +502,7 @@ public class LiftBar { | ||
497 | command.setInGrossWeight(inWt); | 502 | command.setInGrossWeight(inWt); |
498 | command.setGoodsWeight(goodsWt); | 503 | command.setGoodsWeight(goodsWt); |
499 | command.setActualGoodsWeight(diffVal); | 504 | command.setActualGoodsWeight(diffVal); |
500 | - if(list_infos.size()>0){ | 505 | + if(list_infos !=null && list_infos.size()>0){ |
501 | command.setMasterList(Arrays.toString(toStrArry(list_infos))); | 506 | command.setMasterList(Arrays.toString(toStrArry(list_infos))); |
502 | } | 507 | } |
503 | logic.commandLogService.insert(command); | 508 | logic.commandLogService.insert(command); |
1 | +package com.sy.mapper; | ||
2 | + | ||
3 | +import com.sy.model.LandRouterConfig; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface LandRouterConfigDao { | ||
8 | + int deleteByPrimaryKey(Integer id); | ||
9 | + | ||
10 | + int insert(LandRouterConfig record); | ||
11 | + | ||
12 | + int insertSelective(LandRouterConfig record); | ||
13 | + | ||
14 | + LandRouterConfig selectByPrimaryKey(Integer id); | ||
15 | + | ||
16 | + List<LandRouterConfig> selectByGatherInfo(LandRouterConfig record); | ||
17 | + | ||
18 | + List<LandRouterConfig> selectByBussType(String businessType); | ||
19 | + | ||
20 | + int updateByPrimaryKeySelective(LandRouterConfig record); | ||
21 | + | ||
22 | + int updateByPrimaryKey(LandRouterConfig record); | ||
23 | +} |
1 | package com.sy.mapper; | 1 | package com.sy.mapper; |
2 | 2 | ||
3 | -import com.sy.model.commandInfo; | 3 | +import com.sy.model.CommandInfoX22; |
4 | import org.springframework.stereotype.Component; | 4 | import org.springframework.stereotype.Component; |
5 | 5 | ||
6 | @Component | 6 | @Component |
7 | public interface commandInfoMapper { | 7 | public interface commandInfoMapper { |
8 | int deleteByPrimaryKey(String seqNo); | 8 | int deleteByPrimaryKey(String seqNo); |
9 | 9 | ||
10 | - int insert(commandInfo record); | 10 | + int insert(CommandInfoX22 record); |
11 | 11 | ||
12 | - int insertSelective(commandInfo record); | 12 | + int insertSelective(CommandInfoX22 record); |
13 | 13 | ||
14 | - commandInfo selectByPrimaryKey(String seqNo); | 14 | + CommandInfoX22 selectByPrimaryKey(String seqNo); |
15 | 15 | ||
16 | - int updateByPrimaryKeySelective(commandInfo record); | 16 | + int updateByPrimaryKeySelective(CommandInfoX22 record); |
17 | 17 | ||
18 | - int updateByPrimaryKey(commandInfo record); | ||
19 | -} | ||
18 | + int updateByPrimaryKey(CommandInfoX22 record); | ||
19 | +} |
@@ -2,7 +2,7 @@ package com.sy.model; | @@ -2,7 +2,7 @@ package com.sy.model; | ||
2 | 2 | ||
3 | import java.util.Date; | 3 | import java.util.Date; |
4 | 4 | ||
5 | -public class commandInfo { | 5 | +public class CommandInfoX22 { |
6 | private String seqNo; | 6 | private String seqNo; |
7 | 7 | ||
8 | private String sender; | 8 | private String sender; |
@@ -192,4 +192,4 @@ public class commandInfo { | @@ -192,4 +192,4 @@ public class commandInfo { | ||
192 | public void setOpHint(String opHint) { | 192 | public void setOpHint(String opHint) { |
193 | this.opHint = opHint == null ? null : opHint.trim(); | 193 | this.opHint = opHint == null ? null : opHint.trim(); |
194 | } | 194 | } |
195 | -} | ||
195 | +} |
1 | +package com.sy.model; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.Date; | ||
5 | +import lombok.Data; | ||
6 | + | ||
7 | +/** | ||
8 | + * land_router_config | ||
9 | + * @author | ||
10 | + */ | ||
11 | +@Data | ||
12 | +public class LandRouterConfig implements Serializable { | ||
13 | + private Integer id; | ||
14 | + | ||
15 | + /** | ||
16 | + * 场站编号 | ||
17 | + */ | ||
18 | + private String areaId; | ||
19 | + | ||
20 | + /** | ||
21 | + * 场站名称 | ||
22 | + */ | ||
23 | + private String areaName; | ||
24 | + | ||
25 | + /** | ||
26 | + * 通道编号 | ||
27 | + */ | ||
28 | + private String chanelId; | ||
29 | + | ||
30 | + /** | ||
31 | + * 通道名称 | ||
32 | + */ | ||
33 | + private String chanelName; | ||
34 | + | ||
35 | + /** | ||
36 | + * 进出口类型 | ||
37 | + */ | ||
38 | + private String chanelType; | ||
39 | + | ||
40 | + /** | ||
41 | + * 流转申请表头业务类型 | ||
42 | + */ | ||
43 | + private String businessType; | ||
44 | + | ||
45 | + /** | ||
46 | + * 对应金二业务类型码 | ||
47 | + */ | ||
48 | + private String g2BusinessType; | ||
49 | + | ||
50 | + /** | ||
51 | + * 车辆信息识别方式;IC;VN;VE;BC;BC>VN>VE>IC | ||
52 | + */ | ||
53 | + private String identifyType; | ||
54 | + | ||
55 | + /** | ||
56 | + * 路由目的处理方;金二还是本地;G2;LOC; | ||
57 | + */ | ||
58 | + private String gatherReceiver; | ||
59 | + | ||
60 | + private Date createTime; | ||
61 | + | ||
62 | + /** | ||
63 | + * 默认Y生效,N失效 | ||
64 | + */ | ||
65 | + private String status; | ||
66 | + | ||
67 | + private static final long serialVersionUID = 1L; | ||
68 | +} |
1 | package com.sy.service; | 1 | package com.sy.service; |
2 | 2 | ||
3 | 3 | ||
4 | -import com.sy.model.commandInfo; | 4 | +import com.sy.model.CommandInfoX22; |
5 | 5 | ||
6 | public interface CommandInfoService { | 6 | public interface CommandInfoService { |
7 | 7 | ||
8 | - int save(commandInfo info); | 8 | + int save(CommandInfoX22 info); |
9 | + | ||
10 | + void handel(CommandInfoX22 info); | ||
9 | } | 11 | } |
1 | package com.sy.service; | 1 | package com.sy.service; |
2 | 2 | ||
3 | +import com.sy.model.GatherInfo; | ||
4 | +import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO; | ||
5 | +import com.sy.model.LandBusinessTypeList; | ||
3 | import com.sy.model.commandLog; | 6 | import com.sy.model.commandLog; |
4 | 7 | ||
8 | +import java.util.List; | ||
9 | + | ||
5 | public interface CommandLogService { | 10 | public interface CommandLogService { |
6 | int insert(commandLog command); | 11 | int insert(commandLog command); |
12 | + | ||
13 | + /** | ||
14 | + * 根据进出场信息写入日志 | ||
15 | + * @param info 过卡信息 | ||
16 | + * @param check 过卡状态 | ||
17 | + * @param reason 抬杆指令内容 | ||
18 | + * @param land 流转申请信息 | ||
19 | + * @param listInfos 流转单列表 | ||
20 | + * @param selfWt 车辆备案重量 | ||
21 | + * @param inWt 车辆入场重量 | ||
22 | + * @param goodsWt 车辆装载货物重量 | ||
23 | + * @param diffVal 进出场差值 | ||
24 | + */ | ||
25 | + void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> listInfos, | ||
26 | + Double selfWt,Double inWt,Double goodsWt,Double diffVal | ||
27 | + ); | ||
7 | } | 28 | } |
1 | package com.sy.service; | 1 | package com.sy.service; |
2 | 2 | ||
3 | import com.sy.model.GatherInfo; | 3 | import com.sy.model.GatherInfo; |
4 | +import com.sy.model.LandBusinessTypeList; | ||
4 | 5 | ||
5 | public interface GatherInfoService { | 6 | public interface GatherInfoService { |
6 | 7 | ||
@@ -10,4 +11,6 @@ public interface GatherInfoService { | @@ -10,4 +11,6 @@ public interface GatherInfoService { | ||
10 | * 根据过卡进行抬杆指令处理 | 11 | * 根据过卡进行抬杆指令处理 |
11 | */ | 12 | */ |
12 | void handel(GatherInfo info); | 13 | void handel(GatherInfo info); |
14 | + | ||
15 | + | ||
13 | } | 16 | } |
1 | package com.sy.service; | 1 | package com.sy.service; |
2 | 2 | ||
3 | 3 | ||
4 | +import com.sy.model.GatherInfo; | ||
4 | import com.sy.model.LandBusinessTypeList; | 5 | import com.sy.model.LandBusinessTypeList; |
5 | 6 | ||
6 | import java.util.List; | 7 | import java.util.List; |
@@ -38,4 +39,10 @@ public interface LandBusListService { | @@ -38,4 +39,10 @@ public interface LandBusListService { | ||
38 | //查询出场申请为最后一个 | 39 | //查询出场申请为最后一个 |
39 | int selectlaststation(String frameNo, String barcode); | 40 | int selectlaststation(String frameNo, String barcode); |
40 | 41 | ||
42 | + /** | ||
43 | + * 根据gatherInfo获取对应的流转申请 | ||
44 | + * @return 对应通道的流转申请信息 | ||
45 | + */ | ||
46 | + LandBusinessTypeList getLandBusinessTypeListByGather(GatherInfo info); | ||
47 | + | ||
41 | } | 48 | } |
@@ -19,5 +19,12 @@ public interface RedisService { | @@ -19,5 +19,12 @@ public interface RedisService { | ||
19 | 19 | ||
20 | boolean set(String key,String value); | 20 | boolean set(String key,String value); |
21 | 21 | ||
22 | + /** | ||
23 | + * | ||
24 | + * @param key key | ||
25 | + * @param value 值 | ||
26 | + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 | ||
27 | + * @return | ||
28 | + */ | ||
22 | boolean set(String key,String value,long time); | 29 | boolean set(String key,String value,long time); |
23 | } | 30 | } |
@@ -6,12 +6,15 @@ import com.sy.service.BusnesslistinfoService; | @@ -6,12 +6,15 @@ import com.sy.service.BusnesslistinfoService; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
7 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
8 | 8 | ||
9 | +import javax.annotation.Resource; | ||
9 | import java.util.List; | 10 | import java.util.List; |
10 | 11 | ||
11 | @Service | 12 | @Service |
12 | public class BusnesslistinfoImpl implements BusnesslistinfoService { | 13 | public class BusnesslistinfoImpl implements BusnesslistinfoService { |
13 | - @Autowired | 14 | + |
15 | + @Resource | ||
14 | LAND_BUSINEESTYPE_LIST_INFOMapper list_infoMapper; | 16 | LAND_BUSINEESTYPE_LIST_INFOMapper list_infoMapper; |
17 | + | ||
15 | @Override | 18 | @Override |
16 | public List<LAND_BUSINEESTYPE_LIST_INFO> selectarrvie(String applicationformid) { | 19 | public List<LAND_BUSINEESTYPE_LIST_INFO> selectarrvie(String applicationformid) { |
17 | return list_infoMapper.selectarrive(applicationformid); | 20 | return list_infoMapper.selectarrive(applicationformid); |
@@ -2,7 +2,7 @@ package com.sy.service.impl; | @@ -2,7 +2,7 @@ package com.sy.service.impl; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.sy.mapper.commandInfoMapper; | 4 | import com.sy.mapper.commandInfoMapper; |
5 | -import com.sy.model.commandInfo; | 5 | +import com.sy.model.CommandInfoX22; |
6 | import com.sy.service.CommandInfoService; | 6 | import com.sy.service.CommandInfoService; |
7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
@@ -14,7 +14,7 @@ public class CommandInfoImpl implements CommandInfoService { | @@ -14,7 +14,7 @@ public class CommandInfoImpl implements CommandInfoService { | ||
14 | private commandInfoMapper infoMapper; | 14 | private commandInfoMapper infoMapper; |
15 | 15 | ||
16 | @Override | 16 | @Override |
17 | - public int save(commandInfo info) { | 17 | + public int save(CommandInfoX22 info) { |
18 | int row = 0; | 18 | int row = 0; |
19 | try { | 19 | try { |
20 | row =infoMapper.insert(info); | 20 | row =infoMapper.insert(info); |
@@ -23,4 +23,9 @@ public class CommandInfoImpl implements CommandInfoService { | @@ -23,4 +23,9 @@ public class CommandInfoImpl implements CommandInfoService { | ||
23 | } | 23 | } |
24 | return row; | 24 | return row; |
25 | } | 25 | } |
26 | + | ||
27 | + @Override | ||
28 | + public void handel(CommandInfoX22 info) { | ||
29 | + | ||
30 | + } | ||
26 | } | 31 | } |
1 | package com.sy.service.impl; | 1 | package com.sy.service.impl; |
2 | 2 | ||
3 | import com.sy.mapper.commandLogMapper; | 3 | import com.sy.mapper.commandLogMapper; |
4 | +import com.sy.model.GatherInfo; | ||
5 | +import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO; | ||
6 | +import com.sy.model.LandBusinessTypeList; | ||
4 | import com.sy.model.commandLog; | 7 | import com.sy.model.commandLog; |
5 | import com.sy.service.CommandLogService; | 8 | import com.sy.service.CommandLogService; |
6 | -import org.springframework.beans.factory.annotation.Autowired; | 9 | + |
7 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
8 | 11 | ||
12 | +import javax.annotation.Resource; | ||
13 | +import java.util.Arrays; | ||
14 | +import java.util.List; | ||
15 | +import java.util.UUID; | ||
16 | + | ||
17 | +import static com.sy.service.impl.ResMessageServiceImpl.toStrArry; | ||
18 | + | ||
9 | @Service | 19 | @Service |
10 | public class CommandLogImpl implements CommandLogService { | 20 | public class CommandLogImpl implements CommandLogService { |
11 | - @Autowired | 21 | + |
22 | + @Resource | ||
12 | commandLogMapper mapper; | 23 | commandLogMapper mapper; |
24 | + | ||
13 | @Override | 25 | @Override |
14 | public int insert(commandLog command) { | 26 | public int insert(commandLog command) { |
15 | return mapper.insertSelective(command); | 27 | return mapper.insertSelective(command); |
16 | } | 28 | } |
29 | + | ||
30 | + | ||
31 | + @Override | ||
32 | + public void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos, | ||
33 | + Double selfWt,Double inWt,Double goodsWt,Double diffVal | ||
34 | + ){ | ||
35 | + String flag="",type=""; | ||
36 | + commandLog command=new commandLog(); | ||
37 | + command.setId(UUID.randomUUID().toString()); | ||
38 | + command.setBarcode(info.getBarcode()); | ||
39 | + if(land!=null){ | ||
40 | + command.setBusnessType(land.getBusinesstype()); | ||
41 | + } | ||
42 | + command.setAreaId(info.getAreaid()); | ||
43 | + command.setChnlNo(info.getChnlno()); | ||
44 | + if (check){ | ||
45 | + flag = "00"; | ||
46 | + } else{ | ||
47 | + flag = "11"; | ||
48 | + } | ||
49 | + if("I".equals(info.getIetype())){ | ||
50 | + type="000000200000000000"; | ||
51 | + }else{ | ||
52 | + type="000000100000000000"; | ||
53 | + } | ||
54 | + command.setReasonCode(flag+type); | ||
55 | + command.setReasonText(reason); | ||
56 | + command.setVeName(info.getVename()); | ||
57 | + command.setVeWeight(selfWt); | ||
58 | + command.setIeType(info.getIetype()); | ||
59 | + command.setExitGrossWeight(info.getGrosswt().doubleValue()); | ||
60 | + command.setInGrossWeight(inWt); | ||
61 | + command.setGoodsWeight(goodsWt); | ||
62 | + command.setActualGoodsWeight(diffVal); | ||
63 | + if(list_infos.size()>0){ | ||
64 | + command.setMasterList(Arrays.toString(toStrArry(list_infos))); | ||
65 | + } | ||
66 | + insert(command); | ||
67 | + } | ||
17 | } | 68 | } |
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; | @@ -4,7 +4,6 @@ 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.sy.crossDomain.buildBarCode; | 6 | import com.sy.crossDomain.buildBarCode; |
7 | -import com.sy.logic.LiftBar; | ||
8 | import com.sy.model.*; | 7 | import com.sy.model.*; |
9 | import com.sy.service.*; | 8 | import com.sy.service.*; |
10 | import com.sy.socket.CommandClient; | 9 | import com.sy.socket.CommandClient; |
@@ -13,8 +12,10 @@ import org.apache.commons.lang.StringUtils; | @@ -13,8 +12,10 @@ import org.apache.commons.lang.StringUtils; | ||
13 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
14 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
15 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
16 | -import org.springframework.stereotype.Service; | 15 | +import org.springframework.beans.factory.annotation.Value; |
16 | +import org.springframework.stereotype.Component; | ||
17 | 17 | ||
18 | +import javax.annotation.PostConstruct; | ||
18 | import javax.validation.constraints.NotNull; | 19 | import javax.validation.constraints.NotNull; |
19 | import java.math.BigDecimal; | 20 | import java.math.BigDecimal; |
20 | import java.util.*; | 21 | import java.util.*; |
@@ -22,10 +23,11 @@ import java.util.stream.Collectors; | @@ -22,10 +23,11 @@ import java.util.stream.Collectors; | ||
22 | 23 | ||
23 | import static com.sy.service.impl.ResMessageServiceImpl.toStrArry; | 24 | import static com.sy.service.impl.ResMessageServiceImpl.toStrArry; |
24 | 25 | ||
25 | -@Service("GatherInfoHandle") | ||
26 | -public class GatherInfoHandleImpl implements GatherInfoService { | 26 | +@Component("GatherInfoHandle") |
27 | +public class GatherInfoHandle implements GatherInfoService { | ||
27 | 28 | ||
28 | - private static final Logger logger = LoggerFactory.getLogger(LiftBar.class); | 29 | + private static final Logger logger = LoggerFactory.getLogger(GatherInfoHandle.class); |
30 | + private static GatherInfoHandle gatherInfoHandle; | ||
29 | 31 | ||
30 | //逻辑判断后的返回信息定义 | 32 | //逻辑判断后的返回信息定义 |
31 | private static String PERMITTHOUGH = "直接放行"; | 33 | private static String PERMITTHOUGH = "直接放行"; |
@@ -42,44 +44,48 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -42,44 +44,48 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
42 | private static String NOGrossWt = "过磅重量异常"; | 44 | private static String NOGrossWt = "过磅重量异常"; |
43 | private static String BLACKLIST= "此车辆已被拉进黑名单,不允许出区"; | 45 | private static String BLACKLIST= "此车辆已被拉进黑名单,不允许出区"; |
44 | 46 | ||
45 | - @Autowired | ||
46 | - FeignService feignService; | ||
47 | 47 | ||
48 | @Autowired | 48 | @Autowired |
49 | - NmmsService nmmsService; | 49 | + private NmmsService nmmsService; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * 车辆信息备案表 | 52 | * 车辆信息备案表 |
53 | */ | 53 | */ |
54 | @Autowired | 54 | @Autowired |
55 | - LandRoadVeService veService; | 55 | + private LandRoadVeService veService; |
56 | 56 | ||
57 | @Autowired | 57 | @Autowired |
58 | - RedisService redisService; | 58 | + private RedisService redisService; |
59 | 59 | ||
60 | @Autowired | 60 | @Autowired |
61 | BusnesslistinfoService busnesslistinfoService; | 61 | BusnesslistinfoService busnesslistinfoService; |
62 | 62 | ||
63 | + @Value("${devdebug}") | ||
64 | + private Boolean debug; | ||
65 | + | ||
63 | /** | 66 | /** |
64 | * 进出场申请表 | 67 | * 进出场申请表 |
65 | */ | 68 | */ |
66 | @Autowired | 69 | @Autowired |
67 | - LandBusListService listService; | 70 | + private LandBusListService listService; |
68 | 71 | ||
69 | /** | 72 | /** |
70 | * 重量校验算法 | 73 | * 重量校验算法 |
71 | */ | 74 | */ |
72 | @Autowired | 75 | @Autowired |
73 | - WeightCheckHandleService weightCheckHandleService; | 76 | + private WeightCheckHandleService weightCheckHandleService; |
74 | 77 | ||
75 | /** | 78 | /** |
76 | * 查询运单放行表 | 79 | * 查询运单放行表 |
77 | */ | 80 | */ |
78 | @Autowired | 81 | @Autowired |
79 | - ResMessageService resMessageService; | 82 | + private ResMessageService resMessageService; |
80 | 83 | ||
84 | + /** | ||
85 | + * 指令日志表 | ||
86 | + */ | ||
81 | @Autowired | 87 | @Autowired |
82 | - CommandLogService commandLogService; | 88 | + private CommandLogService commandLogService; |
83 | 89 | ||
84 | /** | 90 | /** |
85 | * 车辆过卡信息 | 91 | * 车辆过卡信息 |
@@ -129,6 +135,10 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -129,6 +135,10 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
129 | private double diffVal=0.0; | 135 | private double diffVal=0.0; |
130 | 136 | ||
131 | 137 | ||
138 | + @PostConstruct | ||
139 | + public void init() { | ||
140 | + gatherInfoHandle = this; | ||
141 | + } | ||
132 | 142 | ||
133 | @Override | 143 | @Override |
134 | public int save(GatherInfo info) { | 144 | public int save(GatherInfo info) { |
@@ -137,12 +147,54 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -137,12 +147,54 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
137 | 147 | ||
138 | @Override | 148 | @Override |
139 | public void handel(GatherInfo gatherInfo) { | 149 | public void handel(GatherInfo gatherInfo) { |
140 | - this.info = gatherInfo; | ||
141 | - //获取过磅重量 | ||
142 | - growssWt = info.getGrosswt().doubleValue(); | 150 | + try { |
151 | + this.info = gatherInfo; | ||
152 | + //获取过磅重量 | ||
153 | + growssWt = info.getGrosswt().doubleValue(); | ||
154 | + | ||
155 | + //取车牌号,判定卡口是否取到车牌号 | ||
156 | + vaName = info.getVename(); | ||
157 | + | ||
158 | + | ||
159 | + //车牌校验 | ||
160 | + if (veNameCheck(vaName) | ||
161 | + && veRecordCheck() //车辆备案 | ||
162 | + && LandBusinessFormCheck() //流转申请校验 | ||
163 | + && weightCheck(info) //过磅重量校验 | ||
164 | + ){ | ||
165 | + | ||
166 | + // 场站白名单放行验证 | ||
167 | + if (areaWhiteListCheck()){ | ||
168 | + pass(); | ||
169 | + return; | ||
170 | + } | ||
171 | + //入区核放 | ||
172 | + if(chanelInCheck()){ | ||
173 | + pass(); | ||
174 | + }else{ | ||
175 | + inStationInfo(); //入场信息获取 | ||
176 | + setListinfos(); //流转申请表体获取 | ||
177 | + | ||
178 | + if (goodsWhiteListCheck()){ //货物类型白名单 | ||
179 | + pass(); | ||
180 | + return; | ||
181 | + } | ||
182 | + | ||
183 | + if(checkRelease()){ //出区核放 | ||
184 | + sendBw(info, true,PERMITTHOUGH,landBusinessTypeList,listinfos); | ||
185 | + releaseFormCheck(); //流转申请单核销 | ||
186 | + } | ||
187 | + } | ||
188 | + } | ||
189 | + logger.info("[X21-ERROR]:车辆过磅验放失败"); | ||
190 | + | ||
191 | + }catch (Exception e){ | ||
192 | + logger.error("放行判定异常",e); | ||
193 | + CommandClient.Client(gatherInfo, "放行判定异常"); | ||
194 | + } | ||
195 | + | ||
196 | + | ||
143 | 197 | ||
144 | - //取车牌号,判定卡口是否取到车牌号 | ||
145 | - vaName = info.getVename(); | ||
146 | } | 198 | } |
147 | 199 | ||
148 | 200 | ||
@@ -166,7 +218,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -166,7 +218,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
166 | //1. 若无车牌号,返回未识别错误 | 218 | //1. 若无车牌号,返回未识别错误 |
167 | if (StringUtils.isEmpty(vaName)) { | 219 | if (StringUtils.isEmpty(vaName)) { |
168 | logger.error(NO_CHEPAI+vaName); | 220 | logger.error(NO_CHEPAI+vaName); |
169 | - sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList(),listinfos); | 221 | + sendBw(info,false,NO_CHEPAI + vaName,null,listinfos); |
170 | //CommandClient.Client(info, NO_CHEPAI + vaName); | 222 | //CommandClient.Client(info, NO_CHEPAI + vaName); |
171 | return false; | 223 | return false; |
172 | } | 224 | } |
@@ -178,11 +230,11 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -178,11 +230,11 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
178 | */ | 230 | */ |
179 | private boolean veRecordCheck(){ | 231 | private boolean veRecordCheck(){ |
180 | //2. 校验车辆是否备案 | 232 | //2. 校验车辆是否备案 |
181 | - LandRoadVe ve = veService.selectByFrameNo(vaName); | 233 | + LandRoadVe ve = gatherInfoHandle.veService.selectByFrameNo(vaName); |
182 | //若无备案信息或者黑名单,返回车辆未备案或者识别错误, | 234 | //若无备案信息或者黑名单,返回车辆未备案或者识别错误, |
183 | if (ve == null && !veBlackListCheck(ve)) { | 235 | if (ve == null && !veBlackListCheck(ve)) { |
184 | logger.error(NORECORD+vaName); | 236 | logger.error(NORECORD+vaName); |
185 | - sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList(),listinfos); | 237 | + sendBw(info,false,NORECORD + vaName,null,listinfos); |
186 | //CommandClient.Client(info, NORECORD + vaName); | 238 | //CommandClient.Client(info, NORECORD + vaName); |
187 | return false; | 239 | return false; |
188 | } | 240 | } |
@@ -198,7 +250,8 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -198,7 +250,8 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
198 | */ | 250 | */ |
199 | private boolean veBlackListCheck(LandRoadVe ve){ | 251 | private boolean veBlackListCheck(LandRoadVe ve){ |
200 | if("Y".equals(ve.getVeState())){ | 252 | if("Y".equals(ve.getVeState())){ |
201 | - sendBw(info,false,BLACKLIST + vaName,new LandBusinessTypeList(),listinfos); | 253 | + logger.info(BLACKLIST+vaName); |
254 | + sendBw(info,false,BLACKLIST + vaName,null,listinfos); | ||
202 | return false; | 255 | return false; |
203 | } | 256 | } |
204 | return true; | 257 | return true; |
@@ -211,12 +264,19 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -211,12 +264,19 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
211 | */ | 264 | */ |
212 | private boolean LandBusinessFormCheck(){ | 265 | private boolean LandBusinessFormCheck(){ |
213 | try { | 266 | try { |
267 | + logger.info("车辆-{}核碰缓存",info.getVename()); | ||
268 | + landBusinessTypeListList = new ArrayList<>(); | ||
214 | //通过车牌号,二维码,场站,通道号,进出类型查询进出场站申请列表 | 269 | //通过车牌号,二维码,场站,通道号,进出类型查询进出场站申请列表 |
215 | - String landBusinessJson = redisService.get(info.getVename()); | 270 | + if (info==null){ |
271 | + logger.error("info 实体为NULL"); | ||
272 | + return false; | ||
273 | + } | ||
274 | + | ||
275 | + String landBusinessJson = gatherInfoHandle.redisService.get(info.getVename()); | ||
216 | List<LandBusinessTypeList> list = new ArrayList<>(); | 276 | List<LandBusinessTypeList> list = new ArrayList<>(); |
217 | if (StringUtils.isNotEmpty(landBusinessJson)){ | 277 | if (StringUtils.isNotEmpty(landBusinessJson)){ |
218 | 278 | ||
219 | - list = (List<LandBusinessTypeList>) JSON.parseObject(landBusinessJson,List.class); | 279 | + list = JSONArray.parseArray(landBusinessJson,LandBusinessTypeList.class); |
220 | 280 | ||
221 | landBusinessTypeListList = list; | 281 | landBusinessTypeListList = list; |
222 | //4. 若查询结果为null,返回无相对应进出场申请 | 282 | //4. 若查询结果为null,返回无相对应进出场申请 |
@@ -226,33 +286,53 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -226,33 +286,53 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
226 | return false; | 286 | return false; |
227 | } | 287 | } |
228 | 288 | ||
229 | - list.stream() | ||
230 | - .filter( item->{ | ||
231 | - if (item.getAisle().equals(info.getChnlno()) && item.getBarcode().equals(info.getBarcode())){ | ||
232 | - landBusinessTypeList = item; | 289 | + for (LandBusinessTypeList item : list) { |
233 | 290 | ||
234 | - //离场装载货物重量 | ||
235 | - goodsWt = Double.parseDouble(landBusinessTypeList.getRemark()); | 291 | + if (item.getAisle().equals(info.getChnlno()) && item.getBarcode().equals(info.getBarcode())){ |
292 | + landBusinessTypeList = item; | ||
293 | + //离场装载货物重量 | ||
294 | + goodsWt = Double.parseDouble(landBusinessTypeList.getRemark()); | ||
295 | + logger.info("车辆-{}的申请缓存信息核碰成功,通道:{}",info.getVename(),info.getChnlno()); | ||
296 | + return true; | ||
297 | + } | ||
298 | + } | ||
236 | 299 | ||
237 | - return true; | ||
238 | - }else { | ||
239 | - return false; | ||
240 | - } | ||
241 | - }); | 300 | + //核碰流转申请失败 |
301 | + logger.info("[CACHE]:车辆-{}的流转申请校验失败,无对应流转申请信息",info.getVename()); | ||
242 | }else { | 302 | }else { |
243 | - logger.error("未找到车辆-{}的申请缓存信息",info.getVename()); | ||
244 | - logger.info("未找到车辆-{}的申请缓存信息,或者流转已超期失效",info.getVename()); | 303 | + logger.error("[CACHE-ERROR]:未找到车辆-{}的申请缓存信息",info.getVename()); |
304 | + logger.info("[CACHE-ERROR]:未找到车辆-{}的申请缓存信息,或者流转已超期失效",info.getVename()); | ||
305 | + return false; | ||
245 | } | 306 | } |
246 | }catch (Exception e){ | 307 | }catch (Exception e){ |
308 | + e.printStackTrace(); | ||
309 | + logger.error("[CACHE-PARSE-ERROR]:",e); | ||
247 | return false; | 310 | return false; |
248 | } | 311 | } |
249 | 312 | ||
313 | + return false; | ||
314 | + } | ||
315 | + | ||
316 | + | ||
317 | + | ||
318 | + | ||
319 | + /** | ||
320 | + * 5. 车辆过磅重量校验 | ||
321 | + * @return true 通过 false 不通过 | ||
322 | + */ | ||
323 | + private boolean weightCheck(GatherInfo info){ | ||
324 | + if(info.getGrosswt().compareTo(BigDecimal.ZERO) > 0){ | ||
325 | + logger.info("过磅重量校验通过,过磅重量大于0"); | ||
326 | + }else{ | ||
327 | + sendBw(info,false,NOGrossWt + growssWt,new LandBusinessTypeList(),listinfos); | ||
328 | + return false; | ||
329 | + } | ||
250 | return true; | 330 | return true; |
251 | } | 331 | } |
252 | 332 | ||
253 | /** | 333 | /** |
254 | * 流转申请-货物类型白名单,白名单的货物类型目前直接放行 | 334 | * 流转申请-货物类型白名单,白名单的货物类型目前直接放行 |
255 | - * @return | 335 | + * @return true 白名单货物直接放行 false 非白名单 需要验放 |
256 | */ | 336 | */ |
257 | private boolean goodsWhiteListCheck(){ | 337 | private boolean goodsWhiteListCheck(){ |
258 | if(!"普通货物".equals(landBusinessTypeList.getCocode()) | 338 | if(!"普通货物".equals(landBusinessTypeList.getCocode()) |
@@ -265,30 +345,29 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -265,30 +345,29 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
265 | //todo:换单货物校验逻辑待定 | 345 | //todo:换单货物校验逻辑待定 |
266 | //todo:未来取消货物类型判定. | 346 | //todo:未来取消货物类型判定. |
267 | logger.info("车辆装载货物为:" + landBusinessTypeList.getCocode()); | 347 | logger.info("车辆装载货物为:" + landBusinessTypeList.getCocode()); |
268 | - return true; | 348 | + return true; |
269 | } | 349 | } |
270 | return false; | 350 | return false; |
271 | } | 351 | } |
272 | 352 | ||
273 | /** | 353 | /** |
274 | - * 5. 车辆过磅重量校验 | ||
275 | - * @return true 通过 false 不通过 | 354 | + * todo:通道及金二路由判定,是金二通道的话,等金二X22 |
355 | + * 目前宽进严出策略,本地判定 | ||
356 | + * | ||
276 | */ | 357 | */ |
277 | - private boolean weightCheck(GatherInfo info){ | ||
278 | - if(info.getGrosswt().compareTo(BigDecimal.ZERO) > 0){ | ||
279 | - logger.info("过磅重量校验通过,过磅重量大于0"); | ||
280 | - }else{ | ||
281 | - sendBw(info,false,NOGrossWt + growssWt,new LandBusinessTypeList(),listinfos); | 358 | + private boolean chanelInCheck(){ |
359 | + if ("I".equals(info.getIetype())){ | ||
360 | + return true; | ||
361 | + }else { | ||
282 | return false; | 362 | return false; |
283 | } | 363 | } |
284 | - return true; | ||
285 | } | 364 | } |
286 | 365 | ||
287 | /** | 366 | /** |
288 | * 离场时需要获取的车辆进场信息,入场重量,进出场差值 | 367 | * 离场时需要获取的车辆进场信息,入场重量,进出场差值 |
289 | */ | 368 | */ |
290 | private void inStationInfo(){ | 369 | private void inStationInfo(){ |
291 | - List<LandBusinessTypeList> stationInChanleInfo= listService.selectwt(info.getVename(),info.getBarcode(),info.getAreaid(),"I"); | 370 | + List<LandBusinessTypeList> stationInChanleInfo= gatherInfoHandle.listService.selectwt(info.getVename(),info.getBarcode(),info.getAreaid(),"I"); |
292 | if (stationInChanleInfo.isEmpty()){ | 371 | if (stationInChanleInfo.isEmpty()){ |
293 | logger.info("未查询到车辆:{}的入场信息",info.getVename()); | 372 | logger.info("未查询到车辆:{}的入场信息",info.getVename()); |
294 | }else { | 373 | }else { |
@@ -313,36 +392,26 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -313,36 +392,26 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
313 | 392 | ||
314 | } | 393 | } |
315 | 394 | ||
316 | - /** | ||
317 | - * todo:通道及金二路由判定,是金二通道的话,等金二X22 | ||
318 | - * 目前宽进严出策略,本地判定 | ||
319 | - * | ||
320 | - */ | ||
321 | - private boolean chanelInCheck(){ | ||
322 | - if ("I".equals(info.getIetype())){ | ||
323 | - return true; | ||
324 | - }else { | ||
325 | - return false; | ||
326 | - } | ||
327 | - } | 395 | + |
328 | 396 | ||
329 | /** | 397 | /** |
330 | * 设置表体全局变量 | 398 | * 设置表体全局变量 |
331 | */ | 399 | */ |
332 | private void setListinfos(){ | 400 | private void setListinfos(){ |
333 | //查询运单列表 | 401 | //查询运单列表 |
334 | - listinfos=busnesslistinfoService.selectmanilist(info.getBarcode()); | 402 | + listinfos=gatherInfoHandle.busnesslistinfoService.selectmanilist(info.getBarcode()); |
335 | } | 403 | } |
336 | 404 | ||
337 | /** | 405 | /** |
406 | + * todo:与金二指令一起核碰 | ||
338 | * 出区抬杆放行判定 | 407 | * 出区抬杆放行判定 |
339 | - * @return | 408 | + * @return true 抬杆放行 |
340 | */ | 409 | */ |
341 | private boolean checkRelease(){ | 410 | private boolean checkRelease(){ |
342 | logger.info("[进出场申请]-业务类型为:"+landBusinessTypeList.getCocode()+landBusinessTypeList.getBusinesstype()); | 411 | logger.info("[进出场申请]-业务类型为:"+landBusinessTypeList.getCocode()+landBusinessTypeList.getBusinesstype()); |
343 | switch (landBusinessTypeList.getBusinesstype()){ | 412 | switch (landBusinessTypeList.getBusinesstype()){ |
344 | case "空车业务": | 413 | case "空车业务": |
345 | - if(weightCheckHandleService.checkEmpty(growssWt,selfWt)){ | 414 | + if(gatherInfoHandle.weightCheckHandleService.checkEmpty(growssWt,selfWt)){ |
346 | return true; | 415 | return true; |
347 | }else{ | 416 | }else{ |
348 | logger.error("[空车业务]-出场重量未通过校验:"+GROWSSEXCETION); | 417 | logger.error("[空车业务]-出场重量未通过校验:"+GROWSSEXCETION); |
@@ -351,7 +420,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -351,7 +420,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
351 | } | 420 | } |
352 | case "出口转关": | 421 | case "出口转关": |
353 | case "出口送货": | 422 | case "出口送货": |
354 | - if (weightCheckHandleService.checkExportDownLoading(growssWt, selfWt, goodsWt,inWt)){ | 423 | + if (gatherInfoHandle.weightCheckHandleService.checkExportDownLoading(growssWt, selfWt, goodsWt,inWt)){ |
355 | return true; | 424 | return true; |
356 | }else{ | 425 | }else{ |
357 | logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION); | 426 | logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION); |
@@ -360,7 +429,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -360,7 +429,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
360 | } | 429 | } |
361 | case "进口转关": | 430 | case "进口转关": |
362 | case "进口提货": | 431 | case "进口提货": |
363 | - if (weightCheckHandleService.checkImportDlv(growssWt, selfWt, goodsWt,inWt)){ | 432 | + if (gatherInfoHandle.weightCheckHandleService.checkImportDlv(growssWt, selfWt, goodsWt,inWt)){ |
364 | if ("退库货物".equals(landBusinessTypeList.getCocode())){ | 433 | if ("退库货物".equals(landBusinessTypeList.getCocode())){ |
365 | /** | 434 | /** |
366 | * 退库货物不校验运单放行. | 435 | * 退库货物不校验运单放行. |
@@ -368,7 +437,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -368,7 +437,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
368 | logger.info("[退库业务]-重量核验通过."); | 437 | logger.info("[退库业务]-重量核验通过."); |
369 | }else{ | 438 | }else{ |
370 | //检查运单放行 | 439 | //检查运单放行 |
371 | - if (resMessageService.checkManifestRelease(info,listinfos)){ | 440 | + if (gatherInfoHandle.resMessageService.checkManifestRelease(info,listinfos)){ |
372 | return true; | 441 | return true; |
373 | }else { | 442 | }else { |
374 | //有运单未放行 | 443 | //有运单未放行 |
@@ -385,7 +454,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -385,7 +454,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
385 | } | 454 | } |
386 | break; | 455 | break; |
387 | case "分拨业务": | 456 | case "分拨业务": |
388 | - if (weightCheckHandleService.checkAllocateOrDispatch(growssWt, selfWt, goodsWt,inWt)){ | 457 | + if (gatherInfoHandle.weightCheckHandleService.checkAllocateOrDispatch(growssWt, selfWt, goodsWt,inWt)){ |
389 | //todo:检查分拨申请 | 458 | //todo:检查分拨申请 |
390 | boolean allocatCheck = checkNmmsAllocate(landBusinessTypeList.getMasterList()); | 459 | boolean allocatCheck = checkNmmsAllocate(landBusinessTypeList.getMasterList()); |
391 | if(!allocatCheck){ | 460 | if(!allocatCheck){ |
@@ -401,9 +470,9 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -401,9 +470,9 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
401 | return false; | 470 | return false; |
402 | } | 471 | } |
403 | case "调拨业务": | 472 | case "调拨业务": |
404 | - if (weightCheckHandleService.checkAllocateOrDispatch(growssWt, selfWt, goodsWt,inWt)){ | 473 | + if (gatherInfoHandle.weightCheckHandleService.checkAllocateOrDispatch(growssWt, selfWt, goodsWt,inWt)){ |
405 | //检查运单放行 | 474 | //检查运单放行 |
406 | - if (resMessageService.checkManifestRelease(info,listinfos)){ | 475 | + if (gatherInfoHandle.resMessageService.checkManifestRelease(info,listinfos)){ |
407 | return true; | 476 | return true; |
408 | }else { | 477 | }else { |
409 | //有运单未放行 | 478 | //有运单未放行 |
@@ -451,30 +520,39 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -451,30 +520,39 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
451 | landBusinessTypeList.setId(UUID.randomUUID().toString()); | 520 | landBusinessTypeList.setId(UUID.randomUUID().toString()); |
452 | landBusinessTypeList.setIsvalid("1"); | 521 | landBusinessTypeList.setIsvalid("1"); |
453 | //todo:这里SEQN也要入库 | 522 | //todo:这里SEQN也要入库 |
454 | - listService.saveList(landBusinessTypeList); | 523 | + gatherInfoHandle.listService.saveList(landBusinessTypeList); |
455 | } | 524 | } |
456 | 525 | ||
457 | /** | 526 | /** |
458 | - * 流转申请是否核销判定 | 527 | + * 流转申请是否进行核销判定 |
459 | */ | 528 | */ |
460 | private void releaseFormCheck(){ | 529 | private void releaseFormCheck(){ |
530 | + List<LandBusinessTypeList> temp = landBusinessTypeListList; | ||
461 | //二维码已出区的记录 | 531 | //二维码已出区的记录 |
462 | - List<LandBusinessTypeList> havenCrossList = listService.selectByBarcodeWithE(info.getBarcode()); | ||
463 | - //申请核销判定 | 532 | + List<LandBusinessTypeList> havenCrossList = gatherInfoHandle.listService.selectByBarcodeWithE(info.getBarcode()); |
533 | + | ||
534 | + if (landBusinessTypeListList.isEmpty() && havenCrossList.isEmpty()){ | ||
535 | + return; | ||
536 | + } | ||
537 | + | ||
538 | + //申请核销判定,已出区的记录与流转申请数据核碰.如果流转申请列表核碰完,还剩下的需要出区的场站则不核销. | ||
464 | for (LandBusinessTypeList businessTypeList : havenCrossList) { | 539 | for (LandBusinessTypeList businessTypeList : havenCrossList) { |
465 | List<LandBusinessTypeList> r = landBusinessTypeListList.stream().filter(item ->{ | 540 | List<LandBusinessTypeList> r = landBusinessTypeListList.stream().filter(item ->{ |
541 | + //判断还有没有没有出区的场站,还有没有出区的场站就不核销 | ||
466 | if(item.getEndstation().equals(businessTypeList.getEndstation())) { | 542 | if(item.getEndstation().equals(businessTypeList.getEndstation())) { |
467 | - landBusinessTypeListList.remove(item); | ||
468 | return true; | 543 | return true; |
469 | }else { | 544 | }else { |
470 | return false; | 545 | return false; |
471 | } | 546 | } |
472 | }) | 547 | }) |
473 | .collect(Collectors.toList()); | 548 | .collect(Collectors.toList()); |
549 | + temp.removeAll(r); | ||
474 | } | 550 | } |
475 | 551 | ||
476 | - if (landBusinessTypeListList.isEmpty()){ | 552 | + if (temp.isEmpty()){ |
553 | + | ||
477 | //todo:流转申请状态核销 | 554 | //todo:流转申请状态核销 |
555 | + logger.info("[进出场申请]-流转申请已核销:"+vaName); | ||
478 | //二维码核销 | 556 | //二维码核销 |
479 | releaseBarCode(); | 557 | releaseBarCode(); |
480 | } | 558 | } |
@@ -486,12 +564,15 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -486,12 +564,15 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
486 | */ | 564 | */ |
487 | private void releaseBarCode(){ | 565 | private void releaseBarCode(){ |
488 | //二维码判定 | 566 | //二维码判定 |
489 | - int count=listService.selectlaststation(info.getVename(),info.getBarcode()); | 567 | + int count=gatherInfoHandle.listService.selectlaststation(info.getVename(),info.getBarcode()); |
490 | //二维码失效通知,已进入场站的与缓存比较. | 568 | //二维码失效通知,已进入场站的与缓存比较. |
491 | if(count==0){ | 569 | if(count==0){ |
492 | //todo:测试注释掉,二维码释放 | 570 | //todo:测试注释掉,二维码释放 |
493 | logger.info("[进出场申请]-二维码释放:"+vaName); | 571 | logger.info("[进出场申请]-二维码释放:"+vaName); |
494 | - buildBarCode.cancleBarCode(vaName); | 572 | + if (!gatherInfoHandle.debug){ |
573 | + buildBarCode.cancleBarCode(vaName); | ||
574 | + } | ||
575 | + gatherInfoHandle.redisService.del(info.getVename()); | ||
495 | } | 576 | } |
496 | } | 577 | } |
497 | 578 | ||
@@ -501,20 +582,30 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -501,20 +582,30 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
501 | 582 | ||
502 | /** | 583 | /** |
503 | * 发送X22指令 | 584 | * 发送X22指令 |
504 | - * @param info | ||
505 | - * @param check | ||
506 | - * @param reason | ||
507 | - * @param land | ||
508 | - * @param list_infos | ||
509 | - * @return | ||
510 | - */ | ||
511 | - public boolean sendBw(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) { | 585 | + * @param info 过卡信息 |
586 | + * @param check true 抬杆,false 不抬杆 | ||
587 | + * @param reason 原因 | ||
588 | + * @param land 流转申请表头信息 | ||
589 | + * @param list_infos 流转申请表体信息 | ||
590 | + * @return 调试模式 直接返回true,生产模式按业务走 | ||
591 | + */ | ||
592 | + private boolean sendBw(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) { | ||
593 | + //调试模式 直接返回true | ||
594 | + if (gatherInfoHandle.debug){ | ||
595 | + if (check) { | ||
596 | + record(); | ||
597 | + } | ||
598 | + commandlog(info,check,reason,land,list_infos); | ||
599 | + return check; | ||
600 | + } | ||
601 | + | ||
512 | logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); | 602 | logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); |
513 | boolean flag = false; | 603 | boolean flag = false; |
514 | if (check) { | 604 | if (check) { |
515 | CommandClient.Client(info, PERMITTHOUGH); | 605 | CommandClient.Client(info, PERMITTHOUGH); |
516 | logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<=============="); | 606 | logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<=============="); |
517 | flag = true; | 607 | flag = true; |
608 | + record(); | ||
518 | } else { | 609 | } else { |
519 | CommandClient.Client(info, reason); | 610 | CommandClient.Client(info, reason); |
520 | logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<=============="); | 611 | logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<=============="); |
@@ -524,6 +615,13 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -524,6 +615,13 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
524 | } | 615 | } |
525 | 616 | ||
526 | /** | 617 | /** |
618 | + * 直接放行 | ||
619 | + */ | ||
620 | + private void pass(){ | ||
621 | + sendBw(info,true,PERMITTHOUGH,landBusinessTypeList,listinfos); | ||
622 | + } | ||
623 | + | ||
624 | + /** | ||
527 | * 放行日志记录 | 625 | * 放行日志记录 |
528 | * @param info | 626 | * @param info |
529 | * @param check | 627 | * @param check |
@@ -531,7 +629,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -531,7 +629,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
531 | * @param land | 629 | * @param land |
532 | * @param list_infos | 630 | * @param list_infos |
533 | */ | 631 | */ |
534 | - public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){ | 632 | + private void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){ |
535 | String flag="",type=""; | 633 | String flag="",type=""; |
536 | commandLog command=new commandLog(); | 634 | commandLog command=new commandLog(); |
537 | command.setId(UUID.randomUUID().toString()); | 635 | command.setId(UUID.randomUUID().toString()); |
@@ -562,10 +660,10 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -562,10 +660,10 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
562 | command.setInGrossWeight(inWt); | 660 | command.setInGrossWeight(inWt); |
563 | command.setGoodsWeight(goodsWt); | 661 | command.setGoodsWeight(goodsWt); |
564 | command.setActualGoodsWeight(diffVal); | 662 | command.setActualGoodsWeight(diffVal); |
565 | - if(list_infos.size()>0){ | 663 | + if(list_infos !=null && list_infos.size()>0){ |
566 | command.setMasterList(Arrays.toString(toStrArry(list_infos))); | 664 | command.setMasterList(Arrays.toString(toStrArry(list_infos))); |
567 | } | 665 | } |
568 | - commandLogService.insert(command); | 666 | + gatherInfoHandle.commandLogService.insert(command); |
569 | } | 667 | } |
570 | 668 | ||
571 | /** | 669 | /** |
@@ -576,7 +674,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | @@ -576,7 +674,7 @@ public class GatherInfoHandleImpl implements GatherInfoService { | ||
576 | private Map nmmsAllocate(@NotNull String waybill){ | 674 | private Map nmmsAllocate(@NotNull String waybill){ |
577 | logger.info("新舱单查询分拨申请数据开始"); | 675 | logger.info("新舱单查询分拨申请数据开始"); |
578 | Feign_Allocate_Search feignAllocateSearch = new Feign_Allocate_Search(waybill,0,10); | 676 | Feign_Allocate_Search feignAllocateSearch = new Feign_Allocate_Search(waybill,0,10); |
579 | - Map map = nmmsService.getAllocate(feignAllocateSearch); | 677 | + Map map = gatherInfoHandle.nmmsService.getAllocate(feignAllocateSearch); |
580 | logger.info(""+map); | 678 | logger.info(""+map); |
581 | return map; | 679 | return map; |
582 | } | 680 | } |
@@ -6,7 +6,7 @@ import com.sy.service.GatherInfoService; | @@ -6,7 +6,7 @@ import com.sy.service.GatherInfoService; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
7 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
8 | 8 | ||
9 | -@Service | 9 | +@Service("GatherInfoService") |
10 | public class GatherInfoServiceImpl implements GatherInfoService { | 10 | public class GatherInfoServiceImpl implements GatherInfoService { |
11 | 11 | ||
12 | @Autowired | 12 | @Autowired |
1 | package com.sy.service.impl; | 1 | package com.sy.service.impl; |
2 | 2 | ||
3 | 3 | ||
4 | +import com.alibaba.fastjson.JSONArray; | ||
4 | import com.sy.mapper.LandBusinessTypeListMapper; | 5 | import com.sy.mapper.LandBusinessTypeListMapper; |
6 | +import com.sy.model.GatherInfo; | ||
5 | import com.sy.model.LandBusinessTypeList; | 7 | import com.sy.model.LandBusinessTypeList; |
6 | import com.sy.service.LandBusListService; | 8 | import com.sy.service.LandBusListService; |
9 | +import com.sy.service.RedisService; | ||
10 | +import org.apache.commons.lang.StringUtils; | ||
11 | +import org.slf4j.Logger; | ||
12 | +import org.slf4j.LoggerFactory; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
9 | 15 | ||
16 | +import java.util.ArrayList; | ||
10 | import java.util.List; | 17 | import java.util.List; |
11 | 18 | ||
12 | @Service | 19 | @Service |
13 | public class LandBusListServiceImpl implements LandBusListService { | 20 | public class LandBusListServiceImpl implements LandBusListService { |
14 | 21 | ||
22 | + private static final Logger logger = LoggerFactory.getLogger(LandBusListServiceImpl.class); | ||
23 | + | ||
15 | @Autowired | 24 | @Autowired |
16 | private LandBusinessTypeListMapper listMapper; | 25 | private LandBusinessTypeListMapper listMapper; |
17 | 26 | ||
27 | + @Autowired | ||
28 | + private RedisService redisService; | ||
29 | + | ||
18 | @Override | 30 | @Override |
19 | public List<LandBusinessTypeList> selectByFrameNoAndType(String frameNo, String flag) { | 31 | public List<LandBusinessTypeList> selectByFrameNoAndType(String frameNo, String flag) { |
20 | List<LandBusinessTypeList> lists = null; | 32 | List<LandBusinessTypeList> lists = null; |
@@ -101,4 +113,43 @@ public class LandBusListServiceImpl implements LandBusListService { | @@ -101,4 +113,43 @@ public class LandBusListServiceImpl implements LandBusListService { | ||
101 | public int selectlaststation(String frameNo, String barcode) { | 113 | public int selectlaststation(String frameNo, String barcode) { |
102 | return listMapper.selectlaststation(frameNo,barcode); | 114 | return listMapper.selectlaststation(frameNo,barcode); |
103 | } | 115 | } |
116 | + | ||
117 | + /** | ||
118 | + * 根据gatherInfo获取对应的流转申请 | ||
119 | + * @return 流转申请信息 | ||
120 | + */ | ||
121 | + @Override | ||
122 | + public LandBusinessTypeList getLandBusinessTypeListByGather(GatherInfo gatherInfo){ | ||
123 | + try { | ||
124 | + //通过车牌号,二维码,场站,通道号,进出类型查询进出场站申请列表 | ||
125 | + String landBusinessJson = redisService.get(gatherInfo.getVename()); | ||
126 | + List<LandBusinessTypeList> list = new ArrayList<>(); | ||
127 | + if (StringUtils.isNotEmpty(landBusinessJson)){ | ||
128 | + list = JSONArray.parseArray(landBusinessJson,LandBusinessTypeList.class); | ||
129 | + //4. 若查询结果为null,返回无相对应进出场申请 | ||
130 | + if (list == null || list.isEmpty()) { | ||
131 | + logger.error(gatherInfo.getVename()+"无相对应进出场申请"); | ||
132 | + return null; | ||
133 | + } | ||
134 | + | ||
135 | + for (LandBusinessTypeList item : list) { | ||
136 | + | ||
137 | + if (item.getAisle().equals(gatherInfo.getChnlno()) && item.getBarcode().equals(gatherInfo.getBarcode())){ | ||
138 | + | ||
139 | + logger.info("车辆-{}的申请缓存信息核碰成功,通道:{}",gatherInfo.getVename(),gatherInfo.getChnlno()); | ||
140 | + return item; | ||
141 | + } | ||
142 | + } | ||
143 | + }else { | ||
144 | + logger.error("未找到车辆-{}的申请缓存信息",gatherInfo.getVename()); | ||
145 | + logger.info("未找到车辆-{}的申请缓存信息,或者流转已超期失效",gatherInfo.getVename()); | ||
146 | + return null; | ||
147 | + } | ||
148 | + }catch (Exception e){ | ||
149 | + e.printStackTrace(); | ||
150 | + return null; | ||
151 | + } | ||
152 | + | ||
153 | + return null; | ||
154 | + } | ||
104 | } | 155 | } |
@@ -4,6 +4,7 @@ import com.sy.mapper.RESMESSAGEMapper; | @@ -4,6 +4,7 @@ import com.sy.mapper.RESMESSAGEMapper; | ||
4 | import com.sy.model.GatherInfo; | 4 | import com.sy.model.GatherInfo; |
5 | import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO; | 5 | import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO; |
6 | import com.sy.model.RESMESSAGE; | 6 | import com.sy.model.RESMESSAGE; |
7 | +import com.sy.service.CommandLogService; | ||
7 | import com.sy.service.ResMessageService; | 8 | import com.sy.service.ResMessageService; |
8 | import com.sy.socket.CommandClient; | 9 | import com.sy.socket.CommandClient; |
9 | import org.apache.log4j.Logger; | 10 | import org.apache.log4j.Logger; |
@@ -14,6 +15,7 @@ import java.util.ArrayList; | @@ -14,6 +15,7 @@ import java.util.ArrayList; | ||
14 | import java.util.Arrays; | 15 | import java.util.Arrays; |
15 | import java.util.List; | 16 | import java.util.List; |
16 | import java.util.Vector; | 17 | import java.util.Vector; |
18 | +import java.util.stream.Collectors; | ||
17 | 19 | ||
18 | /** | 20 | /** |
19 | * @author | 21 | * @author |
@@ -27,6 +29,9 @@ public class ResMessageServiceImpl implements ResMessageService { | @@ -27,6 +29,9 @@ public class ResMessageServiceImpl implements ResMessageService { | ||
27 | @Autowired | 29 | @Autowired |
28 | private RESMESSAGEMapper mapper; | 30 | private RESMESSAGEMapper mapper; |
29 | 31 | ||
32 | + @Autowired | ||
33 | + CommandLogService commandLogService; | ||
34 | + | ||
30 | 35 | ||
31 | @Override | 36 | @Override |
32 | public int saveEnter(RESMESSAGE resmessage){ | 37 | public int saveEnter(RESMESSAGE resmessage){ |
@@ -51,30 +56,49 @@ public class ResMessageServiceImpl implements ResMessageService { | @@ -51,30 +56,49 @@ public class ResMessageServiceImpl implements ResMessageService { | ||
51 | return false; | 56 | return false; |
52 | } | 57 | } |
53 | 58 | ||
59 | + //只拉板箱的话,这里list_infos会为null | ||
60 | + list_infos = list_infos.stream().filter(listInfo ->{ | ||
61 | + if("B".equals(listInfo.getExt4())){ | ||
62 | + return true; | ||
63 | + }else { | ||
64 | + return false; | ||
65 | + } | ||
66 | + }).collect(Collectors.toList()); | ||
67 | + | ||
54 | logger.info("运单列表:" + toStrArry(list_infos)); | 68 | logger.info("运单列表:" + toStrArry(list_infos)); |
55 | boolean flag = false; | 69 | boolean flag = false; |
56 | 70 | ||
57 | - List<RESMESSAGE> list = selectByManifestList(toStrArry(list_infos)); | 71 | + /** |
72 | + * 这里如果list_infos为NULL,会报错NULL Exception.什么指令都不给了. | ||
73 | + * 如果申请单据只有ULD板箱类型的时候. | ||
74 | + */ | ||
75 | + if (!list_infos.isEmpty()){ | ||
76 | + List<RESMESSAGE> list = selectByManifestList(toStrArry(list_infos)); | ||
58 | 77 | ||
59 | - if (list.size() == toStrArry(list_infos).length) { | ||
60 | - flag = true; | ||
61 | - }else{ | ||
62 | - //返回未放行的运单列表 | ||
63 | - if (toStrArry(list_infos).length>0){ | ||
64 | - for (String awb : toStrArry(list_infos)) { | ||
65 | - boolean anyMatch = list.stream().anyMatch(resmessage -> { | ||
66 | - return resmessage.getManifest().equals(awb); | ||
67 | - }); | ||
68 | - if (!anyMatch){ | ||
69 | - noRelease.add(awb); | 78 | + if (list.size() == toStrArry(list_infos).length) { |
79 | + flag = true; | ||
80 | + }else{ | ||
81 | + //返回未放行的运单列表 | ||
82 | + if (toStrArry(list_infos).length>0){ | ||
83 | + for (String awb : toStrArry(list_infos)) { | ||
84 | + boolean anyMatch = list.stream().anyMatch(resmessage -> { | ||
85 | + return resmessage.getManifest().equals(awb); | ||
86 | + }); | ||
87 | + if (!anyMatch){ | ||
88 | + noRelease.add(awb); | ||
89 | + } | ||
90 | + } | ||
91 | + if (!noRelease.isEmpty()) { | ||
92 | + logger.info(Arrays.toString(noRelease.toArray())+FANGXING); | ||
93 | + commandLogService.commandlog(info,false,Arrays.toString(noRelease.toArray())+FANGXING,null,list_infos, | ||
94 | + new Double("0.0"),new Double("0.0"),new Double("0.0"),new Double("0.0")); | ||
95 | + CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING); | ||
70 | } | 96 | } |
71 | - } | ||
72 | - if (!noRelease.isEmpty()) { | ||
73 | - logger.info(Arrays.toString(noRelease.toArray())+FANGXING); | ||
74 | - CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING); | ||
75 | } | 97 | } |
76 | } | 98 | } |
77 | } | 99 | } |
100 | + | ||
101 | + | ||
78 | return flag; | 102 | return flag; |
79 | } | 103 | } |
80 | public static String[] toStrArry(List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){ | 104 | public static String[] toStrArry(List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){ |
@@ -164,17 +164,24 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -164,17 +164,24 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
164 | 164 | ||
165 | //卸货离场判定 | 165 | //卸货离场判定 |
166 | double result3= 0.00; | 166 | double result3= 0.00; |
167 | + double result4= 0.00; | ||
167 | 168 | ||
168 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ | 169 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ |
170 | + //带货出,入场重量+带货重量 = 离场重量 | ||
169 | result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); | 171 | result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); |
172 | + //带货出,用车辆备案重量对碰,车辆备案重量+带货重量 = 离场重量 | ||
173 | + result4 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt)); | ||
174 | + //空车出,过磅重量 = 车辆备案重量 | ||
170 | result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | 175 | result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); |
176 | + //卸货出,入场重量-卸货重量 = 离场重量 | ||
171 | result3 = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | 177 | result3 = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); |
172 | System.out.println("进场提货离场差值:"+result); | 178 | System.out.println("进场提货离场差值:"+result); |
173 | System.out.println("空车离场差值:"+result2); | 179 | System.out.println("空车离场差值:"+result2); |
174 | System.out.println("进场卸货离场差值:"+result3); | 180 | System.out.println("进场卸货离场差值:"+result3); |
181 | + System.out.println("备案重量进场装载货物离场差值:"+result4); | ||
175 | } | 182 | } |
176 | double range = valueDob(); | 183 | double range = valueDob(); |
177 | - if (result <= range || result2 <= range || result3 <= range ) { | 184 | + if (result <= range || result2 <= range || result3 <= range || result4 <= range) { |
178 | flag = true; | 185 | flag = true; |
179 | } | 186 | } |
180 | return flag; | 187 | return flag; |
1 | +package com.sy.service.router; | ||
2 | + | ||
3 | +import com.sy.bwAssist.Message; | ||
4 | + | ||
5 | +/** | ||
6 | + * 卡口业务报文处理路由 | ||
7 | + * 处理接收的卡口报文X22与X21, | ||
8 | + * 并根据路由表,决定X21报文是否发送给金二,由金二验放处理,并本地记录.还是不发金二本地验放处理 | ||
9 | + * 集中核销流转申请. | ||
10 | + * @author mrz | ||
11 | + */ | ||
12 | +public interface MessageRouter { | ||
13 | + /** | ||
14 | + * CARM报文实体路由处理 | ||
15 | + */ | ||
16 | + void route(Message message); | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | +} |
1 | +package com.sy.service.router; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.sy.bwAnalysis.GatherInfoAnalysis; | ||
5 | +import com.sy.bwAssist.Message; | ||
6 | +import com.sy.mapper.LandRouterConfigDao; | ||
7 | +import com.sy.model.GatherInfo; | ||
8 | +import com.sy.model.LandBusinessTypeList; | ||
9 | +import com.sy.model.LandRouterConfig; | ||
10 | +import com.sy.service.CommandLogService; | ||
11 | +import com.sy.service.LandBusListService; | ||
12 | +import com.sy.service.RedisService; | ||
13 | +import com.sy.service.impl.GatherInfoHandle; | ||
14 | +import com.sy.socket.CommandClient; | ||
15 | +import org.apache.commons.lang.StringUtils; | ||
16 | +import org.slf4j.Logger; | ||
17 | +import org.slf4j.LoggerFactory; | ||
18 | +import org.springframework.beans.factory.annotation.Autowired; | ||
19 | +import org.springframework.beans.factory.annotation.Value; | ||
20 | +import org.springframework.stereotype.Service; | ||
21 | + | ||
22 | +import javax.annotation.Resource; | ||
23 | +import java.util.List; | ||
24 | + | ||
25 | +@Service("X21") | ||
26 | +public class MessageRouterX21 implements MessageRouter { | ||
27 | + private static final Logger logger = LoggerFactory.getLogger(MessageRouterX21.class); | ||
28 | + /** | ||
29 | + * 金二与本地认证兼容性开关 | ||
30 | + * Y 是金二业务必须走金二 | ||
31 | + * N 车辆扫二维码或本地和金二都可进出区验放 | ||
32 | + */ | ||
33 | + @Value("${g2.switch}") | ||
34 | + private boolean g2Switch; | ||
35 | + | ||
36 | + @Resource | ||
37 | + private LandRouterConfigDao landRouterConfigDao; | ||
38 | + | ||
39 | + @Autowired | ||
40 | + private LandBusListService landBusListService; | ||
41 | + | ||
42 | + @Autowired | ||
43 | + private RedisService redisService; | ||
44 | + | ||
45 | + @Autowired | ||
46 | + private CommandLogService commandLogService; | ||
47 | + | ||
48 | + @Override | ||
49 | + public void route(Message message) { | ||
50 | + logger.info("处理X21:gatherInfo"); | ||
51 | + GatherInfoAnalysis gatherInfoAnalysis = new GatherInfoAnalysis(); | ||
52 | + GatherInfo info = gatherInfoAnalysis.toJavaBean(message); | ||
53 | + | ||
54 | + if (g2Switch){ | ||
55 | + //金二判断,业务类型,通道,路由目的地 | ||
56 | + routerCheckG2(info); | ||
57 | + }else { | ||
58 | + X21Local(info); | ||
59 | + } | ||
60 | + | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * 判断X21报文是否给金二 | ||
65 | + * @param info 过卡信息 | ||
66 | + * | ||
67 | + * @return true 给金二 false 不给金二 | ||
68 | + */ | ||
69 | + private void routerCheckG2(GatherInfo info){ | ||
70 | + /** | ||
71 | + * 通过业务类型进行核对 | ||
72 | + * 1. 获取进出场申请信息,主要获取业务类型 | ||
73 | + */ | ||
74 | + LandBusinessTypeList landBusinessTypeList = landBusListService.getLandBusinessTypeListByGather(info); | ||
75 | + if (landBusinessTypeList!=null){ | ||
76 | + rightChnelCheck(landBusinessTypeList.getBusinesstype(),info); | ||
77 | + }else { | ||
78 | + | ||
79 | + } | ||
80 | + | ||
81 | + | ||
82 | + /** | ||
83 | + * 通过X21的通道进行核对.暂时不用这个 | ||
84 | + */ | ||
85 | +// LandRouterConfig config = new LandRouterConfig(); | ||
86 | +// config.setChanelId(info.getChnlno()); | ||
87 | +// config.setBusinessType(landBusinessTypeList.getBusinesstype()); | ||
88 | +// config.setChanelType(info.getIetype()); | ||
89 | +// config.setGatherReceiver("G2"); | ||
90 | +// config.setStatus("Y"); | ||
91 | +// | ||
92 | +// List<LandRouterConfig> routerConfigs = landRouterConfigDao.selectByGatherInfo(config); | ||
93 | +// return !routerConfigs.isEmpty(); | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * 有金二通道配置 ,但是车辆没走金二通道进行验放,用这个方法验证 | ||
98 | + * G2_SWITCH 开关为Y的时候.进行此校验. | ||
99 | + * G2_SWITCH 开关为N时此校验永远返回true | ||
100 | + * 金二业务的正确性校验 | ||
101 | + * 比如进口提货业务,走金二的应该是出一通道验放金二.但是车辆从出二扫二维码出区了,也是不允许的. | ||
102 | + * 要返回走错通道G2. | ||
103 | + * 逻辑:查询路由表 流转业务类型 目的核放处理方是G2 反向查找得到 通道列表,车辆没走此列表中的通道 视为走错通道. | ||
104 | + * @param businessType 业务类型 | ||
105 | + * @param info 过卡信息 | ||
106 | + * @return true 走对通道 false 走错通道 | ||
107 | + */ | ||
108 | + private void rightChnelCheck(String businessType,GatherInfo info){ | ||
109 | + | ||
110 | + List<LandRouterConfig> routerConfigs = landRouterConfigDao.selectByBussType(businessType); | ||
111 | + //有金二与业务类型绑定 | ||
112 | + if (!routerConfigs.isEmpty()){ | ||
113 | + | ||
114 | + //是否走对通道的判定 | ||
115 | + for (LandRouterConfig routerConfig : routerConfigs) { | ||
116 | + | ||
117 | + if (routerConfig.getChanelId().equals(info.getChnlno())){ | ||
118 | + /** | ||
119 | + * 查找到金二与通道的验放配置 | ||
120 | + */ | ||
121 | + | ||
122 | + //缓存X21,用来接收海关的x82指令核对.收到X22指令后进行核销此缓存.走金二验放的才缓存 | ||
123 | + cacheWithSeqno(info); | ||
124 | + //将X21报文发给三宝,让三宝发给金二 | ||
125 | + sendToSample(info); | ||
126 | + record(info,true,"已转金二验放-[SEQN]:"+info.getSeqno(),null); | ||
127 | + logger.info("[G2]>>为[金二业务],已将[{}]过卡信息发送与金二",info.getVename()); | ||
128 | + return; | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + /** | ||
133 | + * 没适配上 为走错通道,走错通道直接给指令,不走本地验放. | ||
134 | + * 为提高抬杆效率 | ||
135 | + */ | ||
136 | + //todo:走错通道的回执指令处理 | ||
137 | + record(info,false,"走错通道-[SEQN]:"+info.getSeqno(),null); | ||
138 | + logger.info("走错通道"); | ||
139 | + | ||
140 | + }else { | ||
141 | + //没有金二配置,走本地 | ||
142 | + X21Local(info); | ||
143 | + } | ||
144 | + | ||
145 | + | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * 如果是金二将报文发送给三宝接口 | ||
150 | + */ | ||
151 | + private void sendToSample(GatherInfo info){ | ||
152 | + CommandClient.gatherInfoBuildAndSend(info); | ||
153 | + } | ||
154 | + | ||
155 | + /** | ||
156 | + * 缓存X21信息,如果走金二,KEY 为SEQN_NO | ||
157 | + */ | ||
158 | + private void cacheWithSeqno(GatherInfo info){ | ||
159 | + if (info!=null && StringUtils.isNotEmpty(info.getSeqno())) { | ||
160 | + redisService.set(info.getSeqno(), JSON.toJSONString(info),60*60*24); | ||
161 | + } | ||
162 | + } | ||
163 | + | ||
164 | + /** | ||
165 | + * 本地处理 | ||
166 | + */ | ||
167 | + private void X21Local(GatherInfo info){ | ||
168 | + GatherInfoHandle gatherInfoHandle = new GatherInfoHandle(); | ||
169 | + gatherInfoHandle.handel(info); | ||
170 | + } | ||
171 | + | ||
172 | + /** | ||
173 | + * 车辆过卡指令日志记录 | ||
174 | + */ | ||
175 | + private void record(GatherInfo info,boolean result,String reason,LandBusinessTypeList landBusinessTypeList){ | ||
176 | + commandLogService.commandlog(info,result,reason,landBusinessTypeList,null,0.0,0.0,0.0,0.0); | ||
177 | + } | ||
178 | +} |
1 | +package com.sy.service.router; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.sy.bwAnalysis.CommandInfoAnalysis; | ||
5 | +import com.sy.bwAssist.Message; | ||
6 | +import com.sy.mapper.LandRouterConfigDao; | ||
7 | +import com.sy.model.GatherInfo; | ||
8 | +import com.sy.model.LandBusinessTypeList; | ||
9 | +import com.sy.model.LandRouterConfig; | ||
10 | +import com.sy.model.CommandInfoX22; | ||
11 | +import com.sy.service.CommandLogService; | ||
12 | +import com.sy.service.LandBusListService; | ||
13 | +import com.sy.service.RedisService; | ||
14 | +import com.sy.service.impl.GatherInfoHandle; | ||
15 | +import com.sy.socket.CommandClient; | ||
16 | +import org.apache.commons.lang.StringUtils; | ||
17 | +import org.slf4j.Logger; | ||
18 | +import org.slf4j.LoggerFactory; | ||
19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
20 | +import org.springframework.beans.factory.annotation.Value; | ||
21 | +import org.springframework.stereotype.Service; | ||
22 | + | ||
23 | +import javax.annotation.Resource; | ||
24 | +import java.util.List; | ||
25 | + | ||
26 | +@Service("X22") | ||
27 | +public class MessageRouterX22 implements MessageRouter { | ||
28 | + private static final Logger logger = LoggerFactory.getLogger(MessageRouterX22.class); | ||
29 | + | ||
30 | + @Value("${g2.switch}") | ||
31 | + private boolean g2Switch; | ||
32 | + | ||
33 | + @Autowired | ||
34 | + private RedisService redisService; | ||
35 | + | ||
36 | + @Autowired | ||
37 | + private CommandLogService commandLogService; | ||
38 | + | ||
39 | + | ||
40 | + /** | ||
41 | + * 放行的code标识 | ||
42 | + */ | ||
43 | + private static String CODE_RELEASE = "00000000200000000000"; | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + /** | ||
48 | + * 金二抬杆指令处理 | ||
49 | + * 1. 金二通道正常可以接收抬杆指令时,与本地联合验放 | ||
50 | + * 2. ERROR 或者 金二 TIME_OUT,金二通道异常 接收不到放行指令,使用金二开关,进行本地验放. | ||
51 | + * @param message | ||
52 | + */ | ||
53 | + @Override | ||
54 | + public void route(Message message) { | ||
55 | + try { | ||
56 | + logger.info("处理X22:CommandInfo"); | ||
57 | + CommandInfoAnalysis commandInfoAnalysis = new CommandInfoAnalysis(); | ||
58 | + CommandInfoX22 commandInfoX22 = commandInfoAnalysis.toJavaBean(message); | ||
59 | + | ||
60 | + if (commandInfoX22!=null){ | ||
61 | + /** | ||
62 | + * 根据SEQNO 读取缓存 确定是否金二指令 | ||
63 | + */ | ||
64 | + GatherInfo gatherInfo = readCacheWithSeqno(commandInfoX22); | ||
65 | + //是金二指令 | ||
66 | + if (gatherInfo!=null){ | ||
67 | + /** | ||
68 | + * 1. 判断指令是否放行 | ||
69 | + */ | ||
70 | + if (commandInfoX22.getCheckResult().equals(CODE_RELEASE)) { | ||
71 | + /** | ||
72 | + * todo:第一种.收到G2指令直接放行.并记录过卡与流转申请的核销 | ||
73 | + */ | ||
74 | + | ||
75 | + | ||
76 | + /** | ||
77 | + * 第二种,结合本地指令进行放行. | ||
78 | + */ | ||
79 | + GatherInfoHandle gatherInfoHandle = new GatherInfoHandle(); | ||
80 | + gatherInfoHandle.handel(gatherInfo); | ||
81 | + | ||
82 | + }else { | ||
83 | + /** | ||
84 | + * 是金二指令,但是是未放行指令 | ||
85 | + * 记录未放行原因. | ||
86 | + * 通知卡口 | ||
87 | + */ | ||
88 | + CommandClient.Client(gatherInfo,commandInfoX22.getOpHint()); | ||
89 | + record(gatherInfo,false,gatherInfo.getSeqno()+"金二验放失败:"+commandInfoX22.getOpHint(),null); | ||
90 | + | ||
91 | + | ||
92 | + } | ||
93 | + } | ||
94 | + } | ||
95 | + }catch (Exception e){ | ||
96 | + logger.error("[X22-ERROR]:",e); | ||
97 | + } | ||
98 | + } | ||
99 | + | ||
100 | + | ||
101 | + /** | ||
102 | + * 读取X21信息,如果走金二,KEY 为SEQN_NO | ||
103 | + * @param info X22实体 | ||
104 | + * @return X21实体. | ||
105 | + */ | ||
106 | + private GatherInfo readCacheWithSeqno(CommandInfoX22 info){ | ||
107 | + if (info!=null && StringUtils.isNotEmpty(info.getSeqNo())) { | ||
108 | + String X21_GatherInfo = redisService.get(info.getSeqNo()); | ||
109 | + if (StringUtils.isNotEmpty(X21_GatherInfo)){ | ||
110 | + GatherInfo gatherInfo = JSON.parseObject(X21_GatherInfo, GatherInfo.class); | ||
111 | + return gatherInfo; | ||
112 | + } | ||
113 | + } | ||
114 | + return null; | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 车辆过卡指令日志记录 | ||
119 | + */ | ||
120 | + private void record(GatherInfo info,boolean result,String reason,LandBusinessTypeList landBusinessTypeList){ | ||
121 | + commandLogService.commandlog(info,result,reason,landBusinessTypeList,null,0.0,0.0,0.0,0.0); | ||
122 | + } | ||
123 | + | ||
124 | +} |
1 | +package com.sy.service.router; | ||
2 | + | ||
3 | +import com.sy.bwAssist.Message; | ||
4 | + | ||
5 | +public class RouterContext { | ||
6 | + | ||
7 | + private MessageRouter messageRouter; | ||
8 | + | ||
9 | + public RouterContext(MessageRouter messageRouter){ | ||
10 | + this.messageRouter = messageRouter; | ||
11 | + } | ||
12 | + | ||
13 | + public void executeStrategy(Message message){ | ||
14 | + messageRouter.route(message); | ||
15 | + } | ||
16 | +} |
1 | package com.sy.socket; | 1 | package com.sy.socket; |
2 | 2 | ||
3 | +import com.sy.model.CommandInfoX22; | ||
3 | import com.sy.model.GatherInfo; | 4 | import com.sy.model.GatherInfo; |
4 | import org.apache.log4j.Logger; | 5 | import org.apache.log4j.Logger; |
5 | import org.springframework.stereotype.Component; | 6 | import org.springframework.stereotype.Component; |
@@ -14,12 +15,69 @@ public class CommandClient { | @@ -14,12 +15,69 @@ public class CommandClient { | ||
14 | 15 | ||
15 | private static final Logger logger = Logger.getLogger(CommandClient.class); | 16 | private static final Logger logger = Logger.getLogger(CommandClient.class); |
16 | 17 | ||
18 | + private static final String GATHER_TEMPLATE = "<GATHER_INFO AREA_ID=\"${AREA_ID}\" CHNL_NO=\"${CHNL_NO}\" I_E_TYPE=\"${I_E_TYPE}\" SEQ_NO=\"${SEQ_NO}\">\n" + | ||
19 | + "\t<IC>\n" + | ||
20 | + "\t\t<DR_IC_NO/>\n" + | ||
21 | + "\t\t<IC_DR_CUSTOMS_NO/>\n" + | ||
22 | + "\t\t<IC_CO_CUSTOMS_NO/>\n" + | ||
23 | + "\t\t<IC_BILL_NO/>\n" + | ||
24 | + "\t\t<IC_FORM_TYPE/>\n" + | ||
25 | + "\t\t<IC_GROSS_WT/>\n" + | ||
26 | + "\t\t<IC_VE_CUSTOMS_NO/>\n" + | ||
27 | + "\t\t<IC_VE_NAME/>\n" + | ||
28 | + "\t\t<IC_CONTA_ID/>\n" + | ||
29 | + "\t\t<IC_ESEAL_ID/>\n" + | ||
30 | + "\t\t<IC_REG_DATETIME/>\n" + | ||
31 | + "\t\t<IC_PER_DAY_DUE/>\n" + | ||
32 | + "\t</IC>\n" + | ||
33 | + "\t<WEIGHT>\n" + | ||
34 | + "\t\t<GROSS_WT>${GROSS_WT}</GROSS_WT>\n" + | ||
35 | + "\t</WEIGHT>\n" + | ||
36 | + "\t<CAR>\n" + | ||
37 | + "\t\t<VE_NAME>${VE_NAME}</VE_NAME>\n" + | ||
38 | + "\t\t<CAR_EC_NO/>\n" + | ||
39 | + "\t\t<CAR_EC_NO2/>\n" + | ||
40 | + "\t\t<VE_CUSTOMS_NO/>\n" + | ||
41 | + "\t\t<VE_WT/>\n" + | ||
42 | + "\t</CAR>\n" + | ||
43 | + "\t<CONTA>\n" + | ||
44 | + "\t\t<CONTA_NUM/>\n" + | ||
45 | + "\t\t<CONTA_RECO>${CONTA_RECO}</CONTA_RECO>\n" + | ||
46 | + "\t\t<CONTA_ID_F/>\n" + | ||
47 | + "\t\t<CONTA_ID_B/>\n" + | ||
48 | + "\t\t<CONTA_MODEL_F/>\n" + | ||
49 | + "\t\t<CONTA_MODEL_B/>\n" + | ||
50 | + "\t</CONTA>\n" + | ||
51 | + "\t<ORDER_NUM/>\n" + | ||
52 | + "\t<BAR_CODE>${BAR_CODE}</BAR_CODE>\n" + | ||
53 | + "\t<SEAL>\n" + | ||
54 | + "\t\t<ESEAL_ID/>\n" + | ||
55 | + "\t\t<SEAL_KEY/>\n" + | ||
56 | + "\t</SEAL>\n" + | ||
57 | + "</GATHER_INFO>"; | ||
58 | + | ||
59 | + private static final String COMMAND_INFO_TEMPLATE = "<COMMAND_INFO AREA_ID=\"${AREA_ID}\" CHNL_NO=\"${CHNL_NO}\" I_E_TYPE=\"${I_E_TYPE}\" SEQ_NO=\"${SEQ_NO}\">\n" + | ||
60 | + "\t<CHECK_RESULT>${CHECK_RESULT}</CHECK_RESULT>\n" + | ||
61 | + "\t<OP_HINT>${OP_HINT}</OP_HINT>\n" + | ||
62 | + "\t<SEAL>\n" + | ||
63 | + "\t\t<ESEAL_ID/>\n" + | ||
64 | + "\t\t<SEAL_KEY>${SEAL_KEY}</SEAL_KEY>\n" + | ||
65 | + "\t\t<OPEN_TIMES/>\n" + | ||
66 | + "\t\t<ESEAL_IC_NO/>\n" + | ||
67 | + "\t</SEAL>\n" + | ||
68 | + "\t<SZ_MSG/>\n" + | ||
69 | + "</COMMAND_INFO>"; | ||
70 | + | ||
17 | /** | 71 | /** |
18 | * @Param GatherInfo 卡口采集信息 | 72 | * @Param GatherInfo 卡口采集信息 |
19 | * @Param flag 是否放行信息 | 73 | * @Param flag 是否放行信息 |
20 | * */ | 74 | * */ |
21 | public static void Client(GatherInfo info,String flag) { | 75 | public static void Client(GatherInfo info,String flag) { |
22 | String xmlBody = getXmlInfo(info,flag); | 76 | String xmlBody = getXmlInfo(info,flag); |
77 | + sendWithSocket(info,xmlBody); | ||
78 | + } | ||
79 | + | ||
80 | + private static void sendWithSocket(GatherInfo info,String xmlBody){ | ||
23 | Socket socket =null; | 81 | Socket socket =null; |
24 | OutputStream op = null; | 82 | OutputStream op = null; |
25 | try { | 83 | try { |
@@ -73,8 +131,6 @@ public class CommandClient { | @@ -73,8 +131,6 @@ public class CommandClient { | ||
73 | e.printStackTrace(); | 131 | e.printStackTrace(); |
74 | logger.info("文件发送失败"+e.getMessage()); | 132 | logger.info("文件发送失败"+e.getMessage()); |
75 | } | 133 | } |
76 | - | ||
77 | - | ||
78 | } | 134 | } |
79 | /** | 135 | /** |
80 | * @Param info 卡口采集信息 | 136 | * @Param info 卡口采集信息 |
@@ -114,6 +170,27 @@ public class CommandClient { | @@ -114,6 +170,27 @@ public class CommandClient { | ||
114 | return buffer.toString(); | 170 | return buffer.toString(); |
115 | } | 171 | } |
116 | 172 | ||
173 | + /** | ||
174 | + * 生成GATHERINFO 报文内容 | ||
175 | + * @param info 过卡信息 | ||
176 | + * @return X21报文 | ||
177 | + */ | ||
178 | + public static void gatherInfoBuildAndSend(GatherInfo info){ | ||
179 | + String gatherXML = ""; | ||
180 | + gatherXML = GATHER_TEMPLATE.replace("${AREA_ID}",info.getAreaid()) | ||
181 | + .replace("${CHNL_NO}",info.getChnlno()) | ||
182 | + .replace("${I_E_TYPE}",info.getIetype()) | ||
183 | + .replace("${SEQ_NO}",info.getSeqno()) | ||
184 | + .replace("${GROSS_WT}", info.getGrosswt().toString()) | ||
185 | + .replace("${VE_NAME}",info.getVename()) | ||
186 | + .replace("${CONTA_RECO}",info.getContareco()) | ||
187 | + //给三宝的去掉BARCODE,todo:不去掉做个测试 | ||
188 | + .replace("${BAR_CODE}",info.getBarcode()); | ||
189 | + | ||
190 | + sendWithSocket(info,gatherXML); | ||
191 | + } | ||
192 | + | ||
193 | + | ||
117 | //int转byte | 194 | //int转byte |
118 | private static byte[] intToByte4(int i) { | 195 | private static byte[] intToByte4(int i) { |
119 | byte[] targets = new byte[4]; | 196 | byte[] targets = new byte[4]; |
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.sy.mapper.LandRouterConfigDao"> | ||
4 | + <resultMap id="BaseResultMap" type="com.sy.model.LandRouterConfig"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="area_id" jdbcType="VARCHAR" property="areaId" /> | ||
7 | + <result column="area_name" jdbcType="VARCHAR" property="areaName" /> | ||
8 | + <result column="chanel_id" jdbcType="VARCHAR" property="chanelId" /> | ||
9 | + <result column="chanel_name" jdbcType="VARCHAR" property="chanelName" /> | ||
10 | + <result column="chanel_type" jdbcType="VARCHAR" property="chanelType" /> | ||
11 | + <result column="business_type" jdbcType="VARCHAR" property="businessType" /> | ||
12 | + <result column="g2_business_type" jdbcType="VARCHAR" property="g2BusinessType" /> | ||
13 | + <result column="identify_type" jdbcType="VARCHAR" property="identifyType" /> | ||
14 | + <result column="gather_receiver" jdbcType="VARCHAR" property="gatherReceiver" /> | ||
15 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
16 | + <result column="status" jdbcType="VARCHAR" property="status" /> | ||
17 | + </resultMap> | ||
18 | + <sql id="Base_Column_List"> | ||
19 | + id, area_id, area_name, chanel_id, chanel_name, chanel_type, business_type, g2_business_type, | ||
20 | + identify_type, gather_receiver, create_time, `status` | ||
21 | + </sql> | ||
22 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||
23 | + select | ||
24 | + <include refid="Base_Column_List" /> | ||
25 | + from land_router_config | ||
26 | + where id = #{id,jdbcType=INTEGER} | ||
27 | + </select> | ||
28 | + | ||
29 | + <select id="selectByGatherInfo" parameterType="com.sy.model.LandRouterConfig" resultMap="BaseResultMap"> | ||
30 | + select | ||
31 | + <include refid="Base_Column_List" /> | ||
32 | + from land_router_config | ||
33 | + where chanel_id = #{chanelId,jdbcType=VARCHAR} | ||
34 | + and `status` = #{status,jdbcType=VARCHAR} | ||
35 | + and gather_receiver = #{gatherReceiver,jdbcType=VARCHAR} | ||
36 | + and business_type = #{businessType,jdbcType=VARCHAR} | ||
37 | + </select> | ||
38 | + | ||
39 | + <select id="selectByBussType" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
40 | + select | ||
41 | + <include refid="Base_Column_List" /> | ||
42 | + from land_router_config | ||
43 | + where | ||
44 | + business_type = #{businessType,jdbcType=VARCHAR} | ||
45 | + and gather_receiver = 'G2' | ||
46 | + and `status` = 'Y' | ||
47 | + </select> | ||
48 | + | ||
49 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
50 | + delete from land_router_config | ||
51 | + where id = #{id,jdbcType=INTEGER} | ||
52 | + </delete> | ||
53 | + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.sy.model.LandRouterConfig" useGeneratedKeys="true"> | ||
54 | + insert into land_router_config (area_id, area_name, chanel_id, | ||
55 | + chanel_name, chanel_type, business_type, | ||
56 | + g2_business_type, identify_type, gather_receiver, | ||
57 | + create_time, `status`) | ||
58 | + values (#{areaId,jdbcType=VARCHAR}, #{areaName,jdbcType=VARCHAR}, #{chanelId,jdbcType=VARCHAR}, | ||
59 | + #{chanelName,jdbcType=VARCHAR}, #{chanelType,jdbcType=VARCHAR}, #{businessType,jdbcType=VARCHAR}, | ||
60 | + #{g2BusinessType,jdbcType=VARCHAR}, #{identifyType,jdbcType=VARCHAR}, #{gatherReceiver,jdbcType=VARCHAR}, | ||
61 | + #{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}) | ||
62 | + </insert> | ||
63 | + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.sy.model.LandRouterConfig" useGeneratedKeys="true"> | ||
64 | + insert into land_router_config | ||
65 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
66 | + <if test="areaId != null"> | ||
67 | + area_id, | ||
68 | + </if> | ||
69 | + <if test="areaName != null"> | ||
70 | + area_name, | ||
71 | + </if> | ||
72 | + <if test="chanelId != null"> | ||
73 | + chanel_id, | ||
74 | + </if> | ||
75 | + <if test="chanelName != null"> | ||
76 | + chanel_name, | ||
77 | + </if> | ||
78 | + <if test="chanelType != null"> | ||
79 | + chanel_type, | ||
80 | + </if> | ||
81 | + <if test="businessType != null"> | ||
82 | + business_type, | ||
83 | + </if> | ||
84 | + <if test="g2BusinessType != null"> | ||
85 | + g2_business_type, | ||
86 | + </if> | ||
87 | + <if test="identifyType != null"> | ||
88 | + identify_type, | ||
89 | + </if> | ||
90 | + <if test="gatherReceiver != null"> | ||
91 | + gather_receiver, | ||
92 | + </if> | ||
93 | + <if test="createTime != null"> | ||
94 | + create_time, | ||
95 | + </if> | ||
96 | + <if test="status != null"> | ||
97 | + `status`, | ||
98 | + </if> | ||
99 | + </trim> | ||
100 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
101 | + <if test="areaId != null"> | ||
102 | + #{areaId,jdbcType=VARCHAR}, | ||
103 | + </if> | ||
104 | + <if test="areaName != null"> | ||
105 | + #{areaName,jdbcType=VARCHAR}, | ||
106 | + </if> | ||
107 | + <if test="chanelId != null"> | ||
108 | + #{chanelId,jdbcType=VARCHAR}, | ||
109 | + </if> | ||
110 | + <if test="chanelName != null"> | ||
111 | + #{chanelName,jdbcType=VARCHAR}, | ||
112 | + </if> | ||
113 | + <if test="chanelType != null"> | ||
114 | + #{chanelType,jdbcType=VARCHAR}, | ||
115 | + </if> | ||
116 | + <if test="businessType != null"> | ||
117 | + #{businessType,jdbcType=VARCHAR}, | ||
118 | + </if> | ||
119 | + <if test="g2BusinessType != null"> | ||
120 | + #{g2BusinessType,jdbcType=VARCHAR}, | ||
121 | + </if> | ||
122 | + <if test="identifyType != null"> | ||
123 | + #{identifyType,jdbcType=VARCHAR}, | ||
124 | + </if> | ||
125 | + <if test="gatherReceiver != null"> | ||
126 | + #{gatherReceiver,jdbcType=VARCHAR}, | ||
127 | + </if> | ||
128 | + <if test="createTime != null"> | ||
129 | + #{createTime,jdbcType=TIMESTAMP}, | ||
130 | + </if> | ||
131 | + <if test="status != null"> | ||
132 | + #{status,jdbcType=VARCHAR}, | ||
133 | + </if> | ||
134 | + </trim> | ||
135 | + </insert> | ||
136 | + <update id="updateByPrimaryKeySelective" parameterType="com.sy.model.LandRouterConfig"> | ||
137 | + update land_router_config | ||
138 | + <set> | ||
139 | + <if test="areaId != null"> | ||
140 | + area_id = #{areaId,jdbcType=VARCHAR}, | ||
141 | + </if> | ||
142 | + <if test="areaName != null"> | ||
143 | + area_name = #{areaName,jdbcType=VARCHAR}, | ||
144 | + </if> | ||
145 | + <if test="chanelId != null"> | ||
146 | + chanel_id = #{chanelId,jdbcType=VARCHAR}, | ||
147 | + </if> | ||
148 | + <if test="chanelName != null"> | ||
149 | + chanel_name = #{chanelName,jdbcType=VARCHAR}, | ||
150 | + </if> | ||
151 | + <if test="chanelType != null"> | ||
152 | + chanel_type = #{chanelType,jdbcType=VARCHAR}, | ||
153 | + </if> | ||
154 | + <if test="businessType != null"> | ||
155 | + business_type = #{businessType,jdbcType=VARCHAR}, | ||
156 | + </if> | ||
157 | + <if test="g2BusinessType != null"> | ||
158 | + g2_business_type = #{g2BusinessType,jdbcType=VARCHAR}, | ||
159 | + </if> | ||
160 | + <if test="identifyType != null"> | ||
161 | + identify_type = #{identifyType,jdbcType=VARCHAR}, | ||
162 | + </if> | ||
163 | + <if test="gatherReceiver != null"> | ||
164 | + gather_receiver = #{gatherReceiver,jdbcType=VARCHAR}, | ||
165 | + </if> | ||
166 | + <if test="createTime != null"> | ||
167 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | ||
168 | + </if> | ||
169 | + <if test="status != null"> | ||
170 | + `status` = #{status,jdbcType=VARCHAR}, | ||
171 | + </if> | ||
172 | + </set> | ||
173 | + where id = #{id,jdbcType=INTEGER} | ||
174 | + </update> | ||
175 | + <update id="updateByPrimaryKey" parameterType="com.sy.model.LandRouterConfig"> | ||
176 | + update land_router_config | ||
177 | + set area_id = #{areaId,jdbcType=VARCHAR}, | ||
178 | + area_name = #{areaName,jdbcType=VARCHAR}, | ||
179 | + chanel_id = #{chanelId,jdbcType=VARCHAR}, | ||
180 | + chanel_name = #{chanelName,jdbcType=VARCHAR}, | ||
181 | + chanel_type = #{chanelType,jdbcType=VARCHAR}, | ||
182 | + business_type = #{businessType,jdbcType=VARCHAR}, | ||
183 | + g2_business_type = #{g2BusinessType,jdbcType=VARCHAR}, | ||
184 | + identify_type = #{identifyType,jdbcType=VARCHAR}, | ||
185 | + gather_receiver = #{gatherReceiver,jdbcType=VARCHAR}, | ||
186 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | ||
187 | + `status` = #{status,jdbcType=VARCHAR} | ||
188 | + where id = #{id,jdbcType=INTEGER} | ||
189 | + </update> | ||
190 | +</mapper> |
1 | <?xml version="1.0" encoding="UTF-8"?> | 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"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.sy.mapper.commandInfoMapper"> | 3 | <mapper namespace="com.sy.mapper.commandInfoMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.sy.model.commandInfo"> | 4 | + <resultMap id="BaseResultMap" type="com.sy.model.CommandInfoX22"> |
5 | <id column="SEQ_NO" jdbcType="VARCHAR" property="seqNo" /> | 5 | <id column="SEQ_NO" jdbcType="VARCHAR" property="seqNo" /> |
6 | <result column="sender" jdbcType="VARCHAR" property="sender" /> | 6 | <result column="sender" jdbcType="VARCHAR" property="sender" /> |
7 | <result column="receiver" jdbcType="VARCHAR" property="receiver" /> | 7 | <result column="receiver" jdbcType="VARCHAR" property="receiver" /> |
@@ -23,12 +23,12 @@ | @@ -23,12 +23,12 @@ | ||
23 | <result column="OP_HINT" jdbcType="VARCHAR" property="opHint" /> | 23 | <result column="OP_HINT" jdbcType="VARCHAR" property="opHint" /> |
24 | </resultMap> | 24 | </resultMap> |
25 | <sql id="Base_Column_List"> | 25 | <sql id="Base_Column_List"> |
26 | - SEQ_NO, sender, receiver, seqn, sendtime, btype, stype, AREA_ID, CHNL_NO, I_E_TYPE, | ||
27 | - CHECK_RESULT, VE_NAME, GPS_ID, ORIGIN_CUSTOMS, DEST_CUSTOMS, ESEAL_ID, SEAL_KEY, | 26 | + SEQ_NO, sender, receiver, seqn, sendtime, btype, stype, AREA_ID, CHNL_NO, I_E_TYPE, |
27 | + CHECK_RESULT, VE_NAME, GPS_ID, ORIGIN_CUSTOMS, DEST_CUSTOMS, ESEAL_ID, SEAL_KEY, | ||
28 | FORM_ID, OP_HINT | 28 | FORM_ID, OP_HINT |
29 | </sql> | 29 | </sql> |
30 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | 30 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> |
31 | - select | 31 | + select |
32 | <include refid="Base_Column_List" /> | 32 | <include refid="Base_Column_List" /> |
33 | from commandinfo | 33 | from commandinfo |
34 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} | 34 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} |
@@ -37,23 +37,23 @@ | @@ -37,23 +37,23 @@ | ||
37 | delete from commandinfo | 37 | delete from commandinfo |
38 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} | 38 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} |
39 | </delete> | 39 | </delete> |
40 | - <insert id="insert" parameterType="com.sy.model.commandInfo"> | ||
41 | - insert into commandinfo (SEQ_NO, sender, receiver, | ||
42 | - seqn, sendtime, btype, | ||
43 | - stype, AREA_ID, CHNL_NO, | ||
44 | - I_E_TYPE, CHECK_RESULT, VE_NAME, | ||
45 | - GPS_ID, ORIGIN_CUSTOMS, DEST_CUSTOMS, | ||
46 | - ESEAL_ID, SEAL_KEY, FORM_ID, | 40 | + <insert id="insert" parameterType="com.sy.model.CommandInfoX22"> |
41 | + insert into commandinfo (SEQ_NO, sender, receiver, | ||
42 | + seqn, sendtime, btype, | ||
43 | + stype, AREA_ID, CHNL_NO, | ||
44 | + I_E_TYPE, CHECK_RESULT, VE_NAME, | ||
45 | + GPS_ID, ORIGIN_CUSTOMS, DEST_CUSTOMS, | ||
46 | + ESEAL_ID, SEAL_KEY, FORM_ID, | ||
47 | OP_HINT) | 47 | OP_HINT) |
48 | - values (#{seqNo,jdbcType=VARCHAR}, #{sender,jdbcType=VARCHAR}, #{receiver,jdbcType=VARCHAR}, | ||
49 | - #{seqn,jdbcType=VARCHAR}, #{sendtime,jdbcType=TIMESTAMP}, #{btype,jdbcType=VARCHAR}, | ||
50 | - #{stype,jdbcType=VARCHAR}, #{areaId,jdbcType=VARCHAR}, #{chnlNo,jdbcType=VARCHAR}, | ||
51 | - #{iEType,jdbcType=VARCHAR}, #{checkResult,jdbcType=VARCHAR}, #{veName,jdbcType=VARCHAR}, | ||
52 | - #{gpsId,jdbcType=VARCHAR}, #{originCustoms,jdbcType=VARCHAR}, #{destCustoms,jdbcType=VARCHAR}, | ||
53 | - #{esealId,jdbcType=VARCHAR}, #{sealKey,jdbcType=VARCHAR}, #{formId,jdbcType=VARCHAR}, | 48 | + values (#{seqNo,jdbcType=VARCHAR}, #{sender,jdbcType=VARCHAR}, #{receiver,jdbcType=VARCHAR}, |
49 | + #{seqn,jdbcType=VARCHAR}, #{sendtime,jdbcType=TIMESTAMP}, #{btype,jdbcType=VARCHAR}, | ||
50 | + #{stype,jdbcType=VARCHAR}, #{areaId,jdbcType=VARCHAR}, #{chnlNo,jdbcType=VARCHAR}, | ||
51 | + #{iEType,jdbcType=VARCHAR}, #{checkResult,jdbcType=VARCHAR}, #{veName,jdbcType=VARCHAR}, | ||
52 | + #{gpsId,jdbcType=VARCHAR}, #{originCustoms,jdbcType=VARCHAR}, #{destCustoms,jdbcType=VARCHAR}, | ||
53 | + #{esealId,jdbcType=VARCHAR}, #{sealKey,jdbcType=VARCHAR}, #{formId,jdbcType=VARCHAR}, | ||
54 | #{opHint,jdbcType=VARCHAR}) | 54 | #{opHint,jdbcType=VARCHAR}) |
55 | </insert> | 55 | </insert> |
56 | - <insert id="insertSelective" parameterType="com.sy.model.commandInfo"> | 56 | + <insert id="insertSelective" parameterType="com.sy.model.CommandInfoX22"> |
57 | insert into commandinfo | 57 | insert into commandinfo |
58 | <trim prefix="(" suffix=")" suffixOverrides=","> | 58 | <trim prefix="(" suffix=")" suffixOverrides=","> |
59 | <if test="seqNo != null"> | 59 | <if test="seqNo != null"> |
@@ -174,7 +174,7 @@ | @@ -174,7 +174,7 @@ | ||
174 | </if> | 174 | </if> |
175 | </trim> | 175 | </trim> |
176 | </insert> | 176 | </insert> |
177 | - <update id="updateByPrimaryKeySelective" parameterType="com.sy.model.commandInfo"> | 177 | + <update id="updateByPrimaryKeySelective" parameterType="com.sy.model.CommandInfoX22"> |
178 | update commandinfo | 178 | update commandinfo |
179 | <set> | 179 | <set> |
180 | <if test="sender != null"> | 180 | <if test="sender != null"> |
@@ -234,7 +234,7 @@ | @@ -234,7 +234,7 @@ | ||
234 | </set> | 234 | </set> |
235 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} | 235 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} |
236 | </update> | 236 | </update> |
237 | - <update id="updateByPrimaryKey" parameterType="com.sy.model.commandInfo"> | 237 | + <update id="updateByPrimaryKey" parameterType="com.sy.model.CommandInfoX22"> |
238 | update commandinfo | 238 | update commandinfo |
239 | set sender = #{sender,jdbcType=VARCHAR}, | 239 | set sender = #{sender,jdbcType=VARCHAR}, |
240 | receiver = #{receiver,jdbcType=VARCHAR}, | 240 | receiver = #{receiver,jdbcType=VARCHAR}, |
@@ -256,4 +256,4 @@ | @@ -256,4 +256,4 @@ | ||
256 | OP_HINT = #{opHint,jdbcType=VARCHAR} | 256 | OP_HINT = #{opHint,jdbcType=VARCHAR} |
257 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} | 257 | where SEQ_NO = #{seqNo,jdbcType=VARCHAR} |
258 | </update> | 258 | </update> |
259 | -</mapper> | ||
259 | +</mapper> |
@@ -57,5 +57,6 @@ class RedisServiceTest { | @@ -57,5 +57,6 @@ class RedisServiceTest { | ||
57 | 57 | ||
58 | @Test | 58 | @Test |
59 | void testSet() { | 59 | void testSet() { |
60 | + redisService.set("豫A61CR7","[{\"agentname\":\"ceshi\",\"agentno\":\"ceshi\",\"aisle\":\"4604601010\",\"barcode\":\"74b-4bef-b248-80a95358683f\",\"businesstype\":\"进口提货\",\"cocode\":\"普通货物\",\"createBy\":\"1\",\"createDate\":1661237499690,\"declarePersonnelNumbers\":\"8930000085548\",\"endport\":\"4604\",\"endstation\":\"4604600000\",\"endstationList\":[\"4604600000\"],\"enterpriseCreditCode\":\"9141010070678920XJ\",\"id\":\"402eff8d-ca6b-4192-99ff-ccc6c22b4749\",\"inAllocatingBusiness\":0,\"isDelete\":\"0\",\"isfull\":\"0\",\"isthree\":\"0\",\"isvalid\":\"0\",\"landBusineestypeListInfoList\":[{\"applicationformid\":\"74b-4bef-b248-80a95358683f\",\"arrivedaheadtime\":\"0\",\"awba\":\"999-11111111\",\"ext1\":\"123\",\"ext2\":\"123\",\"ext3\":\"进口提货\",\"ext4\":\"B\",\"flightno\":\"CV2212\",\"id\":\"0f9fd8a3-3485-43a3-bf5d-e53908999075\",\"intelligentLockOne\":\"123321\",\"intelligentLockTwo\":\"123321\",\"licenseplatenumber\":\"豫A61CR7\",\"partialidentity\":\"0\"}],\"massageId\":\"202208231451390761\",\"masterList\":\"999-11111111\",\"mediumtype\":\"2\",\"modeTransportation\":\"5\",\"organizationCode\":\"70678920X\",\"prodectTime\":1661237499690,\"remark\":\"123.00\",\"remark3\":\"\",\"trailerFrameNo\":\"豫A61CR7\",\"trailerLicenseNo\":\"超级管理员\",\"trainsconfirmationNumber\":\"\",\"turnoverflag\":\"I\",\"veProperty\":\"超级管理员\"},{\"agentname\":\"ceshi\",\"agentno\":\"ceshi\",\"aisle\":\"4604601011\",\"barcode\":\"74b-4bef-b248-80a95358683f\",\"businesstype\":\"进口提货\",\"cocode\":\"普通货物\",\"createBy\":\"1\",\"createDate\":1661237499690,\"declarePersonnelNumbers\":\"8930000085548\",\"endport\":\"4604\",\"endstation\":\"4604600000\",\"endstationList\":[\"4604600000\"],\"enterpriseCreditCode\":\"9141010070678920XJ\",\"id\":\"5fb6b71f-59f4-4fbc-aa18-a73758cac8e6\",\"inAllocatingBusiness\":0,\"isDelete\":\"0\",\"isfull\":\"0\",\"isthree\":\"0\",\"isvalid\":\"0\",\"landBusineestypeListInfoList\":[{\"applicationformid\":\"74b-4bef-b248-80a95358683f\",\"arrivedaheadtime\":\"0\",\"awba\":\"999-11111111\",\"ext1\":\"123\",\"ext2\":\"123\",\"ext3\":\"进口提货\",\"ext4\":\"B\",\"flightno\":\"CV2212\",\"id\":\"0f9fd8a3-3485-43a3-bf5d-e53908999075\",\"intelligentLockOne\":\"123321\",\"intelligentLockTwo\":\"123321\",\"licenseplatenumber\":\"豫A61CR7\",\"partialidentity\":\"0\"}],\"massageId\":\"202208231451390761\",\"masterList\":\"999-11111111\",\"mediumtype\":\"2\",\"modeTransportation\":\"5\",\"organizationCode\":\"70678920X\",\"prodectTime\":1661237499690,\"remark\":\"123.00\",\"remark3\":\"\",\"trailerFrameNo\":\"豫A61CR7\",\"trailerLicenseNo\":\"超级管理员\",\"trainsconfirmationNumber\":\"\",\"turnoverflag\":\"I\",\"veProperty\":\"超级管理员\"},{\"agentname\":\"ceshi\",\"agentno\":\"ceshi\",\"aisle\":\"4604601012\",\"barcode\":\"74b-4bef-b248-80a95358683f\",\"businesstype\":\"进口提货\",\"cocode\":\"普通货物\",\"createBy\":\"1\",\"createDate\":1661237499690,\"declarePersonnelNumbers\":\"8930000085548\",\"endport\":\"4604\",\"endstation\":\"4604600000\",\"endstationList\":[\"4604600000\"],\"enterpriseCreditCode\":\"9141010070678920XJ\",\"id\":\"a1bd7e91-4a7f-4e36-b525-93f6b21a933a\",\"inAllocatingBusiness\":0,\"isDelete\":\"0\",\"isfull\":\"0\",\"isthree\":\"0\",\"isvalid\":\"0\",\"landBusineestypeListInfoList\":[{\"applicationformid\":\"74b-4bef-b248-80a95358683f\",\"arrivedaheadtime\":\"0\",\"awba\":\"999-11111111\",\"ext1\":\"123\",\"ext2\":\"123\",\"ext3\":\"进口提货\",\"ext4\":\"B\",\"flightno\":\"CV2212\",\"id\":\"0f9fd8a3-3485-43a3-bf5d-e53908999075\",\"intelligentLockOne\":\"123321\",\"intelligentLockTwo\":\"123321\",\"licenseplatenumber\":\"豫A61CR7\",\"partialidentity\":\"0\"}],\"massageId\":\"202208231451390761\",\"masterList\":\"999-11111111\",\"mediumtype\":\"2\",\"modeTransportation\":\"5\",\"organizationCode\":\"70678920X\",\"prodectTime\":1661237499690,\"remark\":\"123.00\",\"remark3\":\"\",\"trailerFrameNo\":\"豫A61CR7\",\"trailerLicenseNo\":\"超级管理员\",\"trainsconfirmationNumber\":\"\",\"turnoverflag\":\"I\",\"veProperty\":\"超级管理员\"},{\"agentname\":\"ceshi\",\"agentno\":\"ceshi\",\"aisle\":\"4604600010\",\"barcode\":\"74b-4bef-b248-80a95358683f\",\"businesstype\":\"进口提货\",\"cocode\":\"普通货物\",\"createBy\":\"1\",\"createDate\":1661237499690,\"declarePersonnelNumbers\":\"8930000085548\",\"endport\":\"4604\",\"endstation\":\"4604600000\",\"endstationList\":[\"4604600000\"],\"enterpriseCreditCode\":\"9141010070678920XJ\",\"id\":\"0fd720f2-31d1-4304-a513-7e1c85713394\",\"inAllocatingBusiness\":0,\"isDelete\":\"0\",\"isfull\":\"0\",\"isthree\":\"0\",\"isvalid\":\"0\",\"landBusineestypeListInfoList\":[{\"applicationformid\":\"74b-4bef-b248-80a95358683f\",\"arrivedaheadtime\":\"0\",\"awba\":\"999-11111111\",\"ext1\":\"123\",\"ext2\":\"123\",\"ext3\":\"进口提货\",\"ext4\":\"B\",\"flightno\":\"CV2212\",\"id\":\"0f9fd8a3-3485-43a3-bf5d-e53908999075\",\"intelligentLockOne\":\"123321\",\"intelligentLockTwo\":\"123321\",\"licenseplatenumber\":\"豫A61CR7\",\"partialidentity\":\"0\"}],\"massageId\":\"202208231451390761\",\"masterList\":\"999-11111111\",\"mediumtype\":\"2\",\"modeTransportation\":\"5\",\"organizationCode\":\"70678920X\",\"prodectTime\":1661237499690,\"remark\":\"123.00\",\"remark3\":\"\",\"trailerFrameNo\":\"豫A61CR7\",\"trailerLicenseNo\":\"超级管理员\",\"trainsconfirmationNumber\":\"\",\"turnoverflag\":\"E\",\"veProperty\":\"超级管理员\"},{\"agentname\":\"ceshi\",\"agentno\":\"ceshi\",\"aisle\":\"4604600011\",\"barcode\":\"74b-4bef-b248-80a95358683f\",\"businesstype\":\"进口提货\",\"cocode\":\"普通货物\",\"createBy\":\"1\",\"createDate\":1661237499690,\"declarePersonnelNumbers\":\"8930000085548\",\"endport\":\"4604\",\"endstation\":\"4604600000\",\"endstationList\":[\"4604600000\"],\"enterpriseCreditCode\":\"9141010070678920XJ\",\"id\":\"5eee7cdd-4851-43bd-a5ff-914a3c618f9a\",\"inAllocatingBusiness\":0,\"isDelete\":\"0\",\"isfull\":\"0\",\"isthree\":\"0\",\"isvalid\":\"0\",\"landBusineestypeListInfoList\":[{\"applicationformid\":\"74b-4bef-b248-80a95358683f\",\"arrivedaheadtime\":\"0\",\"awba\":\"999-11111111\",\"ext1\":\"123\",\"ext2\":\"123\",\"ext3\":\"进口提货\",\"ext4\":\"B\",\"flightno\":\"CV2212\",\"id\":\"0f9fd8a3-3485-43a3-bf5d-e53908999075\",\"intelligentLockOne\":\"123321\",\"intelligentLockTwo\":\"123321\",\"licenseplatenumber\":\"豫A61CR7\",\"partialidentity\":\"0\"}],\"massageId\":\"202208231451390761\",\"masterList\":\"999-11111111\",\"mediumtype\":\"2\",\"modeTransportation\":\"5\",\"organizationCode\":\"70678920X\",\"prodectTime\":1661237499690,\"remark\":\"123.00\",\"remark3\":\"\",\"trailerFrameNo\":\"豫A61CR7\",\"trailerLicenseNo\":\"超级管理员\",\"trainsconfirmationNumber\":\"\",\"turnoverflag\":\"E\",\"veProperty\":\"超级管理员\"},{\"agentname\":\"ceshi\",\"agentno\":\"ceshi\",\"aisle\":\"4604600012\",\"barcode\":\"74b-4bef-b248-80a95358683f\",\"businesstype\":\"进口提货\",\"cocode\":\"普通货物\",\"createBy\":\"1\",\"createDate\":1661237499690,\"declarePersonnelNumbers\":\"8930000085548\",\"endport\":\"4604\",\"endstation\":\"4604600000\",\"endstationList\":[\"4604600000\"],\"enterpriseCreditCode\":\"9141010070678920XJ\",\"id\":\"44bcde85-20ae-4467-a44e-4406396dd0c0\",\"inAllocatingBusiness\":0,\"isDelete\":\"0\",\"isfull\":\"0\",\"isthree\":\"0\",\"isvalid\":\"0\",\"landBusineestypeListInfoList\":[{\"applicationformid\":\"74b-4bef-b248-80a95358683f\",\"arrivedaheadtime\":\"0\",\"awba\":\"999-11111111\",\"ext1\":\"123\",\"ext2\":\"123\",\"ext3\":\"进口提货\",\"ext4\":\"B\",\"flightno\":\"CV2212\",\"id\":\"0f9fd8a3-3485-43a3-bf5d-e53908999075\",\"intelligentLockOne\":\"123321\",\"intelligentLockTwo\":\"123321\",\"licenseplatenumber\":\"豫A61CR7\",\"partialidentity\":\"0\"}],\"massageId\":\"202208231451390761\",\"masterList\":\"999-11111111\",\"mediumtype\":\"2\",\"modeTransportation\":\"5\",\"organizationCode\":\"70678920X\",\"prodectTime\":1661237499690,\"remark\":\"123.00\",\"remark3\":\"\",\"trailerFrameNo\":\"豫A61CR7\",\"trailerLicenseNo\":\"超级管理员\",\"trainsconfirmationNumber\":\"\",\"turnoverflag\":\"E\",\"veProperty\":\"超级管理员\"}]"); | ||
60 | } | 61 | } |
61 | } | 62 | } |
1 | +package com.sy.service.impl; | ||
2 | + | ||
3 | +import com.sy.bwAnalysis.AnalysisRoute; | ||
4 | +import com.sy.bwAnalysis.GatherInfoAnalysis; | ||
5 | +import com.sy.bwAnalysis.MessageAnalysis; | ||
6 | +import com.sy.bwAssist.Message; | ||
7 | +import com.sy.model.GatherInfo; | ||
8 | +import com.sy.service.RedisService; | ||
9 | +import com.sy.service.router.MessageRouter; | ||
10 | +import com.sy.service.router.RouterContext; | ||
11 | +import org.apache.log4j.PropertyConfigurator; | ||
12 | +import org.junit.Test; | ||
13 | +import org.junit.runner.RunWith; | ||
14 | +import org.slf4j.Logger; | ||
15 | +import org.slf4j.LoggerFactory; | ||
16 | +import org.springframework.beans.factory.annotation.Autowired; | ||
17 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
18 | +import org.springframework.boot.test.context.SpringBootTest; | ||
19 | +import org.springframework.test.context.junit4.SpringRunner; | ||
20 | + | ||
21 | +@RunWith(SpringRunner.class) | ||
22 | +@SpringBootTest | ||
23 | +public class GatherInfoHandleImplTest { | ||
24 | + | ||
25 | + private static final Logger logger = LoggerFactory.getLogger(GatherInfoHandleImplTest.class); | ||
26 | + | ||
27 | + private AnalysisRoute analysisRoute=new AnalysisRoute(); | ||
28 | + | ||
29 | + private static String AREA_BEIHUO= "4604600000"; | ||
30 | + private static String CHANEL_BEIHUO_I1 = "4604601010"; | ||
31 | + private static String CHANEL_BEIHUO_E1 = "4604600010"; | ||
32 | + private static String CHANEL_BEIHUO_E2 = "4604600011"; | ||
33 | + | ||
34 | + @Autowired | ||
35 | + RedisService redisService; | ||
36 | + | ||
37 | + @Qualifier("X21") | ||
38 | + @Autowired | ||
39 | + MessageRouter messageRouterX21; | ||
40 | + | ||
41 | + @Qualifier("X22") | ||
42 | + @Autowired | ||
43 | + MessageRouter messageRouterX22; | ||
44 | + | ||
45 | + //车牌号 | ||
46 | + private String voNo = "豫A61CR7"; | ||
47 | + //备案重量 | ||
48 | + private String vo_weight = "2000"; | ||
49 | + //过卡重量 | ||
50 | + private String cross_weight= "2324"; | ||
51 | + //场站编号 | ||
52 | + private String areaID = "4604600000"; | ||
53 | + //通道编号 | ||
54 | + private String chnlNo = "4604601010"; | ||
55 | + //进出场类型I/E | ||
56 | + private String ie = "I"; | ||
57 | + //二维码 | ||
58 | + private String barcode = "613f5c"; | ||
59 | + | ||
60 | + //进通道报文 | ||
61 | + private static String IMPORT_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + | ||
62 | + "<MSG>\n" + | ||
63 | + "\t<META>\n" + | ||
64 | + "\t\t<SNDR>KAO</SNDR>\n" + | ||
65 | + "\t\t<RCVR/>\n" + | ||
66 | + "\t\t<SEQN>20220624063157</SEQN>\n" + | ||
67 | + "\t\t<DDTM>20220624063157</DDTM>\n" + | ||
68 | + "\t\t<TYPE>KAKO</TYPE>\n" + | ||
69 | + "\t\t<STYP>CARM</STYP>\n" + | ||
70 | + "\t</META>\n" + | ||
71 | + "\t<GATHER_INFO AREA_ID=\"${areaID}\" CHNL_NO=\"${chnlNo}\" I_E_TYPE=\"${IETYPE}\" SEQ_NO=\"20220624063118000004\">\n" + | ||
72 | + "\t\t<IC>\n" + | ||
73 | + "\t\t\t<DR_IC_NO/>\n" + | ||
74 | + "\t\t\t<IC_DR_CUSTOMS_NO/>\n" + | ||
75 | + "\t\t\t<IC_CO_CUSTOMS_NO/>\n" + | ||
76 | + "\t\t\t<IC_BILL_NO/>\n" + | ||
77 | + "\t\t\t<IC_FORM_TYPE/>\n" + | ||
78 | + "\t\t\t<IC_GROSS_WT/>\n" + | ||
79 | + "\t\t\t<IC_VE_CUSTOMS_NO/>\n" + | ||
80 | + "\t\t\t<IC_VE_NAME/>\n" + | ||
81 | + "\t\t\t<IC_CONTA_ID/>\n" + | ||
82 | + "\t\t\t<IC_ESEAL_ID/>\n" + | ||
83 | + "\t\t\t<IC_REG_DATETIME/>\n" + | ||
84 | + "\t\t\t<IC_PER_DAY_DUE/>\n" + | ||
85 | + "\t\t\t<GPS_ID/>\n" + | ||
86 | + "\t\t</IC>\n" + | ||
87 | + "\t\t<WEIGHT>\n" + | ||
88 | + "\t\t\t<GROSS_WT>${cross_weight}</GROSS_WT>\n" + | ||
89 | + "\t\t</WEIGHT>\n" + | ||
90 | + "\t\t<CAR>\n" + | ||
91 | + "\t\t\t<VE_NAME>${car}</VE_NAME>\n" + | ||
92 | + "\t\t\t<CAR_EC_NO/>\n" + | ||
93 | + "\t\t\t<CAR_EC_NO2/>\n" + | ||
94 | + "\t\t\t<VE_CUSTOMS_NO/>\n" + | ||
95 | + "\t\t\t<VE_WT/>\n" + | ||
96 | + "\t\t</CAR>\n" + | ||
97 | + "\t\t<CONTA>\n" + | ||
98 | + "\t\t\t<CONTA_NUM/>\n" + | ||
99 | + "\t\t\t<CONTA_RECO>1</CONTA_RECO>\n" + | ||
100 | + "\t\t\t<CONTA_ID_F/>\n" + | ||
101 | + "\t\t\t<CONTA_ID_B/>\n" + | ||
102 | + "\t\t\t<CONTA_MODEL_F/>\n" + | ||
103 | + "\t\t\t<CONTA_MODEL_B/>\n" + | ||
104 | + "\t\t</CONTA>\n" + | ||
105 | + "\t\t<ORDER_NUM/>\n" + | ||
106 | + "\t\t<BAR_CODE>${barcode}</BAR_CODE>\n" + | ||
107 | + "\t\t<SEAL>\n" + | ||
108 | + "\t\t\t<ESEAL_ID/>\n" + | ||
109 | + "\t\t\t<SEAL_KEY/>\n" + | ||
110 | + "\t\t</SEAL>\n" + | ||
111 | + "\t</GATHER_INFO>\n" + | ||
112 | + "</MSG>"; | ||
113 | + | ||
114 | + | ||
115 | + | ||
116 | + /** | ||
117 | + * 进场测试 | ||
118 | + */ | ||
119 | + @Test | ||
120 | + public void exportDownload_I() { | ||
121 | + //车牌号 | ||
122 | + String voNo = "豫A61CR7"; | ||
123 | + //过卡重量 | ||
124 | + String cross_weight= "1660"; | ||
125 | + //场站编号 | ||
126 | + String areaID = AREA_BEIHUO; | ||
127 | + //通道编号 | ||
128 | + String chnlNo = CHANEL_BEIHUO_I1; | ||
129 | + //进出场类型I/E | ||
130 | + String ie = "I"; | ||
131 | + //二维码 | ||
132 | + String barcode = "74b-4bef-b248-80a95358683f"; | ||
133 | + | ||
134 | + logger.error("开始进场测试"); | ||
135 | + IMPORT_XML= IMPORT_XML.replace("${car}",voNo) | ||
136 | + .replace("${cross_weight}",cross_weight) | ||
137 | + .replace("${areaID}",areaID) | ||
138 | + .replace("${chnlNo}",chnlNo) | ||
139 | + .replace("${IETYPE}",ie) | ||
140 | + .replace("${barcode}",barcode); | ||
141 | + //进港提货测试 | ||
142 | + | ||
143 | + String string = IMPORT_XML.replace("Msg","MSG"); | ||
144 | + MessageAnalysis analysis = new MessageAnalysis(); | ||
145 | + Message message = analysis.readTicketsXml(string); | ||
146 | + GatherInfoAnalysis gatherInfoAnalysis = new GatherInfoAnalysis(); | ||
147 | + GatherInfo info = gatherInfoAnalysis.toJavaBean(message); | ||
148 | + | ||
149 | + | ||
150 | + | ||
151 | + } | ||
152 | + | ||
153 | + /** | ||
154 | + * 出场测试 | ||
155 | + */ | ||
156 | + @Test | ||
157 | + public void exportDownload_E(){ | ||
158 | + PropertyConfigurator.configure("config/log4j.properties"); | ||
159 | + | ||
160 | + //车牌号 | ||
161 | + String voNo = "豫A61CR7"; | ||
162 | + //过卡重量 | ||
163 | + String cross_weight= String.valueOf(2000+123); | ||
164 | + //场站编号 | ||
165 | + String areaID = AREA_BEIHUO; | ||
166 | + //通道编号 | ||
167 | + String chnlNo = CHANEL_BEIHUO_E2; | ||
168 | + //进出场类型I/E | ||
169 | + String ie = "E"; | ||
170 | + //二维码 | ||
171 | + String barcode = "22a-47a0-a296-1fe53e37a217"; | ||
172 | + | ||
173 | + logger.error("开始出口送货离场测试"); | ||
174 | + IMPORT_XML= IMPORT_XML.replace("${car}",voNo) | ||
175 | + .replace("${cross_weight}",cross_weight) | ||
176 | + .replace("${areaID}",areaID) | ||
177 | + .replace("${chnlNo}",chnlNo) | ||
178 | + .replace("${IETYPE}",ie) | ||
179 | + .replace("${barcode}",barcode); | ||
180 | + //进港提货测试 | ||
181 | + String string = IMPORT_XML.replace("Msg","MSG"); | ||
182 | + MessageAnalysis analysis = new MessageAnalysis(); | ||
183 | + Message message = analysis.readTicketsXml(string); | ||
184 | + | ||
185 | + | ||
186 | + if ("CARM".equals(message.getMeta().getSmType())) { | ||
187 | + //策略判断 | ||
188 | + if(message.getComInfo() !=null){ | ||
189 | + RouterContext routerContext = new RouterContext(messageRouterX22); | ||
190 | + routerContext.executeStrategy(message); | ||
191 | + }else{ | ||
192 | + RouterContext routerContext = new RouterContext(messageRouterX21); | ||
193 | + routerContext.executeStrategy(message); | ||
194 | + } | ||
195 | + } | ||
196 | + | ||
197 | + } | ||
198 | + | ||
199 | + | ||
200 | +} |
-
请 注册 或 登录 后发表评论