Merge branch 'dev/dev' into dev/dev_xp
This commit is contained in:
@@ -77,7 +77,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Transactional
|
||||
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
|
||||
log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO));
|
||||
Account account = getOneByUserName(accountDTO.getUserName());
|
||||
Account account = getOneByEmail(accountDTO.getEmail());
|
||||
//用户有效期校验
|
||||
validateUserValidaExpire(account);
|
||||
if ("Third-000000".equals(account.getUserPassword())) {
|
||||
@@ -287,8 +287,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
private Account getOneByEmail(String email) {
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(Account::getUserEmail, email);
|
||||
queryWrapper.lambda().last("limit 1");
|
||||
queryWrapper.eq("BINARY user_email", email);
|
||||
List<Account> accountList = accountMapper.selectList(queryWrapper);
|
||||
if (CollectionUtil.isEmpty(accountList)) {
|
||||
throw new BusinessException("email.does.not.exist", ResultEnum.PROMPT.getCode());
|
||||
@@ -471,28 +470,27 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
String ipAddress = RequestInfoUtil.getIpAddress(request);
|
||||
// 先检测试用订单
|
||||
QueryWrapper<TrialOrder> trialOrderQueryWrapper = new QueryWrapper<>();
|
||||
trialOrderQueryWrapper.lambda().eq(TrialOrder::getIp, ipAddress);
|
||||
trialOrderQueryWrapper.lambda().and(wrapper ->
|
||||
wrapper.eq(TrialOrder::getEmail, accountTrialDTO.getEmail())
|
||||
.or() // OR
|
||||
.like(TrialOrder::getUserName, accountTrialDTO.getUserName()));
|
||||
trialOrderQueryWrapper.eq("BINARY email", accountTrialDTO.getEmail());
|
||||
// trialOrderQueryWrapper.lambda().eq(TrialOrder::getIp, ipAddress);
|
||||
// trialOrderQueryWrapper.lambda().and(wrapper ->
|
||||
// wrapper.eq(TrialOrder::getEmail, accountTrialDTO.getEmail())
|
||||
// .or() // OR
|
||||
// .like(TrialOrder::getUserName, accountTrialDTO.getUserName()));
|
||||
List<TrialOrder> trialOrders = trialOrderMapper.selectList(trialOrderQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(trialOrders)) {
|
||||
throw new BusinessException("You have submitted a trial application, please wait for approval.");
|
||||
}
|
||||
// 先检测用户名和邮箱
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Account::getUserEmail, accountTrialDTO.getEmail())
|
||||
.or()
|
||||
.eq(Account::getUserName, accountTrialDTO.getUserName());
|
||||
qw.eq("BINARY email", accountTrialDTO.getEmail());
|
||||
List<Account> accountList = accountMapper.selectList(qw);
|
||||
if (CollectionUtil.isNotEmpty(accountList)) {
|
||||
if (accountList.get(0).getIsTrial() == 1) {
|
||||
throw new BusinessException("The username or email has already been registered", ResultEnum.PROMPT.getCode());
|
||||
throw new BusinessException("The email has already been registered", ResultEnum.PROMPT.getCode());
|
||||
}else {
|
||||
Account account = accountList.get(0);
|
||||
if (null == account.getValidEndTime() || account.getValidEndTime() > System.currentTimeMillis()) {
|
||||
throw new BusinessException("The username or email has already been registered", ResultEnum.PROMPT.getCode());
|
||||
throw new BusinessException("The email has already been registered", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,9 +500,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
trialOrder.setStatus(0);
|
||||
trialOrder.setIp(ipAddress);
|
||||
trialOrderMapper.insert(trialOrder);
|
||||
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,1);
|
||||
SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,1);
|
||||
SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,1);
|
||||
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,1);
|
||||
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,1);
|
||||
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,1);
|
||||
// 判断当前的试用订单是否自动批准
|
||||
if (AutoApproved.getStatus()) {
|
||||
// 改变试用订单状态,新增试用用户
|
||||
@@ -532,10 +530,10 @@ 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);
|
||||
// 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());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@@ -556,9 +554,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
trialOrderMapper.updateById(trialOrder);
|
||||
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Account::getUserEmail, trialOrder.getEmail())
|
||||
.or()
|
||||
.eq(Account::getUserName, trialOrder.getUserName());
|
||||
qw.eq("BINARY email", trialOrder.getEmail());
|
||||
List<Account> accountList = accountMapper.selectList(qw);
|
||||
|
||||
Account account = new Account();
|
||||
@@ -582,10 +578,10 @@ 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);
|
||||
// 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());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
public void checkModel(String value, List<Long> modelIds, Integer deleteModelConfirm) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getUserName, authPrincipalVo.getUsername());
|
||||
qw.lambda().eq(Workspace::getAccountId, authPrincipalVo.getId());
|
||||
if (value.equals(Sex.FEMALE.getValue())) {
|
||||
qw.lambda().in(Workspace::getMannequinFemaleId, modelIds);
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
// 防止前端传值修改标识
|
||||
workspace.setIsLastIndex(null);
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
workspace.setUserName(userInfo.getUsername());
|
||||
checkWorkspaceName(workspace.getId(), workspace.getWorkSpaceName(), userInfo.getUsername());
|
||||
workspace.setAccountId(userInfo.getId());
|
||||
checkWorkspaceName(workspace.getId(), workspace.getWorkSpaceName(), userInfo.getId());
|
||||
if (null == workspace.getId()) {
|
||||
workspace.setIsLastIndex(0);
|
||||
QueryWrapper<SysFile> systemFemaleQw = new QueryWrapper<>();
|
||||
@@ -123,11 +123,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
}
|
||||
}
|
||||
|
||||
private void checkWorkspaceName(Long id, String workSpaceName, String userName) {
|
||||
private void checkWorkspaceName(Long id, String workSpaceName, Long accountId) {
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().ne(null != id, Workspace::getId, id);
|
||||
qw.lambda().eq(Workspace::getWorkSpaceName, workSpaceName);
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
qw.lambda().eq(Workspace::getAccountId, accountId);
|
||||
List<Workspace> workspaces = baseMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("the.workspaceName.already.exists", ResultEnum.PROMPT.getCode());
|
||||
@@ -137,9 +137,9 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
@Override
|
||||
public WorkspaceVO getPage(WorkspaceDTO query) {
|
||||
WorkspaceVO vo = new WorkspaceVO();
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
qw.lambda().eq(Workspace::getAccountId, accountId);
|
||||
IPage<Workspace> page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
if (page.getTotal() == 0L) {
|
||||
// 给用户新建默认workspace
|
||||
@@ -148,7 +148,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
workspace.setSex(Sex.FEMALE.getValue());
|
||||
workspace.setSystemDesignerPercentage(SYSTEM_DESIGNER_PERCENTAGE);
|
||||
workspace.setPosition("Overall");
|
||||
workspace.setUserName(userName);
|
||||
workspace.setAccountId(accountId);
|
||||
QueryWrapper<SysFile> systemFemaleQw = new QueryWrapper<>();
|
||||
systemFemaleQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||
systemFemaleQw.lambda().eq(SysFile::getLevel2Type, "Female");
|
||||
@@ -225,7 +225,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
);
|
||||
vo.setPage(PageBaseResponse.success(convert));
|
||||
QueryWrapper<Workspace> qwIsLastIndex = new QueryWrapper<>();
|
||||
qwIsLastIndex.lambda().eq(Workspace::getUserName, userName);
|
||||
qwIsLastIndex.lambda().eq(Workspace::getAccountId, accountId);
|
||||
qwIsLastIndex.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
qwIsLastIndex.last("limit 1");
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qwIsLastIndex);
|
||||
@@ -250,9 +250,9 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
|
||||
@Override
|
||||
public Workspace getByIdNew(Long id) {
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
|
||||
qwOld.lambda().eq(Workspace::getUserName, userName);
|
||||
qwOld.lambda().eq(Workspace::getAccountId, accountId);
|
||||
qwOld.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
Workspace oldIsLastIndex = workspaceMapper.selectOne(qwOld);
|
||||
oldIsLastIndex.setIsLastIndex(0);
|
||||
|
||||
Reference in New Issue
Block a user