|
@@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.SaLoginModel;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
@@ -163,8 +164,11 @@ public class AccountServiceImpl extends ServiceImpl<IAccountMapper, Account> imp
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_10003);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_10003);
|
|
}
|
|
}
|
|
|
|
|
|
- if(!param.getUserName().equals(account.getUserName())){
|
|
|
|
|
|
+ if(StrUtil.isNotEmpty(param.getUserName()) && !param.getUserName().equals(account.getUserName())){
|
|
User user = userService.getByUserName(param.getUserName());
|
|
User user = userService.getByUserName(param.getUserName());
|
|
|
|
+ if(Objects.isNull(user)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_10003);
|
|
|
|
+ }
|
|
account.setUserName(param.getUserName());
|
|
account.setUserName(param.getUserName());
|
|
account.setUserId(user.getId());
|
|
account.setUserId(user.getId());
|
|
}
|
|
}
|
|
@@ -176,19 +180,22 @@ public class AccountServiceImpl extends ServiceImpl<IAccountMapper, Account> imp
|
|
|
|
|
|
UserAuthInfo userAuthInfo = userAuthService.findByAccountId(account.getId());
|
|
UserAuthInfo userAuthInfo = userAuthService.findByAccountId(account.getId());
|
|
|
|
|
|
- int totalCount = userAuthInfo.getTotalCount();
|
|
|
|
|
|
+ Integer totalCount = userAuthInfo.getTotalCount();
|
|
if(totalCount < 0){
|
|
if(totalCount < 0){
|
|
totalCount = 0;
|
|
totalCount = 0;
|
|
}
|
|
}
|
|
Integer count = param.getCount();
|
|
Integer count = param.getCount();
|
|
- if(CountType.NO_LIMIT.code() == param.getCountType()){
|
|
|
|
- totalCount = -1;
|
|
|
|
- }else if(CountType.REDUCE.code() == param.getCountType()){
|
|
|
|
- totalCount -= count;
|
|
|
|
- totalCount = totalCount < 0 ? 0 : totalCount;
|
|
|
|
- }else{
|
|
|
|
- totalCount += count;
|
|
|
|
|
|
+ if(Objects.nonNull(param.getCountType())){
|
|
|
|
+ if(CountType.NO_LIMIT.code() == param.getCountType()){
|
|
|
|
+ totalCount = -1;
|
|
|
|
+ }else if(CountType.REDUCE.code() == param.getCountType()){
|
|
|
|
+ totalCount -= count;
|
|
|
|
+ totalCount = totalCount < 0 ? 0 : totalCount;
|
|
|
|
+ }else{
|
|
|
|
+ totalCount += count;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
userAuthInfo.setUserId(account.getUserId());
|
|
userAuthInfo.setUserId(account.getUserId());
|
|
userAuthInfo.setTotalCount(totalCount);
|
|
userAuthInfo.setTotalCount(totalCount);
|
|
userAuthInfo.setState(param.getState());
|
|
userAuthInfo.setState(param.getState());
|