|
@@ -62,8 +62,6 @@ public class DpccService {
|
|
|
+ "&username=" + dpcc.getClientName()
|
|
|
+ "&password=" + dpcc.getPassword();
|
|
|
|
|
|
- log.info("DPCC获取TOKEN地址:{}", url);
|
|
|
-
|
|
|
JSONObject response = template.postForObject(url,
|
|
|
new HttpEntity<>(null, headers), JSONObject.class);
|
|
|
log.info("DPCC获取TOKEN:{}", response);
|
|
@@ -294,12 +292,19 @@ public class DpccService {
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("data", encrypt);
|
|
|
HttpEntity<JSONObject> body = new HttpEntity<>(data, headers);
|
|
|
- String response = new RestTemplate().postForObject(url, body, String.class);
|
|
|
- log.info("DPCC上传{}返回:{}", label, response);
|
|
|
-// if (StrUtil.isNotBlank(response)) {
|
|
|
-// JSONObject json = JSON.parseObject(response);
|
|
|
-// Integer code = json.getInteger("code");
|
|
|
-// }
|
|
|
+ try {
|
|
|
+ String response = new RestTemplate().postForObject(url, body, String.class);
|
|
|
+ log.info("DPCC上传{}返回:{}", label, response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ String errMsg = e.getMessage();
|
|
|
+ if (StrUtil.isBlank(errMsg)) {
|
|
|
+ errMsg = null == e.getCause() ? e.toString() : e.getCause().getMessage();
|
|
|
+ }
|
|
|
+ log.error("DPCC上传{}出错:{}", label, errMsg);
|
|
|
+ if (errMsg.contains("401 Unauthorized")) {
|
|
|
+ getToken();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
enum Type {
|