TASK:自动识别上传服装的类别

This commit is contained in:
2023-12-11 14:24:28 +08:00
parent 2b8f970acc
commit cd41229f9e
8 changed files with 80 additions and 24 deletions

View File

@@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate;
@@ -79,6 +80,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
Integer timeout = 99999999;
@Override
@Transactional(rollbackFor = Exception.class)
public ChatRobotVO sendMessageToChatRobot(ChatSendDTO chatSendDTO) {
// SseEmitter emitter = new SseEmitter();
// String requestBody = gson.toJson(chatSendDTO);
@@ -221,6 +223,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
chatRobot.setSuccessful(1);
chatRobotMapper.insert(chatRobot);
}
chatRobotVO.setIsTutorial(output.contains("tutorial"));
return chatRobotVO;
}
log.error("ChatRobot response data is null!");

View File

@@ -86,8 +86,13 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
String objectName = userInfo.getId() + "/" + level1TypeEnum.getRealName();
String path = minioUtil.upload(collectionElement, objectName, uploadDTO.getFile());
String level2Type = null;
if (uploadDTO.getLevel1Type().equals(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName())){
level2Type = pythonService.getClothCategory(path,uploadDTO.getGender());
}
//保存element元素
CollectionElement collectionElement = resolveData(uploadDTO, userInfo, path);
CollectionElement collectionElement = resolveData(uploadDTO, userInfo, path, level2Type);
saveOne(collectionElement);
CollectionElementVO collectionElementVO = CopyUtil.copyObject(collectionElement, CollectionElementVO.class);
collectionElementVO.setMinIOPath(collectionElementVO.getUrl());
@@ -126,7 +131,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
return element;
}
private CollectionElement resolveData(CollectionElementUploadDTO uploadDTO, AuthPrincipalVo userInfo, String path) {
private CollectionElement resolveData(CollectionElementUploadDTO uploadDTO, AuthPrincipalVo userInfo, String path, String level2Type) {
CollectionElement element = CopyUtil.copyObject(uploadDTO, CollectionElement.class);
element.setAccountId(userInfo.getId());
element.setCollectionId(0L);
@@ -140,6 +145,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
element.setUrl(path);
//按时区计算
element.setCreateDate(DateUtil.getByTimeZone(uploadDTO.getTimeZone()));
element.setLevel2Type(level2Type);
// String linuxDomain = fileProperties.getLinuxDomain();
// if (!StringUtils.isEmpty(linuxDomain)) {
// //linux 系统