TASK: attribute_retrieval;
This commit is contained in:
@@ -1554,9 +1554,10 @@ public class PythonService {
|
|||||||
* 生成 attribute_retrieval
|
* 生成 attribute_retrieval
|
||||||
*
|
*
|
||||||
* @param sketchUrlList
|
* @param sketchUrlList
|
||||||
|
* @param modelSex
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public DesignAttributeRetrievalDTO generateAttributeRetrieval(List<String> sketchUrlList, Long userId) {
|
public DesignAttributeRetrievalDTO generateAttributeRetrieval(List<String> sketchUrlList, Long userId, String modelSex) {
|
||||||
//限流校验
|
//限流校验
|
||||||
AccessLimitUtils.validate("generateAttributeRetrieval",4);
|
AccessLimitUtils.validate("generateAttributeRetrieval",4);
|
||||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
@@ -1568,6 +1569,7 @@ public class PythonService {
|
|||||||
Map<String, Object> content = Maps.newHashMap();
|
Map<String, Object> content = Maps.newHashMap();
|
||||||
content.put("sketch_upload_img_path", sketchUrlList);
|
content.put("sketch_upload_img_path", sketchUrlList);
|
||||||
content.put("userid", userId);
|
content.put("userid", userId);
|
||||||
|
content.put("colony", modelSex);
|
||||||
MediaType mediaType = MediaType.parse("application/json");
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
@@ -1604,19 +1606,23 @@ public class PythonService {
|
|||||||
private static DesignAttributeRetrievalDTO resolveDesignAttributeRetrievalDTO(String bodyStr){
|
private static DesignAttributeRetrievalDTO resolveDesignAttributeRetrievalDTO(String bodyStr){
|
||||||
DesignAttributeRetrievalDTO response = new DesignAttributeRetrievalDTO();
|
DesignAttributeRetrievalDTO response = new DesignAttributeRetrievalDTO();
|
||||||
JSONObject jsonObject = JSON.parseObject(bodyStr);
|
JSONObject jsonObject = JSON.parseObject(bodyStr);
|
||||||
JSONObject jsonObjectSys = jsonObject.getJSONObject("sys_lib_dict");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
if(null == jsonObjectSys || jsonObjectSys.size() == 0){
|
if (data != null) {
|
||||||
log.error("generateAttributeRetrieval异常###{}", "jsonObjectSys is empty!");
|
JSONObject jsonObjectSys = data.getJSONObject("sys_lib_dict");
|
||||||
throw new BusinessException("system error!");
|
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());
|
throw new BusinessException("AttributeRetrieval response data is null");
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setUrls(JSONObject jsonObjectSys,List<String> urls){
|
private static void setUrls(JSONObject jsonObjectSys,List<String> urls){
|
||||||
|
|||||||
@@ -110,26 +110,24 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
private void calculateLibraryAndSysFile(DesignCollectionDTO designDTO, ValidateElementVO elementVO, AuthPrincipalVo userInfo) {
|
private void calculateLibraryAndSysFile(DesignCollectionDTO designDTO, ValidateElementVO elementVO, AuthPrincipalVo userInfo) {
|
||||||
//查询用户 sketch library
|
//查询用户 sketch library
|
||||||
List<LibraryVo> libraryVos;
|
List<LibraryVo> libraryVos;
|
||||||
// if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||||
// List<String> sketchUrlList = elementVO.getSketchBoardElements()
|
List<String> sketchUrlList = elementVO.getSketchBoardElements()
|
||||||
// .stream()
|
.stream()
|
||||||
// .map(CollectionElement::getUrl)
|
.map(CollectionElement::getUrl)
|
||||||
// .collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// DesignAttributeRetrievalDTO designAttributeRetrievalDTO =
|
DesignAttributeRetrievalDTO designAttributeRetrievalDTO =
|
||||||
// pythonService.generateAttributeRetrieval(sketchUrlList, userInfo.getId());
|
pythonService.generateAttributeRetrieval(sketchUrlList, userInfo.getId(), elementVO.getModelSex());
|
||||||
// if (CollectionUtils.isEmpty(designAttributeRetrievalDTO.getLibraryUrls())) {
|
if (CollectionUtils.isEmpty(designAttributeRetrievalDTO.getLibraryUrls())) {
|
||||||
// libraryVos = null;
|
libraryVos = null;
|
||||||
// } else {
|
} else {
|
||||||
// libraryVos = libraryService.getByUrlList(designAttributeRetrievalDTO.getLibraryUrls(), userInfo.getId());
|
libraryVos = libraryService.getByUrlList(designAttributeRetrievalDTO.getLibraryUrls(), userInfo.getId());
|
||||||
// }
|
}
|
||||||
// List<SysFileVO> sysFileVOS = sysFileService.getByUrlList(designAttributeRetrievalDTO.getSysFileUrlS());
|
List<SysFileVO> sysFileVOS = sysFileService.getByUrlList(designAttributeRetrievalDTO.getSysFileUrlS());
|
||||||
// elementVO.setSysFileVo(sysFileVOS);
|
elementVO.setSysFileVo(sysFileVOS);
|
||||||
// } else {
|
} else {
|
||||||
// libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||||
// Collections.singletonList(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
Collections.singletonList(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
||||||
// }
|
}
|
||||||
libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
|
||||||
Collections.singletonList(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
|
||||||
elementVO.setLibraryVos(libraryVos);
|
elementVO.setLibraryVos(libraryVos);
|
||||||
//校验比列
|
//校验比列
|
||||||
validateRatio(designDTO, libraryVos);
|
validateRatio(designDTO, libraryVos);
|
||||||
|
|||||||
Reference in New Issue
Block a user