|
@@ -186,7 +186,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return Result.ok(userLoginVO).message("账号尚未激活").result(ResultCode.USER_NO_ACTIVATE);
|
|
|
}
|
|
|
// 绑定 客户端编号 和 设备 序列号 ( 判断type是登录(0)还是激活(1) )
|
|
|
- if (!user.getDeviceSn().equals(dto.getDeviceSn())){
|
|
|
+ if (!user.getDeviceSn().equals(dto.getDeviceSn())) {
|
|
|
return Result.ok(userLoginVO).message("账号尚未激活").result(ResultCode.USER_NO_ACTIVATE);
|
|
|
}
|
|
|
|
|
@@ -212,7 +212,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
addUser.setPassword(password);
|
|
|
Integer distributorId = user.getDistributorId();
|
|
|
//根据id查询维修厂
|
|
|
- if(user.getDistributorId() != null){
|
|
|
+ if (user.getDistributorId() != null) {
|
|
|
Distributor distributor = distributorService.getById(distributorId);
|
|
|
if (BeanUtil.isEmpty(distributor)) {
|
|
|
throw new BadReqException("该维修厂不存在");
|
|
@@ -230,7 +230,19 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
deviceService.save(device);
|
|
|
}
|
|
|
this.save(addUser);
|
|
|
-
|
|
|
+ if (StringUtils.isNotBlank(user.getVciSn())) {
|
|
|
+ UserVci userVci = new UserVci();
|
|
|
+ //根据vciSn查询
|
|
|
+ VciInfo vciInfo = vciInfoService.lambdaQuery()
|
|
|
+ .eq(VciInfo::getVciNum, user.getVciSn())
|
|
|
+ .one();
|
|
|
+ if (vciInfo == null) {
|
|
|
+ throw new BadReqException("该VCI设备不存在");
|
|
|
+ }
|
|
|
+ userVci.setVciInfoId(vciInfo.getId());
|
|
|
+ userVci.setUserId(addUser.getId());
|
|
|
+ userVciService.save(userVci);
|
|
|
+ }
|
|
|
return Result.ok();
|
|
|
}
|
|
|
|
|
@@ -348,16 +360,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
User userById = getById(userId);
|
|
|
String password = user.getPassword();
|
|
|
BeanUtil.copyProperties(user, userById);
|
|
|
- //密码加密
|
|
|
- try {
|
|
|
- password = AesUtil.Encrypt(password);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("密码加密出错", ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
- }
|
|
|
- if (!password.equals(userById.getPassword())) {
|
|
|
- userById.setPassword(password);
|
|
|
+ if (!password.equals(userById.getPassword())){
|
|
|
+ //密码加密
|
|
|
+ try {
|
|
|
+ password = AesUtil.Encrypt(password);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("密码加密出错", ResultCode.PASSWORD_ENCRYPT_ERROR);
|
|
|
+ }
|
|
|
+ if (!password.equals(userById.getPassword())) {
|
|
|
+ userById.setPassword(password);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
Integer distributorId = userById.getDistributorId();
|
|
|
//根据id查询维修厂
|
|
|
Distributor distributor = distributorService.getById(distributorId);
|
|
@@ -382,7 +398,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
Integer userId = guidDTO.getUserId();
|
|
|
String username = dto.getUsername();
|
|
|
User user = this.lambdaQuery()
|
|
|
- .eq(User::getUsername,username)
|
|
|
+ .eq(User::getUsername, username)
|
|
|
.one();
|
|
|
if (user == null) {
|
|
|
return Result.error().message("用户不存在").result(ResultCode.USER_NO_EXIST);
|
|
@@ -528,7 +544,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
return null;
|
|
|
}
|
|
|
}
|