|
@@ -107,7 +107,7 @@ public class AttendanceAssessmentSdk {
|
|
|
jsonStr = JSONUtil.toJsonStr(postData, config);
|
|
|
logger.info("入参:{}", jsonStr);
|
|
|
|
|
|
- apiResult = HttpRequest.post(url).body(jsonStr).setConnectionTimeout(2000).execute().body();
|
|
|
+ apiResult = HttpRequest.post(url).header("Content-Type", "application/json").body(jsonStr).execute().body();
|
|
|
logger.info("接口返回报文:{}", apiResult);
|
|
|
apiReturnDto = JSONUtil.toBean(apiResult, ApiReturnDto.class);
|
|
|
switch (apiReturnDto.getApsStat()) {
|
|
@@ -129,8 +129,6 @@ public class AttendanceAssessmentSdk {
|
|
|
throw new CustomException("必填项为空");
|
|
|
case CODE_103:
|
|
|
throw new CustomException("数据主键或数据编码有误,数据操作失败");
|
|
|
- case 0:
|
|
|
- throw new CustomException("代码异常");
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -213,18 +211,16 @@ public class AttendanceAssessmentSdk {
|
|
|
String body = null;
|
|
|
String token = null;
|
|
|
try {
|
|
|
- body = HttpRequest.post(url).body(postData.toString()).setConnectionTimeout(2000).execute().body();
|
|
|
+ body = HttpRequest.post(url).header("Content-Type", "application/json").body(JSONUtil.toJsonStr(postData)).execute().body();
|
|
|
logger.info("接口返回: {}", body);
|
|
|
- if (StringUtils.isEmptyStr(body)) {
|
|
|
- throw new CustomException("请求token失败");
|
|
|
- }
|
|
|
+
|
|
|
ApiReturnDto response = JSONUtil.toBean(body, ApiReturnDto.class);
|
|
|
token = response.getToken();
|
|
|
// 将 token 放入redis;
|
|
|
redisService.redisCatchInit(REDIS_KEY_NAME, token, TOKEN_EXPIRED_SECONDS);
|
|
|
logger.info("获取token接口返回的信息: {}", response);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ e.getMessage();
|
|
|
throw new CustomException("请求token失败");
|
|
|
} finally {
|
|
|
String finalBody = body;
|