|
@@ -1,5 +1,6 @@
|
|
|
package org.thyy.thirdpartapi.inspection.inspectionImpl;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -13,11 +14,12 @@ import org.thyy.thirdpartapi.inspection.response.jy.*;
|
|
|
import org.thyy.utils.exception.BizException;
|
|
|
import org.thyy.utils.exception.ExceptionEnum;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
-@ConditionalOnProperty(prefix = "thyy.inspection", name = "service", havingValue = "shanghaihaotai")
|
|
|
+@ConditionalOnProperty(prefix = "thyy.inspection", name = "service", havingValue = "shanghaihaotai", matchIfMissing = true)
|
|
|
public class ThyyInspectionImpl implements InspectionInterface {
|
|
|
private String api;
|
|
|
private final RestTemplate restTemplate;
|
|
@@ -30,13 +32,17 @@ public class ThyyInspectionImpl implements InspectionInterface {
|
|
|
init();
|
|
|
}
|
|
|
|
|
|
- public void init( ) {
|
|
|
+ public void init() {
|
|
|
this.api = inspectionApiConfig.getJy();
|
|
|
log.info("检验检查模块初始化完成");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<JyIndexResponse> queryExamIndex(JSONObject request) {
|
|
|
+ if (StrUtil.isBlank(api)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
JSONObject response = restTemplate.postForObject(api + "/self", request, JSONObject.class);
|
|
|
if (null == response) {
|
|
|
throw new BizException(ExceptionEnum.NETWORK_ERROR);
|
|
@@ -52,6 +58,9 @@ public class ThyyInspectionImpl implements InspectionInterface {
|
|
|
|
|
|
@Override
|
|
|
public JyDetailResponse queryExamDetail(JSONObject request) {
|
|
|
+ if (StrUtil.isBlank(api)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
JSONObject response = new RestTemplate().postForObject(
|
|
|
api + "/detail", request, JSONObject.class);
|
|
|
if (null == response) {
|