TASK: attribute_retrieval;
This commit is contained in:
@@ -1554,9 +1554,10 @@ public class PythonService {
|
||||
* 生成 attribute_retrieval
|
||||
*
|
||||
* @param sketchUrlList
|
||||
* @param modelSex
|
||||
* @return
|
||||
*/
|
||||
public DesignAttributeRetrievalDTO generateAttributeRetrieval(List<String> sketchUrlList, Long userId) {
|
||||
public DesignAttributeRetrievalDTO generateAttributeRetrieval(List<String> sketchUrlList, Long userId, String modelSex) {
|
||||
//限流校验
|
||||
AccessLimitUtils.validate("generateAttributeRetrieval",4);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
@@ -1568,6 +1569,7 @@ public class PythonService {
|
||||
Map<String, Object> content = Maps.newHashMap();
|
||||
content.put("sketch_upload_img_path", sketchUrlList);
|
||||
content.put("userid", userId);
|
||||
content.put("colony", modelSex);
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
||||
Request request = new Request.Builder()
|
||||
@@ -1604,19 +1606,23 @@ public class PythonService {
|
||||
private static DesignAttributeRetrievalDTO resolveDesignAttributeRetrievalDTO(String bodyStr){
|
||||
DesignAttributeRetrievalDTO response = new DesignAttributeRetrievalDTO();
|
||||
JSONObject jsonObject = JSON.parseObject(bodyStr);
|
||||
JSONObject jsonObjectSys = jsonObject.getJSONObject("sys_lib_dict");
|
||||
if(null == jsonObjectSys || jsonObjectSys.size() == 0){
|
||||
log.error("generateAttributeRetrieval异常###{}", "jsonObjectSys is empty!");
|
||||
throw new BusinessException("system error!");
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data != null) {
|
||||
JSONObject jsonObjectSys = data.getJSONObject("sys_lib_dict");
|
||||
if(null == jsonObjectSys || jsonObjectSys.size() == 0){
|
||||
log.error("generateAttributeRetrieval异常###{}", "jsonObjectSys is empty!");
|
||||
throw new BusinessException("system error!");
|
||||
}
|
||||
setUrls(jsonObjectSys,response.getSysFileUrlS());
|
||||
JSONObject jsonObjectLibrary = data.getJSONObject("user_lib_dict");
|
||||
if(null == jsonObjectLibrary || jsonObjectLibrary.size() == 0){
|
||||
log.error("generateAttributeRetrieval异常###{}", "jsonObjectLibrary is empty!");
|
||||
throw new BusinessException("system error!");
|
||||
}
|
||||
setUrls(jsonObjectLibrary,response.getLibraryUrls());
|
||||
return response;
|
||||
}
|
||||
setUrls(jsonObjectSys,response.getSysFileUrlS());
|
||||
JSONObject jsonObjectLibrary = jsonObject.getJSONObject("user_lib_dict");
|
||||
if(null == jsonObjectLibrary || jsonObjectLibrary.size() == 0){
|
||||
log.error("generateAttributeRetrieval异常###{}", "jsonObjectLibrary is empty!");
|
||||
throw new BusinessException("system error!");
|
||||
}
|
||||
setUrls(jsonObjectLibrary,response.getLibraryUrls());
|
||||
return response;
|
||||
throw new BusinessException("AttributeRetrieval response data is null");
|
||||
}
|
||||
|
||||
private static void setUrls(JSONObject jsonObjectSys,List<String> urls){
|
||||
|
||||
Reference in New Issue
Block a user