|
@@ -98,10 +98,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
try {
|
|
|
password = AesUtil.Encrypt(password);
|
|
|
} catch (Exception e) {
|
|
|
- throw new BizException("密码加密出错",ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
+ throw new BizException("密码加密出错", ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
}
|
|
|
//判断密码是否正确
|
|
|
- if (StringUtils.equals(password,user.getPassword())) {
|
|
|
+ if (StringUtils.equals(password, user.getPassword())) {
|
|
|
return Result.fail("密码错误").result(ResultCode.PASSWORD_ERROR);
|
|
|
}
|
|
|
if (user.getState() == 0) {
|
|
@@ -148,7 +148,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
VciInfoVO vciInfoVO = new VciInfoVO();
|
|
|
Integer vciInfoId = userVci.getVciInfoId();
|
|
|
VciInfo vciInfo = vciInfoService.getById(vciInfoId);
|
|
|
- if (BeanUtil.isEmpty(vciInfo)){
|
|
|
+ if (BeanUtil.isEmpty(vciInfo)) {
|
|
|
throw new BadReqException("该VCI设备不存在");
|
|
|
}
|
|
|
if (userVci.getIsDefault() == 1) {
|
|
@@ -187,13 +187,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
try {
|
|
|
password = AesUtil.Encrypt(password);
|
|
|
} catch (Exception e) {
|
|
|
- throw new BizException("密码加密出错",ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
+ throw new BizException("密码加密出错", ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
}
|
|
|
addUser.setPassword(password);
|
|
|
Integer distributorId = user.getDistributorId();
|
|
|
//根据id查询维修厂
|
|
|
Distributor distributor = distributorService.getById(distributorId);
|
|
|
- if (BeanUtil.isEmpty(distributor)){
|
|
|
+ if (BeanUtil.isEmpty(distributor)) {
|
|
|
throw new BadReqException("该维修厂不存在");
|
|
|
}
|
|
|
addUser.setDistributorName(distributor.getCompany());
|
|
@@ -320,16 +320,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
try {
|
|
|
password = AesUtil.Encrypt(password);
|
|
|
} catch (Exception e) {
|
|
|
- throw new BizException("密码加密出错",ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
+ throw new BizException("密码加密出错", ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
}
|
|
|
- if (!password.equals(userById.getPassword())){
|
|
|
+ if (!password.equals(userById.getPassword())) {
|
|
|
userById.setPassword(password);
|
|
|
}
|
|
|
|
|
|
Integer distributorId = userById.getDistributorId();
|
|
|
//根据id查询维修厂
|
|
|
Distributor distributor = distributorService.getById(distributorId);
|
|
|
- if (BeanUtil.isEmpty(distributor)){
|
|
|
+ if (BeanUtil.isEmpty(distributor)) {
|
|
|
throw new BadReqException("该维修厂不存在");
|
|
|
}
|
|
|
userById.setDistributorName(distributor.getCompany());
|
|
@@ -370,7 +370,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if (userLoginDTO.getUsername() == null || userLoginDTO.getPassword() == null) {
|
|
|
return Result.error().message("用户名密码为空").result(ResultCode.NO_DATA);
|
|
|
}
|
|
|
- if (userLoginDTO.getPassword().equals(userLoginDTO.getRePassword())){
|
|
|
+ if (userLoginDTO.getPassword().equals(userLoginDTO.getRePassword())) {
|
|
|
return Result.error().message("两次密码不一样").result(ResultCode.PASSWORD_ERROR);
|
|
|
}
|
|
|
user.setUsername(userLoginDTO.getUsername());
|
|
@@ -457,7 +457,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
@Override
|
|
|
public Result bindingVci(AppBindVO bindVO) {
|
|
|
- if (BeanUtil.isEmpty(bindVO)){
|
|
|
+ if (BeanUtil.isEmpty(bindVO)) {
|
|
|
return Result.error().message("参数为空").result(ResultCode.NO_DATA);
|
|
|
}
|
|
|
Integer userId = bindVO.getUserId();
|
|
@@ -478,4 +478,23 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result<List<VciInfo>> getVciByUserId(Integer userId) {
|
|
|
+ //根据id查询user
|
|
|
+ User user = this.getById(userId);
|
|
|
+ if (BeanUtil.isEmpty(user)) {
|
|
|
+ throw new BadReqException("该用户不存在");
|
|
|
+ }
|
|
|
+ List<UserVci> list = userVciService.lambdaQuery()
|
|
|
+ .eq(UserVci::getUserId, userId)
|
|
|
+ .list();
|
|
|
+ if (list.isEmpty()) {
|
|
|
+ return Result.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|