|
@@ -1,16 +1,16 @@
|
|
|
package com.zhongshu.iot.server.core.httpRequest;
|
|
package com.zhongshu.iot.server.core.httpRequest;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import com.github.microservice.core.util.net.apache.MethodType;
|
|
|
|
|
+import com.github.microservice.http.APIResponseModel;
|
|
|
|
|
+import com.github.microservice.http.ApiConfParam;
|
|
|
import com.zhongshu.iot.server.core.dao.payment.RequestInfoDao;
|
|
import com.zhongshu.iot.server.core.dao.payment.RequestInfoDao;
|
|
|
-import com.zhongshu.iot.server.core.httpRequest.apiConf.APIResponseModel;
|
|
|
|
|
-import com.zhongshu.iot.server.core.httpRequest.apiConf.ApiConfParam;
|
|
|
|
|
import com.zhongshu.iot.server.core.httpRequest.conf.FullCardAPIConfig;
|
|
import com.zhongshu.iot.server.core.httpRequest.conf.FullCardAPIConfig;
|
|
|
import com.zhongshu.iot.server.core.httpRequest.conf.FullCardConf;
|
|
import com.zhongshu.iot.server.core.httpRequest.conf.FullCardConf;
|
|
|
import com.zhongshu.iot.server.core.service.base.SuperService;
|
|
import com.zhongshu.iot.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.iot.server.core.service.other.RequestInfoService;
|
|
import com.zhongshu.iot.server.core.service.other.RequestInfoService;
|
|
|
import com.zhongshu.iot.server.core.util.net.apache.HttpClientUtil;
|
|
import com.zhongshu.iot.server.core.util.net.apache.HttpClientUtil;
|
|
|
import com.zhongshu.iot.server.core.util.net.apache.HttpModel;
|
|
import com.zhongshu.iot.server.core.util.net.apache.HttpModel;
|
|
|
-import com.zhongshu.iot.server.core.util.net.apache.MethodType;
|
|
|
|
|
import com.zhongshu.iot.server.core.util.net.apache.ResponseModel;
|
|
import com.zhongshu.iot.server.core.util.net.apache.ResponseModel;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -59,7 +59,7 @@ public class ApiRequestService extends SuperService {
|
|
|
stopWatch.start();
|
|
stopWatch.start();
|
|
|
String url = fullCardConf.getUrl() + fullCardConf.getCardServerName() + apiConfParam.getApiName();
|
|
String url = fullCardConf.getUrl() + fullCardConf.getCardServerName() + apiConfParam.getApiName();
|
|
|
ResponseModel request = HttpClientUtil.request(HttpModel.builder()
|
|
ResponseModel request = HttpClientUtil.request(HttpModel.builder()
|
|
|
- .url(url).method(apiConfParam.getMethodType()).charset("utf-8").body(data).build());
|
|
|
|
|
|
|
+ .url(url).method(MethodType.Json).charset("utf-8").body(data).build());
|
|
|
if (request.getCode() == 200) {
|
|
if (request.getCode() == 200) {
|
|
|
responseModel = BeanUtil.copyProperties(request.getBody(), APIResponseModel.class);
|
|
responseModel = BeanUtil.copyProperties(request.getBody(), APIResponseModel.class);
|
|
|
} else {
|
|
} else {
|
|
@@ -84,11 +84,11 @@ public class ApiRequestService extends SuperService {
|
|
|
try {
|
|
try {
|
|
|
ApiConfParam apiConfParam = new ApiConfParam();
|
|
ApiConfParam apiConfParam = new ApiConfParam();
|
|
|
apiConfParam.setApiName(url);
|
|
apiConfParam.setApiName(url);
|
|
|
- apiConfParam.setMethodType(MethodType.Json);
|
|
|
|
|
|
|
+ apiConfParam.setMethodType(MethodType.Json.name());
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
StopWatch stopWatch = new StopWatch();
|
|
|
stopWatch.start();
|
|
stopWatch.start();
|
|
|
ResponseModel request = HttpClientUtil.request(HttpModel.builder()
|
|
ResponseModel request = HttpClientUtil.request(HttpModel.builder()
|
|
|
- .url(url).method(apiConfParam.getMethodType()).charset("utf-8").body(data).build());
|
|
|
|
|
|
|
+ .url(url).method(MethodType.Json).charset("utf-8").body(data).build());
|
|
|
int code = request.getCode();
|
|
int code = request.getCode();
|
|
|
if (code == 200) {
|
|
if (code == 200) {
|
|
|
responseModel = BeanUtil.copyProperties(request.getBody(), APIResponseModel.class);
|
|
responseModel = BeanUtil.copyProperties(request.getBody(), APIResponseModel.class);
|