BUGFIX:设置上传文件大小,正式用户转试用用户

This commit is contained in:
shahaibo
2024-01-27 16:32:18 +08:00
parent f047ca0324
commit 18d0d55d4f
2 changed files with 55 additions and 23 deletions

View File

@@ -476,7 +476,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
.eq(Account::getUserName, accountTrialDTO.getUserName());
List<Account> accountList = accountMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accountList)) {
throw new BusinessException("The username or email has already been registered", ResultEnum.PROMPT.getCode());
if (accountList.get(0).getIsTrial() == 1) {
throw new BusinessException("The username or email has already been registered", ResultEnum.PROMPT.getCode());
}
// else {
// Account account = accountList.get(0);
// account.setIsTrial(1);
// accountMapper.updateById(account);
// }
}
// 接收到数据后要形成一条使用订单信息
TrialOrder trialOrder = CopyUtil.copyObject(accountTrialDTO, TrialOrder.class);
@@ -491,16 +498,25 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrder.setUpdateTime(LocalDateTime.now());
trialOrderMapper.updateById(trialOrder);
Account account = new Account();
account.setUserName(trialOrder.getUserName());
account.setUserPassword("Third-000000");
account.setUserEmail(trialOrder.getEmail());
account.setLanguage(Language.ENGLISH.name());
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date());
account.setIsTrial(1);
account.setIsBeginner(1);
accountMapper.insert(account);
if (CollectionUtil.isNotEmpty(accountList)) {
account = CopyUtil.copyObject(accountList.get(0), Account.class);
account.setIsTrial(1);
account.setIsBeginner(1);
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
accountMapper.updateById(account);
}else {
account.setUserName(trialOrder.getUserName());
account.setUserPassword("Third-000000");
account.setUserEmail(trialOrder.getEmail());
account.setLanguage(Language.ENGLISH.name());
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date());
account.setIsTrial(1);
account.setIsBeginner(1);
accountMapper.insert(account);
}
// 发送邮件提醒用户试用用户已创建
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);
@@ -522,17 +538,33 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrder.setStatus(1);
trialOrder.setUpdateTime(LocalDateTime.now());
trialOrderMapper.updateById(trialOrder);
QueryWrapper<Account> qw = new QueryWrapper<>();
qw.lambda().eq(Account::getUserEmail, trialOrder.getEmail())
.or()
.eq(Account::getUserName, trialOrder.getUserName());
List<Account> accountList = accountMapper.selectList(qw);
Account account = new Account();
account.setUserName(trialOrder.getUserName());
account.setUserPassword("Third-000000");
account.setUserEmail(trialOrder.getEmail());
account.setLanguage(Language.ENGLISH.name());
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date());
account.setIsTrial(1);
account.setIsBeginner(1);
accountMapper.insert(account);
if (CollectionUtil.isNotEmpty(accountList)) {
account = CopyUtil.copyObject(accountList.get(0), Account.class);
account.setIsTrial(1);
account.setIsBeginner(1);
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
accountMapper.updateById(account);
}else {
account.setUserName(trialOrder.getUserName());
account.setUserPassword("Third-000000");
account.setUserEmail(trialOrder.getEmail());
account.setLanguage(Language.ENGLISH.name());
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date());
account.setIsTrial(1);
account.setIsBeginner(1);
accountMapper.insert(account);
}
// 发送邮件提醒用户试用用户已创建
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);