Merge remote-tracking branch 'origin/dev/dev' into dev/dev
# Conflicts: # src/main/java/com/ai/da/mapper/primary/entity/DesignItem.java
This commit is contained in:
@@ -31,9 +31,9 @@ import java.util.Set;
|
||||
*/
|
||||
public interface LLMService {
|
||||
|
||||
SseEmitter stream(String prompt, Long projectId, String fileUrl, List<String> imageUrlList, String token);
|
||||
SseEmitter stream(String prompt, Long projectId, String fileUrl, List<String> imageUrlList, String token, Boolean enableThinking, String process);
|
||||
|
||||
Long chatCreateProject(String prompt, String process);
|
||||
Long chatCreateProject(String prompt, String process, String fileUrl, List<String> imageUrlList);
|
||||
|
||||
List<String> uploadFile(MultipartFile file);
|
||||
|
||||
|
||||
@@ -601,18 +601,37 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
}
|
||||
}
|
||||
// 校验模特
|
||||
if (!StringUtils.isEmpty(designDTO.getModelType())) {
|
||||
if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
|
||||
Library byId = libraryService.getById(designDTO.getTemplateId());
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, byId.getHigh(), byId.getWidth(), byId.getUrl()));
|
||||
} else if (designDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
|
||||
if (!StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
|
||||
elementVO.setStyle(byId.getLevel3Type());
|
||||
if (!CollectionUtils.isEmpty(designDTO.getMannequins())) {
|
||||
List<DesignLibraryModelPointVO> designLibraryModelPointVOList = new ArrayList<>();
|
||||
for (MannequinDTO mannequin : designDTO.getMannequins()) {
|
||||
if (mannequin.getType().equals("System")) {
|
||||
SysFileVO byId = sysFileService.getById(mannequin.getId());
|
||||
// if (!StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
|
||||
// elementVO.setStyle(byId.getLevel3Type());
|
||||
// }
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), mannequin.getType());
|
||||
designLibraryModelPointVOList.add(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||
}else {
|
||||
Library byId = libraryService.getById(mannequin.getId());
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), mannequin.getType());
|
||||
designLibraryModelPointVOList.add(calculateTemplatePointTemplate(modelPoint, byId.getHigh(), byId.getWidth(), byId.getUrl()));
|
||||
}
|
||||
}
|
||||
elementVO.setMannequins(designLibraryModelPointVOList);
|
||||
}else {
|
||||
if (!StringUtils.isEmpty(designDTO.getModelType())) {
|
||||
if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
|
||||
Library byId = libraryService.getById(designDTO.getTemplateId());
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, byId.getHigh(), byId.getWidth(), byId.getUrl()));
|
||||
} else if (designDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
|
||||
if (!StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
|
||||
elementVO.setStyle(byId.getLevel3Type());
|
||||
}
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||
}
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||
}
|
||||
}
|
||||
elementVO.setModelSex(designDTO.getModelSex());
|
||||
@@ -660,6 +679,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
libraryModelPoint.setWaistbandLeft(calculateTemplatePointOne(modelPoint.getWaistbandLeft(), high, width));
|
||||
libraryModelPoint.setWaistbandRight(calculateTemplatePointOne(modelPoint.getWaistbandRight(), high, width));
|
||||
libraryModelPoint.setTemplateUrl(templateUrl);
|
||||
libraryModelPoint.setRelationId(modelPoint.getRelationId());
|
||||
libraryModelPoint.setRelationType(modelPoint.getModelType());
|
||||
return libraryModelPoint;
|
||||
}
|
||||
|
||||
|
||||
@@ -759,6 +759,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItem.setDesignUrl(item.getBasic().getSave_name());
|
||||
designItem.setHasLike((byte) 0);
|
||||
//生成designItem
|
||||
Map<String, Object> bodyPointTest = item.getBasic().getBody_point_test();
|
||||
// 转换 relation_id (Long)
|
||||
Long relationId = Optional.ofNullable(bodyPointTest.get("relation_id"))
|
||||
.filter(Number.class::isInstance)
|
||||
.map(num -> ((Number) num).longValue())
|
||||
.orElseThrow(null);
|
||||
|
||||
// 转换 relation_type (String)
|
||||
String relationType = Optional.ofNullable(bodyPointTest.get("relation_type"))
|
||||
.filter(String.class::isInstance)
|
||||
.map(String.class::cast)
|
||||
.orElse(null);
|
||||
designItem.setModelId(relationId);
|
||||
designItem.setModelType(relationType);
|
||||
Long designItemId = designItemService.saveOne(designItem);
|
||||
// python design返回入库及封装
|
||||
// JSONObject outfit = data.getJSONObject(i + "");
|
||||
@@ -1753,6 +1767,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean receiveDesignResults(JSONObject responseJSONObject) {
|
||||
// String requestId = "UUID.randomUUID().toString()";
|
||||
System.out.println(responseJSONObject.toJSONString());
|
||||
String requestId = responseJSONObject.getString("requestId");
|
||||
Map<String, Object> context;
|
||||
synchronized (designContext) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.ChatHistoryDTO;
|
||||
import com.ai.da.model.dto.ReceiveCollectionElement;
|
||||
import com.ai.da.model.dto.ReceiveDesignParam;
|
||||
import com.ai.da.model.enums.*;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
@@ -18,10 +19,12 @@ import com.ai.da.service.DesignService;
|
||||
import com.ai.da.service.LLMService;
|
||||
import com.ai.da.service.SysFileService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
@@ -34,10 +37,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class LLMServiceImpl implements LLMService {
|
||||
private final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
@Override
|
||||
public SseEmitter stream(String prompt, Long projectId, String fileUrl, List<String> imageUrlList, String token) {
|
||||
public SseEmitter stream(String prompt, Long projectParamId, String fileUrl, List<String> imageUrlList, String token, Boolean enableThinking, String process) {
|
||||
SseEmitter emitter = new SseEmitter(0L); // 永不超时
|
||||
|
||||
executor.submit(() -> {
|
||||
@@ -76,38 +76,60 @@ public class LLMServiceImpl implements LLMService {
|
||||
if (validate) {
|
||||
AuthPrincipalVo principal = jwtTokenHelper.parserToUser(token);
|
||||
Long accountId = principal.getId();
|
||||
int userSeq = getNextSeq(projectId); // 获取当前session下一条消息序号
|
||||
String url = "http://18.167.251.121:10002/chat-stream";
|
||||
// String url = "http://10.1.1.240:1013/chat-stream";
|
||||
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
conn.setRequestProperty("Content-Type", "application/json");
|
||||
Long projectId = null;
|
||||
if (null == projectParamId) {
|
||||
Project project = new Project();
|
||||
project.setCreateTime(LocalDateTime.now());
|
||||
projectMapper.insert(project);
|
||||
projectId = project.getId();
|
||||
}else {
|
||||
projectId = projectParamId;
|
||||
}
|
||||
|
||||
JSONObject jsonBodyObject = new JSONObject();
|
||||
jsonBodyObject.put("session_id", projectId.toString());
|
||||
jsonBodyObject.put("project_id", projectId.toString());
|
||||
jsonBodyObject.put("role", "user");
|
||||
jsonBodyObject.put("image", imageUrlList); // 可扩展
|
||||
jsonBodyObject.put("file", fileUrl != null ? fileUrl : "");
|
||||
jsonBodyObject.put("image", !CollectionUtils.isEmpty(imageUrlList) ? imageUrlList : new ArrayList<>()); // 可扩展
|
||||
// jsonBodyObject.put("image", ""); // 可扩展
|
||||
jsonBodyObject.put("file", !StringUtils.isEmpty(fileUrl) ? Collections.singletonList(fileUrl) : new ArrayList<>());
|
||||
jsonBodyObject.put("message", prompt);
|
||||
jsonBodyObject.put("enable_thinking", false);
|
||||
jsonBodyObject.put("enable_thinking", enableThinking);
|
||||
jsonBodyObject.put("process", !StringUtils.isEmpty(process) ? process : "");
|
||||
jsonBodyObject.put("is_create_project", false);
|
||||
|
||||
// 1. 存储用户输入
|
||||
ChatMessage userMessage = new ChatMessage();
|
||||
userMessage.setRole("user");
|
||||
userMessage.setProjectId(projectId);
|
||||
userMessage.setSeq(userSeq);
|
||||
userMessage.setSeq(getNextSeq(projectId));
|
||||
userMessage.setCreateTime(LocalDateTime.now());
|
||||
userMessage.setContent(jsonBodyObject.toJSONString());
|
||||
userMessage.setAccountId(accountId);
|
||||
chatMessageMapper.insert(userMessage);
|
||||
|
||||
try (OutputStream os = conn.getOutputStream()) {
|
||||
System.out.println(jsonBodyObject.toJSONString());
|
||||
byte[] input = jsonBodyObject.toJSONString().getBytes(StandardCharsets.UTF_8);
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
|
||||
// 2. 流式接收并累积内容
|
||||
StringBuilder responseBuilder = new StringBuilder();
|
||||
// 3. 存储系统回复
|
||||
ChatMessage systemMessage = new ChatMessage();
|
||||
systemMessage.setRole("system");
|
||||
systemMessage.setIsImage(0);
|
||||
systemMessage.setProjectId(projectId);
|
||||
// systemMessage.setCreateTime(LocalDateTime.now());
|
||||
// systemMessage.setContent(responseBuilder.toString());
|
||||
systemMessage.setAccountId(accountId);
|
||||
// chatMessageMapper.insert(systemMessage);
|
||||
StringBuilder responseContentBuilder = new StringBuilder();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
@@ -117,42 +139,169 @@ public class LLMServiceImpl implements LLMService {
|
||||
System.out.println(jsonStr);
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
String status = json.getString("status");
|
||||
|
||||
if ("[DONE]".equals(status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(status)) {
|
||||
String content = json.getString("content");
|
||||
if (!status.equals("[RUNNING]") && !status.equals("[DESIGN_SIGNAL]")) {
|
||||
// 结束标识
|
||||
if ("[DONE]".equals(status)) {
|
||||
break;
|
||||
}else if ("[RUNNING]".equals(status)) {
|
||||
if (content.startsWith("\n[TOOL_CALL]") || content.startsWith("\n[TOOL_RESPONSE]")) {
|
||||
// 不发送不存储
|
||||
}else {
|
||||
responseContentBuilder.append(content);
|
||||
emitter.send(json.toJSONString());
|
||||
}
|
||||
}else {
|
||||
if (responseContentBuilder.length() != 0) {
|
||||
systemMessage.setSeq(getNextSeq(projectId));
|
||||
systemMessage.setCreateTime(LocalDateTime.now());
|
||||
systemMessage.setContent(responseContentBuilder.toString());
|
||||
chatMessageMapper.insert(systemMessage);
|
||||
systemMessage.setId(null);
|
||||
responseContentBuilder = new StringBuilder();
|
||||
}
|
||||
JSONObject toolsData = json.getJSONObject("tools_data");
|
||||
ReceiveDesignParam receiveDesignParam = JSONObject.parseObject(JSONObject.toJSONString(toolsData), ReceiveDesignParam.class);
|
||||
receiveDesignParam.setProjectId(projectId);
|
||||
designService.receiveDesignParams(receiveDesignParam);
|
||||
}
|
||||
if (content != null) {
|
||||
responseBuilder.append(content);
|
||||
if (Objects.nonNull(toolsData) && !status.equals("[DESIGN_SIGNAL]") && !status.equals("[PROJECT_CREATE_SIGNAL]")) {
|
||||
boolean color = true;
|
||||
ReceiveDesignParam receiveDesignParam = JSONObject.parseObject(JSONObject.toJSONString(toolsData), ReceiveDesignParam.class);
|
||||
receiveDesignParam.setProjectId(projectId);
|
||||
designService.receiveDesignParams(receiveDesignParam);
|
||||
for (ReceiveCollectionElement receiveCollectionElement : receiveDesignParam.getReceiveCollectionElementList()) {
|
||||
if (!StringUtils.isEmpty(receiveCollectionElement.getUrl())) {
|
||||
color = false;
|
||||
receiveCollectionElement.setMinioUrl(minioUtil.getPreSignedUrl(receiveCollectionElement.getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
String jsonString = JSONObject.toJSONString(receiveDesignParam);
|
||||
json.put("tools_data", jsonString);
|
||||
ChatMessage systemImage = new ChatMessage();
|
||||
systemImage.setRole("system");
|
||||
if (color) {
|
||||
systemImage.setIsImage(1);
|
||||
}else {
|
||||
systemImage.setIsImage(2);
|
||||
}
|
||||
systemImage.setProjectId(projectId);
|
||||
systemImage.setSeq(getNextSeq(projectId));
|
||||
systemImage.setCreateTime(LocalDateTime.now());
|
||||
systemImage.setContent(JSONObject.toJSONString(receiveDesignParam.getReceiveCollectionElementList()));
|
||||
systemImage.setAccountId(accountId);
|
||||
chatMessageMapper.insert(systemImage);
|
||||
}
|
||||
// if (status.equals("[PROJECT_CREATE_SIGNAL]")) {
|
||||
// JSONObject data = toolsData;
|
||||
// Project project = projectMapper.selectById(projectId);
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// project.setUpdateTime(now);
|
||||
// project.setAccountId(accountId);
|
||||
// project.setName(data.getString("project_name"));
|
||||
// project.setOriginal(1);
|
||||
// project.setProcess(process);
|
||||
// projectMapper.updateById(project);
|
||||
//
|
||||
// Workspace workspace = new Workspace();
|
||||
// workspace.setAccountId(accountId);
|
||||
// workspace.setCreateTime(now);
|
||||
// String ageGroup = data.getString("ageGroup");
|
||||
// if (StringUtils.isEmpty(ageGroup)) {
|
||||
// workspace.setAgeGroup("Adult");
|
||||
// }else {
|
||||
// if (AgeGroup.isValidName(process)) {
|
||||
// workspace.setAgeGroup(ageGroup);
|
||||
// }else {
|
||||
// workspace.setAgeGroup("Adult");
|
||||
// }
|
||||
// }
|
||||
// String gender = data.getString("gender");
|
||||
// if (StringUtils.isEmpty(gender)) {
|
||||
// workspace.setSex("Female");
|
||||
// }else {
|
||||
// if (Sex.isValidName(gender)) {
|
||||
// workspace.setSex(gender);
|
||||
// }else {
|
||||
// workspace.setSex("Female");
|
||||
// }
|
||||
// }
|
||||
// String position = data.getString("position");
|
||||
// if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
|
||||
// workspace.setPosition("Overall");
|
||||
// }else {
|
||||
// if (StringUtils.isEmpty(position)) {
|
||||
// if (workspace.getSex().equals("Female")) {
|
||||
// workspace.setPosition(Position.BLOUSE.getValue());
|
||||
// }else {
|
||||
// workspace.setPosition(Position.TOPS.getValue());
|
||||
// }
|
||||
// }else {
|
||||
// if (Position.isValidName(position)) {
|
||||
// workspace.setPosition(position);
|
||||
// }else {
|
||||
// if (workspace.getSex().equals("Female")) {
|
||||
// workspace.setPosition(Position.BLOUSE.getValue());
|
||||
// }else {
|
||||
// workspace.setPosition(Position.TOPS.getValue());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// workspace.setSystemDesignerPercentage(30);
|
||||
// workspace.setProjectId(project.getId());
|
||||
// workspace.setAccountId(accountId);
|
||||
// String style = data.getString("style");
|
||||
// String styleName = null;
|
||||
// if (StringUtils.isEmpty(style)) {
|
||||
// styleName = StyleEnum.NEW_CHINESE.name();
|
||||
// }else {
|
||||
// if (StyleEnum.isValidName(style)) {
|
||||
// styleName = style;
|
||||
// }else {
|
||||
// styleName = StyleEnum.NEW_CHINESE.name();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// SysFile sysFile = sysFileService.getOneBySex(styleName, workspace.getSex(), workspace.getAgeGroup());
|
||||
//
|
||||
// if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
|
||||
// workspace.setMannequinFemaleId(sysFile.getId());
|
||||
// workspace.setMannequinFemaleType("System");
|
||||
// }else {
|
||||
// workspace.setMannequinMaleId(sysFile.getId());
|
||||
// workspace.setMannequinMaleType("System");
|
||||
// }
|
||||
//
|
||||
// workspaceMapper.insert(workspace);
|
||||
//
|
||||
// if (!StringUtils.isEmpty(styleName)) {
|
||||
// QueryWrapper<Style> qw = new QueryWrapper<>();
|
||||
// qw.lambda().eq(Style::getName, styleName);
|
||||
// Style style1 = styleMapper.selectOne(qw);
|
||||
// if (Objects.nonNull(style1)) {
|
||||
// WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
// rel.setWorkspaceId(workspace.getId());
|
||||
// rel.setStyleId(style1.getId());
|
||||
// workspaceRelStyleMapper.insert(rel);
|
||||
// }
|
||||
// }
|
||||
// toolsData.put("projectId", projectId);
|
||||
// json.put("tools_data", toolsData.toJSONString());
|
||||
// }
|
||||
emitter.send(json.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (responseContentBuilder.length() != 0) {
|
||||
systemMessage.setSeq(getNextSeq(projectId));
|
||||
systemMessage.setCreateTime(LocalDateTime.now());
|
||||
systemMessage.setContent(responseContentBuilder.toString());
|
||||
chatMessageMapper.insert(systemMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 存储系统回复
|
||||
int systemSeq = getNextSeq(projectId);
|
||||
ChatMessage systemMessage = new ChatMessage();
|
||||
systemMessage.setRole("user");
|
||||
systemMessage.setProjectId(projectId);
|
||||
systemMessage.setSeq(systemSeq);
|
||||
systemMessage.setCreateTime(LocalDateTime.now());
|
||||
systemMessage.setContent(responseBuilder.toString());
|
||||
systemMessage.setAccountId(accountId);
|
||||
chatMessageMapper.insert(systemMessage);
|
||||
}
|
||||
|
||||
emitter.complete();
|
||||
} catch (Exception e) {
|
||||
System.out.println("走进异常");
|
||||
emitter.completeWithError(e);
|
||||
}
|
||||
});
|
||||
@@ -161,9 +310,9 @@ public class LLMServiceImpl implements LLMService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long chatCreateProject(String prompt, String process) {
|
||||
public Long chatCreateProject(String prompt, String process, String fileUrl, List<String> imageUrlList) {
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
JSONObject jsonObject = pythonService.getProjectParam(prompt);
|
||||
JSONObject jsonObject = pythonService.getProjectParam(prompt, fileUrl, imageUrlList);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
Project project = new Project();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -209,13 +358,25 @@ public class LLMServiceImpl implements LLMService {
|
||||
}
|
||||
}
|
||||
String position = data.getString("position");
|
||||
if (StringUtils.isEmpty(position)) {
|
||||
if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
|
||||
workspace.setPosition("Overall");
|
||||
}else {
|
||||
if (Position.isValidName(position)) {
|
||||
workspace.setPosition(position);
|
||||
if (StringUtils.isEmpty(position)) {
|
||||
if (workspace.getSex().equals("Female")) {
|
||||
workspace.setPosition(Position.BLOUSE.getValue());
|
||||
}else {
|
||||
workspace.setPosition(Position.TOPS.getValue());
|
||||
}
|
||||
}else {
|
||||
workspace.setPosition("Overall");
|
||||
if (Position.isValidName(position) && !position.equals(Position.OVERALL.getValue())) {
|
||||
workspace.setPosition(position);
|
||||
}else {
|
||||
if (workspace.getSex().equals("Female")) {
|
||||
workspace.setPosition(Position.BLOUSE.getValue());
|
||||
}else {
|
||||
workspace.setPosition(Position.TOPS.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
workspace.setSystemDesignerPercentage(30);
|
||||
@@ -263,7 +424,7 @@ public class LLMServiceImpl implements LLMService {
|
||||
@Override
|
||||
public List<String> uploadFile(MultipartFile file) {
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
String minioUrl = minioUtil.upload("chat-message", userHolder.getId() + "", file);
|
||||
String minioUrl = minioUtil.upload("chat-message", userHolder.getId() + "/" + file.getOriginalFilename(), file, null);
|
||||
String preSignedUrl = minioUtil.getPreSignedUrl(minioUrl, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(minioUrl);
|
||||
@@ -274,9 +435,47 @@ public class LLMServiceImpl implements LLMService {
|
||||
@Override
|
||||
public PageBaseResponse<ChatMessage> getChatHistory(ChatHistoryDTO chatHistoryDTO) {
|
||||
QueryWrapper<ChatMessage> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(ChatMessage::getProjectId, chatHistoryDTO);
|
||||
qw.lambda().eq(ChatMessage::getProjectId, chatHistoryDTO.getProjectId());
|
||||
qw.lambda().orderByDesc(ChatMessage::getSeq);
|
||||
Page<ChatMessage> chatMessagePage = chatMessageMapper.selectPage(new Page<>(chatHistoryDTO.getPage(), chatHistoryDTO.getSize()), qw);
|
||||
for (ChatMessage record : chatMessagePage.getRecords()) {
|
||||
if (record.getIsImage() != null && record.getIsImage() == 1) {
|
||||
String content = record.getContent();
|
||||
List<ReceiveCollectionElement> list = JSONObject.parseArray(content, ReceiveCollectionElement.class);
|
||||
for (ReceiveCollectionElement receiveCollectionElement : list) {
|
||||
if (!StringUtils.isEmpty(receiveCollectionElement.getUrl())) {
|
||||
receiveCollectionElement.setMinioUrl(minioUtil.getPreSignedUrl(receiveCollectionElement.getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
record.setContent(JSONObject.toJSONString(list));
|
||||
}
|
||||
if (record.getRole().equals("user")) {
|
||||
String content = record.getContent();
|
||||
JSONObject jsonObject = JSONObject.parseObject(content);
|
||||
JSONArray fileArray = jsonObject.getJSONArray("file");
|
||||
if (!CollectionUtils.isEmpty(fileArray)) {
|
||||
for (int i = 0; i < fileArray.size(); i++) {
|
||||
String string = fileArray.getString(i);
|
||||
if (!StringUtils.isEmpty(string)) {
|
||||
fileArray.set(i, minioUtil.getPreSignedUrl(string, 24 * 60));
|
||||
}
|
||||
}
|
||||
jsonObject.put("file", fileArray);
|
||||
}
|
||||
|
||||
JSONArray imageArray = jsonObject.getJSONArray("image");
|
||||
if (!CollectionUtils.isEmpty(imageArray)) {
|
||||
for (int i = 0; i < imageArray.size(); i++) {
|
||||
String string = imageArray.getString(i);
|
||||
if (!StringUtils.isEmpty(string)) {
|
||||
imageArray.set(i, minioUtil.getPreSignedUrl(string, 24 * 60));
|
||||
}
|
||||
}
|
||||
jsonObject.put("image", imageArray);
|
||||
}
|
||||
record.setContent(JSONObject.toJSONString(jsonObject));
|
||||
}
|
||||
}
|
||||
return PageBaseResponse.success(chatMessagePage);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,10 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
queryWrapper.like("name", query.getPictureName());
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(query.getAgeGroup())) {
|
||||
queryWrapper.eq("level3_type", query.getAgeGroup());
|
||||
}
|
||||
|
||||
if (query.getBrandId() != null) {
|
||||
QueryWrapper<BrandRelLibrary> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(BrandRelLibrary::getBrandId, query.getBrandId());
|
||||
|
||||
@@ -131,6 +131,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
private ThreeDModuleMapper threeDModuleMapper;
|
||||
@Resource
|
||||
private ProductImageService productImageService;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
|
||||
@Override
|
||||
public void deleteUserGroup(Long userGroupId) {
|
||||
@@ -1653,11 +1655,36 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
moduleChooseVO.setPatternMaking3D(threeDModuleVO);
|
||||
}
|
||||
}
|
||||
}else if (module.equals(Module.mannequin.name())) {
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElement::getProjectId, projectDTO.getId());
|
||||
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
||||
List<CollectionElementVO> list = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
for (CollectionElement collectionElement : collectionElements) {
|
||||
CollectionElementVO collectionElementVO = CopyUtil.copyObject(collectionElement, CollectionElementVO.class);
|
||||
CollectionElementRelModel relModel = getCollectionElementRelModel(collectionElementVO.getId());
|
||||
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(collectionElementVO.getUrl(), 24 * 60));
|
||||
collectionElementVO.setMannequinRelationId(relModel.getRelationId());
|
||||
collectionElementVO.setMannequinRelationType(relModel.getRelationType());
|
||||
collectionElementVO.setCollectionId(collectionElement.getId());
|
||||
list.add(collectionElementVO);
|
||||
}
|
||||
}
|
||||
moduleChooseVO.setMannequin(list);
|
||||
}
|
||||
}
|
||||
return moduleChooseVO;
|
||||
}
|
||||
|
||||
private CollectionElementRelModel getCollectionElementRelModel(Long id) {
|
||||
QueryWrapper<CollectionElementRelModel> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElementRelModel::getCollectionElementId, id);
|
||||
CollectionElementRelModel collectionElementRelModel = collectionElementRelModelMapper.selectOne(qw);
|
||||
return collectionElementRelModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO) {
|
||||
@@ -1902,6 +1929,85 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(moduleSaveDTO.getMannequin())) {
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
||||
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
||||
Set<Long> old = collectionElements.stream().map(CollectionElement::getId).collect(Collectors.toSet());
|
||||
// Set<String> oldUrl = collectionElements.stream().map(CollectionElement::getUrl).collect(Collectors.toSet());
|
||||
List<MannequinDTO> mannequin = moduleSaveDTO.getMannequin();
|
||||
for (MannequinDTO dto : mannequin) {
|
||||
if (null != dto.getCollectionElementId()) {
|
||||
old.remove(dto.getId());
|
||||
continue;
|
||||
}
|
||||
if (dto.getType().equals("System")) {
|
||||
SysFile sysFile = sysFileMapper.selectById(dto.getId());
|
||||
|
||||
CollectionElement collectionElement = new CollectionElement();
|
||||
collectionElement.setAccountId(accountId);
|
||||
collectionElement.setProjectId(projectId);
|
||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
collectionElement.setName(sysFile.getName());
|
||||
collectionElement.setUrl(sysFile.getUrl());
|
||||
// collectionElement.setHasPin(board.getIsPin());
|
||||
collectionElement.setMd5(sysFile.getMd5());
|
||||
collectionElement.setCreateDate(new Date());
|
||||
collectionElement.setHasPin((byte) 0);
|
||||
collectionElementMapper.insert(collectionElement);
|
||||
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
|
||||
collectionElementRelModel.setCollectionElementId(collectionElement.getId());
|
||||
collectionElementRelModel.setRelationId(dto.getId());
|
||||
collectionElementRelModel.setRelationType("System");
|
||||
collectionElementRelModelMapper.insert(collectionElementRelModel);
|
||||
}else if (dto.getType().equals("Library")) {
|
||||
Library library = libraryMapper.selectById(dto.getId());
|
||||
|
||||
CollectionElement collectionElement = new CollectionElement();
|
||||
collectionElement.setAccountId(accountId);
|
||||
collectionElement.setProjectId(projectId);
|
||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
collectionElement.setName(library.getName());
|
||||
collectionElement.setUrl(library.getUrl());
|
||||
// collectionElement.setHasPin(board.getIsPin());
|
||||
collectionElement.setMd5(library.getMd5());
|
||||
collectionElement.setCreateDate(new Date());
|
||||
collectionElement.setHasPin((byte) 0);
|
||||
collectionElementMapper.insert(collectionElement);
|
||||
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
|
||||
collectionElementRelModel.setCollectionElementId(collectionElement.getId());
|
||||
collectionElementRelModel.setRelationId(dto.getId());
|
||||
collectionElementRelModel.setRelationType("System");
|
||||
collectionElementRelModelMapper.insert(collectionElementRelModel);
|
||||
|
||||
}else {
|
||||
// if (old.contains(dto.getId())) {
|
||||
// CollectionElement collectionElement = collectionElementMapper.selectById(dto.getId());
|
||||
//// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
//// collectionElement.setHasPin(board.getIsPin());
|
||||
// collectionElement.setUpdateDate(new Date());
|
||||
// collectionElementMapper.updateById(collectionElement);
|
||||
// old.remove(dto.getId());
|
||||
// }else {
|
||||
// CollectionElement collectionElement = collectionElementMapper.selectById(dto.getId());
|
||||
// collectionElement.setProjectId(projectId);
|
||||
//// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
//// collectionElement.setHasPin(board.getIsPin());
|
||||
// collectionElement.setUpdateDate(new Date());
|
||||
// collectionElementMapper.updateById(collectionElement);
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(old)) {
|
||||
collectionElementMapper.deleteBatchIds(old);
|
||||
// 删除关联关系
|
||||
deleteByCollectionElementIdList(old);
|
||||
}
|
||||
|
||||
}
|
||||
if (boundingBox) {
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
||||
@@ -1932,6 +2038,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
return result;
|
||||
}
|
||||
|
||||
private void deleteByCollectionElementIdList(Set<Long> old) {
|
||||
QueryWrapper<CollectionElementRelModel> qw = new QueryWrapper<>();
|
||||
qw.lambda().in(CollectionElementRelModel::getCollectionElementId, old);
|
||||
collectionElementRelModelMapper.delete(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryLibraryPageVO getMannequinDetail(MannequinDTO mannequinDTO) {
|
||||
QueryLibraryPageVO vo = new QueryLibraryPageVO();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
||||
import com.ai.da.common.enums.LibraryLevel1TypeEnum;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.ResultEnum;
|
||||
@@ -61,6 +62,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
@Resource
|
||||
private BrandDNAMapper brandDNAMapper;
|
||||
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
@@ -82,6 +85,10 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
|
||||
@Override
|
||||
public IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace) {
|
||||
@@ -396,6 +403,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
vo.setStyleName(styleEnum.getChinese());
|
||||
}
|
||||
}
|
||||
if (null != vo.getUserBrandDna()) {
|
||||
BrandDNA brandDNA = brandDNAMapper.selectById(vo.getUserBrandDna());
|
||||
vo.setUserBrandDnaName(brandDNA.getBrandName());
|
||||
vo.setUserBrandDnaImg(minioUtil.getPreSignedUrl(brandDNA.getBrandLogo(), 24 * 60));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -687,47 +699,48 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
projectMapper.updateById(project);
|
||||
}
|
||||
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getProjectId, projectDTO.getId());
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("Lack of associated workspace.");
|
||||
}else {
|
||||
Workspace workspace = workspaces.get(0);
|
||||
Workspace workspaceNew = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
||||
workspaceNew.setId(workspace.getId());
|
||||
workspace.setUpdateTime(LocalDateTime.now());
|
||||
workspaceMapper.updateById(workspaceNew);
|
||||
}
|
||||
|
||||
if (projectDTO.getStyleId() != null) {
|
||||
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
||||
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
||||
if (CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
rel.setWorkspaceId(projectDTO.getWorkspace().getId());
|
||||
rel.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
if (Objects.nonNull(projectDTO.getWorkspace())) {
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getProjectId, projectDTO.getId());
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("Lack of associated workspace.");
|
||||
}else {
|
||||
WorkspaceRelStyle workspaceRelStyleOld = workspaceRelStyles.get(0);
|
||||
if (!Objects.equals(workspaceRelStyleOld.getStyleId(), projectDTO.getStyleId())) {
|
||||
workspaceRelStyleOld.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.updateById(workspaceRelStyleOld);
|
||||
Workspace workspace = workspaces.get(0);
|
||||
Workspace workspaceNew = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
||||
workspaceNew.setId(workspace.getId());
|
||||
workspace.setUpdateTime(LocalDateTime.now());
|
||||
workspaceMapper.updateById(workspaceNew);
|
||||
}
|
||||
if (projectDTO.getStyleId() != null) {
|
||||
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
||||
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
||||
if (CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
rel.setWorkspaceId(projectDTO.getWorkspace().getId());
|
||||
rel.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
}else {
|
||||
WorkspaceRelStyle workspaceRelStyleOld = workspaceRelStyles.get(0);
|
||||
if (!Objects.equals(workspaceRelStyleOld.getStyleId(), projectDTO.getStyleId())) {
|
||||
workspaceRelStyleOld.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.updateById(workspaceRelStyleOld);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
||||
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
||||
if (!CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
workspaceRelStyleMapper.deleteBatchIds(workspaceRelStyles);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
||||
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
||||
if (!CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
workspaceRelStyleMapper.deleteBatchIds(workspaceRelStyles);
|
||||
}
|
||||
Long workspaceId = workspaceService.getByProjectId(projectId);
|
||||
WorkspaceVO byIdForProject = workspaceService.getByIdForProject(workspaceId);
|
||||
vo.setWorkspaceVO(byIdForProject);
|
||||
}
|
||||
Long workspaceId = workspaceService.getByProjectId(projectId);
|
||||
WorkspaceVO byIdForProject = workspaceService.getByIdForProject(workspaceId);
|
||||
vo.setId(projectId);
|
||||
vo.setWorkspaceVO(byIdForProject);
|
||||
return vo;
|
||||
}else {
|
||||
Project project = CopyUtil.copyObject(projectDTO, Project.class);
|
||||
@@ -737,36 +750,52 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
project.setUpdateTime(now);
|
||||
projectMapper.insert(project);
|
||||
|
||||
Workspace workspace = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
||||
workspace.setIsLastIndex(0);
|
||||
workspace.setAccountId(userInfo.getId());
|
||||
workspace.setProjectId(project.getId());
|
||||
workspace.setCreateTime(LocalDateTime.now());
|
||||
workspace.setUpdateTime(LocalDateTime.now());
|
||||
if (Objects.nonNull(projectDTO.getWorkspace())) {
|
||||
Workspace workspace = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
||||
workspace.setIsLastIndex(0);
|
||||
workspace.setAccountId(userInfo.getId());
|
||||
workspace.setProjectId(project.getId());
|
||||
workspace.setCreateTime(LocalDateTime.now());
|
||||
workspace.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
if (projectDTO.getProcess().equals(DesignProcess.SERIES_DESIGN.name()) || projectDTO.getProcess().equals(DesignProcess.SKETCH_COLLAGE_PROCESS.name())) {
|
||||
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
||||
|
||||
if (projectDTO.getWorkspace().getSex().equals(Sex.FEMALE.getValue())) {
|
||||
workspace.setMannequinFemaleId(sysFile.getId());
|
||||
workspace.setMannequinFemaleType("System");
|
||||
}else {
|
||||
workspace.setMannequinMaleId(sysFile.getId());
|
||||
workspace.setMannequinMaleType("System");
|
||||
if (projectDTO.getProcess().equals(DesignProcess.SERIES_DESIGN.name()) || projectDTO.getProcess().equals(DesignProcess.SKETCH_COLLAGE_PROCESS.name())) {
|
||||
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
||||
CollectionElement collectionElement = new CollectionElement();
|
||||
collectionElement.setAccountId(userInfo.getId());
|
||||
collectionElement.setProjectId(project.getId());
|
||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
|
||||
collectionElement.setName(sysFile.getName());
|
||||
collectionElement.setUrl(sysFile.getUrl());
|
||||
collectionElement.setMd5(sysFile.getMd5());
|
||||
collectionElement.setCreateDate(new Date());
|
||||
collectionElement.setHasPin((byte) 0);
|
||||
collectionElementMapper.insert(collectionElement);
|
||||
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
|
||||
collectionElementRelModel.setCollectionElementId(collectionElement.getId());
|
||||
collectionElementRelModel.setRelationId(sysFile.getId());
|
||||
collectionElementRelModel.setRelationType("System");
|
||||
collectionElementRelModelMapper.insert(collectionElementRelModel);
|
||||
if (projectDTO.getWorkspace().getSex().equals(Sex.FEMALE.getValue())) {
|
||||
workspace.setMannequinFemaleId(sysFile.getId());
|
||||
workspace.setMannequinFemaleType("System");
|
||||
}else {
|
||||
workspace.setMannequinMaleId(sysFile.getId());
|
||||
workspace.setMannequinMaleType("System");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workspaceMapper.insert(workspace);
|
||||
workspaceMapper.insert(workspace);
|
||||
|
||||
if (projectDTO.getStyleId() != null) {
|
||||
WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
rel.setWorkspaceId(workspace.getId());
|
||||
rel.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
if (projectDTO.getStyleId() != null) {
|
||||
WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
rel.setWorkspaceId(workspace.getId());
|
||||
rel.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
}
|
||||
WorkspaceVO byIdForProject = workspaceService.getByIdForProject(workspace.getId());
|
||||
vo.setWorkspaceVO(byIdForProject);
|
||||
}
|
||||
WorkspaceVO byIdForProject = workspaceService.getByIdForProject(workspace.getId());
|
||||
vo.setId(project.getId());
|
||||
vo.setWorkspaceVO(byIdForProject);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user