diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index df8aff88..6d3e5516 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -1039,18 +1039,22 @@ public class AccountServiceImpl extends ServiceImpl impl List accountList = accountMapper.selectList(queryWrapper); System.out.println(accountList); int i = 0; + int size = accountList.size(); for (Account account : accountList) { + i ++; try { if (account.getLanguage().equals(Language.CHINESE_SIMPLIFIED.name())) { + log.info("进度:{} / {} CN - {}", i, size, account.getUserEmail()); SendEmailUtil.sendUpgradeNotification(account, null, 0); } else { + log.info("进度:{} / {} EN - {}", i, size, account.getUserEmail()); // 英文 SendEmailUtil.sendUpgradeNotification(account, null, 1); } }catch (Exception e) { - log.info(e.getMessage()); + log.error("向 {} 发送邮件失败", account.getUserEmail()); + log.error(e.getMessage()); } - i ++; } } diff --git a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java index fa0fb819..06b61070 100644 --- a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java @@ -13,6 +13,8 @@ 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.Position; +import com.ai.da.model.enums.Sex; import com.ai.da.model.vo.*; import com.ai.da.service.*; import com.alibaba.fastjson.JSONObject; @@ -31,6 +33,7 @@ import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -611,6 +614,7 @@ public class PortfolioServiceImpl extends ServiceImpl collectionElementListOld = projectSnapshot.getCollectionElementList(); + Long collectionIdNew; + if (collectionElementListOld.isEmpty()){ + throw new BusinessException("No elements in collection."); + } else { + Long collectionIdOld = collectionElementListOld.get(0).getCollectionId(); + Collection collection = collectionMapper.selectById(collectionIdOld); + if (Objects.nonNull(collection) && Objects.nonNull(collection.getMoodTemplateId())){ + CollectionElement moodTemplateElement = collectionElementMapper.selectById(collection.getMoodTemplateId()); + if (Objects.nonNull(moodTemplateElement)){ + moodTemplateElement.setId(null); + moodTemplateElement.setAccountId(accountId); + moodTemplateElement.setProjectId(projectIdNew); + moodTemplateElement.setCreateDate(new Date()); + collectionElementMapper.insert(moodTemplateElement); + + collection.setMoodTemplateId(String.valueOf(moodTemplateElement.getId())); + } + } + collection.setId(null); + collection.setAccountId(accountId); + collection.setCreateDate(new Date()); + collectionMapper.insert(collection); + + collectionIdNew = collection.getId(); + } + + 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); + for (CollectionElement element : collectionElementListOld) { + element.setCollectionId(collectionIdNew); element.setProjectId(projectIdNew); element.setId(null); + element.setCreateDate(new Date()); + element.setUpdateDate(null); collectionElementMapper.insert(element); } @@ -657,10 +720,11 @@ public class PortfolioServiceImpl extends ServiceImpl