Просмотр исходного кода

1、司机端登录接口调整;

zk 2 лет назад
Родитель
Сommit
c3de3cc866

+ 3 - 3
sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java

@@ -70,15 +70,15 @@ public class AuthController {
         if (StringUtils.isBlank(params.getAccount())) {
             return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, "请输入您的账号!");
         }
+        if (params.getLoginMethod() == LoginMethodEnum.ORDINARY.getValue() && StringUtils.isBlank(params.getPassword())) {
+            return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, "请输入您的密码!");
+        }
         if (params.getLoginMethod() == LoginMethodEnum.SMS.getValue() && !RegularUtils.matchs(RegularUtils.PHONE_REG, params.getAccount())) {
             return HttpResult.error(HttpStatus.PARAMETERS_PATTERN_ERROR_CODE, "手机号格式不正确,请检查并重新输入!");
         }
         if (params.getLoginMethod() == LoginMethodEnum.SMS.getValue() && StringUtils.isBlank(params.getCaptcha())) {
             return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, "请输入您的验证码!");
         }
-        if (params.getLoginMethod() == LoginMethodEnum.ORDINARY.getValue() && StringUtils.isBlank(params.getPassword())) {
-            return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, "请输入您的密码!");
-        }
         return HttpResult.ok();
     }
     /**--------------------------------------------------------------------------------------------------------------**/

+ 9 - 8
sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java

@@ -362,16 +362,16 @@ public class AuthServiceImpl implements IAuthService {
     @Override
     public HttpResult driverAuth(LoginBase loginBase) {
         /**查询用户信息**/
-        RDriverDetailVo driver = fleetService.findDriver(loginBase.getAccount());
+        RDriverDetailVo driver = fleetService.findDriverDetai(loginBase.getAccount());
         /**信息校验**/
         if (driver == null) {
-            return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号不存在,请检查并重新输入!");
+            return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号不存在,请检查并重新输入!");
         }
         if (!PasswordUtils.validatePassword(loginBase.getPassword(), driver.getPassword())) {
-            return HttpResult.error(HttpStatus.CODE_10301, "密码不正确,请检查并重新输入!");
+            return HttpResult.error(HttpStatus.CODE_10301, "密码不正确,请检查并重新输入!");
         }
         if (driver.getStatus() == Global.YES) {
-            return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服:400-803-6377!");
+            return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服:400-803-6377!");
         }
         //企业信息
         REnterpriseVo enterprise = systemService.queryEntDetails(driver.getEntId());
@@ -379,7 +379,7 @@ public class AuthServiceImpl implements IAuthService {
         /**生成token**/
         String token = EncryUtil.encryV1(Global.PRI_KEY, String.valueOf(driver.getId()));
         if (StringUtils.isBlank(token)) {
-            return HttpResult.error(HttpStatus.CODE_10301, "生成密钥失败,请联系系统管理员!");
+            return HttpResult.error(HttpStatus.CODE_10301, "生成密钥失败,请联系系统管理员");
         }
 
         /**缓存司机/企业信息**/
@@ -387,10 +387,11 @@ public class AuthServiceImpl implements IAuthService {
 
         /**数据组装**/
         LoginResVo1 loginRes = new LoginResVo1();
+        BeanUtils.copyPropertiesValue(driver, loginRes);
         loginRes.setAccount(loginBase.getAccount());
-        loginRes.setFirmName(enterprise.getFirmName());
-        loginRes.setApproval(enterprise.getApproval());
-        loginRes.setEntTypeNames(enterprise.getEntTypeNames());
+        loginRes.setFirmName(enterprise != null ? enterprise.getFirmName() : null);
+        loginRes.setApproval(enterprise != null ? enterprise.getApproval() : null);
+        loginRes.setEntTypeNames(enterprise != null ? enterprise.getEntTypeNames() : null);
         loginRes.setClientType(loginBase.getClientType());
         loginRes.setSystemType(loginBase.getSystemType());
         loginRes.setToken(token);

+ 1 - 1
sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/RemoteFleetService.java

@@ -36,7 +36,7 @@ public interface RemoteFleetService {
      * @author zk
      * @date 2023/8/10
      **/
-    RDriverDetailVo findDriver(String phone);
+    RDriverDetailVo findDriverDetai(String phone);
 
     /**
      * @param params 司机档案信息

+ 0 - 1
sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/model/vo/RDriverDetailVo.java

@@ -1,7 +1,6 @@
 package com.sckw.fleet.api.model.vo;
 
 import lombok.Data;
-
 import java.io.Serializable;
 import java.math.BigDecimal;
 

+ 6 - 1
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/req/REnterpriseVo.java

@@ -2,6 +2,8 @@ package com.sckw.system.api.model.dto.req;
 
 import lombok.Data;
 
+import java.io.Serial;
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -10,7 +12,10 @@ import java.util.Date;
  * @date 2023/8/10 0010
  */
 @Data
-public class REnterpriseVo {
+public class REnterpriseVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 970722911118698101L;
 
     /**
      * 企业编号

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dubbo/RemoteFleetServiceImpl.java

@@ -84,7 +84,7 @@ public class RemoteFleetServiceImpl implements RemoteFleetService {
      * @date 2023/8/10
      **/
     @Override
-    public RDriverDetailVo findDriver(String phone) {
+    public RDriverDetailVo findDriverDetai(String phone) {
         List<KwfDriver> drivers = driverDao.findDriver(new HashMap(){{put("phone", phone);}});
         if (CollectionUtils.isEmpty(drivers)) {
             return null;

+ 1 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 /**

+ 8 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -883,10 +883,16 @@ public class KwsEnterpriseService {
      * @date 2023/8/10
      **/
     public REnterpriseVo queryEntDetails(Long entId) {
-        REnterpriseVo enterpriseVo = new REnterpriseVo();
         //企业信息
         KwsEnterprise enterprise = kwsEnterpriseDao.selectByKey(entId);
-        BeanUtils.copyPropertiesValue(enterprise, enterpriseVo);
+        if (enterprise == null) {
+            return null;
+        }
+        REnterpriseVo enterpriseVo = new REnterpriseVo();
+        enterpriseVo.setId(enterprise.getId());
+        enterpriseVo.setFirmName(enterprise.getFirmName());
+        enterpriseVo.setRegTime(enterprise.getRegTime());
+        enterpriseVo.setApproval(enterprise.getApproval());
 
         //企业类型
         List<KwsEntType> entTypes = kwsEntTypeDao.findListByEntId(entId);