BUGFIX:1. to product 不添加衣服类别提示词

2. 新增添加了单个印花的未分割图层返回
3. design中使用的元素,sketch没有被正确的添加年龄段,导致用户无法查询到
This commit is contained in:
2025-09-25 16:51:58 +08:00
parent 24fe265172
commit 2d0936f0f3
13 changed files with 71 additions and 28 deletions

View File

@@ -94,6 +94,10 @@ public class DesignItemDetail implements Serializable {
* 未分割的只上了颜色或只有overall印花的图层
*/
private String undividedLayer;
/**
* 未分割的添加了颜色、overall印花和single印花的图
*/
private String undividedLayerWithSinglePrint;
/**
* 局部design 只会有一张图

View File

@@ -62,6 +62,9 @@ public class DesignItemClothesDetailVO {
@ApiModelProperty("未分割的图层")
private String undividedLayer;
@ApiModelProperty("添加single印花的未分割的图层")
private String undividedLayerWithSinglePrint;
@ApiModelProperty("局部design")
private PartialDesignDTO partialDesign;

View File

@@ -65,7 +65,7 @@ public interface CollectionElementService extends IService<CollectionElement> {
*/
Boolean saveLibraryByCollectionElement(List<CollectionElement> elements, String timeZone);
Boolean saveLibraryByCollectionElement(List<CollectionElement> elements, String timeZone, String modelSex);
Boolean saveLibraryByCollectionElement(List<CollectionElement> elements, String timeZone, String modelSex, String ageGroup);
/**
* 校验element

View File

@@ -53,7 +53,7 @@ public interface DesignItemService extends IService<DesignItem> {
DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO);
Map<String, String> setPriorityAndUndividedLayer(JSONArray layers);
Map<String, List<String>> setPriorityAndUndividedLayer(JSONArray layers);
Map<String, String> setTypeAndUndividedLayer(JSONArray layers);

View File

@@ -63,4 +63,7 @@ public interface WorkspaceService extends IService<Workspace> {
SaveOrUpdateProjectVO saveOrUpdateProject(ProjectDTO projectDTO);
Long getByProjectId(Long projectId);
Workspace getWSByProjectId(Long projectId);
}

View File

@@ -91,11 +91,11 @@ public class AliPayServiceImpl implements AliPayService {
return response.getBody();
} else {
log.info("调用失败,返回码 ===> " + response.getCode() + ", 返回描述 ===> " + response.getMsg());
throw new BusinessException("Order creation failed");
throw new BusinessException("order.creation.failed");
}
} catch (AlipayApiException e) {
e.printStackTrace();
throw new BusinessException("Order creation failed");
throw new BusinessException("order.creation.failed");
}
}

View File

@@ -318,7 +318,7 @@ public class ChatRobotServiceImpl extends ServiceImpl<ChatRobotMapper, ChatRobot
library.setName(name);
}
} else {
throw new BusinessException("error url");
throw new BusinessException("the.path.is.error");
}
try {

View File

@@ -331,7 +331,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
}
@Override
public Boolean saveLibraryByCollectionElement(List<CollectionElement> elements, String timeZone, String modelSex) {
public Boolean saveLibraryByCollectionElement(List<CollectionElement> elements, String timeZone,
String modelSex, String ageGroup) {
if (CollectionUtils.isEmpty(elements)) {
return Boolean.TRUE;
}
@@ -351,6 +352,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
List<Library> libraryList = CopyUtil.copyList(elements, Library.class, (o, d) -> {
if (d.getLevel1Type().equals(LibraryLevel1TypeEnum.SKETCH_BOARD.getRealName())) {
d.setLevel3Type(modelSex);
d.setAgeGroup(ageGroup);
// try {
// libraryService.processSketchBoards(d.getUrl(), d.getLevel2Type());
// }catch (Exception e) {

View File

@@ -336,7 +336,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
public List<TDesignPythonOutfitDetail> saveDesignSingleItemDetailAndLayers(DesignPythonObjects pythonObjects
, Long designId, Long designItemId, Long userId
, JSONObject outfit, String timeZone, List<DesignSingleItemDTO> designSingleItemDTOList
, Map<String, String> priorityAndUndividedLayer
, Map<String, List<String>> priorityAndUndividedLayer
, boolean changeModelFlag
, Long modelId, String modelType, boolean isSingleCollectionFlag) {
@@ -375,7 +375,11 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
}
designItemDetail.setIconPath(detail.getIcon());
// designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getType().toLowerCase()));
if (!detail.getType().equals("Body")) designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getPriority().toString()));
if (!detail.getType().equals("Body")){
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(0));
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1));
}
// 印花存储在design_item_detail_print表中 这里还要存吗?
// DesignPythonItemPrint printObject = detail.getPrintToPython();
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
@@ -600,7 +604,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
JSONObject outfit = data.getJSONObject("0");
JSONArray layers = outfit.getJSONArray("layers");
Map<String, String> priorityAndUndividedLayer = setPriorityAndUndividedLayer(layers);
Map<String, List<String>> priorityAndUndividedLayer = setPriorityAndUndividedLayer(layers);
if (!designSingleIncludeLayersDTO.getIsPreview()) {
// 更新及保存图层信息
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId()
@@ -727,13 +731,13 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
}
@Override
public Map<String, String> setPriorityAndUndividedLayer(JSONArray layers){
HashMap<String, String> priorityAndLayer = new HashMap<>();
public Map<String, List<String>> setPriorityAndUndividedLayer(JSONArray layers){
HashMap<String, List<String>> priorityAndLayer = new HashMap<>();
for (int i = 0; i < layers.size(); i++) {
JSONObject jsonObject = layers.getJSONObject(i);
String priority = jsonObject.getString("priority");
String category = jsonObject.getString("image_category").split("_")[0];
if (!category.equals("body") && !priorityAndLayer.containsKey(priority)) priorityAndLayer.put(priority, jsonObject.getString("pattern_image_url"));
if (!category.equals("body") && !priorityAndLayer.containsKey(priority)) priorityAndLayer.put(priority, Arrays.asList(jsonObject.getString("pattern_overall_image_url"), jsonObject.getString("pattern_print_image_url")));
}
return priorityAndLayer;
}
@@ -848,7 +852,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
List<DesignSingleItemDTO> designSingleItemDTOList,
List<DesignPythonOutfitVO> layersObject,
String singleOrOverall,
Map<String, String> priorityAndUndividedLayer) {
Map<String, List<String>> priorityAndUndividedLayer) {
DesignSingleVO designSingleVO = new DesignSingleVO();
ArrayList<DesignItemClothesDetailVO> clothes = new ArrayList<>();
@@ -887,7 +891,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
String preSignedUrl = StringUtil.isNullOrEmpty(partialDesignMinioPath) ? null : minioUtil.getPreSignedUrl(partialDesignMinioPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true);
designItemClothesDetailVO.setPartialDesign(new PartialDesignDTO(partialDesignMinioPath, preSignedUrl));
if (priorityAndUndividedLayer.containsKey(singleItem.getPriority().toString())) designItemClothesDetailVO.setUndividedLayer(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
if (priorityAndUndividedLayer.containsKey(singleItem.getPriority().toString())){
designItemClothesDetailVO.setUndividedLayer(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(0), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
designItemClothesDetailVO.setUndividedLayerWithSinglePrint(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(1), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
}
body.setLayersObject(layersObject.stream().filter(layers -> layers.getImageCategory().equals("body")).collect(Collectors.toList()));
clothes.add(designItemClothesDetailVO);

View File

@@ -13,10 +13,7 @@ import com.ai.da.mapper.primary.*;
import com.ai.da.mapper.primary.entity.*;
import com.ai.da.mapper.primary.entity.Collection;
import com.ai.da.model.dto.*;
import com.ai.da.model.enums.BuildType;
import com.ai.da.model.enums.CollectionType;
import com.ai.da.model.enums.DesignProcess;
import com.ai.da.model.enums.UserBehaviorType;
import com.ai.da.model.enums.*;
import com.ai.da.model.vo.*;
import com.ai.da.python.PythonService;
import com.ai.da.python.vo.*;
@@ -385,7 +382,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
log.info("design python端运行时间" + totalTimeInSeconds + "");
//生成library
startTime = System.currentTimeMillis();
generateLibrary(elementVO, designDTO.getTimeZone());
String ageGroup = getAgeGroupByCollectionId(collectionId);
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
//处理关联关系,修复element覆盖得情况
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
// List<Long> relationElementIds = relationElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
@@ -412,6 +410,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
return requestId;
}
private String getAgeGroupByCollectionId(Long collectionId){
List<CollectionElement> byCollectionId = collectionElementService.getByCollectionId(collectionId);
if (byCollectionId != null && !byCollectionId.isEmpty()){
Long projectId = byCollectionId.get(0).getProjectId();
if (projectId != null && projectId != 0L){
Workspace workspace = workspaceService.getWSByProjectId(projectId);
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
return workspace.getAgeGroup();
}
}
}
return AgeGroup.ADULT.getValue();
}
@Override
public void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam) {
if (!StringUtils.isEmpty(moodboardPosition)) {
@@ -670,7 +682,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
).collect(Collectors.toList()));
}
private void generateLibrary(ValidateElementVO elementVO, String timeZone) {
private void generateLibrary(ValidateElementVO elementVO, String timeZone, String ageGroup) {
List<CollectionElement> elements = Lists.newArrayList();
if (!CollectionUtils.isEmpty(elementVO.getMoodBoardElements())) {
elements.addAll(elementVO.getMoodBoardElements());
@@ -684,7 +696,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
if (!CollectionUtils.isEmpty(elementVO.getMarketingSketchElements())) {
elements.addAll(elementVO.getMarketingSketchElements());
}
collectionElementService.saveLibraryByCollectionElement(elements, timeZone, elementVO.getModelSex());
collectionElementService.saveLibraryByCollectionElement(elements, timeZone, elementVO.getModelSex(), ageGroup);
}
@Override
@@ -839,7 +851,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
(existing, replacement) -> replacement));
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
log.info("all typeLayers Map:{}", typeAndUndividedLayer);
Map<String, String> priorityAndUndividedLayer = designItemService.setPriorityAndUndividedLayer(layers);
Map<String, List<String>> priorityAndUndividedLayer = designItemService.setPriorityAndUndividedLayer(layers);
for (DesignPythonItem detail : item.getItems()) {
if (null == detail) {
continue;
@@ -866,7 +878,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
DesignPythonItemPrint printObject = detail.getPrint().getOverall();
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
designItemDetail.setPrintPath(CollectionUtils.isEmpty(printObject.getPrint_path_list()) ? "" : printObject.getPrint_path_list().get(0));
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()));
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(0));
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(1));
}
designItemDetailService.save(designItemDetail);
if (!SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) && !StringUtil.isNullOrEmpty(designItemDetail.getPrintPath())) {
@@ -2484,7 +2497,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
log.info("design python端运行时间" + totalTimeInSeconds + "");
//生成library
startTime = System.currentTimeMillis();
generateLibrary(elementVO, designDTO.getTimeZone());
String ageGroup = getAgeGroupByCollectionId(collectionId);
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
//处理关联关系,修复element覆盖得情况
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
// List<Long> relationElementIds = relationElements.stream().map(CollectionElement::getId).collect(Collectors.toList());

View File

@@ -98,7 +98,7 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
response = payPalClient.client(mode, clientId, clientSecret).execute(paypalRequest);
} catch (Exception e) {
log.error("调用paypal订单创建失败失败原因 ===> {}", e.getMessage());
throw new BusinessException("Order creation failed");
throw new BusinessException("order.creation.failed");
}
String approve = "";
@@ -377,7 +377,7 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
response = payPalClient.client(mode, clientId, clientSecret).execute(request);
} catch (Exception e) {
log.error("调用paypal扣款失败失败原因 ===> {}", e.getMessage());
throw new BusinessException("Order deduction failed.");
throw new BusinessException("order.deduction.failed");
}
log.info("Status Code = {}, Status = {}, OrderID = {}", response.statusCode(), response.result().status(), response.result().id());
for (LinkDescription link : response.result().links()) {
@@ -455,7 +455,7 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
ordersGetResponse = payPalClient.client(mode, clientId, clientSecret).execute(ordersGetRequest);
} catch (Exception e) {
log.error("调用paypal订单查询失败失败原因 ===> {}", e.getMessage());
throw new BusinessException("Order query failed");
throw new BusinessException("order.query.failed");
}
String captureId = ordersGetResponse.result().purchaseUnits().get(0).payments().captures().get(0).id();
CapturesRefundRequest request = new CapturesRefundRequest(captureId);

View File

@@ -479,7 +479,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}else {
sb.append("a beautiful woman,");
}
sb.append("wearing ").append(collect);
// sb.append("wearing ").append(collect);
}
if (StringUtils.isEmpty(prompt)) {
sb.append(",high quality clothing details,8K realistic,HDR");

View File

@@ -863,6 +863,16 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
return workspaceList.get(0).getId();
}
public Workspace getWSByProjectId(Long projectId) {
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().eq(Workspace::getProjectId, projectId);
List<Workspace> workspaceList = workspaceMapper.selectList(qw);
if (CollectionUtils.isEmpty(workspaceList)) {
return null;
}
return workspaceList.get(0);
}
public static List<File> getPNGFiles(String directoryPath) {
List<File> pngFiles = new ArrayList<>();
File directory = new File(directoryPath);