Merge remote-tracking branch 'origin/release/3.0' into dev/dev

# Conflicts:
#	pom.xml
#	src/main/java/com/ai/da/common/utils/SendEmailUtil.java
#	src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java
This commit is contained in:
shahaibo
2024-05-27 15:03:02 +08:00
18 changed files with 131 additions and 74 deletions

View File

@@ -12,16 +12,16 @@ public class MQConfig {
// public static final String GENERATE_QUEUE = "generate-queue-test";
// ==================================================================
// public static final String GENERATE_QUEUE = "generate-queue-local";
public static final String GENERATE_QUEUE = "generate-queue-dev";
public static final String GENERATE_QUEUE = "generate-queue-prod";
// public static final String SR_QUEUE = "SR-queue-local";
public static final String SR_QUEUE = "SR-queue-dev";
public static final String SR_QUEUE = "SR-queue-prod";
// public static final String SR_RESULT_QUEUE = "SuperResolution-local";
public static final String SR_RESULT_QUEUE = "SuperResolution-dev";
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev";
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
public MQConfig() {
}

View File

@@ -89,7 +89,7 @@ public class AuthenticationFilter extends OncePerRequestFilter {
private void extracted(HttpServletRequest request) throws AuthenticationException {
String jwtToken = request.getHeader(properties.getJwtTokenHeader());
log.debug("后台检查令牌:{}", jwtToken);
// log.debug("后台检查令牌:{}", jwtToken);
if (StrUtil.isBlank(jwtToken)) {
String ipAddress = RequestInfoUtil.getIpAddress(request);

View File

@@ -135,6 +135,7 @@ public class SendEmailUtil {
private final static Long NOTIFICATION_CHINESE_TEMPLATE_ID = 122229L;
private final static Long TRIAL_ORDER_LIST_ID = 122273L;
private final static Long NO_TRIAL_ORDER_LIST_ID = 122591L;
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country) {
try {
// 实例化一个认证对象
@@ -229,6 +230,7 @@ public class SendEmailUtil {
}
}
public static void sendNoExcelEmail(String receiverAddress, String senderAddress) {
try {
// 实例化一个认证对象

View File

@@ -3,10 +3,12 @@ package com.ai.da.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
@Data
@EqualsAndHashCode
@ApiModel("设计Collection颜色板 响应")
public class CollectionColorVO {

View File

@@ -3,10 +3,12 @@ package com.ai.da.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@EqualsAndHashCode
@ApiModel("用户关联的collection-响应")
public class UserLikeCollectionVO {

View File

@@ -679,7 +679,7 @@ public class PythonService {
}
if (attributeRetrievalAttrDict.getOpeningType() != null) {
nonNullFields.add("openingType");
if (tableName.equals("male_outwear")) {
if (tableName.equals("male_outwear") || tableName.equals("male_top") || tableName.equals("male_bottom")) {
nonNullFields.remove("openingType");
attributeRetrievalAttrDict.setOpeningType(null);
}
@@ -965,7 +965,7 @@ public class PythonService {
QueryWrapper<Dressing> qw = new QueryWrapper<>();
qw.lambda().eq(Dressing::getApparel, validateElementVO.getModelSex());
if (validateElementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
qw.lambda().eq(Dressing::getApparel, validateElementVO.getSwitchCategory());
qw.lambda().eq(Dressing::getStyleCategory, validateElementVO.getSwitchCategory());
}
List<Dressing> dressings = dressingMapper.selectList(qw);
if (CollectionUtil.isEmpty(dressings)) {

View File

@@ -483,7 +483,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) {
@@ -542,7 +542,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;
}
@@ -563,7 +567,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();
@@ -587,10 +591,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

@@ -276,7 +276,6 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
@Override
public WorkspaceVO getByIdNew(Long id) {
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
Long accountId = UserContext.getUserHolder().getId();
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
qwOld.lambda().eq(Workspace::getAccountId, accountId);
@@ -287,21 +286,26 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
Workspace newIsLastIndex = workspaceMapper.selectById(id);
newIsLastIndex.setIsLastIndex(1);
workspaceMapper.updateById(newIsLastIndex);
WorkspaceVO workspaceVO = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspaceVO.getId());
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
if (!CollectionUtils.isEmpty(workspaceRelStyles)) {
Long styleId = workspaceRelStyles.get(0).getStyleId();
Style style = styleMapper.selectById(styleId);
StyleEnum styleEnum = StyleEnum.fromName(style.getName());
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
workspaceVO.setStyleName(styleEnum.getEnglish());
}else {
workspaceVO.setStyleName(styleEnum.getChinese());
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));
}
}
return workspaceVO;
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