Commit dbb59cc8 authored by ZWT's avatar ZWT

nocommit

parent 36d9b7fb
......@@ -151,16 +151,15 @@ public class WellheadDailyProductionSituationService {
String token;
ThirdPartyConfigCache exist = ThirdPartyConfigCache.exist(context, ThirdPartyApiConstant.CQ_TOKEN_CACHE_KEY);
if (ObjectUtil.isNull(exist)) {
token = this.getCqToken();
this.setThirdPartyConfigCache(context, token);
token = this.getCqToken(context);
} else {
long between = DateUtil.between(exist.getCurrentDate(), DateUtil.date(), DateUnit.SECOND);
long duration = (long) exist.getDuration();
if (duration - between < 300) {
token = this.getCqToken();
this.setThirdPartyConfigCache(context, token);
token = this.getCqToken(context);
} else {
token = exist.getCode();
}
token = exist.getCode();
}
return token;
}
......@@ -170,7 +169,7 @@ public class WellheadDailyProductionSituationService {
*
* @return {@link String}
*/
private String getCqToken() {
private String getCqToken(XContext context) {
String url = XStartup.getCurrent().getProperty("third-party.chang-qing.url");
url += ThirdPartyApiConstant.CQ_TOKEN;
Map<String, String> param = new HashMap<>(4);
......@@ -178,7 +177,9 @@ public class WellheadDailyProductionSituationService {
param.put("UserPassWord", "PvGroup@147369");
String result = XHttpUtils.postAsForm(url, param);
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