作者 朱兆平

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

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