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()); .eq(Account::getUserName, accountTrialDTO.getUserName());
List<Account> accountList = accountMapper.selectList(qw); List<Account> accountList = accountMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accountList)) { 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); TrialOrder trialOrder = CopyUtil.copyObject(accountTrialDTO, TrialOrder.class);
@@ -491,16 +498,25 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrder.setUpdateTime(LocalDateTime.now()); trialOrder.setUpdateTime(LocalDateTime.now());
trialOrderMapper.updateById(trialOrder); trialOrderMapper.updateById(trialOrder);
Account account = new Account(); Account account = new Account();
account.setUserName(trialOrder.getUserName()); if (CollectionUtil.isNotEmpty(accountList)) {
account.setUserPassword("Third-000000"); account = CopyUtil.copyObject(accountList.get(0), Account.class);
account.setUserEmail(trialOrder.getEmail()); account.setIsTrial(1);
account.setLanguage(Language.ENGLISH.name()); account.setIsBeginner(1);
account.setValidStartTime(System.currentTimeMillis()); account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli()); account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date()); accountMapper.updateById(account);
account.setIsTrial(1); }else {
account.setIsBeginner(1); account.setUserName(trialOrder.getUserName());
accountMapper.insert(account); 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("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3); SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);
@@ -522,17 +538,33 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrder.setStatus(1); trialOrder.setStatus(1);
trialOrder.setUpdateTime(LocalDateTime.now()); trialOrder.setUpdateTime(LocalDateTime.now());
trialOrderMapper.updateById(trialOrder); 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 account = new Account();
account.setUserName(trialOrder.getUserName()); if (CollectionUtil.isNotEmpty(accountList)) {
account.setUserPassword("Third-000000"); account = CopyUtil.copyObject(accountList.get(0), Account.class);
account.setUserEmail(trialOrder.getEmail()); account.setIsTrial(1);
account.setLanguage(Language.ENGLISH.name()); account.setIsBeginner(1);
account.setValidStartTime(System.currentTimeMillis()); account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli()); account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date()); accountMapper.updateById(account);
account.setIsTrial(1); }else {
account.setIsBeginner(1); account.setUserName(trialOrder.getUserName());
accountMapper.insert(account); 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("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3); SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);

View File

@@ -36,8 +36,8 @@ file.linux.path=/workspace/home/aida/file/
#linux服务器域名(预览和下载用) #linux服务器域名(预览和下载用)
file.linuxDomain=https://www.aida.com.hk/download/ file.linuxDomain=https://www.aida.com.hk/download/
file.windows.path=D:\\upload\\ file.windows.path=D:\\upload\\
spring.servlet.multipart.max-file-size = 5MB spring.servlet.multipart.max-file-size = 10MB
spring.servlet.multipart.max-request-size= 5MB spring.servlet.multipart.max-request-size= 10MB
#访问python服务的ip(对应环境) #访问python服务的ip(对应环境)
#access.python.ip=http://43.198.80.117 #access.python.ip=http://43.198.80.117
access.python.ip=http://18.167.251.121 access.python.ip=http://18.167.251.121