Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
shahaibo
2023-12-11 16:59:21 +08:00
3 changed files with 15 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ public class ElementController {
public Response<CollectionElementVO> upload(@RequestParam("file") MultipartFile file, public Response<CollectionElementVO> upload(@RequestParam("file") MultipartFile file,
@ApiParam("一级类型 Moodboard Printboard Sketchboard MarketingSketch Colorboard") @ApiParam("一级类型 Moodboard Printboard Sketchboard MarketingSketch Colorboard")
@RequestParam(value = "level1Type") String level1Type, @RequestParam(value = "level1Type") String level1Type,
@RequestParam(value = "gender") String gender, @RequestParam(name = "gender", required = false) String gender,
@ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取") @ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
@RequestParam(value = "timeZone") String timeZone) { @RequestParam(value = "timeZone") String timeZone) {
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) { if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {

View File

@@ -2383,6 +2383,7 @@ public class PythonService {
} }
} }
JSONObject jsonObject = JSON.parseObject(bodyString); JSONObject jsonObject = JSON.parseObject(bodyString);
try{
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful"); Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
if (result && jsonObject.get("msg").equals("OK!")) { if (result && jsonObject.get("msg").equals("OK!")) {
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
@@ -2390,6 +2391,10 @@ public class PythonService {
JSONObject map = (JSONObject) list.get(0); JSONObject map = (JSONObject) list.get(0);
return map.get("category").toString(); return map.get("category").toString();
} }
}catch (NullPointerException e){
log.info("getClothCategory 失败###{}未返回category", jsonObject);
throw new BusinessException("cloth-classification.interface.exception");
}
log.info("getClothCategory 失败###{}", jsonObject); log.info("getClothCategory 失败###{}", jsonObject);
//生成失败 //生成失败
throw new BusinessException("cloth-classification.interface.exception"); throw new BusinessException("cloth-classification.interface.exception");

View File

@@ -88,6 +88,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
String level2Type = null; String level2Type = null;
if (uploadDTO.getLevel1Type().equals(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName())){ if (uploadDTO.getLevel1Type().equals(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName())){
if (StringUtil.isNullOrEmpty(uploadDTO.getGender())) {
throw new BusinessException("gender.cannot.be.empty");
}
level2Type = pythonService.getClothCategory(path,uploadDTO.getGender()); level2Type = pythonService.getClothCategory(path,uploadDTO.getGender());
} }