正在显示
25 个修改的文件
包含
1498 行增加
和
285 行删除
@@ -6,6 +6,10 @@ eureka.client.service-url.defaultZone=http://192.168.1.53:12345/eureka/ | @@ -6,6 +6,10 @@ eureka.client.service-url.defaultZone=http://192.168.1.53:12345/eureka/ | ||
6 | 6 | ||
7 | spring.application.name=kako_analysisforstation | 7 | spring.application.name=kako_analysisforstation |
8 | spring.cloud.service-registry.auto-registration.enabled=false | 8 | spring.cloud.service-registry.auto-registration.enabled=false |
9 | +spring.cloud.discovery.client.health-indicator.enabled=false | ||
10 | +spring.cloud.service-registry.auto-registration.register-management=false | ||
11 | +spring.cloud.features.enabled=false | ||
12 | +spring.cloud.discovery.enabled=false | ||
9 | 13 | ||
10 | spring.devtools.restart.enabled=true | 14 | spring.devtools.restart.enabled=true |
11 | 15 | ||
@@ -15,15 +19,18 @@ spring.mvc.view.suffix=/WEB-INF/jsp/ | @@ -15,15 +19,18 @@ spring.mvc.view.suffix=/WEB-INF/jsp/ | ||
15 | 19 | ||
16 | spring.mvc.view.prefix=.jsp | 20 | spring.mvc.view.prefix=.jsp |
17 | 21 | ||
22 | +spring.redis.host=192.168.1.53 | ||
23 | +spring.redis.port=6379 | ||
24 | + | ||
25 | +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
26 | +# 测试环境 | ||
18 | spring.datasource.username=110 | 27 | spring.datasource.username=110 |
19 | spring.datasource.password=QAHqCJf2kFYCLirM | 28 | spring.datasource.password=QAHqCJf2kFYCLirM |
20 | -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
21 | spring.datasource.url=jdbc:mysql://118.31.66.166:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai | 29 | spring.datasource.url=jdbc:mysql://118.31.66.166:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai |
22 | - | ||
23 | -#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
24 | -#spring.datasource.url=jdbc:mysql://localhost:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai | ||
25 | -#spring.datasource.username=station | ||
26 | -#spring.datasource.password=station@10.50.7.70 | 30 | +# 生产环境 |
31 | +#spring.datasource.url=jdbc:mysql://10.50.7.60:3306/station?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai | ||
32 | +#spring.datasource.username=110 | ||
33 | +#spring.datasource.password=vmvnv1v2VV. | ||
27 | 34 | ||
28 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource | 35 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
29 | 36 | ||
@@ -54,9 +61,9 @@ pagehelper.reasonable=true | @@ -54,9 +61,9 @@ pagehelper.reasonable=true | ||
54 | pagehelper.support-methods-arguments=true | 61 | pagehelper.support-methods-arguments=true |
55 | pagehelper.params=count=countSql | 62 | pagehelper.params=count=countSql |
56 | # 是否启用httpclient | 63 | # 是否启用httpclient |
57 | -feign.httpclient.enabled=false | 64 | +feign.httpclient.enabled=true |
58 | # 是否启用httpok(性能比httpclient高) | 65 | # 是否启用httpok(性能比httpclient高) |
59 | -feign.okhttp.enabled=true | 66 | +#feign.okhttp.enabled=true |
60 | # 是否启用hystrix | 67 | # 是否启用hystrix |
61 | feign.hystrix.enabled=true | 68 | feign.hystrix.enabled=true |
62 | # 请求连接超时时间(毫秒) | 69 | # 请求连接超时时间(毫秒) |
@@ -66,5 +73,5 @@ wharf.interface.host=http://10.50.3.66:1983/ | @@ -66,5 +73,5 @@ wharf.interface.host=http://10.50.3.66:1983/ | ||
66 | #新舱单运单查询数据接口,注意尾部带/符号 | 73 | #新舱单运单查询数据接口,注意尾部带/符号 |
67 | nmms.interface.host=http://10.50.3.82:8081/ | 74 | nmms.interface.host=http://10.50.3.82:8081/ |
68 | #新舱单网站内网接口,注意尾部带/符号 | 75 | #新舱单网站内网接口,注意尾部带/符号 |
69 | -nmms.site.host=http://nmms1.15miaoo.com:17999 | 76 | +nmms.site.host=http://10.50.3.61:90 |
70 | custom.receptDirectory= bw/read/ | 77 | custom.receptDirectory= bw/read/ |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
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.1-BH-SNAPSHOT</version> | 8 | + <version>2.12-BH-SNAPSHOT</version> |
9 | <packaging>jar</packaging> | 9 | <packaging>jar</packaging> |
10 | 10 | ||
11 | <name>analysis_imf</name> | 11 | <name>analysis_imf</name> |
@@ -33,6 +33,10 @@ | @@ -33,6 +33,10 @@ | ||
33 | </dependency> | 33 | </dependency> |
34 | <dependency> | 34 | <dependency> |
35 | <groupId>org.springframework.boot</groupId> | 35 | <groupId>org.springframework.boot</groupId> |
36 | + <artifactId>spring-boot-starter-data-redis</artifactId> | ||
37 | + </dependency> | ||
38 | + <dependency> | ||
39 | + <groupId>org.springframework.boot</groupId> | ||
36 | <artifactId>spring-boot-starter-web</artifactId> | 40 | <artifactId>spring-boot-starter-web</artifactId> |
37 | </dependency> | 41 | </dependency> |
38 | <dependency> | 42 | <dependency> |
@@ -5,6 +5,7 @@ import com.sy.logic.LiftBar; | @@ -5,6 +5,7 @@ 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; | ||
8 | import org.apache.commons.lang.StringUtils; | 9 | import org.apache.commons.lang.StringUtils; |
9 | import org.apache.log4j.Logger; | 10 | import org.apache.log4j.Logger; |
10 | import org.apache.log4j.PropertyConfigurator; | 11 | import org.apache.log4j.PropertyConfigurator; |
@@ -31,7 +32,7 @@ public class AnalysisRoute implements Runnable{ | @@ -31,7 +32,7 @@ public class AnalysisRoute implements Runnable{ | ||
31 | private CLRService clrService; | 32 | private CLRService clrService; |
32 | 33 | ||
33 | @Autowired | 34 | @Autowired |
34 | - private GatherInfoService infoService; | 35 | + private GatherInfoServiceImpl infoService; |
35 | 36 | ||
36 | @Autowired | 37 | @Autowired |
37 | private CommandInfoService commandService; | 38 | private CommandInfoService commandService; |
@@ -89,7 +90,7 @@ public class AnalysisRoute implements Runnable{ | @@ -89,7 +90,7 @@ public class AnalysisRoute implements Runnable{ | ||
89 | 90 | ||
90 | PropertyConfigurator.configure("config/log4j.properties"); | 91 | PropertyConfigurator.configure("config/log4j.properties"); |
91 | string = string.replace("Msg","MSG"); | 92 | string = string.replace("Msg","MSG"); |
92 | - Message message = analysis.readTicketsXml(string);; | 93 | + Message message = analysis.readTicketsXml(string); |
93 | String stype = message.getMeta().getSmType(); | 94 | String stype = message.getMeta().getSmType(); |
94 | if (stype.equals("CARM")) { | 95 | if (stype.equals("CARM")) { |
95 | if(message.getComInfo() !=null){ | 96 | if(message.getComInfo() !=null){ |
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 | +} |
@@ -12,7 +12,7 @@ public class MessageAnalysis { | @@ -12,7 +12,7 @@ public class MessageAnalysis { | ||
12 | return getMessage(str); | 12 | return getMessage(str); |
13 | } | 13 | } |
14 | 14 | ||
15 | - static Message getMessage(String str) { | 15 | + private Message getMessage(String str) { |
16 | XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyNameCoder("_-", "_"))); | 16 | XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyNameCoder("_-", "_"))); |
17 | xstream.processAnnotations(Message.class); | 17 | xstream.processAnnotations(Message.class); |
18 | //对xstream对象设置默认的安全防护 | 18 | //对xstream对象设置默认的安全防护 |
@@ -30,6 +30,8 @@ public interface LandBusinessTypeListMapper { | @@ -30,6 +30,8 @@ public interface LandBusinessTypeListMapper { | ||
30 | 30 | ||
31 | List<LandBusinessTypeList> selectByBarcode(@Param("barcode")String barcode); | 31 | List<LandBusinessTypeList> selectByBarcode(@Param("barcode")String barcode); |
32 | 32 | ||
33 | + List<LandBusinessTypeList> selectByBarcodeWithE(@Param("barcode")String barcode); | ||
34 | + | ||
33 | 35 | ||
34 | int updateByBarCode(@Param("barcode")String barcode); | 36 | int updateByBarCode(@Param("barcode")String barcode); |
35 | 37 |
1 | -package com.sy.model; | ||
2 | - | ||
3 | -public enum BusinessTypeEnum { | ||
4 | - /** | ||
5 | - * 业务类型枚举 | ||
6 | - * todo: 代码暂时不正确 | ||
7 | - */ | ||
8 | - IMPORT_LOCAL_DELIVER("进口提货","100001"), | ||
9 | - EXPORT_LOCAL("出口送货","100002"); | ||
10 | - /** | ||
11 | - * 业务类型 | ||
12 | - */ | ||
13 | - private String name; | ||
14 | - /** | ||
15 | - * 对应金二业务代码 | ||
16 | - */ | ||
17 | - private String code; | ||
18 | - | ||
19 | - BusinessTypeEnum(String name, String code) { | ||
20 | - this.name = name; | ||
21 | - this.code = code; | ||
22 | - } | ||
23 | - | ||
24 | - public String getName() { | ||
25 | - return name; | ||
26 | - } | ||
27 | - | ||
28 | - public String getCode() { | ||
29 | - return code; | ||
30 | - } | ||
31 | -} |
1 | -package com.sy.service; | ||
2 | - | ||
3 | -/** | ||
4 | - * @author mrz | ||
5 | - * 描述:抬杆放行判定接口 | ||
6 | - */ | ||
7 | - | ||
8 | -public interface BayonetReleaseCheck { | ||
9 | - | ||
10 | - /** | ||
11 | - * 车辆过卡信息抬杆指令判定_适配器 | ||
12 | - * @param businesstype 申请业务类型 | ||
13 | - * @param ieType 进出卡口类型 I 进 E 出 | ||
14 | - */ | ||
15 | - public void bayonetCrossCheck(String businesstype,String ieType); | ||
16 | - | ||
17 | - | ||
18 | - /** | ||
19 | - * 车辆信息及车辆备案及黑名单判定 | ||
20 | - * @param veName 车牌号 | ||
21 | - */ | ||
22 | - public void veInfoCHeck(String veName); | ||
23 | -} |
1 | -package com.sy.service; | ||
2 | - | ||
3 | -/** | ||
4 | - * @author mrz | ||
5 | - * 描述:抬杆放行判定适配器 | ||
6 | - */ | ||
7 | - | ||
8 | -public interface BayonetReleaseCheckAdvanced { | ||
9 | - | ||
10 | - /** | ||
11 | - * 进口清关提货 | ||
12 | - * 车辆过卡信息抬杆指令判定_适配器 | ||
13 | - * @param ieType 进出卡口类型 I 进 E 出 | ||
14 | - */ | ||
15 | - public void importLocalDelivery(String ieType); | ||
16 | - | ||
17 | - /** | ||
18 | - * 出口清关送货 | ||
19 | - */ | ||
20 | - public void exportLocalCustoms(String ieType); | ||
21 | - | ||
22 | -} |
@@ -5,4 +5,9 @@ import com.sy.model.GatherInfo; | @@ -5,4 +5,9 @@ import com.sy.model.GatherInfo; | ||
5 | public interface GatherInfoService { | 5 | public interface GatherInfoService { |
6 | 6 | ||
7 | int save(GatherInfo info); | 7 | int save(GatherInfo info); |
8 | + | ||
9 | + /** | ||
10 | + * 根据过卡进行抬杆指令处理 | ||
11 | + */ | ||
12 | + void handel(GatherInfo info); | ||
8 | } | 13 | } |
@@ -26,6 +26,8 @@ public interface LandBusListService { | @@ -26,6 +26,8 @@ public interface LandBusListService { | ||
26 | 26 | ||
27 | List<LandBusinessTypeList> selectByBarcode(String barcode); | 27 | List<LandBusinessTypeList> selectByBarcode(String barcode); |
28 | 28 | ||
29 | + List<LandBusinessTypeList> selectByBarcodeWithE(String barcode); | ||
30 | + | ||
29 | int updateByBarcode(String barcode); | 31 | int updateByBarcode(String barcode); |
30 | 32 | ||
31 | List<LandBusinessTypeList> selectMessageId(String messageId); | 33 | List<LandBusinessTypeList> selectMessageId(String messageId); |
1 | +package com.sy.service; | ||
2 | + | ||
3 | +import java.util.Set; | ||
4 | + | ||
5 | +/** | ||
6 | + * @author mrz | ||
7 | + */ | ||
8 | +public interface RedisService { | ||
9 | + | ||
10 | + boolean expire(String key,long time); | ||
11 | + | ||
12 | + boolean hasKey(String key); | ||
13 | + | ||
14 | + void del(String ... key); | ||
15 | + | ||
16 | + Set<String> deleteBatchByKeys(String key); | ||
17 | + | ||
18 | + String get(String key); | ||
19 | + | ||
20 | + boolean set(String key,String value); | ||
21 | + | ||
22 | + boolean set(String key,String value,long time); | ||
23 | +} |
1 | -package com.sy.service.adapter; | ||
2 | - | ||
3 | -import com.sy.service.BayonetReleaseCheck; | ||
4 | -import com.sy.service.BayonetReleaseCheckAdvanced; | ||
5 | - | ||
6 | -/** | ||
7 | - * 车辆过卡路由适配器 | ||
8 | - * @author mrz | ||
9 | - * @date 2022-08-07 | ||
10 | - */ | ||
11 | -public class BayonetReleaseCheckAdapter implements BayonetReleaseCheck { | ||
12 | - private static final String IMPORT_LOCAL_DELIVER = "进口提货"; | ||
13 | - private static final String EXPORT_LOCAL = "出口送货"; | ||
14 | - | ||
15 | - private BayonetReleaseCheckAdvanced bayonetReleaseCheckAdvanced; | ||
16 | - | ||
17 | - public BayonetReleaseCheckAdapter(String businesstype) { | ||
18 | - switch (businesstype){ | ||
19 | - case "进口提货": | ||
20 | - bayonetReleaseCheckAdvanced = new BayonetReleaseCheckImportCustomsClearance(); | ||
21 | - break; | ||
22 | - case "出口送货": | ||
23 | - bayonetReleaseCheckAdvanced = new BayonetReleaseCheckExportCustomsClearance(); | ||
24 | - break; | ||
25 | - default: | ||
26 | - System.out.println("无法处理的业务类型"); | ||
27 | - break; | ||
28 | - } | ||
29 | - | ||
30 | - } | ||
31 | - | ||
32 | - @Override | ||
33 | - public void bayonetCrossCheck(String businesstype, String ieType) { | ||
34 | - switch (businesstype){ | ||
35 | - case "进口提货": | ||
36 | - bayonetReleaseCheckAdvanced.importLocalDelivery(ieType); | ||
37 | - break; | ||
38 | - case "出口送货": | ||
39 | - bayonetReleaseCheckAdvanced.exportLocalCustoms(ieType); | ||
40 | - default: | ||
41 | - break; | ||
42 | - } | ||
43 | - } | ||
44 | - | ||
45 | - @Override | ||
46 | - public void veInfoCHeck(String veName) { | ||
47 | - | ||
48 | - } | ||
49 | -} |
1 | -package com.sy.service.adapter; | ||
2 | - | ||
3 | -import com.sy.service.BayonetReleaseCheckAdvanced; | ||
4 | - | ||
5 | -/** | ||
6 | - * 本地出口清关适配器处理器 | ||
7 | - */ | ||
8 | -public class BayonetReleaseCheckExportCustomsClearance implements BayonetReleaseCheckAdvanced { | ||
9 | - | ||
10 | - private static final org.slf4j.Logger log4 = org.slf4j.LoggerFactory.getLogger(BayonetReleaseCheckExportCustomsClearance.class); | ||
11 | - | ||
12 | - | ||
13 | - @Override | ||
14 | - public void importLocalDelivery( String ieType) { | ||
15 | - log4.info("[Adapter]-进口-{}-本地-清关适配器处理,什么也不做",ieType); | ||
16 | - | ||
17 | - } | ||
18 | - | ||
19 | - @Override | ||
20 | - public void exportLocalCustoms(String ieType) { | ||
21 | - log4.info("[Adapter]-出口-{}-本地-清关适配器处理,处理出口送货清关业务",ieType); | ||
22 | - | ||
23 | - } | ||
24 | -} |
1 | -package com.sy.service.adapter; | ||
2 | - | ||
3 | -import com.sy.service.BayonetReleaseCheck; | ||
4 | -import org.slf4j.Logger; | ||
5 | -import org.slf4j.LoggerFactory; | ||
6 | - | ||
7 | -/** | ||
8 | - * 业务类型抬杆指令处理入口 | ||
9 | - * @author mrz | ||
10 | - */ | ||
11 | -public class BayonetReleaseCheckHandle implements BayonetReleaseCheck { | ||
12 | - private static final Logger log4 = LoggerFactory.getLogger(BayonetReleaseCheckHandle.class); | ||
13 | - | ||
14 | - private BayonetReleaseCheckAdapter bayonetReleaseCheckAdapter; | ||
15 | - | ||
16 | - @Override | ||
17 | - public void bayonetCrossCheck(String businesstype, String ieType) { | ||
18 | - | ||
19 | - bayonetReleaseCheckAdapter = new BayonetReleaseCheckAdapter(businesstype); | ||
20 | - bayonetReleaseCheckAdapter.bayonetCrossCheck(businesstype,ieType); | ||
21 | - | ||
22 | - } | ||
23 | - | ||
24 | - @Override | ||
25 | - public void veInfoCHeck(String veName) { | ||
26 | - | ||
27 | - } | ||
28 | -} |
1 | -package com.sy.service.adapter; | ||
2 | - | ||
3 | -import com.sy.service.BayonetReleaseCheckAdvanced; | ||
4 | - | ||
5 | -/** | ||
6 | - * 进口清关适配器处理器 | ||
7 | - */ | ||
8 | -public class BayonetReleaseCheckImportCustomsClearance implements BayonetReleaseCheckAdvanced { | ||
9 | - | ||
10 | - private static final org.slf4j.Logger log4 = org.slf4j.LoggerFactory.getLogger(BayonetReleaseCheckImportCustomsClearance.class); | ||
11 | - | ||
12 | - @Override | ||
13 | - public void importLocalDelivery( String ieType) { | ||
14 | - log4.info("[Adapter]-进口-{}-本地-清关适配器处理,处理本地清关业务",ieType); | ||
15 | - } | ||
16 | - | ||
17 | - @Override | ||
18 | - public void exportLocalCustoms(String ieType) { | ||
19 | - log4.info("[Adapter]-出口-{}-本地清关适配器处理,什么也不做",ieType); | ||
20 | - | ||
21 | - } | ||
22 | -} |
1 | +package com.sy.service.impl; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.alibaba.fastjson.JSONArray; | ||
5 | +import com.alibaba.fastjson.JSONObject; | ||
6 | +import com.sy.crossDomain.buildBarCode; | ||
7 | +import com.sy.logic.LiftBar; | ||
8 | +import com.sy.model.*; | ||
9 | +import com.sy.service.*; | ||
10 | +import com.sy.socket.CommandClient; | ||
11 | +import com.sy.utils.FileTool; | ||
12 | +import org.apache.commons.lang.StringUtils; | ||
13 | +import org.slf4j.Logger; | ||
14 | +import org.slf4j.LoggerFactory; | ||
15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
16 | +import org.springframework.stereotype.Service; | ||
17 | + | ||
18 | +import javax.validation.constraints.NotNull; | ||
19 | +import java.math.BigDecimal; | ||
20 | +import java.util.*; | ||
21 | +import java.util.stream.Collectors; | ||
22 | + | ||
23 | +import static com.sy.service.impl.ResMessageServiceImpl.toStrArry; | ||
24 | + | ||
25 | +@Service("GatherInfoHandle") | ||
26 | +public class GatherInfoHandleImpl implements GatherInfoService { | ||
27 | + | ||
28 | + private static final Logger logger = LoggerFactory.getLogger(LiftBar.class); | ||
29 | + | ||
30 | + //逻辑判断后的返回信息定义 | ||
31 | + private static String PERMITTHOUGH = "直接放行"; | ||
32 | + private static String GROWSSEXCETION = "禁止通行,重量不在可控范围"; | ||
33 | + private static String NORECORD = "车辆未备案或者识别错误,车牌号:"; | ||
34 | + private static String NO_CHEPAI = "未识别到车牌号:"; | ||
35 | + private static String INPUTSTATION = "此车辆未做进站申请"; | ||
36 | + private static String ENTERSTATION = "此车辆未做出站申请"; | ||
37 | + private static String ISVALID = "二维码数据异常,请使用正确的二维码数据"; | ||
38 | + private static String ERRORWT = "出起始场站的重量和进目的场站的重量不一致"; | ||
39 | + private static String IEPORSE = "无相对应进出场申请"; | ||
40 | + private static String FANGXING= "有运单未放行"; | ||
41 | + private static String FENBO = "装载运单的分拨申请舱单未通过校验"; | ||
42 | + private static String NOGrossWt = "过磅重量异常"; | ||
43 | + private static String BLACKLIST= "此车辆已被拉进黑名单,不允许出区"; | ||
44 | + | ||
45 | + @Autowired | ||
46 | + FeignService feignService; | ||
47 | + | ||
48 | + @Autowired | ||
49 | + NmmsService nmmsService; | ||
50 | + | ||
51 | + /** | ||
52 | + * 车辆信息备案表 | ||
53 | + */ | ||
54 | + @Autowired | ||
55 | + LandRoadVeService veService; | ||
56 | + | ||
57 | + @Autowired | ||
58 | + RedisService redisService; | ||
59 | + | ||
60 | + @Autowired | ||
61 | + BusnesslistinfoService busnesslistinfoService; | ||
62 | + | ||
63 | + /** | ||
64 | + * 进出场申请表 | ||
65 | + */ | ||
66 | + @Autowired | ||
67 | + LandBusListService listService; | ||
68 | + | ||
69 | + /** | ||
70 | + * 重量校验算法 | ||
71 | + */ | ||
72 | + @Autowired | ||
73 | + WeightCheckHandleService weightCheckHandleService; | ||
74 | + | ||
75 | + /** | ||
76 | + * 查询运单放行表 | ||
77 | + */ | ||
78 | + @Autowired | ||
79 | + ResMessageService resMessageService; | ||
80 | + | ||
81 | + @Autowired | ||
82 | + CommandLogService commandLogService; | ||
83 | + | ||
84 | + /** | ||
85 | + * 车辆过卡信息 | ||
86 | + */ | ||
87 | + private GatherInfo info; | ||
88 | + | ||
89 | + /** | ||
90 | + * 车辆流转申请表头信息 | ||
91 | + */ | ||
92 | + private LandBusinessTypeList landBusinessTypeList; | ||
93 | + | ||
94 | + private List<LandBusinessTypeList> landBusinessTypeListList; | ||
95 | + | ||
96 | + /** | ||
97 | + * 车辆申请表体信息 | ||
98 | + */ | ||
99 | + private List<LAND_BUSINEESTYPE_LIST_INFO> listinfos; | ||
100 | + | ||
101 | + | ||
102 | + | ||
103 | + /** | ||
104 | + * 过磅重量 | ||
105 | + */ | ||
106 | + private double growssWt=0.0; | ||
107 | + /** | ||
108 | + * 车牌号 | ||
109 | + */ | ||
110 | + private String vaName; | ||
111 | + | ||
112 | + /** | ||
113 | + * 车辆备案重量 | ||
114 | + */ | ||
115 | + private double selfWt=0.0; | ||
116 | + | ||
117 | + /** | ||
118 | + * 初始化装载货物重量 | ||
119 | + */ | ||
120 | + private double goodsWt=0.0; | ||
121 | + /** | ||
122 | + * 车辆入场时的重量 | ||
123 | + */ | ||
124 | + private double inWt=0.0; | ||
125 | + | ||
126 | + /** | ||
127 | + * 计算后的车辆进出场差值 | ||
128 | + */ | ||
129 | + private double diffVal=0.0; | ||
130 | + | ||
131 | + | ||
132 | + | ||
133 | + @Override | ||
134 | + public int save(GatherInfo info) { | ||
135 | + return 0; | ||
136 | + } | ||
137 | + | ||
138 | + @Override | ||
139 | + public void handel(GatherInfo gatherInfo) { | ||
140 | + this.info = gatherInfo; | ||
141 | + //获取过磅重量 | ||
142 | + growssWt = info.getGrosswt().doubleValue(); | ||
143 | + | ||
144 | + //取车牌号,判定卡口是否取到车牌号 | ||
145 | + vaName = info.getVename(); | ||
146 | + } | ||
147 | + | ||
148 | + | ||
149 | + /** | ||
150 | + * 一. | ||
151 | + * 场站白名单 | ||
152 | + * @return 白名单 true. 其他走校验 | ||
153 | + */ | ||
154 | + private boolean areaWhiteListCheck(){ | ||
155 | + if(FileTool.readProperties("stationsf").equals(info.getAreaid())) { | ||
156 | + return true; | ||
157 | + } | ||
158 | + return false; | ||
159 | + } | ||
160 | + | ||
161 | + | ||
162 | + /** | ||
163 | + * 1. 车牌信息校验 | ||
164 | + */ | ||
165 | + private boolean veNameCheck(String veName){ | ||
166 | + //1. 若无车牌号,返回未识别错误 | ||
167 | + if (StringUtils.isEmpty(vaName)) { | ||
168 | + logger.error(NO_CHEPAI+vaName); | ||
169 | + sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList(),listinfos); | ||
170 | + //CommandClient.Client(info, NO_CHEPAI + vaName); | ||
171 | + return false; | ||
172 | + } | ||
173 | + return true; | ||
174 | + } | ||
175 | + | ||
176 | + /** | ||
177 | + * 2. 车辆备案信息校验 | ||
178 | + */ | ||
179 | + private boolean veRecordCheck(){ | ||
180 | + //2. 校验车辆是否备案 | ||
181 | + LandRoadVe ve = veService.selectByFrameNo(vaName); | ||
182 | + //若无备案信息或者黑名单,返回车辆未备案或者识别错误, | ||
183 | + if (ve == null && !veBlackListCheck(ve)) { | ||
184 | + logger.error(NORECORD+vaName); | ||
185 | + sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList(),listinfos); | ||
186 | + //CommandClient.Client(info, NORECORD + vaName); | ||
187 | + return false; | ||
188 | + } | ||
189 | + | ||
190 | + //车辆备案重量 | ||
191 | + selfWt=Double.parseDouble(ve.getSelfWt()); | ||
192 | + return true; | ||
193 | + | ||
194 | + } | ||
195 | + | ||
196 | + /** | ||
197 | + * 3. 车辆黑名单校验 | ||
198 | + */ | ||
199 | + private boolean veBlackListCheck(LandRoadVe ve){ | ||
200 | + if("Y".equals(ve.getVeState())){ | ||
201 | + sendBw(info,false,BLACKLIST + vaName,new LandBusinessTypeList(),listinfos); | ||
202 | + return false; | ||
203 | + } | ||
204 | + return true; | ||
205 | + } | ||
206 | + | ||
207 | + /** | ||
208 | + * 4. 车辆进出场流转申请单信息校验 | ||
209 | + * 二维码不用校验了,二维码失效会删除redis缓存 | ||
210 | + * @return | ||
211 | + */ | ||
212 | + private boolean LandBusinessFormCheck(){ | ||
213 | + try { | ||
214 | + //通过车牌号,二维码,场站,通道号,进出类型查询进出场站申请列表 | ||
215 | + String landBusinessJson = redisService.get(info.getVename()); | ||
216 | + List<LandBusinessTypeList> list = new ArrayList<>(); | ||
217 | + if (StringUtils.isNotEmpty(landBusinessJson)){ | ||
218 | + | ||
219 | + list = (List<LandBusinessTypeList>) JSON.parseObject(landBusinessJson,List.class); | ||
220 | + | ||
221 | + landBusinessTypeListList = list; | ||
222 | + //4. 若查询结果为null,返回无相对应进出场申请 | ||
223 | + if (list == null || list.isEmpty()) { | ||
224 | + logger.error(vaName+IEPORSE); | ||
225 | + sendBw(info,false,vaName+IEPORSE,null,listinfos); | ||
226 | + return false; | ||
227 | + } | ||
228 | + | ||
229 | + list.stream() | ||
230 | + .filter( item->{ | ||
231 | + if (item.getAisle().equals(info.getChnlno()) && item.getBarcode().equals(info.getBarcode())){ | ||
232 | + landBusinessTypeList = item; | ||
233 | + | ||
234 | + //离场装载货物重量 | ||
235 | + goodsWt = Double.parseDouble(landBusinessTypeList.getRemark()); | ||
236 | + | ||
237 | + return true; | ||
238 | + }else { | ||
239 | + return false; | ||
240 | + } | ||
241 | + }); | ||
242 | + }else { | ||
243 | + logger.error("未找到车辆-{}的申请缓存信息",info.getVename()); | ||
244 | + logger.info("未找到车辆-{}的申请缓存信息,或者流转已超期失效",info.getVename()); | ||
245 | + } | ||
246 | + }catch (Exception e){ | ||
247 | + return false; | ||
248 | + } | ||
249 | + | ||
250 | + return true; | ||
251 | + } | ||
252 | + | ||
253 | + /** | ||
254 | + * 流转申请-货物类型白名单,白名单的货物类型目前直接放行 | ||
255 | + * @return | ||
256 | + */ | ||
257 | + private boolean goodsWhiteListCheck(){ | ||
258 | + if(!"普通货物".equals(landBusinessTypeList.getCocode()) | ||
259 | + && !"转关货物".equals(landBusinessTypeList.getCocode()) | ||
260 | + && !"退库货物".equals(landBusinessTypeList.getCocode()) ) { | ||
261 | + //todo:比如货物类型为快件货物,只走重量校验,不走放行信息等校验. | ||
262 | + //todo:退库货物可以关联货运系统,得到退库信息进行比对 | ||
263 | + //todo:查验货物走查验信息比对 | ||
264 | + //todo:快件暂不校验直接放行,不过得录单 | ||
265 | + //todo:换单货物校验逻辑待定 | ||
266 | + //todo:未来取消货物类型判定. | ||
267 | + logger.info("车辆装载货物为:" + landBusinessTypeList.getCocode()); | ||
268 | + return true; | ||
269 | + } | ||
270 | + return false; | ||
271 | + } | ||
272 | + | ||
273 | + /** | ||
274 | + * 5. 车辆过磅重量校验 | ||
275 | + * @return true 通过 false 不通过 | ||
276 | + */ | ||
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); | ||
282 | + return false; | ||
283 | + } | ||
284 | + return true; | ||
285 | + } | ||
286 | + | ||
287 | + /** | ||
288 | + * 离场时需要获取的车辆进场信息,入场重量,进出场差值 | ||
289 | + */ | ||
290 | + private void inStationInfo(){ | ||
291 | + List<LandBusinessTypeList> stationInChanleInfo= listService.selectwt(info.getVename(),info.getBarcode(),info.getAreaid(),"I"); | ||
292 | + if (stationInChanleInfo.isEmpty()){ | ||
293 | + logger.info("未查询到车辆:{}的入场信息",info.getVename()); | ||
294 | + }else { | ||
295 | + for(LandBusinessTypeList typeList:stationInChanleInfo){ | ||
296 | + if(typeList.getAislewt()!=null){ | ||
297 | + //对应场站进场过磅重量 | ||
298 | + inWt=typeList.getAislewt(); | ||
299 | + } | ||
300 | + diffVal = inWt- growssWt; | ||
301 | + } | ||
302 | + | ||
303 | + //TODO:进场校验 增加 车辆备案重量要 <= 进场过磅重量 ,要有误差判定 | ||
304 | + } | ||
305 | + } | ||
306 | + | ||
307 | + | ||
308 | + | ||
309 | + /** | ||
310 | + * 此通道对应的流转申请货物重量. | ||
311 | + */ | ||
312 | + private void setGoodsWt(LandBusinessTypeList list){ | ||
313 | + | ||
314 | + } | ||
315 | + | ||
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 | + } | ||
328 | + | ||
329 | + /** | ||
330 | + * 设置表体全局变量 | ||
331 | + */ | ||
332 | + private void setListinfos(){ | ||
333 | + //查询运单列表 | ||
334 | + listinfos=busnesslistinfoService.selectmanilist(info.getBarcode()); | ||
335 | + } | ||
336 | + | ||
337 | + /** | ||
338 | + * 出区抬杆放行判定 | ||
339 | + * @return | ||
340 | + */ | ||
341 | + private boolean checkRelease(){ | ||
342 | + logger.info("[进出场申请]-业务类型为:"+landBusinessTypeList.getCocode()+landBusinessTypeList.getBusinesstype()); | ||
343 | + switch (landBusinessTypeList.getBusinesstype()){ | ||
344 | + case "空车业务": | ||
345 | + if(weightCheckHandleService.checkEmpty(growssWt,selfWt)){ | ||
346 | + return true; | ||
347 | + }else{ | ||
348 | + logger.error("[空车业务]-出场重量未通过校验:"+GROWSSEXCETION); | ||
349 | + sendBw(info,false,GROWSSEXCETION,landBusinessTypeList,listinfos); | ||
350 | + return false; | ||
351 | + } | ||
352 | + case "出口转关": | ||
353 | + case "出口送货": | ||
354 | + if (weightCheckHandleService.checkExportDownLoading(growssWt, selfWt, goodsWt,inWt)){ | ||
355 | + return true; | ||
356 | + }else{ | ||
357 | + logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION); | ||
358 | + sendBw(info,false,GROWSSEXCETION,landBusinessTypeList,listinfos); | ||
359 | + return false; | ||
360 | + } | ||
361 | + case "进口转关": | ||
362 | + case "进口提货": | ||
363 | + if (weightCheckHandleService.checkImportDlv(growssWt, selfWt, goodsWt,inWt)){ | ||
364 | + if ("退库货物".equals(landBusinessTypeList.getCocode())){ | ||
365 | + /** | ||
366 | + * 退库货物不校验运单放行. | ||
367 | + */ | ||
368 | + logger.info("[退库业务]-重量核验通过."); | ||
369 | + }else{ | ||
370 | + //检查运单放行 | ||
371 | + if (resMessageService.checkManifestRelease(info,listinfos)){ | ||
372 | + return true; | ||
373 | + }else { | ||
374 | + //有运单未放行 | ||
375 | + logger.error("[进口提货]-出场未通过校验:"+FANGXING+landBusinessTypeList.getMasterList()); | ||
376 | + sendBw(info,false,FANGXING+landBusinessTypeList.getMasterList(),landBusinessTypeList,listinfos); | ||
377 | + return false; | ||
378 | + } | ||
379 | + } | ||
380 | + //todo:装载运单历史数据累加超重判定 | ||
381 | + }else{ | ||
382 | + logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION); | ||
383 | + sendBw(info,false,GROWSSEXCETION,landBusinessTypeList,listinfos); | ||
384 | + return false; | ||
385 | + } | ||
386 | + break; | ||
387 | + case "分拨业务": | ||
388 | + if (weightCheckHandleService.checkAllocateOrDispatch(growssWt, selfWt, goodsWt,inWt)){ | ||
389 | + //todo:检查分拨申请 | ||
390 | + boolean allocatCheck = checkNmmsAllocate(landBusinessTypeList.getMasterList()); | ||
391 | + if(!allocatCheck){ | ||
392 | + logger.error("[分拨业务]-分拨申请舱单未通过校验:"+FENBO); | ||
393 | + sendBw(info,false,FENBO,landBusinessTypeList,listinfos); | ||
394 | + return false; | ||
395 | + } | ||
396 | + return true; | ||
397 | + //todo:分拨运抵通知,重车入场视为运抵 | ||
398 | + }else{ | ||
399 | + logger.error("[分拨业务]-出场重量未通过校验:"+GROWSSEXCETION); | ||
400 | + sendBw(info,false,GROWSSEXCETION,landBusinessTypeList,listinfos); | ||
401 | + return false; | ||
402 | + } | ||
403 | + case "调拨业务": | ||
404 | + if (weightCheckHandleService.checkAllocateOrDispatch(growssWt, selfWt, goodsWt,inWt)){ | ||
405 | + //检查运单放行 | ||
406 | + if (resMessageService.checkManifestRelease(info,listinfos)){ | ||
407 | + return true; | ||
408 | + }else { | ||
409 | + //有运单未放行 | ||
410 | + logger.error("[调拨业务]-出场未通过校验:"+FANGXING+landBusinessTypeList.getMasterList()); | ||
411 | + sendBw(info,false,FANGXING,landBusinessTypeList,listinfos); | ||
412 | + return false; | ||
413 | + } | ||
414 | + //todo:检查ULD放行. | ||
415 | + }else{ | ||
416 | + logger.error("[调拨业务]-出场未通过校验:"+GROWSSEXCETION); | ||
417 | + sendBw(info,false,GROWSSEXCETION,landBusinessTypeList,listinfos); | ||
418 | + return false; | ||
419 | + } | ||
420 | + default: | ||
421 | + logger.error("[未知业务类型]-出场未通过校验"); | ||
422 | + break; | ||
423 | + } | ||
424 | + | ||
425 | + return false; | ||
426 | + } | ||
427 | + | ||
428 | + /** | ||
429 | + * 记录进出区信息 | ||
430 | + */ | ||
431 | + private void record(){ | ||
432 | + if ("I".equals(info.getIetype())){ | ||
433 | + landBusinessTypeList.setAislewt(info.getGrosswt().doubleValue()); | ||
434 | + landBusinessTypeList.setUpdateDate(new Date()); | ||
435 | + landBusinessTypeList.setRemark(String.format("%.1f", goodsWt)); | ||
436 | + //车辆备案重量 | ||
437 | + landBusinessTypeList.setRemark2(String.valueOf(selfWt)); | ||
438 | + landBusinessTypeList.setContrastflag("已进站"); | ||
439 | + }else { | ||
440 | + landBusinessTypeList.setAislewt(info.getGrosswt().doubleValue()); | ||
441 | + landBusinessTypeList.setUpdateDate(new Date()); | ||
442 | + //装载货物总重量 | ||
443 | + landBusinessTypeList.setRemark(String.format("%.1f", goodsWt)); | ||
444 | + //进出差值 | ||
445 | + landBusinessTypeList.setRemark1(String.format("%.1f", diffVal)); | ||
446 | + landBusinessTypeList.setRemark2(String.valueOf(selfWt)); | ||
447 | + landBusinessTypeList.setContrastflag("已出站"); | ||
448 | + } | ||
449 | + | ||
450 | + //todo:判定放行后,插入数据库,出入区记录 | ||
451 | + landBusinessTypeList.setId(UUID.randomUUID().toString()); | ||
452 | + landBusinessTypeList.setIsvalid("1"); | ||
453 | + //todo:这里SEQN也要入库 | ||
454 | + listService.saveList(landBusinessTypeList); | ||
455 | + } | ||
456 | + | ||
457 | + /** | ||
458 | + * 流转申请是否核销判定 | ||
459 | + */ | ||
460 | + private void releaseFormCheck(){ | ||
461 | + //二维码已出区的记录 | ||
462 | + List<LandBusinessTypeList> havenCrossList = listService.selectByBarcodeWithE(info.getBarcode()); | ||
463 | + //申请核销判定 | ||
464 | + for (LandBusinessTypeList businessTypeList : havenCrossList) { | ||
465 | + List<LandBusinessTypeList> r = landBusinessTypeListList.stream().filter(item ->{ | ||
466 | + if(item.getEndstation().equals(businessTypeList.getEndstation())) { | ||
467 | + landBusinessTypeListList.remove(item); | ||
468 | + return true; | ||
469 | + }else { | ||
470 | + return false; | ||
471 | + } | ||
472 | + }) | ||
473 | + .collect(Collectors.toList()); | ||
474 | + } | ||
475 | + | ||
476 | + if (landBusinessTypeListList.isEmpty()){ | ||
477 | + //todo:流转申请状态核销 | ||
478 | + //二维码核销 | ||
479 | + releaseBarCode(); | ||
480 | + } | ||
481 | + | ||
482 | + } | ||
483 | + | ||
484 | + /** | ||
485 | + * 二维码失效核销->判定及失效通知. | ||
486 | + */ | ||
487 | + private void releaseBarCode(){ | ||
488 | + //二维码判定 | ||
489 | + int count=listService.selectlaststation(info.getVename(),info.getBarcode()); | ||
490 | + //二维码失效通知,已进入场站的与缓存比较. | ||
491 | + if(count==0){ | ||
492 | + //todo:测试注释掉,二维码释放 | ||
493 | + logger.info("[进出场申请]-二维码释放:"+vaName); | ||
494 | + buildBarCode.cancleBarCode(vaName); | ||
495 | + } | ||
496 | + } | ||
497 | + | ||
498 | + /** | ||
499 | + * todo:车单关系绑定报文 | ||
500 | + */ | ||
501 | + | ||
502 | + /** | ||
503 | + * 发送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) { | ||
512 | + logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); | ||
513 | + boolean flag = false; | ||
514 | + if (check) { | ||
515 | + CommandClient.Client(info, PERMITTHOUGH); | ||
516 | + logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<=============="); | ||
517 | + flag = true; | ||
518 | + } else { | ||
519 | + CommandClient.Client(info, reason); | ||
520 | + logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<=============="); | ||
521 | + } | ||
522 | + commandlog(info,check,reason,land,list_infos); | ||
523 | + return flag; | ||
524 | + } | ||
525 | + | ||
526 | + /** | ||
527 | + * 放行日志记录 | ||
528 | + * @param info | ||
529 | + * @param check | ||
530 | + * @param reason | ||
531 | + * @param land | ||
532 | + * @param list_infos | ||
533 | + */ | ||
534 | + public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){ | ||
535 | + String flag="",type=""; | ||
536 | + commandLog command=new commandLog(); | ||
537 | + command.setId(UUID.randomUUID().toString()); | ||
538 | + command.setBarcode(info.getBarcode()); | ||
539 | + | ||
540 | + if(land!=null){ | ||
541 | + command.setBarcode(land.getBarcode()); | ||
542 | + command.setBusnessType(land.getBusinesstype()); | ||
543 | + } | ||
544 | + command.setAreaId(info.getAreaid()); | ||
545 | + command.setChnlNo(info.getChnlno()); | ||
546 | + if (check){ | ||
547 | + flag = "00"; | ||
548 | + } else{ | ||
549 | + flag = "11"; | ||
550 | + } | ||
551 | + if("I".equals(info.getIetype())){ | ||
552 | + type="000000200000000000"; | ||
553 | + }else{ | ||
554 | + type="000000100000000000"; | ||
555 | + } | ||
556 | + command.setReasonCode(flag+type); | ||
557 | + command.setReasonText(reason); | ||
558 | + command.setVeName(info.getVename()); | ||
559 | + command.setVeWeight(selfWt); | ||
560 | + command.setIeType(info.getIetype()); | ||
561 | + command.setExitGrossWeight(info.getGrosswt().doubleValue()); | ||
562 | + command.setInGrossWeight(inWt); | ||
563 | + command.setGoodsWeight(goodsWt); | ||
564 | + command.setActualGoodsWeight(diffVal); | ||
565 | + if(list_infos.size()>0){ | ||
566 | + command.setMasterList(Arrays.toString(toStrArry(list_infos))); | ||
567 | + } | ||
568 | + commandLogService.insert(command); | ||
569 | + } | ||
570 | + | ||
571 | + /** | ||
572 | + * 新舱单分拨申请数据查询 | ||
573 | + * @param waybill 查询的运单号 | ||
574 | + * @return | ||
575 | + */ | ||
576 | + private Map nmmsAllocate(@NotNull String waybill){ | ||
577 | + logger.info("新舱单查询分拨申请数据开始"); | ||
578 | + Feign_Allocate_Search feignAllocateSearch = new Feign_Allocate_Search(waybill,0,10); | ||
579 | + Map map = nmmsService.getAllocate(feignAllocateSearch); | ||
580 | + logger.info(""+map); | ||
581 | + return map; | ||
582 | + } | ||
583 | + | ||
584 | + | ||
585 | + /** | ||
586 | + * 分拨申请查询 | ||
587 | + * @param waybill | ||
588 | + * @return | ||
589 | + */ | ||
590 | + private boolean checkNmmsAllocate(String waybill){ | ||
591 | + if (waybill.length() < 1) { | ||
592 | + return false; | ||
593 | + } | ||
594 | + waybill = waybill.replace("-", ""); | ||
595 | + //中文逗号替换 | ||
596 | + waybill = waybill.replace(",", ","); | ||
597 | + String[] maifest = waybill.split(","); | ||
598 | + logger.info("运单列表:" + waybill); | ||
599 | + boolean flag = false; | ||
600 | + | ||
601 | + for (String awb : maifest) { | ||
602 | + Map map= nmmsAllocate(awb); | ||
603 | + if (map.containsKey("reslut")){ | ||
604 | + String result = map.get("reslut").toString(); | ||
605 | + JSONObject jsonObject = JSON.parseObject(result); | ||
606 | + if (jsonObject.containsKey("ds")) { | ||
607 | + JSONArray ds = jsonObject.getJSONArray("ds"); | ||
608 | + JSONObject awbinfo = ds.getJSONObject(0); | ||
609 | + if (awbinfo.containsKey("RECEIPTINFORMATION")){ | ||
610 | + if (awbinfo.getString("RECEIPTINFORMATION").contains("39301") || awbinfo.getString("RECEIPTINFORMATION").contains("39103")){ | ||
611 | + logger.info("运单:{},分拨回执查询结果:{}",awb,awbinfo.getString("RECEIPTINFORMATION")); | ||
612 | + }else { | ||
613 | + logger.info("运单{}分拨申请回执不正常:{}",awb,awbinfo.getString("RECEIPTINFORMATION")); | ||
614 | + return false; | ||
615 | + } | ||
616 | + } | ||
617 | + }else { | ||
618 | + logger.info("运单:{}分拨申请回执未查询到,或未进行分拨申请",awb); | ||
619 | + return false; | ||
620 | + } | ||
621 | + }else{ | ||
622 | + logger.info("运单:{}分拨申请回执未查询到,或未进行分拨申请",awb); | ||
623 | + return false; | ||
624 | + } | ||
625 | + | ||
626 | + } | ||
627 | + return true; | ||
628 | + } | ||
629 | +} |
@@ -22,4 +22,10 @@ public class GatherInfoServiceImpl implements GatherInfoService { | @@ -22,4 +22,10 @@ public class GatherInfoServiceImpl implements GatherInfoService { | ||
22 | } | 22 | } |
23 | return row; | 23 | return row; |
24 | } | 24 | } |
25 | + | ||
26 | + @Override | ||
27 | + public void handel(GatherInfo info){ | ||
28 | + | ||
29 | + } | ||
30 | + | ||
25 | } | 31 | } |
@@ -66,6 +66,17 @@ public class LandBusListServiceImpl implements LandBusListService { | @@ -66,6 +66,17 @@ public class LandBusListServiceImpl implements LandBusListService { | ||
66 | } | 66 | } |
67 | 67 | ||
68 | @Override | 68 | @Override |
69 | + public List<LandBusinessTypeList> selectByBarcodeWithE(String barcode){ | ||
70 | + List<LandBusinessTypeList> list= null; | ||
71 | + try{ | ||
72 | + list = listMapper.selectByBarcodeWithE(barcode); | ||
73 | + }catch (Exception e){ | ||
74 | + System.out.println(e.getMessage()); | ||
75 | + } | ||
76 | + return list; | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
69 | public int updateByBarcode(String barcode) { | 80 | public int updateByBarcode(String barcode) { |
70 | return listMapper.updateByBarCode(barcode); | 81 | return listMapper.updateByBarCode(barcode); |
71 | } | 82 | } |
1 | +package com.sy.service.impl; | ||
2 | + | ||
3 | +import com.sy.service.RedisService; | ||
4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
5 | +import org.springframework.data.redis.core.*; | ||
6 | +import org.springframework.stereotype.Service; | ||
7 | +import org.springframework.util.CollectionUtils; | ||
8 | + | ||
9 | +import java.nio.charset.StandardCharsets; | ||
10 | +import java.util.*; | ||
11 | +import java.util.concurrent.TimeUnit; | ||
12 | + | ||
13 | +@Service | ||
14 | +public class RedisServiceImpl implements RedisService { | ||
15 | + | ||
16 | + @Autowired | ||
17 | + private StringRedisTemplate redisTemplate; | ||
18 | + | ||
19 | + /** | ||
20 | + * 指定缓存失效时间 | ||
21 | + * @param key 键 | ||
22 | + * @param time 时间(秒) | ||
23 | + * @return | ||
24 | + */ | ||
25 | + @Override | ||
26 | + public boolean expire(String key, long time){ | ||
27 | + try { | ||
28 | + if(time>0){ | ||
29 | + redisTemplate.expire(key, time, TimeUnit.SECONDS); | ||
30 | + } | ||
31 | + return true; | ||
32 | + } catch (Exception e) { | ||
33 | + e.printStackTrace(); | ||
34 | + return false; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * 根据key 获取过期时间 | ||
40 | + * @param key 键 不能为null | ||
41 | + * @return 时间(秒) 返回0代表为永久有效 | ||
42 | + */ | ||
43 | + public long getExpire(String key){ | ||
44 | + return redisTemplate.getExpire(key,TimeUnit.SECONDS); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * 判断key是否存在 | ||
49 | + * @param key 键 | ||
50 | + * @return true 存在 false不存在 | ||
51 | + */ | ||
52 | + @Override | ||
53 | + public boolean hasKey(String key){ | ||
54 | + try { | ||
55 | + return redisTemplate.hasKey(key); | ||
56 | + } catch (Exception e) { | ||
57 | + e.printStackTrace(); | ||
58 | + return false; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 删除缓存 | ||
64 | + * @param key 可以传一个值 或多个 | ||
65 | + */ | ||
66 | + @Override | ||
67 | + @SuppressWarnings("unchecked") | ||
68 | + public void del(String ... key){ | ||
69 | + if(key!=null&&key.length>0){ | ||
70 | + if(key.length==1){ | ||
71 | + redisTemplate.delete(key[0]); | ||
72 | + }else{ | ||
73 | + redisTemplate.delete(CollectionUtils.arrayToList(key)); | ||
74 | + } | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * 【 递归删除redis key-value 】 | ||
80 | + * 效率会低点 但是删除方法安全 | ||
81 | + * @author yangjunxiong | ||
82 | + * @date 2021/6/21 10:05 | ||
83 | + **/ | ||
84 | + @Override | ||
85 | + public Set<String> deleteBatchByKeys(String key) { | ||
86 | + Set<String> keys = new HashSet<>(); | ||
87 | + redisTemplate.execute((RedisCallback<Set<String>>) connection -> { | ||
88 | + try (Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder() | ||
89 | + .match(key + "*") | ||
90 | + .count(5000).build())) { | ||
91 | + while (cursor.hasNext()) { | ||
92 | + keys.add(new String(cursor.next(), StandardCharsets.UTF_8)); | ||
93 | + } | ||
94 | + } catch (Exception e) { | ||
95 | + throw new RuntimeException(e); | ||
96 | + } | ||
97 | + return keys; | ||
98 | + }); | ||
99 | + if (CollectionUtils.isEmpty(keys)) { | ||
100 | + return Collections.emptySet(); | ||
101 | + } | ||
102 | + for (String key1 : keys) { | ||
103 | + redisTemplate.delete(key1); | ||
104 | + } | ||
105 | + if (!CollectionUtils.isEmpty(keys)) { | ||
106 | + return deleteBatchByKeys(key); | ||
107 | + } | ||
108 | + return keys; | ||
109 | + } | ||
110 | + | ||
111 | + | ||
112 | + //============================String============================= | ||
113 | + /** | ||
114 | + * 普通缓存获取 | ||
115 | + * @param key 键 | ||
116 | + * @return 值 | ||
117 | + */ | ||
118 | + @Override | ||
119 | + public String get(String key){ | ||
120 | + return key==null?null:redisTemplate.opsForValue().get(key); | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * 普通缓存放入 | ||
125 | + * @param key 键 | ||
126 | + * @param value 值 | ||
127 | + * @return true成功 false失败 | ||
128 | + */ | ||
129 | + @Override | ||
130 | + public boolean set(String key, String value) { | ||
131 | + try { | ||
132 | + redisTemplate.opsForValue().set(key, value); | ||
133 | + return true; | ||
134 | + } catch (Exception e) { | ||
135 | + e.printStackTrace(); | ||
136 | + return false; | ||
137 | + } | ||
138 | + } | ||
139 | + | ||
140 | + /** | ||
141 | + * 普通缓存放入并设置时间 | ||
142 | + * @param key 键 | ||
143 | + * @param value 值 | ||
144 | + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 | ||
145 | + * @return true成功 false 失败 | ||
146 | + */ | ||
147 | + @Override | ||
148 | + public boolean set(String key, String value, long time){ | ||
149 | + try { | ||
150 | + if(time>0){ | ||
151 | + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); | ||
152 | + }else{ | ||
153 | + set(key, value); | ||
154 | + } | ||
155 | + return true; | ||
156 | + } catch (Exception e) { | ||
157 | + e.printStackTrace(); | ||
158 | + return false; | ||
159 | + } | ||
160 | + } | ||
161 | + | ||
162 | + /** | ||
163 | + * 递增 | ||
164 | + * @param key 键 | ||
165 | + * @param delta 要增加几(大于0) | ||
166 | + * @return | ||
167 | + */ | ||
168 | + public long incr(String key, long delta){ | ||
169 | + if(delta<0){ | ||
170 | + throw new RuntimeException("递增因子必须大于0"); | ||
171 | + } | ||
172 | + return redisTemplate.opsForValue().increment(key, delta); | ||
173 | + } | ||
174 | + | ||
175 | + /** | ||
176 | + * 递减 | ||
177 | + * @param key 键 | ||
178 | + * @param delta 要减少几(小于0) | ||
179 | + * @return | ||
180 | + */ | ||
181 | + public long decr(String key, long delta){ | ||
182 | + if(delta<0){ | ||
183 | + throw new RuntimeException("递减因子必须大于0"); | ||
184 | + } | ||
185 | + return redisTemplate.opsForValue().increment(key, -delta); | ||
186 | + } | ||
187 | + | ||
188 | + //================================Map================================= | ||
189 | + /** | ||
190 | + * HashGet | ||
191 | + * @param key 键 不能为null | ||
192 | + * @param item 项 不能为null | ||
193 | + * @return 值 | ||
194 | + */ | ||
195 | + public Object hget(String key,String item){ | ||
196 | + return redisTemplate.opsForHash().get(key, item); | ||
197 | + } | ||
198 | + | ||
199 | + /** | ||
200 | + * 获取hashKey对应的所有键值 | ||
201 | + * @param key 键 | ||
202 | + * @return 对应的多个键值 | ||
203 | + */ | ||
204 | + public Map<Object,Object> hmget(String key){ | ||
205 | + return redisTemplate.opsForHash().entries(key); | ||
206 | + } | ||
207 | + | ||
208 | + /** | ||
209 | + * HashSet | ||
210 | + * @param key 键 | ||
211 | + * @param map 对应多个键值 | ||
212 | + * @return true 成功 false 失败 | ||
213 | + */ | ||
214 | + public boolean hmset(String key, Map<String,String> map){ | ||
215 | + try { | ||
216 | + redisTemplate.opsForHash().putAll(key, map); | ||
217 | + return true; | ||
218 | + } catch (Exception e) { | ||
219 | + e.printStackTrace(); | ||
220 | + return false; | ||
221 | + } | ||
222 | + } | ||
223 | + | ||
224 | + /** | ||
225 | + * HashSet 并设置时间 | ||
226 | + * @param key 键 | ||
227 | + * @param map 对应多个键值 | ||
228 | + * @param time 时间(秒) | ||
229 | + * @return true成功 false失败 | ||
230 | + */ | ||
231 | + public boolean hmset(String key, Map<String,String> map, long time){ | ||
232 | + try { | ||
233 | + redisTemplate.opsForHash().putAll(key, map); | ||
234 | + if(time>0){ | ||
235 | + expire(key, time); | ||
236 | + } | ||
237 | + return true; | ||
238 | + } catch (Exception e) { | ||
239 | + e.printStackTrace(); | ||
240 | + return false; | ||
241 | + } | ||
242 | + } | ||
243 | + | ||
244 | + /** | ||
245 | + * 向一张hash表中放入数据,如果不存在将创建 | ||
246 | + * @param key 键 | ||
247 | + * @param item 项 | ||
248 | + * @param value 值 | ||
249 | + * @return true 成功 false失败 | ||
250 | + */ | ||
251 | + public boolean hset(String key,String item,String value) { | ||
252 | + try { | ||
253 | + redisTemplate.opsForHash().put(key, item, value); | ||
254 | + return true; | ||
255 | + } catch (Exception e) { | ||
256 | + e.printStackTrace(); | ||
257 | + return false; | ||
258 | + } | ||
259 | + } | ||
260 | + | ||
261 | + /** | ||
262 | + * 向一张hash表中放入数据,如果不存在将创建 | ||
263 | + * @param key 键 | ||
264 | + * @param item 项 | ||
265 | + * @param value 值 | ||
266 | + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 | ||
267 | + * @return true 成功 false失败 | ||
268 | + */ | ||
269 | + public boolean hset(String key,String item,String value,long time) { | ||
270 | + try { | ||
271 | + redisTemplate.opsForHash().put(key, item, value); | ||
272 | + if(time>0){ | ||
273 | + expire(key, time); | ||
274 | + } | ||
275 | + return true; | ||
276 | + } catch (Exception e) { | ||
277 | + e.printStackTrace(); | ||
278 | + return false; | ||
279 | + } | ||
280 | + } | ||
281 | + | ||
282 | + /** | ||
283 | + * 删除hash表中的值 | ||
284 | + * @param key 键 不能为null | ||
285 | + * @param item 项 可以使多个 不能为null | ||
286 | + */ | ||
287 | + public void hdel(String key, String... item){ | ||
288 | + redisTemplate.opsForHash().delete(key,item); | ||
289 | + } | ||
290 | + | ||
291 | + /** | ||
292 | + * 判断hash表中是否有该项的值 | ||
293 | + * @param key 键 不能为null | ||
294 | + * @param item 项 不能为null | ||
295 | + * @return true 存在 false不存在 | ||
296 | + */ | ||
297 | + public boolean hHasKey(String key, String item){ | ||
298 | + return redisTemplate.opsForHash().hasKey(key, item); | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
302 | + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 | ||
303 | + * @param key 键 | ||
304 | + * @param item 项 | ||
305 | + * @param by 要增加几(大于0) | ||
306 | + * @return | ||
307 | + */ | ||
308 | + public double hincr(String key, String item,double by){ | ||
309 | + return redisTemplate.opsForHash().increment(key, item, by); | ||
310 | + } | ||
311 | + | ||
312 | + /** | ||
313 | + * hash递减 | ||
314 | + * @param key 键 | ||
315 | + * @param item 项 | ||
316 | + * @param by 要减少记(小于0) | ||
317 | + * @return | ||
318 | + */ | ||
319 | + public double hdecr(String key, String item,double by){ | ||
320 | + return redisTemplate.opsForHash().increment(key, item,-by); | ||
321 | + } | ||
322 | + | ||
323 | + //============================set============================= | ||
324 | + /** | ||
325 | + * 根据key获取Set中的所有值 | ||
326 | + * @param key 键 | ||
327 | + * @return | ||
328 | + */ | ||
329 | + public Set<String> sGet(String key){ | ||
330 | + try { | ||
331 | + return redisTemplate.opsForSet().members(key); | ||
332 | + } catch (Exception e) { | ||
333 | + e.printStackTrace(); | ||
334 | + return null; | ||
335 | + } | ||
336 | + } | ||
337 | + | ||
338 | + /** | ||
339 | + * 根据value从一个set中查询,是否存在 | ||
340 | + * @param key 键 | ||
341 | + * @param value 值 | ||
342 | + * @return true 存在 false不存在 | ||
343 | + */ | ||
344 | + public boolean sHasKey(String key,String value){ | ||
345 | + try { | ||
346 | + return redisTemplate.opsForSet().isMember(key, value); | ||
347 | + } catch (Exception e) { | ||
348 | + e.printStackTrace(); | ||
349 | + return false; | ||
350 | + } | ||
351 | + } | ||
352 | + | ||
353 | + /** | ||
354 | + * 将数据放入set缓存 | ||
355 | + * @param key 键 | ||
356 | + * @param values 值 可以是多个 | ||
357 | + * @return 成功个数 | ||
358 | + */ | ||
359 | + public long sSet(String key, String...values) { | ||
360 | + try { | ||
361 | + return redisTemplate.opsForSet().add(key, values); | ||
362 | + } catch (Exception e) { | ||
363 | + e.printStackTrace(); | ||
364 | + return 0; | ||
365 | + } | ||
366 | + } | ||
367 | + | ||
368 | + /** | ||
369 | + * 将set数据放入缓存 | ||
370 | + * @param key 键 | ||
371 | + * @param time 时间(秒) | ||
372 | + * @param values 值 可以是多个 | ||
373 | + * @return 成功个数 | ||
374 | + */ | ||
375 | + public long sSetAndTime(String key,long time,String...values) { | ||
376 | + try { | ||
377 | + Long count = redisTemplate.opsForSet().add(key, values); | ||
378 | + if(time>0) { | ||
379 | + expire(key, time); | ||
380 | + } | ||
381 | + return count; | ||
382 | + } catch (Exception e) { | ||
383 | + e.printStackTrace(); | ||
384 | + return 0; | ||
385 | + } | ||
386 | + } | ||
387 | + | ||
388 | + /** | ||
389 | + * 获取set缓存的长度 | ||
390 | + * @param key 键 | ||
391 | + * @return | ||
392 | + */ | ||
393 | + public long sGetSetSize(String key){ | ||
394 | + try { | ||
395 | + return redisTemplate.opsForSet().size(key); | ||
396 | + } catch (Exception e) { | ||
397 | + e.printStackTrace(); | ||
398 | + return 0; | ||
399 | + } | ||
400 | + } | ||
401 | + | ||
402 | + /** | ||
403 | + * 移除值为value的 | ||
404 | + * @param key 键 | ||
405 | + * @param values 值 可以是多个 | ||
406 | + * @return 移除的个数 | ||
407 | + */ | ||
408 | + public long setRemove(String key, String ...values) { | ||
409 | + try { | ||
410 | + Long count = redisTemplate.opsForSet().remove(key, values); | ||
411 | + return count; | ||
412 | + } catch (Exception e) { | ||
413 | + e.printStackTrace(); | ||
414 | + return 0; | ||
415 | + } | ||
416 | + } | ||
417 | + //===============================list================================= | ||
418 | + | ||
419 | + /** | ||
420 | + * 获取list缓存的内容 | ||
421 | + * @param key 键 | ||
422 | + * @param start 开始 | ||
423 | + * @param end 结束 0 到 -1代表所有值 | ||
424 | + * @return | ||
425 | + */ | ||
426 | + public List<String> lGet(String key, long start, long end){ | ||
427 | + try { | ||
428 | + return redisTemplate.opsForList().range(key, start, end); | ||
429 | + } catch (Exception e) { | ||
430 | + e.printStackTrace(); | ||
431 | + return null; | ||
432 | + } | ||
433 | + } | ||
434 | + | ||
435 | + /** | ||
436 | + * 获取list缓存的长度 | ||
437 | + * @param key 键 | ||
438 | + * @return | ||
439 | + */ | ||
440 | + public long lGetListSize(String key){ | ||
441 | + try { | ||
442 | + return redisTemplate.opsForList().size(key); | ||
443 | + } catch (Exception e) { | ||
444 | + e.printStackTrace(); | ||
445 | + return 0; | ||
446 | + } | ||
447 | + } | ||
448 | + | ||
449 | + /** | ||
450 | + * 通过索引 获取list中的值 | ||
451 | + * @param key 键 | ||
452 | + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 | ||
453 | + * @return | ||
454 | + */ | ||
455 | + public String lGetIndex(String key,long index){ | ||
456 | + try { | ||
457 | + return redisTemplate.opsForList().index(key, index); | ||
458 | + } catch (Exception e) { | ||
459 | + e.printStackTrace(); | ||
460 | + return null; | ||
461 | + } | ||
462 | + } | ||
463 | + | ||
464 | + /** | ||
465 | + * 将list放入缓存 | ||
466 | + * @param key 键 | ||
467 | + * @param value 值 | ||
468 | + * @return | ||
469 | + */ | ||
470 | + public boolean lSet(String key, String value) { | ||
471 | + try { | ||
472 | + redisTemplate.opsForList().rightPush(key, value); | ||
473 | + return true; | ||
474 | + } catch (Exception e) { | ||
475 | + e.printStackTrace(); | ||
476 | + return false; | ||
477 | + } | ||
478 | + } | ||
479 | + | ||
480 | + /** | ||
481 | + * 将list放入缓存 | ||
482 | + * @param key 键 | ||
483 | + * @param value 值 | ||
484 | + * @param time 时间(秒) | ||
485 | + * @return | ||
486 | + */ | ||
487 | + public boolean lSet(String key, String value, long time) { | ||
488 | + try { | ||
489 | + redisTemplate.opsForList().rightPush(key, value); | ||
490 | + if (time > 0) { | ||
491 | + expire(key, time); | ||
492 | + } | ||
493 | + return true; | ||
494 | + } catch (Exception e) { | ||
495 | + e.printStackTrace(); | ||
496 | + return false; | ||
497 | + } | ||
498 | + } | ||
499 | + | ||
500 | + /** | ||
501 | + * 将list放入缓存 | ||
502 | + * @param key 键 | ||
503 | + * @param value 值 | ||
504 | + * @return | ||
505 | + */ | ||
506 | + public boolean lSet(String key, List<String> value) { | ||
507 | + try { | ||
508 | + redisTemplate.opsForList().rightPushAll(key, value); | ||
509 | + return true; | ||
510 | + } catch (Exception e) { | ||
511 | + e.printStackTrace(); | ||
512 | + return false; | ||
513 | + } | ||
514 | + } | ||
515 | + | ||
516 | + /** | ||
517 | + * 将list放入缓存 | ||
518 | + * @param key 键 | ||
519 | + * @param value 值 | ||
520 | + * @param time 时间(秒) | ||
521 | + * @return | ||
522 | + */ | ||
523 | + public boolean lSet(String key, List<String> value, long time) { | ||
524 | + try { | ||
525 | + redisTemplate.opsForList().rightPushAll(key, value); | ||
526 | + if (time > 0) { | ||
527 | + expire(key, time); | ||
528 | + } | ||
529 | + return true; | ||
530 | + } catch (Exception e) { | ||
531 | + e.printStackTrace(); | ||
532 | + return false; | ||
533 | + } | ||
534 | + } | ||
535 | + | ||
536 | + /** | ||
537 | + * 根据索引修改list中的某条数据 | ||
538 | + * @param key 键 | ||
539 | + * @param index 索引 | ||
540 | + * @param value 值 | ||
541 | + * @return | ||
542 | + */ | ||
543 | + public boolean lUpdateIndex(String key, long index,String value) { | ||
544 | + try { | ||
545 | + redisTemplate.opsForList().set(key, index, value); | ||
546 | + return true; | ||
547 | + } catch (Exception e) { | ||
548 | + e.printStackTrace(); | ||
549 | + return false; | ||
550 | + } | ||
551 | + } | ||
552 | + | ||
553 | + /** | ||
554 | + * 移除N个值为value | ||
555 | + * @param key 键 | ||
556 | + * @param count 移除多少个 | ||
557 | + * @param value 值 | ||
558 | + * @return 移除的个数 | ||
559 | + */ | ||
560 | + public long lRemove(String key,long count,String value) { | ||
561 | + try { | ||
562 | + Long remove = redisTemplate.opsForList().remove(key, count, value); | ||
563 | + return remove; | ||
564 | + } catch (Exception e) { | ||
565 | + e.printStackTrace(); | ||
566 | + return 0; | ||
567 | + } | ||
568 | + } | ||
569 | + | ||
570 | + /** | ||
571 | + * 模糊查询获取key值 | ||
572 | + * @param pattern | ||
573 | + * @return | ||
574 | + */ | ||
575 | + public Set keys(String pattern){ | ||
576 | + return redisTemplate.keys(pattern); | ||
577 | + } | ||
578 | + | ||
579 | + /** | ||
580 | + * 使用Redis的消息队列 | ||
581 | + * @param channel | ||
582 | + * @param message 消息内容 | ||
583 | + */ | ||
584 | + public void convertAndSend(String channel, String message){ | ||
585 | + redisTemplate.convertAndSend(channel,message); | ||
586 | + } | ||
587 | + | ||
588 | + | ||
589 | + //=========BoundListOperations 用法 start============ | ||
590 | + | ||
591 | + /** | ||
592 | + *将数据添加到Redis的list中(从右边添加) | ||
593 | + * @param listKey | ||
594 | + * @param expireEnum 有效期的枚举类 | ||
595 | + * @param values 待添加的数据 | ||
596 | + */ | ||
597 | +// public void addToListRight(String listKey, Status.ExpireEnum expireEnum, String... values) { | ||
598 | +// //绑定操作 | ||
599 | +// BoundListOperations<String, String> boundValueOperations = redisTemplate.boundListOps(listKey); | ||
600 | +// //插入数据 | ||
601 | +// boundValueOperations.rightPushAll(values); | ||
602 | +// //设置过期时间 | ||
603 | +// boundValueOperations.expire(expireEnum.getTime(),expireEnum.getTimeUnit()); | ||
604 | +// } | ||
605 | + /** | ||
606 | + * 根据起始结束序号遍历Redis中的list | ||
607 | + * @param listKey | ||
608 | + * @param start 起始序号 | ||
609 | + * @param end 结束序号 | ||
610 | + * @return | ||
611 | + */ | ||
612 | + public List<String> rangeList(String listKey, long start, long end) { | ||
613 | + //绑定操作 | ||
614 | + BoundListOperations<String, String> boundValueOperations = redisTemplate.boundListOps(listKey); | ||
615 | + //查询数据 | ||
616 | + return boundValueOperations.range(start, end); | ||
617 | + } | ||
618 | + /** | ||
619 | + * 弹出右边的值 --- 并且移除这个值 | ||
620 | + * @param listKey | ||
621 | + */ | ||
622 | + public String rifhtPop(String listKey){ | ||
623 | + //绑定操作 | ||
624 | + BoundListOperations<String, String> boundValueOperations = redisTemplate.boundListOps(listKey); | ||
625 | + return boundValueOperations.rightPop(); | ||
626 | + } | ||
627 | +} |
@@ -103,6 +103,13 @@ | @@ -103,6 +103,13 @@ | ||
103 | where BARCODE = #{barcode,jdbcType=VARCHAR} AND ISVALID = "0" | 103 | where BARCODE = #{barcode,jdbcType=VARCHAR} AND ISVALID = "0" |
104 | </select> | 104 | </select> |
105 | 105 | ||
106 | + <select id="selectByBarcodeWithE" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
107 | + select | ||
108 | + <include refid="Base_Column_List" /> | ||
109 | + from land_businesstype_list | ||
110 | + where BARCODE = #{barcode,jdbcType=VARCHAR} AND ISVALID = "1" and and TURNOVERFLAG = "E" | ||
111 | + </select> | ||
112 | + | ||
106 | <select id="selectMessageId" parameterType="java.lang.String" resultMap="BaseResultMap"> | 113 | <select id="selectMessageId" parameterType="java.lang.String" resultMap="BaseResultMap"> |
107 | select | 114 | select |
108 | <include refid="Base_Column_List" /> | 115 | <include refid="Base_Column_List" /> |
@@ -91,52 +91,7 @@ public class BeihuoTests { | @@ -91,52 +91,7 @@ public class BeihuoTests { | ||
91 | "\t</GATHER_INFO>\n" + | 91 | "\t</GATHER_INFO>\n" + |
92 | "</MSG>"; | 92 | "</MSG>"; |
93 | 93 | ||
94 | - public static String XML = "<MSG>\n" + | ||
95 | - "\t<META>\n" + | ||
96 | - "\t\t<SNDR>KAO</SNDR>\n" + | ||
97 | - "\t\t<RCVR/>\n" + | ||
98 | - "\t\t<SEQN>20220624063157</SEQN>\n" + | ||
99 | - "\t\t<DDTM>20220624063157</DDTM>\n" + | ||
100 | - "\t\t<TYPE>KAKO</TYPE>\n" + | ||
101 | - "\t\t<STYP>CARM</STYP>\n" + | ||
102 | - "\t</META>\n" + | ||
103 | - "\t<GATHER_INFO AREA_ID=\"0000000000\" CHNL_NO=\"0000000000\" I_E_TYPE=\"I\" SEQ_NO=\"123\">\n" + | ||
104 | - "\t\t<IC>\n" + | ||
105 | - "\t\t\t<DR_IC_NO/>\n" + | ||
106 | - "\t\t\t<IC_DR_CUSTOMS_NO/>\n" + | ||
107 | - "\t\t\t<IC_CO_CUSTOMS_NO/>\n" + | ||
108 | - "\t\t\t<IC_BILL_NO/>\n" + | ||
109 | - "\t\t\t<IC_GROSS_WT/>\n" + | ||
110 | - "\t\t\t<IC_VE_CUSTOMS_NO/>\n" + | ||
111 | - "\t\t\t<IC_VE_NAME/>\n" + | ||
112 | - "\t\t\t<IC_CONTA_ID/>\n" + | ||
113 | - "\t\t\t<IC_ESEAL_ID/>\n" + | ||
114 | - "\t\t\t<IC_EX_DATA/>\n" + | ||
115 | - "\t\t</IC>\n" + | ||
116 | - "\t\t<WEIGHT>\n" + | ||
117 | - "\t\t\t<GROSS_WT>22000</GROSS_WT>\n" + | ||
118 | - "\t\t</WEIGHT>\n" + | ||
119 | - "\t\t<CAR>\n" + | ||
120 | - "\t\t\t<VE_NAME/>\n" + | ||
121 | - "\t\t\t<CAR_EC_NO/>\n" + | ||
122 | - "\t\t\t<CAR_EC_NO2/>\n" + | ||
123 | - "\t\t\t<VE_CUSTOMS_NO/>\n" + | ||
124 | - "\t\t\t<VE_WT/>\n" + | ||
125 | - "\t\t</CAR>\n" + | ||
126 | - "\t\t<CONTA>\n" + | ||
127 | - "\t\t\t<CONTA_NUM/>\n" + | ||
128 | - "\t\t\t<CONTA_RECO/>\n" + | ||
129 | - "\t\t\t<CONTA_MODEL_F/>\n" + | ||
130 | - "\t\t\t<CONTA_MODEL_B/>\n" + | ||
131 | - "\t\t\t<CONTA_ID_F/>\n" + | ||
132 | - "\t\t\t<CONTA_ID_B/>\n" + | ||
133 | - "\t\t</CONTA>\n" + | ||
134 | - "\t\t<SEAL>\n" + | ||
135 | - "\t\t\t<ESEAL_ID/>\n" + | ||
136 | - "\t\t</SEAL>\n" + | ||
137 | - "\t\t<BAR_CODE>1111</BAR_CODE>\n" + | ||
138 | - "\t</GATHER_INFO>\n" + | ||
139 | - "</MSG>"; | 94 | + |
140 | /** | 95 | /** |
141 | * 进场测试 | 96 | * 进场测试 |
142 | */ | 97 | */ |
@@ -145,18 +100,18 @@ public class BeihuoTests { | @@ -145,18 +100,18 @@ public class BeihuoTests { | ||
145 | //车牌号 | 100 | //车牌号 |
146 | String voNo = "豫A61CR7"; | 101 | String voNo = "豫A61CR7"; |
147 | //过卡重量 | 102 | //过卡重量 |
148 | - String cross_weight= "2000"; | 103 | + String cross_weight= "4800"; |
149 | //场站编号 | 104 | //场站编号 |
150 | - String areaID = "4604600000"; | 105 | + String areaID = "4604000000"; |
151 | //通道编号 | 106 | //通道编号 |
152 | - String chnlNo = "4604601011"; | 107 | + String chnlNo = "4604333311"; |
153 | //进出场类型I/E | 108 | //进出场类型I/E |
154 | String ie = "I"; | 109 | String ie = "I"; |
155 | //二维码 | 110 | //二维码 |
156 | - String barcode = "5198ad"; | 111 | + String barcode = "fb2-4fdb-aa62-b6ee0d33c915"; |
157 | 112 | ||
158 | logger.error("开始进场测试"); | 113 | logger.error("开始进场测试"); |
159 | - IMPORT_XML= XML.replace("${car}",voNo) | 114 | + IMPORT_XML= IMPORT_XML.replace("${car}",voNo) |
160 | .replace("${cross_weight}",cross_weight) | 115 | .replace("${cross_weight}",cross_weight) |
161 | .replace("${areaID}",areaID) | 116 | .replace("${areaID}",areaID) |
162 | .replace("${chnlNo}",chnlNo) | 117 | .replace("${chnlNo}",chnlNo) |
@@ -175,17 +130,17 @@ public class BeihuoTests { | @@ -175,17 +130,17 @@ public class BeihuoTests { | ||
175 | public void exportDownload_E(){ | 130 | public void exportDownload_E(){ |
176 | 131 | ||
177 | //车牌号 | 132 | //车牌号 |
178 | - String voNo = "豫A61CR7"; | 133 | + String voNo = "豫A61CR8"; |
179 | //过卡重量 | 134 | //过卡重量 |
180 | - String cross_weight= String.valueOf(2000); | 135 | + String cross_weight= String.valueOf(4200); |
181 | //场站编号 | 136 | //场站编号 |
182 | - String areaID = "4604600000"; | 137 | + String areaID = "4600329012"; |
183 | //通道编号 | 138 | //通道编号 |
184 | - String chnlNo = "4604600011"; | 139 | + String chnlNo = "4600010006"; |
185 | //进出场类型I/E | 140 | //进出场类型I/E |
186 | String ie = "E"; | 141 | String ie = "E"; |
187 | //二维码 | 142 | //二维码 |
188 | - String barcode = "5198ad"; | 143 | + String barcode = "f7f-461a-bb39-b61c0a4d5677"; |
189 | logger.error("开始出口送货离场测试"); | 144 | logger.error("开始出口送货离场测试"); |
190 | IMPORT_XML= IMPORT_XML.replace("${car}",voNo) | 145 | IMPORT_XML= IMPORT_XML.replace("${car}",voNo) |
191 | .replace("${cross_weight}",cross_weight) | 146 | .replace("${cross_weight}",cross_weight) |
1 | +package com.sy.service; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.sy.model.LandBusinessTypeList; | ||
5 | +import org.junit.jupiter.api.Test; | ||
6 | +import org.junit.runner.RunWith; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.boot.test.context.SpringBootTest; | ||
9 | +import org.springframework.test.context.junit4.SpringRunner; | ||
10 | + | ||
11 | +import static org.junit.jupiter.api.Assertions.*; | ||
12 | + | ||
13 | +@RunWith(SpringRunner.class) | ||
14 | +@SpringBootTest | ||
15 | +class RedisServiceTest { | ||
16 | + | ||
17 | + @Autowired | ||
18 | + RedisService redisService; | ||
19 | + | ||
20 | + @Test | ||
21 | + void expire() { | ||
22 | + } | ||
23 | + | ||
24 | + @Test | ||
25 | + void hasKey() { | ||
26 | + } | ||
27 | + | ||
28 | + @Test | ||
29 | + void del() { | ||
30 | + } | ||
31 | + | ||
32 | + @Test | ||
33 | + void deleteBatchByKeys() { | ||
34 | + } | ||
35 | + | ||
36 | + @Test | ||
37 | + void get() { | ||
38 | + } | ||
39 | + | ||
40 | + @Test | ||
41 | + void set() { | ||
42 | + LandBusinessTypeList list = new LandBusinessTypeList(); | ||
43 | + list.setTrailerFrameNo("豫A61CR7"); | ||
44 | + list.setBarcode("123-3132"); | ||
45 | + list.setAislewt(2022.22); | ||
46 | + list.setId("020201"); | ||
47 | + list.setStartsatation("西货站"); | ||
48 | + list.setEndstation("北货站"); | ||
49 | + | ||
50 | + redisService.set(list.getTrailerFrameNo(), JSON.toJSONString(list),60*30); | ||
51 | + | ||
52 | + String userJson = redisService.get(list.getTrailerFrameNo()); | ||
53 | + System.out.println("userJson = " + userJson); | ||
54 | + LandBusinessTypeList u = JSON.parseObject(userJson,LandBusinessTypeList.class); | ||
55 | + | ||
56 | + } | ||
57 | + | ||
58 | + @Test | ||
59 | + void testSet() { | ||
60 | + } | ||
61 | +} |
1 | -package com.sy.service.impl; | ||
2 | - | ||
3 | -import com.sy.service.adapter.BayonetReleaseCheckHandle; | ||
4 | -import org.junit.jupiter.api.Test; | ||
5 | - | ||
6 | - | ||
7 | -class BayonetReleaseCheckTest { | ||
8 | - | ||
9 | - @Test | ||
10 | - void bayonetCrossCheck() { | ||
11 | - BayonetReleaseCheckHandle bayonetReleaseCheck = new BayonetReleaseCheckHandle(); | ||
12 | - bayonetReleaseCheck.bayonetCrossCheck("进口提货","I"); | ||
13 | - bayonetReleaseCheck.bayonetCrossCheck("出口送货","I"); | ||
14 | - } | ||
15 | -} |
@@ -17,7 +17,7 @@ class WeightCheckHandleServiceImplTest { | @@ -17,7 +17,7 @@ class WeightCheckHandleServiceImplTest { | ||
17 | 17 | ||
18 | @Test | 18 | @Test |
19 | void checkExportDownLoading() { | 19 | void checkExportDownLoading() { |
20 | - weightCheckHandleService.checkExportDownLoading(21540,20200,19213.0,39360); | 20 | + weightCheckHandleService.checkExportDownLoading(21540,10500,2200,14960); |
21 | } | 21 | } |
22 | 22 | ||
23 | @Test | 23 | @Test |
@@ -25,7 +25,9 @@ class WeightCheckHandleServiceImplTest { | @@ -25,7 +25,9 @@ class WeightCheckHandleServiceImplTest { | ||
25 | weightCheckHandleService.checkImportDlv(33180,20300,12653.00,20280); | 25 | weightCheckHandleService.checkImportDlv(33180,20300,12653.00,20280); |
26 | } | 26 | } |
27 | 27 | ||
28 | + | ||
28 | @Test | 29 | @Test |
29 | - void checkAllocateOrDispatch() { | 30 | + void checkAllocateOrDispatch(){ |
31 | + weightCheckHandleService.checkAllocateOrDispatch(12740,10500,2200+4630,14960); | ||
30 | } | 32 | } |
31 | } | 33 | } |
-
请 注册 或 登录 后发表评论