切换用户sketch点赞记录存储方式;新增镜像和角度字段,存储前端需要的object
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.UserPreference;
|
||||
|
||||
public interface UserPreferenceMapper extends CommonMapper<UserPreference> {
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.WorkspaceRelStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
@@ -11,5 +13,11 @@ import com.ai.da.mapper.primary.entity.WorkspaceRelStyle;
|
||||
*/
|
||||
public interface WorkspaceRelStyleMapper extends CommonMapper<WorkspaceRelStyle> {
|
||||
|
||||
/**
|
||||
* 根据projectId查询workspaceRelStyles
|
||||
* @param projectId 项目ID
|
||||
* @return workspaceRelStyles列表
|
||||
*/
|
||||
List<WorkspaceRelStyle> selectByProjectId(Long projectId);
|
||||
|
||||
}
|
||||
|
||||
@@ -62,4 +62,9 @@ public class DesignItemDetailPrint {
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
/**
|
||||
* 对象信息(JSON格式)
|
||||
*/
|
||||
private String object;
|
||||
}
|
||||
|
||||
@@ -90,6 +90,19 @@ public class TDesignPythonOutfitDetail implements Serializable {
|
||||
*/
|
||||
@Schema(description = "图层优先级")
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 镜像模式
|
||||
*/
|
||||
@Schema(description = "镜像模式")
|
||||
private String transpose;
|
||||
|
||||
/**
|
||||
* 旋转角度
|
||||
*/
|
||||
@Schema(description = "旋转角度")
|
||||
private Double rotate;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("user_preference")
|
||||
public class UserPreference implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long accountId;
|
||||
private String path;
|
||||
private LocalDateTime dataTime;
|
||||
private String category;
|
||||
private String style;
|
||||
private Long workspaceRelStyleId;
|
||||
private Long projectId;
|
||||
private Long designItemId;
|
||||
|
||||
}
|
||||
@@ -67,4 +67,10 @@ public class DesignSingleItemDTO implements Serializable {
|
||||
|
||||
private PartialDesignDTO partialDesign;
|
||||
|
||||
@Schema(description = "镜像模式 ")
|
||||
private int[] transpose;
|
||||
|
||||
@Schema(description = "45")
|
||||
private double rotate;
|
||||
|
||||
}
|
||||
|
||||
@@ -59,4 +59,16 @@ public class DesignPythonOutfitVO {
|
||||
* 图层优先级 从10开始,优先级数字越大越靠近上层
|
||||
*/
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 镜像模式
|
||||
*/
|
||||
@Schema(description = "镜像模式")
|
||||
private int[] transpose;
|
||||
|
||||
/**
|
||||
* 旋转角度
|
||||
*/
|
||||
@Schema(description = "旋转角度")
|
||||
private Double rotate;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public class DesignSinglePrint implements Serializable {
|
||||
@Schema(description = "印花优先级")
|
||||
private Integer priority;
|
||||
|
||||
private String object;
|
||||
|
||||
public DesignSinglePrint() {
|
||||
}
|
||||
|
||||
|
||||
@@ -2869,7 +2869,9 @@ public class PythonService {
|
||||
designSingleItem.getPriority(),
|
||||
minioPath,
|
||||
gradientString,
|
||||
designSingleItem.getMaskUrl()
|
||||
designSingleItem.getMaskUrl(),
|
||||
designSingleItem.getTranspose(),
|
||||
designSingleItem.getRotate()
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
@@ -87,6 +87,16 @@ public class DesignPythonItem {
|
||||
*/
|
||||
private String seg_mask_url;
|
||||
|
||||
/**
|
||||
* 镜像模式
|
||||
*/
|
||||
private int[] transpose;
|
||||
|
||||
/**
|
||||
* 旋转角度
|
||||
*/
|
||||
private double rotate;
|
||||
|
||||
public static List<String> OUTWEAR_DRESS_BLOUSE = Arrays.asList(CollectionLevel2TypeEnum.OUTWEAR.getRealName(),
|
||||
CollectionLevel2TypeEnum.DRESS.getRealName(), CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
||||
|
||||
@@ -143,7 +153,7 @@ public class DesignPythonItem {
|
||||
|
||||
public DesignPythonItem(String type, String path, String color, PrintToPython print, Long businessId,
|
||||
Long image_id, List<Long> offset, Float[] resize_scale, Integer priority, String gradient,
|
||||
String gradientString, String seg_mask_url) {
|
||||
String gradientString, String seg_mask_url, int[] transpose, double rotate) {
|
||||
this.type = type;
|
||||
this.path = path;
|
||||
this.color = color;
|
||||
@@ -157,6 +167,8 @@ public class DesignPythonItem {
|
||||
this.gradient = gradient;
|
||||
this.gradientString = gradientString;
|
||||
this.seg_mask_url = seg_mask_url;
|
||||
this.transpose = transpose;
|
||||
this.rotate = rotate;
|
||||
}
|
||||
|
||||
public DesignPythonItem(String type, String path, String color, PrintToPython print, String icon, Long businessId, Long image_id) {
|
||||
|
||||
@@ -509,6 +509,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designPythonOutfitDetail.setOffset(String.valueOf(priorityOffset.get(Math.abs(priority))));
|
||||
}
|
||||
designPythonOutfitDetail.setPriority(priority);
|
||||
designPythonOutfitDetail.setTranspose(jsonObject.getString("transpose"));
|
||||
designPythonOutfitDetail.setRotate(jsonObject.getDouble("rotate"));
|
||||
|
||||
list.add(designPythonOutfitDetail);
|
||||
}
|
||||
@@ -1201,6 +1203,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetailPrint.setPosition(print.getLocation().toString());
|
||||
designItemDetailPrint.setAngle(print.getAngle());
|
||||
designItemDetailPrint.setPriority(priority);
|
||||
designItemDetailPrint.setObject(print.getObject());
|
||||
|
||||
designItemDetailPrints.add(designItemDetailPrint);
|
||||
});
|
||||
|
||||
@@ -101,8 +101,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserBehaviorMapper userBehaviorMapper;
|
||||
private final UserPreferenceLogMapper userPreferenceLogMapper;
|
||||
private final UserPreferenceMapper userPreferenceMapper;
|
||||
private final WorkspaceService workspaceService;
|
||||
private final WorkspaceRelStyleMapper workspaceRelStyleMapper;
|
||||
|
||||
@Value("${minio.endpoint}")
|
||||
private String endpoint;
|
||||
@@ -1109,18 +1110,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
//修改designItem为like状态
|
||||
designItemService.updateLikeStatus(designLikeDTO.getDesignItemId(), (byte) 1);
|
||||
// 记录喜欢的系统sketch
|
||||
addSystemLikeSketch(designItem);
|
||||
addSystemLikeSketch(designItem, designLikeDTO.getProjectId());
|
||||
// 更新项目更新时间
|
||||
projectService.modifyProjectUpdateTime(designLikeDTO.getProjectId());
|
||||
return new DesignLikeVO(userLikeSortId, userGroupId, groupDetailId, pictureName, userLike.getId(), userLikeSort.getSort());
|
||||
}
|
||||
|
||||
private void addSystemLikeSketch(DesignItem designItem) {
|
||||
public void addSystemLikeSketch(DesignItem designItem, Long projectId) {
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
QueryWrapper<DesignItemDetail> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(DesignItemDetail::getDesignItemId, designItem.getId());
|
||||
qw.lambda().ne(DesignItemDetail::getType, "Body");
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailMapper.selectList(qw);
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectByProjectId(projectId);
|
||||
|
||||
for (DesignItemDetail designItemDetail : designItemDetails) {
|
||||
if (designItemDetail.getPath().startsWith("aida-sys-image")) {
|
||||
String[] split = designItemDetail.getPath().split("/");
|
||||
@@ -1133,28 +1136,29 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
userBehavior.setCreateTime(LocalDateTime.now());
|
||||
userBehaviorMapper.insert(userBehavior);
|
||||
|
||||
UserPreferenceLogTest userPreferenceLogTest = new UserPreferenceLogTest();
|
||||
userPreferenceLogTest.setPath(designItemDetail.getPath());
|
||||
UserPreference userPreference = new UserPreference();
|
||||
userPreference.setPath(designItemDetail.getPath());
|
||||
SysFile sysFile = sysFileService.getOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getUrl, designItemDetail.getPath()));
|
||||
userPreferenceLogTest.setAccountId(userHolder.getId());
|
||||
userPreference.setAccountId(userHolder.getId());
|
||||
if (sysFile != null){
|
||||
userPreferenceLogTest.setCategory(sysFile.getLevel3Type().toLowerCase()+"_"+sysFile.getLevel2Type().toLowerCase());
|
||||
userPreferenceLogTest.setSysFileId(sysFile.getId());
|
||||
userPreferenceLogTest.setStyle(sysFile.getStyle());
|
||||
userPreference.setCategory(sysFile.getLevel3Type().toLowerCase()+"_"+sysFile.getLevel2Type().toLowerCase());
|
||||
userPreference.setStyle(sysFile.getStyle());
|
||||
}else {
|
||||
log.error("sysFile not found:{}",designItemDetail.getPath());
|
||||
SendEmailUtil.commonExceptionReminder("url在sysFile里找不到"+designItemDetail.getPath(), new String[]{"litianxiangxtt@163.com"});
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// userPreferenceLogTest.setUserLikeGroupId(userLike.getUserLikeGroupId());
|
||||
userPreferenceLogTest.setDataTime(designItemDetail.getCreateDate().toInstant()
|
||||
userPreference.setDataTime(designItemDetail.getCreateDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime());
|
||||
userPreferenceLogMapper.insert(userPreferenceLogTest);
|
||||
userPreference.setDesignItemId(designItem.getId());
|
||||
userPreference.setProjectId(projectId);
|
||||
userPreference.setWorkspaceRelStyleId(workspaceRelStyles.get(0).getStyleId());
|
||||
userPreferenceMapper.insert(userPreference);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<Long> validateMergeElement(List<CollectionElement> oldElements, List<DesignItemDetail> designItemDetails) {
|
||||
@@ -1576,6 +1580,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
}
|
||||
designSinglePrint.setScale(scales);
|
||||
designSinglePrint.setObject(detailPrint.getObject());
|
||||
prints.add(designSinglePrint);
|
||||
} else {
|
||||
// 多个印花
|
||||
@@ -1596,7 +1601,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
scales = Arrays.asList(scale, scale);
|
||||
}
|
||||
}
|
||||
prints.add(new DesignSinglePrint(
|
||||
DesignSinglePrint designSinglePrint = new DesignSinglePrint(
|
||||
print.getLevel2Type(),
|
||||
minioUtil.getPreSignedUrl(print.getPath(), 24 * 60),
|
||||
print.getPath(),
|
||||
@@ -1604,7 +1609,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
scales,
|
||||
print.getAngle(),
|
||||
print.getPriority(),
|
||||
ifSingle));
|
||||
ifSingle);
|
||||
designSinglePrint.setObject(print.getObject());
|
||||
prints.add(designSinglePrint);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ai.da.model.vo.DesignPythonOutfitVO;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.ai.da.service.ITDesignPythonOutfitDetailService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -67,6 +68,13 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
||||
designPythonOutfitVO.setScale(modifyScale(detail.getScale()));
|
||||
designPythonOutfitVO.setOffset(StringUtil.isNullOrEmpty(detail.getOffset()) ? Arrays.asList(0L, 0L) : parseLongList(detail.getOffset()));
|
||||
designPythonOutfitVO.setPriority(Math.abs(detail.getPriority()));
|
||||
if (detail.getTranspose() != null) {
|
||||
List<Integer> transposeList = JSONArray.parseArray(detail.getTranspose(), Integer.class);
|
||||
designPythonOutfitVO.setTranspose(transposeList.stream().mapToInt(Integer::intValue).toArray());
|
||||
} else {
|
||||
designPythonOutfitVO.setTranspose(null);
|
||||
}
|
||||
designPythonOutfitVO.setRotate(detail.getRotate());
|
||||
// designPythonOutfitVO.setOffset(CollectionUtil.isEmpty(offset) ? Arrays.asList(0L, 0L) : offset);
|
||||
|
||||
/*if (!StringUtil.isNullOrEmpty(detail.getImageSize())){
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ai.da.mapper.primary.WorkspaceRelStyleMapper">
|
||||
|
||||
<select id="selectByProjectId" resultType="com.ai.da.mapper.primary.entity.WorkspaceRelStyle">
|
||||
SELECT
|
||||
wrs.workspace_id,
|
||||
wrs.style_id
|
||||
FROM
|
||||
workspace_rel_style wrs
|
||||
INNER JOIN
|
||||
workspace w ON wrs.workspace_id = w.id
|
||||
WHERE
|
||||
w.project_id = #{projectId}
|
||||
AND w.is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user