Merge branch 'release/3.0' into dev/dev_xp

# Conflicts:
#	pom.xml
#	src/main/java/com/ai/da/common/utils/SendEmailUtil.java
This commit is contained in:
2024-05-27 13:20:31 +08:00
20 changed files with 137 additions and 65 deletions

View File

@@ -35,7 +35,7 @@ public interface WorkspaceService extends IService<Workspace> {
List<BizJson> getEnumValues(String enumName);
Workspace getByIdNew(Long id);
WorkspaceVO getByIdNew(Long id);
List<ModelsVO> getMannequins(String sex);

View File

@@ -482,7 +482,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
}
// 先检测用户名和邮箱
QueryWrapper<Account> qw = new QueryWrapper<>();
qw.eq("BINARY email", accountTrialDTO.getEmail());
qw.eq("BINARY user_email", accountTrialDTO.getEmail());
List<Account> accountList = accountMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accountList)) {
if (accountList.get(0).getIsTrial() == 1) {
@@ -533,7 +533,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
if (trialOrder.getCountry().equals("China")) {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
}else {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
}
}
return Boolean.TRUE;
}
@@ -554,7 +558,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrderMapper.updateById(trialOrder);
QueryWrapper<Account> qw = new QueryWrapper<>();
qw.eq("BINARY email", trialOrder.getEmail());
qw.eq("BINARY user_email", trialOrder.getEmail());
List<Account> accountList = accountMapper.selectList(qw);
Account account = new Account();
@@ -578,10 +582,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountMapper.insert(account);
}
// 发送邮件提醒用户试用用户已创建
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2, trialOrder.getCountry());
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2, trialOrder.getCountry());
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2, trialOrder.getCountry());
if (trialOrder.getCountry().equals("China")) {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
}else {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
}
}
return Boolean.TRUE;
}

View File

@@ -190,11 +190,11 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
if (CollectionUtils.isEmpty(ids)) {
return;
}
QueryWrapper<CollectionElement> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", ids);
CollectionElement collectionElement = new CollectionElement();
collectionElement.setCollectionId(0L);
collectionElementMapper.update(collectionElement, queryWrapper);
// QueryWrapper<CollectionElement> queryWrapper = new QueryWrapper<>();
// queryWrapper.in("id", ids);
// CollectionElement collectionElement = new CollectionElement();
// collectionElement.setCollectionId(0L);
collectionElementMapper.deleteBatchIds(ids);
}
@Override

View File

@@ -1,5 +1,6 @@
package com.ai.da.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
import com.ai.da.common.enums.DesignTypeEnum;
@@ -129,6 +130,12 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
default:
}
});
if (CollectionUtil.isNotEmpty(response.getColorBoards())) {
List<CollectionColorVO> collect = response.getColorBoards().stream()
.distinct()
.collect(Collectors.toList());
response.setColorBoards(collect);
}
return response;
}

View File

@@ -300,7 +300,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
//generate转化为collection(生成)
saveCollectionElemntsByGenerates(elementVO, collectionId);
//保存颜色版
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
//保存design
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
//计算library
@@ -725,8 +725,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
DesignCollectionDTO designCollectionDTO = CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class);
ValidateElementVO elementVO = collectionElementService.validateElement(designCollectionDTO);
//计算并删除对应的未关联的element
collectionElementService.batchDelete(
calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds()));
List<Long> longs = calculateNoRelationElement(reDesignDTO.getCollectionId(), elementVO.getUsedElementIds());
if (!CollectionUtils.isEmpty(longs)) {
collectionElementService.batchDelete(longs);
}
Design oldDesign = selectByCollectionId(reDesignDTO.getCollectionId());
//删除老的关联的design
deleteByCollectionId(reDesignDTO.getCollectionId());
@@ -740,7 +742,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
private List<Long> calculateNoRelationElement(Long collectionId, List<Long> usedElementIds) {
List<CollectionElement> collectionElements = collectionElementService.getByCollectionId(collectionId);
if (CollectionUtils.isEmpty(collectionElements)) {
throw new BusinessException("get collection elements cannot be empty");
// throw new BusinessException("get collection elements cannot be empty");
return new ArrayList<>();
}
if (CollectionUtils.isEmpty(usedElementIds)) {
return collectionElements.stream().map(CollectionElement::getId).collect(Collectors.toList());

View File

@@ -249,7 +249,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
@Override
public Workspace getByIdNew(Long id) {
public WorkspaceVO getByIdNew(Long id) {
Long accountId = UserContext.getUserHolder().getId();
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
qwOld.lambda().eq(Workspace::getAccountId, accountId);
@@ -260,7 +260,26 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
Workspace newIsLastIndex = workspaceMapper.selectById(id);
newIsLastIndex.setIsLastIndex(1);
workspaceMapper.updateById(newIsLastIndex);
return newIsLastIndex;
WorkspaceVO vo = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
if (vo.getMannequinFemaleId() != null) {
if (vo.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
} else if (vo.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
}
}
if (vo.getMannequinMaleId() != null) {
if (vo.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
} else if (vo.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
}
}
Sex sex = Sex.getSex(vo.getSex());
Position position = Position.getPosition(vo.getPosition());
vo.setSexEnum(new BizJson(sex.getValue(), sex.name(), BusinessException.getMessageFromResource(sex.name())));
vo.setPositionEnum(new BizJson(position.getValue(), position.name(), BusinessException.getMessageFromResource(position.name())));
return vo;
}
@Override