更新docker-compose文件
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
package com.ai.da.service.impl;
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
import com.ai.da.common.constant.TokenConstant;
|
|
||||||
import com.ai.da.common.enums.LoginTypeEnum;
|
import com.ai.da.common.enums.LoginTypeEnum;
|
||||||
import com.ai.da.common.enums.OperationTypeEnum;
|
import com.ai.da.common.enums.OperationTypeEnum;
|
||||||
import com.ai.da.common.httpdata.token.TokenQuery;
|
|
||||||
import com.ai.da.common.security.jwt.JWTTokenHelper;
|
import com.ai.da.common.security.jwt.JWTTokenHelper;
|
||||||
import com.ai.da.common.utils.*;
|
import com.ai.da.common.utils.*;
|
||||||
import com.ai.da.mapper.AccountMapper;
|
import com.ai.da.mapper.AccountMapper;
|
||||||
@@ -19,25 +16,18 @@ import com.ai.da.model.vo.AuthPrincipalVo;
|
|||||||
import com.ai.da.service.AccountLoginLogService;
|
import com.ai.da.service.AccountLoginLogService;
|
||||||
import com.ai.da.service.AccountService;
|
import com.ai.da.service.AccountService;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import io.netty.util.internal.StringUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.catalina.util.RequestUtil;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -64,17 +54,20 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
|
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
|
||||||
log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO));
|
log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO));
|
||||||
Account account = getOneByUserName(accountDTO.getUserName());
|
Account account = getOneByUserName(accountDTO.getUserName());
|
||||||
Assert.isTrue(Objects.nonNull(account),"User does not exist!");
|
Assert.isTrue(Objects.nonNull(account), "User does not exist!");
|
||||||
//用户有效期校验
|
//用户有效期校验
|
||||||
validateUserValidaExpire(account);
|
validateUserValidaExpire(account);
|
||||||
if("Third-000000".equals(account.getUserPassword())){
|
if ("Third-000000".equals(account.getUserPassword())) {
|
||||||
account.setUserPassword(accountDTO.getPassword());
|
account.setUserPassword(accountDTO.getPassword());
|
||||||
accountMapper.updateById(account);
|
accountMapper.updateById(account);
|
||||||
}else{
|
} else {
|
||||||
Assert.isTrue(account.getUserPassword().equals(accountDTO.getPassword()),"Password error !");
|
Assert.isTrue(account.getUserPassword().equals(accountDTO.getPassword()), "Password error !");
|
||||||
}
|
}
|
||||||
/*发送邮件*/
|
/*发送邮件*/
|
||||||
OperationTypeEnum operationTypeEnum = OperationTypeEnum.of(accountDTO.getOperationType());
|
OperationTypeEnum operationTypeEnum = OperationTypeEnum.of(accountDTO.getOperationType());
|
||||||
|
log.info(account.getUserEmail());
|
||||||
|
log.info(accountDTO.getEmail());
|
||||||
|
Assert.isTrue(account.getUserEmail().equals(accountDTO.getEmail()), "Email error !");
|
||||||
Assert.notNull(operationTypeEnum, "Unknown operation type!");
|
Assert.notNull(operationTypeEnum, "Unknown operation type!");
|
||||||
String randomVerifyCode = RandomsUtil.generateVerifyCode(100000L, 999999L);
|
String randomVerifyCode = RandomsUtil.generateVerifyCode(100000L, 999999L);
|
||||||
LocalCacheUtils.setVerifyCodeCache(
|
LocalCacheUtils.setVerifyCodeCache(
|
||||||
@@ -112,10 +105,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
public AccountLoginVO login(AccountLoginDTO accountLoginDTO, HttpServletRequest request) {
|
public AccountLoginVO login(AccountLoginDTO accountLoginDTO, HttpServletRequest request) {
|
||||||
log.info("aida确认登入###accountLoginDTO###{}", JSON.toJSONString(accountLoginDTO));
|
log.info("aida确认登入###accountLoginDTO###{}", JSON.toJSONString(accountLoginDTO));
|
||||||
Account accountExist = getOneByEmail(accountLoginDTO.getEmail().trim());
|
Account accountExist = getOneByEmail(accountLoginDTO.getEmail().trim());
|
||||||
Assert.notNull(accountExist,"User does not exist!");
|
Assert.notNull(accountExist, "User does not exist!");
|
||||||
|
|
||||||
LoginTypeEnum accountType = LoginTypeEnum.of(accountLoginDTO.getLoginType());
|
LoginTypeEnum accountType = LoginTypeEnum.of(accountLoginDTO.getLoginType());
|
||||||
if (Objects.isNull(accountType)|| accountType.equals(LoginTypeEnum.PASSWORD)) {
|
if (Objects.isNull(accountType) || accountType.equals(LoginTypeEnum.PASSWORD)) {
|
||||||
throw new BusinessException("Unknown login type!");
|
throw new BusinessException("Unknown login type!");
|
||||||
}
|
}
|
||||||
//用户有效期校验
|
//用户有效期校验
|
||||||
@@ -126,8 +119,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
case PASSWORD:
|
case PASSWORD:
|
||||||
Assert.isTrue(StringUtils.isNotBlank(accountLoginDTO.getPassword()), "Please input a password !");
|
Assert.isTrue(StringUtils.isNotBlank(accountLoginDTO.getPassword()), "Please input a password !");
|
||||||
account = getOneByUserName(accountLoginDTO.getUserName());
|
account = getOneByUserName(accountLoginDTO.getUserName());
|
||||||
Assert.isTrue(Objects.nonNull(account),"User does not exist!");
|
Assert.isTrue(Objects.nonNull(account), "User does not exist!");
|
||||||
Assert.isTrue(account.getUserPassword().equals(accountLoginDTO.getPassword()),"Password error !");
|
Assert.isTrue(account.getUserPassword().equals(accountLoginDTO.getPassword()), "Password error !");
|
||||||
// Assert.isTrue(StringUtils.isBlank(
|
// Assert.isTrue(StringUtils.isBlank(
|
||||||
// LocalCacheUtils.getTokenCache(String.valueOf(account.getId()))),"该用户已登入");
|
// LocalCacheUtils.getTokenCache(String.valueOf(account.getId()))),"该用户已登入");
|
||||||
break;
|
break;
|
||||||
@@ -139,9 +132,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
throw new BusinessException("Email not registered!");
|
throw new BusinessException("Email not registered!");
|
||||||
}
|
}
|
||||||
//校验邮箱验证码
|
//校验邮箱验证码
|
||||||
String verifyCode = LocalCacheUtils.getVerifyCodeCache( OperationTypeEnum.LOGIN.name() + "_" +accountLoginDTO.getEmail());
|
String verifyCode = LocalCacheUtils.getVerifyCodeCache(OperationTypeEnum.LOGIN.name() + "_" + accountLoginDTO.getEmail());
|
||||||
Assert.isTrue(StringUtils.isNotBlank(verifyCode), "The verification code has expired!");
|
Assert.isTrue(StringUtils.isNotBlank(verifyCode), "The verification code has expired!");
|
||||||
if(!"921314".equals(accountLoginDTO.getEmailVerifyCode())){
|
if (!"921314".equals(accountLoginDTO.getEmailVerifyCode())) {
|
||||||
Assert.isTrue(verifyCode.equals(accountLoginDTO.getEmailVerifyCode()), "Verification code error!");
|
Assert.isTrue(verifyCode.equals(accountLoginDTO.getEmailVerifyCode()), "Verification code error!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -149,34 +142,36 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
}
|
}
|
||||||
AccountLoginVO response = CopyUtil.copyObject(account, AccountLoginVO.class);
|
AccountLoginVO response = CopyUtil.copyObject(account, AccountLoginVO.class);
|
||||||
response.setEmail(account.getUserEmail());
|
response.setEmail(account.getUserEmail());
|
||||||
String token =LocalCacheUtils.getTokenCache(String.valueOf(account.getId()));
|
String token = LocalCacheUtils.getTokenCache(String.valueOf(account.getId()));
|
||||||
if(StringUtils.isNotBlank(token)){
|
if (StringUtils.isNotBlank(token)) {
|
||||||
//用户已登入
|
//用户已登入
|
||||||
response.setToken(token);
|
response.setToken(token);
|
||||||
}else{
|
} else {
|
||||||
response.setToken(createAccountToken(account.getId(),account.getUserName()));
|
response.setToken(createAccountToken(account.getId(), account.getUserName()));
|
||||||
}
|
}
|
||||||
response.setUserId(account.getId());
|
response.setUserId(account.getId());
|
||||||
//判断是否常用ip 不是则发邮件提示
|
//判断是否常用ip 不是则发邮件提示
|
||||||
calculateExceptionIp(RequestInfoUtil.getIpAddress(request),account);
|
calculateExceptionIp(RequestInfoUtil.getIpAddress(request), account);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
private void validateUserValidaExpire(Account account){
|
|
||||||
|
private void validateUserValidaExpire(Account account) {
|
||||||
Long currentTime = new Date().getTime();
|
Long currentTime = new Date().getTime();
|
||||||
if(Objects.nonNull(account.getValidStartTime())){
|
if (Objects.nonNull(account.getValidStartTime())) {
|
||||||
Assert.isTrue(currentTime >= account.getValidStartTime(),"User expired !" );
|
Assert.isTrue(currentTime >= account.getValidStartTime(), "User expired !");
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(account.getValidEndTime())){
|
if (Objects.nonNull(account.getValidEndTime())) {
|
||||||
Assert.isTrue(currentTime <= account.getValidEndTime(),"User expired !" );
|
Assert.isTrue(currentTime <= account.getValidEndTime(), "User expired !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void calculateExceptionIp(String ip ,Account account ){
|
|
||||||
|
private void calculateExceptionIp(String ip, Account account) {
|
||||||
//必须先绑定邮箱才可以发有异常ip邮件提醒
|
//必须先绑定邮箱才可以发有异常ip邮件提醒
|
||||||
if(StringUtils.isNotBlank(account.getUserEmail())){
|
if (StringUtils.isNotBlank(account.getUserEmail())) {
|
||||||
List<AccountLoginLog> accountLoginLogs = accountLoginLogService.getByUserId(account.getId());
|
List<AccountLoginLog> accountLoginLogs = accountLoginLogService.getByUserId(account.getId());
|
||||||
if(CollectionUtil.isNotEmpty(accountLoginLogs)){
|
if (CollectionUtil.isNotEmpty(accountLoginLogs)) {
|
||||||
List<String> existIps = accountLoginLogs.stream().map(AccountLoginLog::getIp).collect(Collectors.toList());
|
List<String> existIps = accountLoginLogs.stream().map(AccountLoginLog::getIp).collect(Collectors.toList());
|
||||||
if(!existIps.contains(ip)){
|
if (!existIps.contains(ip)) {
|
||||||
//非常用ip,没有出现过
|
//非常用ip,没有出现过
|
||||||
EmailSendDTO emailSendDTO = new EmailSendDTO();
|
EmailSendDTO emailSendDTO = new EmailSendDTO();
|
||||||
emailSendDTO.setEmail(account.getUserEmail());
|
emailSendDTO.setEmail(account.getUserEmail());
|
||||||
@@ -187,11 +182,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//保存登入日志
|
//保存登入日志
|
||||||
accountLoginLogService.saveLoginLog(ip,account.getId());
|
accountLoginLogService.saveLoginLog(ip, account.getId());
|
||||||
}
|
}
|
||||||
private String createAccountToken(Long userId,String userName){
|
|
||||||
|
private String createAccountToken(Long userId, String userName) {
|
||||||
String token = LocalCacheUtils.getTokenCache(String.valueOf(userId));
|
String token = LocalCacheUtils.getTokenCache(String.valueOf(userId));
|
||||||
if(StringUtils.isNotBlank(token)){
|
if (StringUtils.isNotBlank(token)) {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
AuthPrincipalVo principal = new AuthPrincipalVo();
|
AuthPrincipalVo principal = new AuthPrincipalVo();
|
||||||
@@ -205,14 +201,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
@Override
|
@Override
|
||||||
public Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO) {
|
public Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO) {
|
||||||
Account account = getOneByUserId(accountBindEmailDTO.getUserId());
|
Account account = getOneByUserId(accountBindEmailDTO.getUserId());
|
||||||
Assert.notNull(account,"User does not exist !");
|
Assert.notNull(account, "User does not exist !");
|
||||||
Assert.isTrue(StringUtils.isBlank(account.getUserEmail()),"User has bound mailbox !");
|
Assert.isTrue(StringUtils.isBlank(account.getUserEmail()), "User has bound mailbox !");
|
||||||
//校验邮箱验证码
|
//校验邮箱验证码
|
||||||
String verifyCode = LocalCacheUtils.getVerifyCodeCache(OperationTypeEnum.BIND_MAILBOX.name() + "_" + accountBindEmailDTO.getUserEmail());
|
String verifyCode = LocalCacheUtils.getVerifyCodeCache(OperationTypeEnum.BIND_MAILBOX.name() + "_" + accountBindEmailDTO.getUserEmail());
|
||||||
Assert.isTrue(StringUtils.isNotBlank(verifyCode), "The verification code has expired !");
|
Assert.isTrue(StringUtils.isNotBlank(verifyCode), "The verification code has expired !");
|
||||||
Assert.isTrue(verifyCode.equals(accountBindEmailDTO.getEmailVerifyCode()), "Verification code error !");
|
Assert.isTrue(verifyCode.equals(accountBindEmailDTO.getEmailVerifyCode()), "Verification code error !");
|
||||||
//绑定
|
//绑定
|
||||||
updatePwdByUserId(accountBindEmailDTO.getUserEmail(),accountBindEmailDTO.getUserId());
|
updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +233,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
accountNew.setUserPassword(pwd);
|
accountNew.setUserPassword(pwd);
|
||||||
accountMapper.update(accountNew, queryWrapper);
|
accountMapper.update(accountNew, queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePwdByUserId(String email, Long userId) {
|
private void updatePwdByUserId(String email, Long userId) {
|
||||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("id", userId);
|
queryWrapper.eq("id", userId);
|
||||||
@@ -258,6 +255,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
queryWrapper.eq("user_name", userName);
|
queryWrapper.eq("user_name", userName);
|
||||||
return accountMapper.selectOne(queryWrapper);
|
return accountMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Account getOneByUserId(Long userId) {
|
private Account getOneByUserId(Long userId) {
|
||||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("id", userId);
|
queryWrapper.eq("id", userId);
|
||||||
@@ -271,9 +269,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
Assert.notNull(operationTypeEnum, "Unknown operation type!");
|
Assert.notNull(operationTypeEnum, "Unknown operation type!");
|
||||||
|
|
||||||
Account emailAccount = getOneByEmail(emailSendDTO.getEmail());
|
Account emailAccount = getOneByEmail(emailSendDTO.getEmail());
|
||||||
String randomVerifyCode =RandomsUtil.generateVerifyCode(100000L,999999L);
|
String randomVerifyCode = RandomsUtil.generateVerifyCode(100000L, 999999L);
|
||||||
LocalCacheUtils.setVerifyCodeCache(
|
LocalCacheUtils.setVerifyCodeCache(
|
||||||
emailSendDTO.getOperationType() + "_" + emailSendDTO.getEmail(),randomVerifyCode);
|
emailSendDTO.getOperationType() + "_" + emailSendDTO.getEmail(), randomVerifyCode);
|
||||||
Boolean result = Boolean.FALSE;
|
Boolean result = Boolean.FALSE;
|
||||||
switch (operationTypeEnum) {
|
switch (operationTypeEnum) {
|
||||||
case LOGIN:
|
case LOGIN:
|
||||||
@@ -306,7 +304,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
public Boolean logout(AccountLogoutDTO accountLogoutDTO) {
|
public Boolean logout(AccountLogoutDTO accountLogoutDTO) {
|
||||||
//jwt本身失效比较难做 统一用缓存实现 删除缓存就失效
|
//jwt本身失效比较难做 统一用缓存实现 删除缓存就失效
|
||||||
String token = LocalCacheUtils.getTokenCache(String.valueOf(accountLogoutDTO.getUserId()));
|
String token = LocalCacheUtils.getTokenCache(String.valueOf(accountLogoutDTO.getUserId()));
|
||||||
if(StringUtils.isNotBlank(token)){
|
if (StringUtils.isNotBlank(token)) {
|
||||||
LocalCacheUtils.delTokenCache(String.valueOf(accountLogoutDTO.getUserId()));
|
LocalCacheUtils.delTokenCache(String.valueOf(accountLogoutDTO.getUserId()));
|
||||||
}
|
}
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
@@ -315,7 +313,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
@Override
|
@Override
|
||||||
public Boolean isLogin(AccountLogoutDTO accountLogoutDTO) {
|
public Boolean isLogin(AccountLogoutDTO accountLogoutDTO) {
|
||||||
String token = LocalCacheUtils.getTokenCache(String.valueOf(accountLogoutDTO.getUserId()));
|
String token = LocalCacheUtils.getTokenCache(String.valueOf(accountLogoutDTO.getUserId()));
|
||||||
if(StringUtils.isNotBlank(token)){
|
if (StringUtils.isNotBlank(token)) {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
@@ -330,52 +328,52 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
account.setValidStartTime(Long.valueOf(accountAddDTO.getValidStartTime()));
|
account.setValidStartTime(Long.valueOf(accountAddDTO.getValidStartTime()));
|
||||||
account.setValidEndTime(Long.valueOf(accountAddDTO.getValidEndTime()));
|
account.setValidEndTime(Long.valueOf(accountAddDTO.getValidEndTime()));
|
||||||
account.setCreateDate(new Date());
|
account.setCreateDate(new Date());
|
||||||
return accountMapper.insert(account)>0;
|
return accountMapper.insert(account) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean editUser(AccountEditDTO accountEditDTO) {
|
public Boolean editUser(AccountEditDTO accountEditDTO) {
|
||||||
if(Objects.isNull(accountEditDTO)|| ObjectUtils.isAllFieldNull(accountEditDTO)){
|
if (Objects.isNull(accountEditDTO) || ObjectUtils.isAllFieldNull(accountEditDTO)) {
|
||||||
throw new BusinessException("The edited account information cannot be blank!");
|
throw new BusinessException("The edited account information cannot be blank!");
|
||||||
}
|
}
|
||||||
QueryWrapper<Account> queryTotal = new QueryWrapper<>();
|
QueryWrapper<Account> queryTotal = new QueryWrapper<>();
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
//校验
|
//校验
|
||||||
if(StringUtils.isNotBlank(accountEditDTO.getNewEmail())){
|
if (StringUtils.isNotBlank(accountEditDTO.getNewEmail())) {
|
||||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldEmail()),"oldEmail cannot be empty!");
|
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldEmail()), "oldEmail cannot be empty!");
|
||||||
queryTotal.eq("user_email",accountEditDTO.getOldEmail());
|
queryTotal.eq("user_email", accountEditDTO.getOldEmail());
|
||||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||||
Assert.notNull(accountSelect,"oldEmail does not exist!");
|
Assert.notNull(accountSelect, "oldEmail does not exist!");
|
||||||
|
|
||||||
account.setUserEmail(accountEditDTO.getNewEmail());
|
account.setUserEmail(accountEditDTO.getNewEmail());
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(accountEditDTO.getNewUserName())){
|
if (StringUtils.isNotBlank(accountEditDTO.getNewUserName())) {
|
||||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()),"oldUserName cannot be empty!");
|
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName cannot be empty!");
|
||||||
queryTotal.eq("user_name",accountEditDTO.getOldUserName());
|
queryTotal.eq("user_name", accountEditDTO.getOldUserName());
|
||||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||||
Assert.notNull(accountSelect,"oldUserName does not exist!");
|
Assert.notNull(accountSelect, "oldUserName does not exist!");
|
||||||
|
|
||||||
account.setUserName(accountEditDTO.getNewUserName());
|
account.setUserName(accountEditDTO.getNewUserName());
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(accountEditDTO.getNewValidStartTime())){
|
if (StringUtils.isNotBlank(accountEditDTO.getNewValidStartTime())) {
|
||||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()),"oldUserName cannot be empty!");
|
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName cannot be empty!");
|
||||||
queryTotal.eq("user_name",accountEditDTO.getOldUserName());
|
queryTotal.eq("user_name", accountEditDTO.getOldUserName());
|
||||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||||
Assert.notNull(accountSelect,"oldUserName does not exist!");
|
Assert.notNull(accountSelect, "oldUserName does not exist!");
|
||||||
|
|
||||||
account.setValidStartTime(Long.valueOf(accountEditDTO.getNewValidStartTime()));
|
account.setValidStartTime(Long.valueOf(accountEditDTO.getNewValidStartTime()));
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(accountEditDTO.getNewValidEndTime())){
|
if (StringUtils.isNotBlank(accountEditDTO.getNewValidEndTime())) {
|
||||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()),"oldUserName cannot be empty!");
|
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName cannot be empty!");
|
||||||
queryTotal.eq("user_name",accountEditDTO.getOldUserName());
|
queryTotal.eq("user_name", accountEditDTO.getOldUserName());
|
||||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||||
Assert.notNull(accountSelect,"oldUserName does not exist!");
|
Assert.notNull(accountSelect, "oldUserName does not exist!");
|
||||||
|
|
||||||
account.setValidEndTime(Long.valueOf(accountEditDTO.getNewValidEndTime()));
|
account.setValidEndTime(Long.valueOf(accountEditDTO.getNewValidEndTime()));
|
||||||
}
|
}
|
||||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||||
Assert.notNull(accountSelect,"oldAccount does not exist!");
|
Assert.notNull(accountSelect, "oldAccount does not exist!");
|
||||||
accountMapper.update(account,queryTotal);
|
accountMapper.update(account, queryTotal);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,26 +41,6 @@
|
|||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
"sourceType": "com.ai.da.common.config.FileProperties"
|
"sourceType": "com.ai.da.common.config.FileProperties"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "file.linux.path",
|
|
||||||
"type": "java.lang.String",
|
|
||||||
"sourceType": "com.ai.da.common.config.FileProperties$ElPath"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "file.mac.path",
|
|
||||||
"type": "java.lang.String",
|
|
||||||
"sourceType": "com.ai.da.common.config.FileProperties$ElPath"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "file.sys.path",
|
|
||||||
"type": "java.lang.String",
|
|
||||||
"sourceType": "com.ai.da.common.config.FileProperties$ElPath"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "file.windows.path",
|
|
||||||
"type": "java.lang.String",
|
|
||||||
"sourceType": "com.ai.da.common.config.FileProperties$ElPath"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "spring.security.auth-api",
|
"name": "spring.security.auth-api",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ server.port=5567
|
|||||||
#datasource
|
#datasource
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://18.167.251.121:33006/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
spring.datasource.url=jdbc:mysql://18.167.251.121:33006/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
spring.datasource.username=root
|
spring.datasource.username=nacos
|
||||||
spring.datasource.password=root
|
spring.datasource.password=nacos
|
||||||
|
|
||||||
#security
|
#security
|
||||||
spring.security.jwtSecret=JWTSECRET
|
spring.security.jwtSecret=JWTSECRET
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user