Browse Source

调用dsp服务失败时增加校验

tags/V1.0.1^2
chengwang 1 year ago
parent
commit
698afd376b
2 changed files with 8 additions and 1 deletions
  1. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/SendPost.java
  2. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/StartAIService.java

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/SendPost.java View File

@@ -58,7 +58,8 @@ public class SendPost {
return result.toString();
} catch (Exception e) {
log.error("post请求失败");
return "post请求失败!";
String stringStr = "post请求失败!";
return stringStr;
}
}


+ 6
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/StartAIService.java View File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum;
import com.tuoheng.admin.entity.request.inspection.MissionStatusRequest;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -75,6 +76,11 @@ public class StartAIService {
log.info("调用DSP服务, jsonObject:{}", jsonObject);
String result = SendPost.doPost(url, jsonObject, null);
log.info("调用DSP服务, result:{}", result);
String stringStr = "post请求失败!";
if(result.equals(stringStr)){
log.info("调用dsp服务, 处理post请求失败");
throw new SecurityException("调用dsp服务,处理post请求失败");
}
return JSONObject.parseObject(result);
}


Loading…
Cancel
Save