Commit dbb59cc8 authored by ZWT's avatar ZWT

nocommit

parent 36d9b7fb
...@@ -151,17 +151,16 @@ public class WellheadDailyProductionSituationService { ...@@ -151,17 +151,16 @@ public class WellheadDailyProductionSituationService {
String token; String token;
ThirdPartyConfigCache exist = ThirdPartyConfigCache.exist(context, ThirdPartyApiConstant.CQ_TOKEN_CACHE_KEY); ThirdPartyConfigCache exist = ThirdPartyConfigCache.exist(context, ThirdPartyApiConstant.CQ_TOKEN_CACHE_KEY);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
token = this.getCqToken(); token = this.getCqToken(context);
this.setThirdPartyConfigCache(context, token);
} else { } else {
long between = DateUtil.between(exist.getCurrentDate(), DateUtil.date(), DateUnit.SECOND); long between = DateUtil.between(exist.getCurrentDate(), DateUtil.date(), DateUnit.SECOND);
long duration = (long) exist.getDuration(); long duration = (long) exist.getDuration();
if (duration - between < 300) { if (duration - between < 300) {
token = this.getCqToken(); token = this.getCqToken(context);
this.setThirdPartyConfigCache(context, token); } else {
}
token = exist.getCode(); token = exist.getCode();
} }
}
return token; return token;
} }
...@@ -170,7 +169,7 @@ public class WellheadDailyProductionSituationService { ...@@ -170,7 +169,7 @@ public class WellheadDailyProductionSituationService {
* *
* @return {@link String} * @return {@link String}
*/ */
private String getCqToken() { private String getCqToken(XContext context) {
String url = XStartup.getCurrent().getProperty("third-party.chang-qing.url"); String url = XStartup.getCurrent().getProperty("third-party.chang-qing.url");
url += ThirdPartyApiConstant.CQ_TOKEN; url += ThirdPartyApiConstant.CQ_TOKEN;
Map<String, String> param = new HashMap<>(4); Map<String, String> param = new HashMap<>(4);
...@@ -178,7 +177,9 @@ public class WellheadDailyProductionSituationService { ...@@ -178,7 +177,9 @@ public class WellheadDailyProductionSituationService {
param.put("UserPassWord", "PvGroup@147369"); param.put("UserPassWord", "PvGroup@147369");
String result = XHttpUtils.postAsForm(url, param); String result = XHttpUtils.postAsForm(url, param);
JSONObject jsonObject = JSONUtil.parseObj(result); JSONObject jsonObject = JSONUtil.parseObj(result);
return jsonObject.getStr("token"); String token = jsonObject.getStr("token");
this.setThirdPartyConfigCache(context, token);
return token;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment