|
@@ -1,6 +1,8 @@
|
|
package com.xy.service;
|
|
package com.xy.service;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -19,7 +21,6 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -121,18 +122,19 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
|
|
@ApiOperation("修改")
|
|
@ApiOperation("修改")
|
|
@Lock(value = "update.userId", prefix = "user_update_")
|
|
@Lock(value = "update.userId", prefix = "user_update_")
|
|
public R update(UserInfoDto.Update update) {
|
|
public R update(UserInfoDto.Update update) {
|
|
|
|
+ log.info("权限用户信息修改请求:{}", JSONUtil.toJsonPrettyStr(update));
|
|
UserInfo byId = getById(update.getUserId());
|
|
UserInfo byId = getById(update.getUserId());
|
|
String account = update.getAccount();
|
|
String account = update.getAccount();
|
|
|
|
|
|
- if (!StringUtils.isEmpty(update.getTel())) {
|
|
|
|
- if (!byId.getTel().equals(update.getTel())) {
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(update.getTel())) {
|
|
|
|
+ if (!update.getTel().equals(byId.getTel())) {
|
|
long count = count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getTel, update.getTel()));
|
|
long count = count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getTel, update.getTel()));
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
return R.fail("手机已存在");
|
|
return R.fail("手机已存在");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (!StringUtils.isEmpty(update.getMail())) {
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(update.getMail())) {
|
|
if (!byId.getMail().equals(update.getMail())) {
|
|
if (!byId.getMail().equals(update.getMail())) {
|
|
long count = count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getMail, update.getMail()));
|
|
long count = count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getMail, update.getMail()));
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
@@ -145,13 +147,14 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
|
|
//修改权限用户
|
|
//修改权限用户
|
|
if (Emptys.check(update.getTel()) || Emptys.check(update.getMail()) || Emptys.check(update.getStatus()) || Emptys.check(update.getPassword())) {
|
|
if (Emptys.check(update.getTel()) || Emptys.check(update.getMail()) || Emptys.check(update.getStatus()) || Emptys.check(update.getPassword())) {
|
|
UpdateDto updateDto = new UpdateDto()
|
|
UpdateDto updateDto = new UpdateDto()
|
|
- .setId(byId.getAuthorizeUserId())
|
|
|
|
|
|
+ .setId(AuthorizeUtils.getLoginId(Long.class))
|
|
.setAccount(account)
|
|
.setAccount(account)
|
|
.setPhone(update.getTel())
|
|
.setPhone(update.getTel())
|
|
.setEmail(update.getMail())
|
|
.setEmail(update.getMail())
|
|
.setPassword(update.getPassword())
|
|
.setPassword(update.getPassword())
|
|
.setStatus(update.getStatus())
|
|
.setStatus(update.getStatus())
|
|
.setRoleIds(update.getRoleIds());
|
|
.setRoleIds(update.getRoleIds());
|
|
|
|
+ log.info("权限用户信息修改:{}", JSONUtil.toJsonPrettyStr(updateDto));
|
|
sysWorkUserService.update(updateDto);
|
|
sysWorkUserService.update(updateDto);
|
|
}
|
|
}
|
|
//修改用户
|
|
//修改用户
|