bmmx 1 рік тому
батько
коміт
6b4f6a6d23

+ 7 - 0
src/main/java/com/om/controller/admin/AppUserController.java

@@ -5,6 +5,7 @@ import com.om.entity.dto.UserLoginDTO;
 import com.om.entity.dto.UserLoginDTO;
 import com.om.entity.dto.UserQueryPageDTO;
 import com.om.entity.po.User;
+import com.om.entity.po.VciInfo;
 import com.om.entity.vo.AppBindVO;
 import com.om.entity.vo.UserAddVO;
 import com.om.entity.vo.UserQueryPageVO;
@@ -121,4 +122,10 @@ public class AppUserController {
 
         return userService.bindingVci(bindVO);
     }
+
+    @GetMapping("/getVciByUserId")
+    @ApiOperation("根据用户id获取vci设备列表")
+    public Result<List<VciInfo>> getVciByUserId(@RequestParam Integer userId){
+        return userService.getVciByUserId(userId);
+    }
 }

+ 1 - 1
src/main/java/com/om/entity/dto/VehicleDates.java

@@ -19,7 +19,7 @@ public class VehicleDates {
     private String brandEn;
 
     @ApiModelProperty(value = "文件大小")
-    private String fileSize;
+    private float fileSize;
 
     @ApiModelProperty(value = "版本号")
     private String version;

+ 1 - 1
src/main/java/com/om/entity/po/DiagnosisVersionInfo.java

@@ -59,7 +59,7 @@ public class DiagnosisVersionInfo implements Serializable {
     private String diagnosisEn;
 
     @ApiModelProperty(value = "诊断程序版本文件大小")
-    private String diagnosisFileSize;
+    private float diagnosisFileSize;
 
     @ApiModelProperty(value = "诊断程序版本名称")
     private String diagnosisName;

+ 1 - 1
src/main/java/com/om/entity/vo/DiagnosisVersionVO.java

@@ -24,7 +24,7 @@ public class DiagnosisVersionVO implements Serializable {
     private String[] descriptionList;
     private String fileUrl;
     private String fileName;
-    private String diagnosisFileSize;
+    private float diagnosisFileSize;
     private Integer status;
     private String username;
     private String version;

+ 6 - 0
src/main/java/com/om/service/IUserService.java

@@ -6,12 +6,15 @@ import com.om.entity.dto.AppUserUpdatePwdDTO;
 import com.om.entity.dto.UserLoginDTO;
 import com.om.entity.dto.UserQueryPageDTO;
 import com.om.entity.po.User;
+import com.om.entity.po.VciInfo;
 import com.om.entity.vo.AppBindVO;
 import com.om.entity.vo.UserAddVO;
 import com.om.entity.vo.UserQueryPageVO;
 import com.om.utils.Result;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
+
 /**
  * <p>
  * 应用用户信息表 服务类
@@ -53,4 +56,7 @@ public interface IUserService extends IService<User> {
     Result updateVci(AppBaseDTO dto);
 
     Result bindingVci(AppBindVO bindVO);
+
+    Result<List<VciInfo>> getVciByUserId(Integer userId);
+
 }

+ 3 - 1
src/main/java/com/om/service/impl/DiagnosisVersionInfoServiceImpl.java

@@ -306,7 +306,9 @@ public class DiagnosisVersionInfoServiceImpl extends ServiceImpl<DiagnosisVersio
                 return Result.fail("未获取到数据").result(ResultCode.NO_DATA);
             }
             //根据品牌id查询品牌
-            Brand brand = brandService.getById(diagnosisVersionInfo.getBrandId());
+            Brand brand = brandService.lambdaQuery()
+                    .eq(Brand::getBrandCode,diagnosisVersionInfo.getBrandCode())
+                    .one();
             if (BeanUtil.isEmpty(brand)) {
                 throw new BadReqException("品牌不存在");
             }

+ 29 - 10
src/main/java/com/om/service/impl/UserServiceImpl.java

@@ -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;
+    }
 }