TASK:portfolio;
This commit is contained in:
@@ -355,7 +355,8 @@ public class SendEmailUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final static Long UPGRADE_NOTIFICATION_ID = 118855L;
|
private final static Long UPGRADE_NOTIFICATION_ID = 118855L;
|
||||||
public static void sendUpgradeNotification(Account account, String senderAddress) {
|
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 122898L;
|
||||||
|
public static void sendUpgradeNotification(Account account, String senderAddress, Integer type) {
|
||||||
try {
|
try {
|
||||||
// 实例化一个认证对象
|
// 实例化一个认证对象
|
||||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||||
@@ -374,8 +375,13 @@ public class SendEmailUtil {
|
|||||||
// 根据邮件类型设置不同的主题和模板
|
// 根据邮件类型设置不同的主题和模板
|
||||||
String subject = "";
|
String subject = "";
|
||||||
Template template = new Template();
|
Template template = new Template();
|
||||||
subject = "Upcoming AiDA 3.0 Launch and Scheduled Maintenance";
|
if (type == 1) {
|
||||||
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
subject = "Upcoming System Upgrade for AiDA 3.0";
|
||||||
|
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||||
|
}else {
|
||||||
|
subject = "即将到来的AiDA 3.0系统升级";
|
||||||
|
template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||||
|
}
|
||||||
template.setTemplateData(buildAccountData(account));
|
template.setTemplateData(buildAccountData(account));
|
||||||
|
|
||||||
req.setSubject(subject);
|
req.setSubject(subject);
|
||||||
|
|||||||
59
src/main/java/com/ai/da/controller/PortfolioController.java
Normal file
59
src/main/java/com/ai/da/controller/PortfolioController.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package com.ai.da.controller;
|
||||||
|
|
||||||
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
|
import com.ai.da.common.response.Response;
|
||||||
|
import com.ai.da.model.dto.PortfolioDTO;
|
||||||
|
import com.ai.da.model.dto.QueryPortfolioPageDTO;
|
||||||
|
import com.ai.da.model.vo.PortfolioVO;
|
||||||
|
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||||
|
import com.ai.da.service.PortfolioService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
@Api(tags = "Portfolio模块")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/portfolio")
|
||||||
|
public class PortfolioController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PortfolioService portfolioService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "发布作品集")
|
||||||
|
@PostMapping("/publish")
|
||||||
|
public Response<Boolean> preLogin(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||||
|
return Response.success(portfolioService.publish(portfolioDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "作品集page")
|
||||||
|
@PostMapping("/page")
|
||||||
|
public Response<PageBaseResponse<PortfolioVO>> page(@Valid @RequestBody QueryPortfolioPageDTO query) {
|
||||||
|
return Response.success(portfolioService.page(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "作品详情")
|
||||||
|
@PostMapping("/detail")
|
||||||
|
public Response<PortfolioVO> detail(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||||
|
return Response.success(portfolioService.detail(portfolioDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "选择作品")
|
||||||
|
@PostMapping("/choose")
|
||||||
|
public Response<UserLikeChooseVO> choose(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||||
|
return Response.success(portfolioService.choose(portfolioDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "更新作品")
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Response<PortfolioVO> update(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||||
|
return Response.success(portfolioService.update(portfolioDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.Portfolio;
|
||||||
|
|
||||||
|
public interface PortfolioMapper extends CommonMapper<Portfolio> {
|
||||||
|
}
|
||||||
55
src/main/java/com/ai/da/mapper/primary/entity/Portfolio.java
Normal file
55
src/main/java/com/ai/da/mapper/primary/entity/Portfolio.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
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 io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "Portfolio对象", description = "作品集")
|
||||||
|
@TableName("portfolio")
|
||||||
|
public class Portfolio implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "collection ID")
|
||||||
|
private Long collectionId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "userLikeGroup源")
|
||||||
|
private Long userLikeGroupSourceId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作品名称")
|
||||||
|
private String portfolioName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作品描述")
|
||||||
|
private String portfolioDes;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作品类型")
|
||||||
|
private String portfolioType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "封面ID")
|
||||||
|
private Long coverId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作品状态1公开0隐藏")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作品集作者ID")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private LocalDateTime createDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private LocalDateTime updateDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除")
|
||||||
|
private Integer isDeleted;
|
||||||
|
}
|
||||||
10
src/main/java/com/ai/da/model/dto/PortfolioDTO.java
Normal file
10
src/main/java/com/ai/da/model/dto/PortfolioDTO.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ai.da.model.dto;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PortfolioDTO extends Portfolio {
|
||||||
|
private Long userLikeGroupId;
|
||||||
|
|
||||||
|
}
|
||||||
14
src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
Normal file
14
src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ai.da.model.dto;
|
||||||
|
|
||||||
|
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("作品集分页查询")
|
||||||
|
public class QueryPortfolioPageDTO extends PageQueryBaseVo {
|
||||||
|
|
||||||
|
}
|
||||||
16
src/main/java/com/ai/da/model/vo/PortfolioVO.java
Normal file
16
src/main/java/com/ai/da/model/vo/PortfolioVO.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.CollectionElement;
|
||||||
|
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||||
|
import com.ai.da.mapper.primary.entity.TDesignPythonOutfit;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PortfolioVO extends Portfolio {
|
||||||
|
private String designPythonOutfitUrl;
|
||||||
|
|
||||||
|
private List<CollectionElement> collectionElementList;
|
||||||
|
private List<TDesignPythonOutfit> designPythonOutfitList;
|
||||||
|
}
|
||||||
21
src/main/java/com/ai/da/service/PortfolioService.java
Normal file
21
src/main/java/com/ai/da/service/PortfolioService.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
|
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||||
|
import com.ai.da.model.dto.PortfolioDTO;
|
||||||
|
import com.ai.da.model.dto.QueryPortfolioPageDTO;
|
||||||
|
import com.ai.da.model.vo.PortfolioVO;
|
||||||
|
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface PortfolioService extends IService<Portfolio> {
|
||||||
|
Boolean publish(PortfolioDTO portfolioDTO);
|
||||||
|
|
||||||
|
PortfolioVO update(PortfolioDTO portfolioDTO);
|
||||||
|
|
||||||
|
PageBaseResponse<PortfolioVO> page(QueryPortfolioPageDTO query);
|
||||||
|
|
||||||
|
PortfolioVO detail(PortfolioDTO portfolioDTO);
|
||||||
|
|
||||||
|
UserLikeChooseVO choose(PortfolioDTO portfolioDTO);
|
||||||
|
}
|
||||||
@@ -23,4 +23,6 @@ public interface UserLikeService extends IService<UserLike> {
|
|||||||
UserLike getByDesignItemId(Long designItemId);
|
UserLike getByDesignItemId(Long designItemId);
|
||||||
|
|
||||||
void updateDate(Long designItemId,String timeZone);
|
void updateDate(Long designItemId,String timeZone);
|
||||||
|
|
||||||
|
List<UserLike> getUserLikeList(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,4 +46,6 @@ public interface WorkspaceService extends IService<Workspace> {
|
|||||||
void maleDataInsert() throws FileNotFoundException;
|
void maleDataInsert() throws FileNotFoundException;
|
||||||
|
|
||||||
List<Long> delete(List<Workspace> workspaceList);
|
List<Long> delete(List<Workspace> workspaceList);
|
||||||
|
|
||||||
|
Workspace getCurrentWorkspace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validateUserValidaExpire(Account account) {
|
private void validateUserValidaExpire(Account account) {
|
||||||
|
|
||||||
Long currentTime = new Date().getTime();
|
Long currentTime = new Date().getTime();
|
||||||
if (Objects.nonNull(account.getValidStartTime())) {
|
if (Objects.nonNull(account.getValidStartTime())) {
|
||||||
if (currentTime < account.getValidStartTime()) {
|
if (currentTime < account.getValidStartTime()) {
|
||||||
@@ -884,15 +885,23 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
@Override
|
@Override
|
||||||
public void upgradeNotification() {
|
public void upgradeNotification() {
|
||||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||||
|
// queryWrapper.eq("id", 88L);
|
||||||
queryWrapper.and(wrapper ->
|
queryWrapper.and(wrapper ->
|
||||||
wrapper.gt("valid_end_time", 1709515797000L)
|
wrapper.gt("valid_end_time", 1715817600000L)
|
||||||
.or().isNull("valid_end_time"))
|
.or().isNull("valid_end_time"))
|
||||||
.isNotNull("user_email");
|
.isNotNull("user_email");
|
||||||
|
|
||||||
List<Account> accountList = accountMapper.selectList(queryWrapper);
|
List<Account> accountList = accountMapper.selectList(queryWrapper);
|
||||||
System.out.println(accountList);
|
System.out.println(accountList);
|
||||||
for (Account account : accountList) {
|
for (Account account : accountList) {
|
||||||
SendEmailUtil.sendUpgradeNotification(account, null);
|
// SendEmailUtil.sendUpgradeNotification(account, null, 0);
|
||||||
|
// SendEmailUtil.sendUpgradeNotification(account, null, 1);
|
||||||
|
if (account.getLanguage().equals(Language.CHINESE_SIMPLIFIED.name())) {
|
||||||
|
SendEmailUtil.sendUpgradeNotification(account, null, 0);
|
||||||
|
}else {
|
||||||
|
// 英文
|
||||||
|
SendEmailUtil.sendUpgradeNotification(account, null, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -353,14 +353,16 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
ValidateElementVO elementVO = CopyUtil.copyObject(designDTO, ValidateElementVO.class);
|
ValidateElementVO elementVO = CopyUtil.copyObject(designDTO, ValidateElementVO.class);
|
||||||
List<CollectionColorDTO> colorBoards = elementVO.getColorBoards();
|
List<CollectionColorDTO> colorBoards = elementVO.getColorBoards();
|
||||||
for (CollectionColorDTO colorBoard : colorBoards) {
|
for (CollectionColorDTO colorBoard : colorBoards) {
|
||||||
String colorImg = colorBoard.getGradient().getColorImg();
|
if (Objects.nonNull(colorBoard.getGradient())) {
|
||||||
String[] parts = colorImg.split(",");
|
String colorImg = colorBoard.getGradient().getColorImg();
|
||||||
String imageType = parts[0].split("/")[1].split(";")[0];
|
String[] parts = colorImg.split(",");
|
||||||
String base64Data = parts[1];
|
String imageType = parts[0].split("/")[1].split(";")[0];
|
||||||
String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType);
|
String base64Data = parts[1];
|
||||||
colorBoard.setGradientMinioUrl(gradientMinioUrl);
|
String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType);
|
||||||
colorBoard.getGradient().setColorImg(null);
|
colorBoard.setGradientMinioUrl(gradientMinioUrl);
|
||||||
colorBoard.setGradientString(JSON.toJSONString(colorBoard.getGradient()));
|
colorBoard.getGradient().setColorImg(null);
|
||||||
|
colorBoard.setGradientString(JSON.toJSONString(colorBoard.getGradient()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elementVO.setColorBoards(colorBoards);
|
elementVO.setColorBoards(colorBoards);
|
||||||
List<Long> usedElementIds = elementVO.getUsedElementIds();
|
List<Long> usedElementIds = elementVO.getUsedElementIds();
|
||||||
@@ -781,7 +783,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
element.setColorRgb(color.getRgbValue());
|
element.setColorRgb(color.getRgbValue());
|
||||||
//按时区计算
|
//按时区计算
|
||||||
element.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
element.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||||
color.getGradient().setColorImg(null);
|
if (Objects.nonNull(color.getGradient())) {
|
||||||
|
color.getGradient().setColorImg(null);
|
||||||
|
}
|
||||||
element.setGradientString(JSON.toJSONString(color.getGradient()));
|
element.setGradientString(JSON.toJSONString(color.getGradient()));
|
||||||
elements.add(element);
|
elements.add(element);
|
||||||
});
|
});
|
||||||
|
|||||||
474
src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
Normal file
474
src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
Normal file
@@ -0,0 +1,474 @@
|
|||||||
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
|
import com.ai.da.common.context.UserContext;
|
||||||
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
|
import com.ai.da.common.response.Response;
|
||||||
|
import com.ai.da.common.utils.CopyUtil;
|
||||||
|
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.PortfolioDTO;
|
||||||
|
import com.ai.da.model.dto.QueryPortfolioPageDTO;
|
||||||
|
import com.ai.da.model.enums.Position;
|
||||||
|
import com.ai.da.model.enums.Sex;
|
||||||
|
import com.ai.da.model.vo.*;
|
||||||
|
import com.ai.da.service.*;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio> implements PortfolioService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserLikeGroupMapper userLikeGroupMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CollectionMapper collectionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CollectionElementService collectionElementService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CollectionElementMapper collectionElementMapper;
|
||||||
|
@Resource
|
||||||
|
private TCollectionElementRelationMapper collectionElementRelationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PortfolioMapper portfolioMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserLikeService userLikeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserLikeMapper userLikeMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DesignItemMapper designItemMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DesignItemDetailMapper designItemDetailMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkspaceService workspaceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DesignMapper designMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserLikeGroupService userLikeGroupService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean publish(PortfolioDTO portfolioDTO) {
|
||||||
|
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||||
|
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||||
|
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||||
|
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||||
|
userLikeGroupNew.setAccountId(-1L);
|
||||||
|
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||||
|
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||||
|
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||||
|
collectionOld.setId(null);
|
||||||
|
collectionMapper.insert(collectionOld);
|
||||||
|
Long collectionIdNew = collectionOld.getId();
|
||||||
|
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||||
|
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||||
|
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||||
|
for (CollectionElement element : collectionElementListOld) {
|
||||||
|
element.setCollectionId(collectionIdNew);
|
||||||
|
element.setId(null);
|
||||||
|
collectionElementMapper.insert(element);
|
||||||
|
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||||
|
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||||
|
collectionElementRelationNew.setElementId(element.getId());
|
||||||
|
collectionElementRelationNew.setCreateDate(new Date());
|
||||||
|
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||||
|
}
|
||||||
|
Portfolio portfolio = new Portfolio();
|
||||||
|
Long coverIdOld = portfolioDTO.getCoverId();
|
||||||
|
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
||||||
|
portfolio.setPortfolioType("History");
|
||||||
|
portfolio.setCollectionId(collectionIdNew);
|
||||||
|
portfolio.setAccountId(authPrincipalVo.getId());
|
||||||
|
portfolio.setCreateDate(LocalDateTime.now());
|
||||||
|
portfolio.setUpdateDate(LocalDateTime.now());
|
||||||
|
portfolio.setStatus(1);
|
||||||
|
portfolio.setIsDeleted(0);
|
||||||
|
portfolio.setUserLikeGroupSourceId(portfolioDTO.getUserLikeGroupId());
|
||||||
|
portfolioMapper.insert(portfolio);
|
||||||
|
|
||||||
|
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||||
|
// List<Long> designPythonOutfitIdList = userLikeList.stream().map(UserLike::getDesignOutfitId).collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||||
|
// qw.lambda().in(TDesignPythonOutfit::getId, designPythonOutfitIdList);
|
||||||
|
// List<TDesignPythonOutfit> designPythonOutfits = designPythonOutfitMapper.selectList(qw);
|
||||||
|
Long coverIdNew = null;
|
||||||
|
Boolean flag = false;
|
||||||
|
for (UserLike userLike : userLikeList) {
|
||||||
|
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||||
|
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||||
|
designPythonOutfit.setDesignId(-1L);
|
||||||
|
designPythonOutfit.setDesignItemId(-1L);
|
||||||
|
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||||
|
if (designPythonOutfit.getId().equals(coverIdOld)) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
designPythonOutfit.setId(null);
|
||||||
|
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||||
|
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||||
|
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||||
|
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||||
|
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||||
|
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||||
|
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||||
|
tDesignPythonOutfitDetail.setId(null);
|
||||||
|
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||||
|
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||||
|
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
coverIdNew = designOutfitIdNew;
|
||||||
|
portfolio.setCoverId(coverIdNew);
|
||||||
|
portfolioMapper.updateById(portfolio);
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long designItemIdOld = userLike.getDesignItemId();
|
||||||
|
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||||
|
designItemOld.setId(null);
|
||||||
|
designItemOld.setAccountId(-1L);
|
||||||
|
designItemOld.setDesignId(-1L);
|
||||||
|
designItemOld.setCollectionId(collectionIdNew);
|
||||||
|
designItemMapper.insert(designItemOld);
|
||||||
|
Long designItemIdNew = designItemOld.getDesignId();
|
||||||
|
|
||||||
|
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||||
|
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||||
|
|
||||||
|
userLike.setDesignItemId(designItemIdNew);
|
||||||
|
userLike.setId(null);
|
||||||
|
userLike.setDesignId(-1L);
|
||||||
|
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||||
|
userLikeMapper.insert(userLike);
|
||||||
|
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||||
|
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemOld);
|
||||||
|
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||||
|
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||||
|
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||||
|
designItemDetailOld.setAccountId(-1L);
|
||||||
|
designItemDetailOld.setDesignId(-1L);
|
||||||
|
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||||
|
designItemDetailMapper.insert(designItemDetailOld);
|
||||||
|
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||||
|
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||||
|
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||||
|
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||||
|
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||||
|
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PortfolioVO update(PortfolioDTO portfolioDTO) {
|
||||||
|
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||||
|
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||||
|
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||||
|
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||||
|
userLikeGroupNew.setAccountId(-1L);
|
||||||
|
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||||
|
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||||
|
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||||
|
collectionOld.setId(null);
|
||||||
|
collectionMapper.insert(collectionOld);
|
||||||
|
Long collectionIdNew = collectionOld.getId();
|
||||||
|
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||||
|
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||||
|
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||||
|
for (CollectionElement element : collectionElementListOld) {
|
||||||
|
element.setCollectionId(collectionIdNew);
|
||||||
|
element.setId(null);
|
||||||
|
collectionElementMapper.insert(element);
|
||||||
|
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||||
|
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||||
|
collectionElementRelationNew.setElementId(element.getId());
|
||||||
|
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||||
|
}
|
||||||
|
Portfolio portfolio = getPortfolioByUserGroupIdSource(portfolioDTO.getUserLikeGroupId());
|
||||||
|
Long coverIdOld = portfolioDTO.getCoverId();
|
||||||
|
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
||||||
|
// portfolio.setPortfolioType("History");
|
||||||
|
portfolio.setCollectionId(collectionIdNew);
|
||||||
|
portfolio.setAccountId(authPrincipalVo.getId());
|
||||||
|
portfolio.setCreateDate(LocalDateTime.now());
|
||||||
|
portfolio.setUpdateDate(LocalDateTime.now());
|
||||||
|
portfolio.setStatus(1);
|
||||||
|
portfolio.setIsDeleted(0);
|
||||||
|
portfolioMapper.updateById(portfolio);
|
||||||
|
|
||||||
|
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||||
|
|
||||||
|
Long coverIdNew = null;
|
||||||
|
Boolean flag = false;
|
||||||
|
for (UserLike userLike : userLikeList) {
|
||||||
|
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||||
|
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||||
|
designPythonOutfit.setDesignId(-1L);
|
||||||
|
designPythonOutfit.setDesignItemId(-1L);
|
||||||
|
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||||
|
if (!flag && designPythonOutfit.getId() == coverIdOld) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
designPythonOutfit.setId(null);
|
||||||
|
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||||
|
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||||
|
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||||
|
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||||
|
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||||
|
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||||
|
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||||
|
tDesignPythonOutfitDetail.setId(null);
|
||||||
|
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||||
|
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||||
|
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
coverIdNew = designPythonOutfit.getId();
|
||||||
|
portfolio.setCoverId(coverIdNew);
|
||||||
|
portfolioMapper.updateById(portfolio);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long designItemIdOld = userLike.getDesignItemId();
|
||||||
|
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||||
|
designItemOld.setId(null);
|
||||||
|
designItemOld.setAccountId(-1L);
|
||||||
|
designItemOld.setDesignId(-1L);
|
||||||
|
designItemOld.setCollectionId(collectionIdNew);
|
||||||
|
designItemMapper.insert(designItemOld);
|
||||||
|
Long designItemIdNew = designItemOld.getDesignId();
|
||||||
|
|
||||||
|
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||||
|
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||||
|
|
||||||
|
userLike.setDesignItemId(designItemIdNew);
|
||||||
|
userLike.setId(null);
|
||||||
|
userLike.setDesignId(-1L);
|
||||||
|
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||||
|
userLikeMapper.insert(userLike);
|
||||||
|
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||||
|
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemOld);
|
||||||
|
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||||
|
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||||
|
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||||
|
designItemDetailOld.setAccountId(-1L);
|
||||||
|
designItemDetailOld.setDesignId(-1L);
|
||||||
|
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||||
|
designItemDetailMapper.insert(designItemDetailOld);
|
||||||
|
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||||
|
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||||
|
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||||
|
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||||
|
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||||
|
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Portfolio getPortfolioByUserGroupIdSource(Long userLikeGroupId) {
|
||||||
|
QueryWrapper<Portfolio> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(Portfolio::getUserLikeGroupSourceId, userLikeGroupId);
|
||||||
|
return portfolioMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageBaseResponse<PortfolioVO> page(QueryPortfolioPageDTO query) {
|
||||||
|
QueryWrapper<Portfolio> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().orderByDesc(Portfolio::getUpdateDate);
|
||||||
|
IPage<Portfolio> page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()),qw);
|
||||||
|
IPage<PortfolioVO> convert = page.convert((Function<Portfolio, PortfolioVO>) portfolio -> {
|
||||||
|
if (portfolio != null) {
|
||||||
|
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
|
||||||
|
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(vo.getCoverId());
|
||||||
|
vo.setDesignPythonOutfitUrl(minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
return PageBaseResponse.success(convert);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PortfolioVO detail(PortfolioDTO portfolioDTO) {
|
||||||
|
Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId());
|
||||||
|
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
|
||||||
|
Long collectionId = portfolio.getCollectionId();
|
||||||
|
List<CollectionElement> collectionElementList = collectionElementService.getByCollectionId(collectionId);
|
||||||
|
for (CollectionElement element : collectionElementList) {
|
||||||
|
if (StringUtils.isEmpty(element.getUrl())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
element.setUrl(minioUtil.getPresignedUrl(element.getUrl(), 24 * 60));
|
||||||
|
}
|
||||||
|
vo.setCollectionElementList(collectionElementList);
|
||||||
|
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(TDesignPythonOutfit::getCollectionId, portfolio.getCollectionId());
|
||||||
|
List<TDesignPythonOutfit> designPythonOutfitList = designPythonOutfitMapper.selectList(qw);
|
||||||
|
for (TDesignPythonOutfit tDesignPythonOutfit : designPythonOutfitList) {
|
||||||
|
tDesignPythonOutfit.setDesignUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||||
|
}
|
||||||
|
vo.setDesignPythonOutfitList(designPythonOutfitList);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserLikeChooseVO choose(PortfolioDTO portfolioDTO) {
|
||||||
|
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||||
|
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||||
|
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||||
|
userLikeGroupNew.setAccountId(authPrincipalVo.getId());
|
||||||
|
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||||
|
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||||
|
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||||
|
collectionOld.setId(null);
|
||||||
|
collectionMapper.insert(collectionOld);
|
||||||
|
Long collectionIdNew = collectionOld.getId();
|
||||||
|
|
||||||
|
Workspace workspace = workspaceService.getCurrentWorkspace();
|
||||||
|
Design design = new Design();
|
||||||
|
design.setCollectionId(collectionIdNew);
|
||||||
|
design.setAccountId(authPrincipalVo.getId());
|
||||||
|
if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
|
||||||
|
design.setTemplateId(workspace.getMannequinFemaleId());
|
||||||
|
design.setModelType(workspace.getMannequinFemaleType());
|
||||||
|
}else {
|
||||||
|
design.setTemplateId(workspace.getMannequinMaleId());
|
||||||
|
design.setModelType(workspace.getMannequinMaleType());
|
||||||
|
}
|
||||||
|
design.setSystemScale(BigDecimal.valueOf(workspace.getSystemDesignerPercentage()));
|
||||||
|
if (workspace.getPosition().equals(Position.OVERALL.getValue())) {
|
||||||
|
design.setSingleOverall("overall");
|
||||||
|
design.setSwitchCategory("");
|
||||||
|
}else {
|
||||||
|
design.setSingleOverall("single");
|
||||||
|
design.setSwitchCategory(workspace.getPosition());
|
||||||
|
}
|
||||||
|
design.setCreateDate(new Date());
|
||||||
|
designMapper.insert(design);
|
||||||
|
|
||||||
|
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||||
|
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||||
|
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||||
|
for (CollectionElement element : collectionElementListOld) {
|
||||||
|
element.setCollectionId(collectionIdNew);
|
||||||
|
element.setId(null);
|
||||||
|
collectionElementMapper.insert(element);
|
||||||
|
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||||
|
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||||
|
collectionElementRelationNew.setElementId(element.getId());
|
||||||
|
collectionElementRelationNew.setCreateDate(new Date());
|
||||||
|
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||||
|
|
||||||
|
for (UserLike userLike : userLikeList) {
|
||||||
|
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||||
|
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||||
|
designPythonOutfit.setDesignId(design.getId());
|
||||||
|
designPythonOutfit.setDesignItemId(-1L);
|
||||||
|
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||||
|
|
||||||
|
designPythonOutfit.setId(null);
|
||||||
|
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||||
|
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||||
|
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||||
|
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||||
|
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||||
|
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||||
|
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||||
|
tDesignPythonOutfitDetail.setId(null);
|
||||||
|
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||||
|
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||||
|
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long designItemIdOld = userLike.getDesignItemId();
|
||||||
|
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||||
|
designItemOld.setId(null);
|
||||||
|
designItemOld.setAccountId(-1L);
|
||||||
|
designItemOld.setDesignId(-1L);
|
||||||
|
designItemOld.setCollectionId(collectionIdNew);
|
||||||
|
designItemMapper.insert(designItemOld);
|
||||||
|
Long designItemIdNew = designItemOld.getDesignId();
|
||||||
|
|
||||||
|
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||||
|
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||||
|
|
||||||
|
userLike.setDesignItemId(designItemIdNew);
|
||||||
|
userLike.setId(null);
|
||||||
|
userLike.setDesignId(design.getId());
|
||||||
|
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||||
|
userLikeMapper.insert(userLike);
|
||||||
|
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||||
|
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemOld);
|
||||||
|
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||||
|
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||||
|
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||||
|
designItemDetailOld.setAccountId(authPrincipalVo.getId());
|
||||||
|
designItemDetailOld.setDesignId(design.getId());
|
||||||
|
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||||
|
designItemDetailMapper.insert(designItemDetailOld);
|
||||||
|
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||||
|
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||||
|
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||||
|
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||||
|
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||||
|
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return userLikeGroupService.choose(userLikeGroupNew.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -123,15 +123,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userGroupId);
|
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userGroupId);
|
||||||
String sex = null;
|
String sex = null;
|
||||||
// if (CollectionUtil.isNotEmpty(userLikeVOS)) {
|
|
||||||
// Long designId = userLikeVOS.get(0).getDesignId();
|
|
||||||
// Design design = designMapper.selectById(designId);
|
|
||||||
// if (design.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
|
||||||
// sex = sysFileMapper.selectById(design.getTemplateId()).getLevel2Type();
|
|
||||||
// }else {
|
|
||||||
// sex = libraryMapper.selectById(design.getTemplateId()).getLevel2Type();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
userLikeVOS.forEach(o -> {
|
userLikeVOS.forEach(o -> {
|
||||||
TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
|
TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
|
||||||
o.setUrl(tDesignPythonOutfit1.getDesignUrl());
|
o.setUrl(tDesignPythonOutfit1.getDesignUrl());
|
||||||
|
|||||||
@@ -81,4 +81,11 @@ public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> i
|
|||||||
baseMapper.update(null,uw);
|
baseMapper.update(null,uw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserLike> getUserLikeList(Long id) {
|
||||||
|
QueryWrapper<UserLike> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(UserLike::getUserLikeGroupId, id);
|
||||||
|
return userLikeMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.naming.Context;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -483,6 +484,20 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
return deleteIds;
|
return deleteIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Workspace getCurrentWorkspace() {
|
||||||
|
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||||
|
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(Workspace::getAccountId, authPrincipalVo.getId());
|
||||||
|
qw.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||||
|
// qw.lambda().eq(Workspace::getIsDeleted, 0);
|
||||||
|
List<Workspace> workspaces = workspaceMapper.selectList(qw);
|
||||||
|
if (CollectionUtils.isEmpty(workspaces)) {
|
||||||
|
throw new BusinessException("workspace not found.");
|
||||||
|
}
|
||||||
|
return workspaces.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
// public static void main(String[] args) throws FileNotFoundException {
|
// public static void main(String[] args) throws FileNotFoundException {
|
||||||
// String b = "C:\\workspace\\fileData\\aida_men_library\\top\\mens_test_9992.png";
|
// String b = "C:\\workspace\\fileData\\aida_men_library\\top\\mens_test_9992.png";
|
||||||
// File pngFile = new File(b);
|
// File pngFile = new File(b);
|
||||||
|
|||||||
Reference in New Issue
Block a user