|
@@ -21,6 +21,7 @@ public class TaiKangHttpService {
|
|
|
private TaiKangHttpClient client;
|
|
private TaiKangHttpClient client;
|
|
|
|
|
|
|
|
private String token;
|
|
private String token;
|
|
|
|
|
+ private String tokenTest = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXFNYXAiOiJ7XCJjYXJSZXF1ZXN0SWRcIjpcIlRPS0UyMDI1MDMxMTA5MzY0MzI0NTAwMDBcIn0iLCJpc3MiOiJ0ay5jbiIsImV4cCI6MTc0MTc0MzQwM30.rXChMg_TtHTv5XZs2_6JtHpHZ7N_E3JeCtrhRolSwbQ";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* {@link #checkResponseUnknownField(UnknownFieldEntity)} 接口对数据校验,发现实体上缺少 json 的一些字段时,抛出异常。
|
|
* {@link #checkResponseUnknownField(UnknownFieldEntity)} 接口对数据校验,发现实体上缺少 json 的一些字段时,抛出异常。
|
|
@@ -31,6 +32,8 @@ public class TaiKangHttpService {
|
|
|
private String token() {
|
|
private String token() {
|
|
|
if (token != null) {
|
|
if (token != null) {
|
|
|
return token;
|
|
return token;
|
|
|
|
|
+ } if (tokenTest != null) {
|
|
|
|
|
+ return tokenTest;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
throw new RuntimeException("token 为 null,请先登录!");
|
|
throw new RuntimeException("token 为 null,请先登录!");
|
|
@@ -547,31 +550,19 @@ public class TaiKangHttpService {
|
|
|
InitQuotationParam param = new InitQuotationParam();
|
|
InitQuotationParam param = new InitQuotationParam();
|
|
|
param.setChannelCode("OffWeb");
|
|
param.setChannelCode("OffWeb");
|
|
|
param.setOrderID(orderId);
|
|
param.setOrderID(orderId);
|
|
|
|
|
+ // 注意:查看报价单时的 initFlag 参数为 1
|
|
|
param.setInitFlag("1");
|
|
param.setInitFlag("1");
|
|
|
|
|
|
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
httpHeaders.add("tkCarRequestToken", token());
|
|
httpHeaders.add("tkCarRequestToken", token());
|
|
|
|
|
|
|
|
- StringResponse response = client.request(HttpURL.initQuotation, param, httpHeaders, StringResponse.class);
|
|
|
|
|
|
|
+ InitQuotationResult.Response response = client.request(HttpURL.initQuotation, param, httpHeaders, InitQuotationResult.Response.class);
|
|
|
|
|
|
|
|
- checkResponseUnknownField(response);
|
|
|
|
|
-
|
|
|
|
|
- // 解密
|
|
|
|
|
- String json = AESDecryptor.decrypt(response.getData());
|
|
|
|
|
-
|
|
|
|
|
- if (logger.isInfoEnabled()) {
|
|
|
|
|
- logger.info("TaiKangHttpClient initQuotation decrypt body: {}", json);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- InitQuotationResult.Response response1 = JsonUtil.readObjcet(json, InitQuotationResult.Response.class);
|
|
|
|
|
-
|
|
|
|
|
- checkResponseUnknownField(response1);
|
|
|
|
|
-
|
|
|
|
|
- return response1.getData();
|
|
|
|
|
|
|
+ return response.getData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- *
|
|
|
|
|
|
|
+ * 保费计算
|
|
|
*
|
|
*
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -579,27 +570,15 @@ public class TaiKangHttpService {
|
|
|
InitQuotationParam param = new InitQuotationParam();
|
|
InitQuotationParam param = new InitQuotationParam();
|
|
|
param.setChannelCode("OffWeb");
|
|
param.setChannelCode("OffWeb");
|
|
|
param.setOrderID(orderId);
|
|
param.setOrderID(orderId);
|
|
|
- param.setInitFlag("1");
|
|
|
|
|
|
|
+ // 注意:发起“保费计算” initFlag 参数为 quote
|
|
|
|
|
+ param.setInitFlag("quote");
|
|
|
|
|
|
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
httpHeaders.add("tkCarRequestToken", token());
|
|
httpHeaders.add("tkCarRequestToken", token());
|
|
|
|
|
|
|
|
- StringResponse response = client.request(HttpURL.initQuotation, param, httpHeaders, StringResponse.class);
|
|
|
|
|
-
|
|
|
|
|
- checkResponseUnknownField(response);
|
|
|
|
|
-
|
|
|
|
|
- // 解密
|
|
|
|
|
- String json = AESDecryptor.decrypt(response.getData());
|
|
|
|
|
|
|
+ InitQuotationResult.Response response = client.request(HttpURL.initQuotation, param, httpHeaders, InitQuotationResult.Response.class);
|
|
|
|
|
|
|
|
- if (logger.isInfoEnabled()) {
|
|
|
|
|
- logger.info("TaiKangHttpClient initQuotation decrypt body: {}", json);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- InitQuotationResult.Response response1 = JsonUtil.readObjcet(json, InitQuotationResult.Response.class);
|
|
|
|
|
-
|
|
|
|
|
- checkResponseUnknownField(response1);
|
|
|
|
|
-
|
|
|
|
|
- return response1.getData();
|
|
|
|
|
|
|
+ return response.getData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|