作者 朱兆平

金二开关及配置刷新优化,支持热刷新重新加载配置文件的值.refresh 端点只刷新那些用@ConfigurationProperties 注解的属性

@@ -81,8 +81,8 @@ wharf.interface.host=http://10.50.3.66:1983/ @@ -81,8 +81,8 @@ wharf.interface.host=http://10.50.3.66:1983/
81 #新舱单运单查询数据接口,注意尾部带/符号 81 #新舱单运单查询数据接口,注意尾部带/符号
82 nmms.interface.host=http://10.50.3.82:8081/ 82 nmms.interface.host=http://10.50.3.82:8081/
83 #新舱单网站内网接口,注意尾部带/符号 83 #新舱单网站内网接口,注意尾部带/符号
84 -nmms.site.host=http://10.50.3.61:90 84 +nmms.site.host=http://nmms1.15miaoo.com:17999
85 custom.receptDirectory= bw/read/ 85 custom.receptDirectory= bw/read/
86 86
87 devdebug=true 87 devdebug=true
88 -g2.switch=true 88 +g2.onoff=false
@@ -29,6 +29,8 @@ public class buildBarCode { @@ -29,6 +29,8 @@ public class buildBarCode {
29 try { 29 try {
30 URL Url = new URL(url); 30 URL Url = new URL(url);
31 HttpURLConnection conn = (HttpURLConnection) Url.openConnection(); 31 HttpURLConnection conn = (HttpURLConnection) Url.openConnection();
  32 + conn.setConnectTimeout(3000);
  33 + conn.setReadTimeout(3000);
32 conn.setDoInput(true); 34 conn.setDoInput(true);
33 conn.setDoOutput(true); 35 conn.setDoOutput(true);
34 conn.setRequestProperty("X-Rrquested-With", "XMLHttpRequest"); 36 conn.setRequestProperty("X-Rrquested-With", "XMLHttpRequest");
  1 +package com.sy.model;
  2 +
  3 +import lombok.Data;
  4 +import org.springframework.boot.context.properties.ConfigurationProperties;
  5 +import org.springframework.stereotype.Component;
  6 +
  7 +@Component
  8 +@ConfigurationProperties(prefix = "g2")
  9 +@Data
  10 +public class G2Bean {
  11 + private Boolean onoff;
  12 +}
@@ -562,9 +562,10 @@ public class GatherInfoHandle implements GatherInfoService { @@ -562,9 +562,10 @@ public class GatherInfoHandle implements GatherInfoService {
562 if (temp.isEmpty()){ 562 if (temp.isEmpty()){
563 563
564 //todo:流转申请状态核销 564 //todo:流转申请状态核销
565 - log.info("[进出场申请]-流转申请核销:"+vaName); 565 + log.info("[进出场申请]-流转申请开始核销:"+vaName);
566 //二维码核销 566 //二维码核销
567 releaseBarCode(); 567 releaseBarCode();
  568 + log.info("[进出场申请]-流转申请已核销:"+vaName);
568 } 569 }
569 570
570 } 571 }
@@ -578,10 +579,10 @@ public class GatherInfoHandle implements GatherInfoService { @@ -578,10 +579,10 @@ public class GatherInfoHandle implements GatherInfoService {
578 //二维码失效通知,已进入场站的与缓存比较. 579 //二维码失效通知,已进入场站的与缓存比较.
579 if(count==0){ 580 if(count==0){
580 //todo:测试注释掉,二维码释放 581 //todo:测试注释掉,二维码释放
581 - log.info("[进出场申请]-二维码释放:"+vaName);  
582 if (!gatherInfoHandle.debug){ 582 if (!gatherInfoHandle.debug){
583 buildBarCode.cancleBarCode(vaName); 583 buildBarCode.cancleBarCode(vaName);
584 } 584 }
  585 + log.info("[进出场申请]-二维码已释放:"+vaName);
585 int rc = gatherInfoHandle.landListDao.releaseBarcode(info.getBarcode()); 586 int rc = gatherInfoHandle.landListDao.releaseBarcode(info.getBarcode());
586 //车辆流转申请缓存删除 587 //车辆流转申请缓存删除
587 releaseCache(); 588 releaseCache();
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
4 import com.sy.bwAnalysis.GatherInfoAnalysis; 4 import com.sy.bwAnalysis.GatherInfoAnalysis;
5 import com.sy.bwAssist.Message; 5 import com.sy.bwAssist.Message;
6 import com.sy.mapper.LandRouterConfigDao; 6 import com.sy.mapper.LandRouterConfigDao;
  7 +import com.sy.model.G2Bean;
7 import com.sy.model.GatherInfo; 8 import com.sy.model.GatherInfo;
8 import com.sy.model.LandBusinessTypeList; 9 import com.sy.model.LandBusinessTypeList;
9 import com.sy.model.LandRouterConfig; 10 import com.sy.model.LandRouterConfig;
@@ -15,7 +16,6 @@ import com.sy.socket.CommandClient; @@ -15,7 +16,6 @@ import com.sy.socket.CommandClient;
15 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
16 import org.apache.commons.lang.StringUtils; 17 import org.apache.commons.lang.StringUtils;
17 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
18 -import org.springframework.beans.factory.annotation.Value;  
19 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
20 20
21 import javax.annotation.Resource; 21 import javax.annotation.Resource;
@@ -34,8 +34,8 @@ public class MessageRouterX21 implements MessageRouter { @@ -34,8 +34,8 @@ public class MessageRouterX21 implements MessageRouter {
34 * Y 是金二业务必须走金二 34 * Y 是金二业务必须走金二
35 * N 车辆扫二维码或本地和金二都可进出区验放 35 * N 车辆扫二维码或本地和金二都可进出区验放
36 */ 36 */
37 - @Value("${g2.switch}")  
38 - private boolean g2Switch; 37 + @Autowired
  38 + private G2Bean g2Bean;
39 39
40 @Resource 40 @Resource
41 private LandRouterConfigDao landRouterConfigDao; 41 private LandRouterConfigDao landRouterConfigDao;
@@ -51,11 +51,10 @@ public class MessageRouterX21 implements MessageRouter { @@ -51,11 +51,10 @@ public class MessageRouterX21 implements MessageRouter {
51 51
52 @Override 52 @Override
53 public void route(Message message) { 53 public void route(Message message) {
54 - log.info("处理X21:gatherInfo"); 54 + log.info("处理X21:gatherInfo,[switch]-G2开关状态:[{}]",g2Bean.getOnoff());
55 GatherInfoAnalysis gatherInfoAnalysis = new GatherInfoAnalysis(); 55 GatherInfoAnalysis gatherInfoAnalysis = new GatherInfoAnalysis();
56 GatherInfo info = gatherInfoAnalysis.toJavaBean(message); 56 GatherInfo info = gatherInfoAnalysis.toJavaBean(message);
57 -  
58 - if (g2Switch){ 57 + if (g2Bean.getOnoff()){
59 //金二判断,业务类型,通道,路由目的地 58 //金二判断,业务类型,通道,路由目的地
60 routerCheckG2(info); 59 routerCheckG2(info);
61 }else { 60 }else {
@@ -13,7 +13,6 @@ import com.sy.socket.CommandClient; @@ -13,7 +13,6 @@ import com.sy.socket.CommandClient;
13 import lombok.extern.slf4j.Slf4j; 13 import lombok.extern.slf4j.Slf4j;
14 import org.apache.commons.lang.StringUtils; 14 import org.apache.commons.lang.StringUtils;
15 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
16 -import org.springframework.beans.factory.annotation.Value;  
17 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
18 17
19 18
@@ -21,9 +20,6 @@ import org.springframework.stereotype.Service; @@ -21,9 +20,6 @@ import org.springframework.stereotype.Service;
21 @Slf4j 20 @Slf4j
22 public class MessageRouterX22 implements MessageRouter { 21 public class MessageRouterX22 implements MessageRouter {
23 22
24 - @Value("${g2.switch}")  
25 - private boolean g2Switch;  
26 -  
27 @Autowired 23 @Autowired
28 private RedisService redisService; 24 private RedisService redisService;
29 25