Преглед изворни кода

1、司机端登录接口;

zk пре 2 година
родитељ
комит
f7dfb9c2f5
17 измењених фајлова са 666 додато и 14 уклоњено
  1. 6 0
      sckw-auth/pom.xml
  2. 62 0
      sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java
  3. 42 0
      sckw-auth/src/main/java/com/sckw/auth/model/vo/req/LoginBase.java
  4. 101 0
      sckw-auth/src/main/java/com/sckw/auth/model/vo/res/LoginResVo1.java
  5. 22 0
      sckw-auth/src/main/java/com/sckw/auth/service/IAuthService.java
  6. 162 8
      sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java
  7. 15 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java
  8. 44 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/LoginMethodEnum.java
  9. 22 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/EncryUtil.java
  10. 47 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/model/LoginEntInfo.java
  11. 8 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java
  12. 60 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/req/REnterpriseVo.java
  13. 21 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  14. 11 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  15. 11 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java
  16. 29 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  17. 3 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml

+ 6 - 0
sckw-auth/pom.xml

@@ -47,11 +47,17 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-system-api</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.sckw</groupId>
             <artifactId>sckw-message-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-fleet-api</artifactId>
+        </dependency>
+
     </dependencies>
     <build>
         <plugins>

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

@@ -3,6 +3,10 @@ package com.sckw.auth.controller;
 import com.sckw.auth.model.vo.req.*;
 import com.sckw.auth.service.IAuthService;
 import com.sckw.core.exception.SystemException;
+import com.sckw.core.model.enums.LoginMethodEnum;
+import com.sckw.core.model.enums.SystemTypeEnum;
+import com.sckw.core.utils.RegularUtils;
+import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import jakarta.validation.Valid;
@@ -21,6 +25,64 @@ public class AuthController {
     @Autowired
     private IAuthService authService;
 
+    @PostMapping("/login1")
+    public HttpResult login(@RequestHeader(name = "System-Type") int systemType,
+                            @RequestHeader(name = "Client-Type") String clientType,
+                            @RequestBody @Valid LoginBase loginBase) {
+        loginBase.setSystemType(systemType);
+        loginBase.setClientType(clientType);
+        loginBase.setLoginMethod(LoginMethodEnum.ORDINARY.getValue());
+
+        /**参数校验**/
+        HttpResult result = checkParams(loginBase);
+        if (result.getCode() != HttpStatus.SUCCESS_CODE) {
+            return result;
+        }
+
+        /**运营端/企业端登录(PC/APP)**/
+        if (loginBase.getSystemType() == SystemTypeEnum.MANAGE.getCode()
+                || loginBase.getSystemType() == SystemTypeEnum.COMPANY.getCode()) {
+
+        }
+
+        /**司机端**/
+        if (loginBase.getSystemType() == SystemTypeEnum.DRIVER.getCode()) {
+            return authService.driverAuth(loginBase);
+        }
+
+        return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.GLOBAL_EXCEPTION_MESSAGE);
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 登录参数校验
+     * @author zk
+     * @date 2020/6/14 18:14
+     **/
+    public HttpResult checkParams(LoginBase params) {
+        if (StringUtils.isBlank(params.getSystemType())) {
+            return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, "应用服务类型不能为空!");
+        }
+        if (StringUtils.isBlank(params.getClientType())) {
+            return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, "客户端类型不能为空!");
+        }
+        if (StringUtils.isBlank(params.getAccount())) {
+            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();
+    }
+    /**--------------------------------------------------------------------------------------------------------------**/
+
     /**
      * @param reqVo 登录入参
      * @return HttpResult

+ 42 - 0
sckw-auth/src/main/java/com/sckw/auth/model/vo/req/LoginBase.java

@@ -0,0 +1,42 @@
+package com.sckw.auth.model.vo.req;
+
+import lombok.Data;
+
+/**
+ * @author zk
+ * @description 登录信息
+ * @date 2020/06/12 09:06:14
+ */
+@Data
+public class LoginBase {
+
+    /**
+     * 账号
+     */
+    private String account;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 验证码
+     */
+    private String captcha;
+
+    /**
+     * 系统类型(1 运营管理中心/2 运营管理中心/3 司机应用/4 官网)
+     */
+    private int systemType;
+
+    /**
+     * 客户端类型(ios 苹果设备/android 安卓设备/pc 浏览器/pc-background 管理系统)
+     */
+    private String clientType;
+
+    /**
+     * 登录方式1 账号密码登录/2账号短信登录/3单账号登录
+     */
+    private int loginMethod;
+}

+ 101 - 0
sckw-auth/src/main/java/com/sckw/auth/model/vo/res/LoginResVo1.java

@@ -0,0 +1,101 @@
+package com.sckw.auth.model.vo.res;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.sckw.core.utils.LongToStringUtils;
+import com.sckw.system.api.model.dto.res.KwsRoleResDto;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author zk
+ * @desc TODO
+ * @date 2023/8/10 0010
+ */
+@Data
+public class LoginResVo1 implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 8977846403689927853L;
+
+    /**
+     * 用户id
+     */
+    @JsonSerialize(using = LongToStringUtils.class)
+    private long id;
+
+    /**
+     * 账号
+     */
+    private String account;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 电话
+     */
+    private String phone;
+
+    /**
+     * 头像
+     */
+    private String photo;
+
+    /**
+     * 是否是企业管理(0是 1否)
+     */
+    private Integer isMain;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+
+    /**
+     * 企业Id
+     */
+    @JsonSerialize(using = LongToStringUtils.class)
+    private Long entId;
+
+    /**
+     * 企业名称
+     */
+    private String firmName;
+
+    /**
+     * 资料审批状态(0未审批、1通过、2未通过、3审批中)
+     */
+    private Integer approval;
+
+    /**
+     * 企业类型(名称)
+     */
+    private String entTypeNames;
+
+    /**
+     * 推送设备id
+     */
+    private String clientId;
+
+    /**
+     * 设备类型
+     */
+    private String clientType;
+
+    /**
+     * 系统类型(1运营端、2企业开户、3司机端)
+     */
+    private Integer systemType;
+
+    /**
+     * 设备类型
+     */
+    private String token;
+
+}

+ 22 - 0
sckw-auth/src/main/java/com/sckw/auth/service/IAuthService.java

@@ -3,6 +3,7 @@ package com.sckw.auth.service;
 import com.sckw.auth.model.vo.req.*;
 import com.sckw.auth.model.vo.res.LoginResVo;
 import com.sckw.core.exception.SystemException;
+import com.sckw.core.web.response.HttpResult;
 
 /**
  *
@@ -56,4 +57,25 @@ public interface IAuthService {
      * @return String
      */
     String getRegisterSms(GetRegisterSmsReqVo reqVo);
+
+    /**
+     * 司机端登录
+     * @param loginBase
+     * @return
+     */
+    HttpResult driverAuth(LoginBase loginBase);
+
+    /**
+     * 企业端登录
+     * @param loginBase
+     * @return
+     */
+    HttpResult entAuth(LoginBase loginBase);
+
+    /**
+     * 运营端
+     * @param loginBase
+     * @return
+     */
+    HttpResult operateAuth(LoginBase loginBase);
 }

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

@@ -6,25 +6,25 @@ import com.sckw.auth.model.vo.req.*;
 import com.sckw.auth.model.vo.res.DeptInfoResVo;
 import com.sckw.auth.model.vo.res.EntInfoResVo;
 import com.sckw.auth.model.vo.res.LoginResVo;
+import com.sckw.auth.model.vo.res.LoginResVo1;
 import com.sckw.auth.util.AsyncFactory;
+import com.sckw.core.model.enums.ClientTypeEnum;
 import com.sckw.core.model.enums.SystemTypeEnum;
-import com.sckw.core.utils.StringUtils;
+import com.sckw.core.utils.*;
 import com.sckw.core.web.model.EntCertificateInfo;
 import com.sckw.core.web.model.LoginEntInfo;
 import com.sckw.core.web.model.LoginUserInfo;
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.fleet.api.RemoteFleetService;
+import com.sckw.fleet.api.model.vo.RDriverDetailVo;
 import com.sckw.message.api.dubbo.SmsInfoService;
-import com.sckw.system.api.model.dto.req.ForgetPasswordReqDto;
-import com.sckw.system.api.model.dto.req.UpdatePasswordReqDto;
-import com.sckw.system.api.model.dto.req.UserLoginReqDto;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.req.*;
 import com.sckw.system.api.model.dto.res.KwsRoleResDto;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.utils.BeanUtils;
-import com.sckw.core.utils.CollectionUtils;
-import com.sckw.core.utils.EncryUtil;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.redis.utils.RedissonUtils;
-import com.sckw.system.api.model.dto.req.RegisterReqDto;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.auth.service.IAuthService;
 import com.sckw.system.api.RemoteUserService;
@@ -47,9 +47,14 @@ public class AuthServiceImpl implements IAuthService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteUserService remoteUserService;
 
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private RemoteSystemService systemService;
+
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private SmsInfoService smsInfoService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteFleetService fleetService;
 
     @Override
     public LoginResVo login(LoginReqVo reqDto) throws SystemException {
@@ -353,4 +358,153 @@ public class AuthServiceImpl implements IAuthService {
 
     }
 
+    /**-------------------------------------------------------------------------------------------------------------->**/
+    @Override
+    public HttpResult driverAuth(LoginBase loginBase) {
+        /**查询用户信息**/
+        RDriverDetailVo driver = fleetService.findDriver(loginBase.getAccount());
+        /**信息校验**/
+        if (driver == null) {
+            return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号不存在,请检查并重新输入!");
+        }
+        if (!PasswordUtils.validatePassword(loginBase.getPassword(), driver.getPassword())) {
+            return HttpResult.error(HttpStatus.CODE_10301, "密码不正确,请检查并重新输入!");
+        }
+        if (driver.getStatus() == Global.YES) {
+            return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服:400-803-6377!");
+        }
+        //企业信息
+        REnterpriseVo enterprise = systemService.queryEntDetails(driver.getEntId());
+
+        /**生成token**/
+        String token = EncryUtil.encryV1(Global.PRI_KEY, String.valueOf(driver.getId()));
+        if (StringUtils.isBlank(token)) {
+            return HttpResult.error(HttpStatus.CODE_10301, "生成密钥失败,请联系系统管理员!");
+        }
+
+        /**缓存司机/企业信息**/
+        AsyncFactory.execute(new AsyncProcess1(loginBase, driver, enterprise));
+
+        /**数据组装**/
+        LoginResVo1 loginRes = new LoginResVo1();
+        loginRes.setAccount(loginBase.getAccount());
+        loginRes.setFirmName(enterprise.getFirmName());
+        loginRes.setApproval(enterprise.getApproval());
+        loginRes.setEntTypeNames(enterprise.getEntTypeNames());
+        loginRes.setClientType(loginBase.getClientType());
+        loginRes.setSystemType(loginBase.getSystemType());
+        loginRes.setToken(token);
+        return HttpResult.ok(loginRes);
+    }
+
+    @Override
+    public HttpResult entAuth(LoginBase loginBase) {
+        /**查询用户信息**/
+        KwsUserResDto user = findUser(loginBase);
+        /**信息校验**/
+        if (user == null) {
+            return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号不存在,请检查并重新输入!");
+        }
+        if (!PasswordUtils.validatePassword(loginBase.getPassword(), user.getPassword())) {
+            return HttpResult.error(HttpStatus.CODE_10301, "密码不正确,请检查并重新输入!");
+        }
+        if (user.getStatus() == Global.YES) {
+            return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服:400-803-6377!");
+        }
+        //企业信息
+        REnterpriseVo enterprise = systemService.queryEntDetails(null);
+
+        /**生成token**/
+        String token = EncryUtil.encryV1(Global.PRI_KEY, String.valueOf(user.getId()));
+        if (StringUtils.isBlank(token)) {
+            return HttpResult.error(HttpStatus.CODE_10301, "生成密钥失败,请联系系统管理员!");
+        }
+
+        /**缓存司机/企业信息**/
+        AsyncFactory.execute(new AsyncProcess1(loginBase, null, enterprise));
+
+        /**数据组装**/
+        LoginResVo1 loginRes = new LoginResVo1();
+        loginRes.setAccount(loginBase.getAccount());
+        loginRes.setFirmName(enterprise.getFirmName());
+        loginRes.setApproval(enterprise.getApproval());
+        loginRes.setEntTypeNames(enterprise.getEntTypeNames());
+        loginRes.setClientType(loginBase.getClientType());
+        loginRes.setSystemType(loginBase.getSystemType());
+        loginRes.setToken(token);
+        return HttpResult.ok(loginRes);
+    }
+
+    @Override
+    public HttpResult operateAuth(LoginBase loginBase) {
+
+        return null;
+    }
+
+
+    private KwsUserResDto findUser(LoginBase loginBase) throws SystemException {
+        List<KwsUserResDto> kwsUsers = remoteUserService.checkUserBase(loginBase.getAccount(), loginBase.getSystemType());
+        return kwsUsers == null || kwsUsers.size() == Global.NUMERICAL_ZERO ? null : kwsUsers.get(0);
+    }
+
+    static class AsyncProcess1 implements Runnable {
+        private final LoginBase loginBase;
+
+        private final RDriverDetailVo driver;
+
+        private final REnterpriseVo enterprise;
+
+        public AsyncProcess1(LoginBase loginBase, RDriverDetailVo driver, REnterpriseVo enterprise) {
+            this.loginBase = loginBase;
+            this.driver = driver;
+            this.enterprise = enterprise;
+        }
+
+        @Override
+        public void run() {
+            //用户信息
+            SaveDriverToCache(loginBase, driver);
+
+            //企业信息
+            SaveEntToCache(enterprise);
+        }
+
+        /**
+         * @param ent 企业信息
+         * @desc: 缓存存企业信息
+         * @author: czh
+         * @date: 2023/7/3
+         */
+        private void SaveEntToCache(REnterpriseVo ent) {
+            if (ent == null) {
+                return;
+            }
+            LoginEntInfo loginEntInfo = new LoginEntInfo();
+            BeanUtils.copyProperties(ent, loginEntInfo);
+            String key = Global.REDIS_ENTERPRISE_PREFIX + ent.getId();
+            RedissonUtils.putString(key, JSON.toJSONString(loginEntInfo), Global.PC_TOKEN_EXPIRE);
+        }
+
+        /**
+         * @param loginBase 登录信息
+         * @param driver 司机信息
+         * @desc: 缓存用户业信息
+         * @author: czh
+         * @date: 2023/7/3
+         */
+        private void SaveDriverToCache(LoginBase loginBase, RDriverDetailVo driver) {
+            //存用户登录信息
+            LoginUserInfo loginUserInfo = new LoginUserInfo();
+            loginUserInfo.setId(driver.getId());
+            loginUserInfo.setSystemType(SystemTypeEnum.DRIVER.getCode());
+            loginUserInfo.setAccount(driver.getPhone());
+            loginUserInfo.setUserName(driver.getName());
+            loginUserInfo.setPhone(driver.getPhone());
+            loginUserInfo.setStatus(driver.getStatus());
+            loginUserInfo.setEntId(enterprise != null ? enterprise.getId() : null);
+            loginUserInfo.setEntName(enterprise != null ? enterprise.getFirmName() : null);
+            String key = Global.getFullUserLoginKey(loginUserInfo.getSystemType(), loginUserInfo.getId(), loginBase.getClientType());
+            RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo), Global.PC_TOKEN_EXPIRE);
+        }
+    }
 }

+ 15 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java

@@ -1,7 +1,11 @@
 package com.sckw.core.model.enums;
 
+import com.sckw.core.model.constant.Global;
 import lombok.Getter;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author czh
  * @desc 企业类型枚举
@@ -36,4 +40,15 @@ public enum EntTypeEnum {
         }
         return null;
     }
+
+    public static String getNames(String entTypes) {
+        List entNames = new ArrayList();
+        EntTypeEnum [] entTypeEnums = EntTypeEnum.values();
+        for (EntTypeEnum entTypeEnum:entTypeEnums) {
+            if (entTypes.contains(String.valueOf(entTypeEnum.getCode()))) {
+                entNames.add(entTypeEnum.getName());
+            }
+        }
+        return String.join(Global.COMMA, entNames);
+    }
 }

+ 44 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/LoginMethodEnum.java

@@ -0,0 +1,44 @@
+package com.sckw.core.model.enums;
+
+/**
+ * @Description 登录类型枚举
+ * @Author zk
+ * @Date 2020/06/15
+ */
+public enum LoginMethodEnum {
+    ORDINARY(1, "账号密码登录"),
+    SMS(2,  "短信登录"),
+    ACCOUNT(3,  "账号登录");
+
+    private int value;
+
+    private String name;
+
+    /**
+     * @description 构造方法
+     * @author zk
+     * @date 2020/6/08 11:28
+     * @param value 键 name 值
+     * @return
+     **/
+    private LoginMethodEnum(int value, String name){
+        this.name = name;
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 22 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/EncryUtil.java

@@ -78,6 +78,28 @@ public class EncryUtil {
     }
 
 
+    /**
+     * 加密
+     * @param appSecret 私钥
+     * @param orginStr 原始加密参数
+     * @author dengyinghui
+     * #date 2019/02/27
+     * @return
+     */
+    public static String encryV1(String appSecret, String orginStr){
+        try {
+            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+            Key key = new SecretKeySpec(toByteArray(appSecret), "AES");
+            cipher.init(Cipher.ENCRYPT_MODE, key);
+            byte[] encodeResult = cipher.doFinal(orginStr.getBytes());
+            return Hex.toHexString(encodeResult);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
     /**
      *  字节数组转成16进制表示格式的字符串
      * @author dengyinghui

+ 47 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/model/LoginEntInfo.java

@@ -85,4 +85,51 @@ public class LoginEntInfo {
      * 资质
      */
     private List<EntCertificateInfo> certificateInfo;
+
+
+//    /**
+//     * 企业编号
+//     */
+//    private Long id;
+//
+//    /**
+//     * 企业名称
+//     */
+//    private String firmName;
+//
+//    /**
+//     * 注册时间
+//     */
+//    private Date regTime;
+//
+//    /**
+//     * 资料审批状态(0未审批、1通过、2未通过、3审批中)
+//     */
+//    private Integer approval;
+//
+//    /**
+//     * 企业类型(值)
+//     */
+//    private String entTypes;
+
+    /**
+     * 企业类型(名称)
+     */
+    private String entTypeNames;
+
+    /**
+     * 企业联系人(企业管理员)
+     */
+    private Long mainId;
+
+    /**
+     * 企业联系人(企业管理员)
+     */
+    private String mainName;
+
+    /**
+     * 联系电话(企业管理员)
+     */
+    private String mainPhone;
+
 }

+ 8 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java

@@ -1,5 +1,6 @@
 package com.sckw.system.api;
 
+import com.sckw.system.api.model.dto.req.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
 
 import java.util.List;
@@ -182,4 +183,11 @@ public interface RemoteSystemService {
      */
     UserCacheResDto queryManagerInfoByEntId(Long entId);
 
+    /**
+     * @param entId 企业ID
+     * @desc 企业详情(企业登录/司机登录)
+     * @author zk
+     * @date 2023/8/10
+     **/
+    REnterpriseVo queryEntDetails(Long entId);
 }

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

@@ -0,0 +1,60 @@
+package com.sckw.system.api.model.dto.req;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc TODO
+ * @date 2023/8/10 0010
+ */
+@Data
+public class REnterpriseVo {
+
+    /**
+     * 企业编号
+     */
+    private Long id;
+
+    /**
+     * 企业名称
+     */
+    private String firmName;
+
+    /**
+     * 注册时间
+     */
+    private Date regTime;
+
+    /**
+     * 资料审批状态(0未审批、1通过、2未通过、3审批中)
+     */
+    private Integer approval;
+
+    /**
+     * 企业类型(值)
+     */
+    private String entTypes;
+
+    /**
+     * 企业类型(名称)
+     */
+    private String entTypeNames;
+
+    /**
+     * 企业联系人(企业管理员)
+     */
+    private Long mainId;
+
+    /**
+     * 企业联系人(企业管理员)
+     */
+    private String mainName;
+
+    /**
+     * 联系电话(企业管理员)
+     */
+    private String mainPhone;
+
+}

+ 21 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -311,7 +311,7 @@ public class KwfTruckService {
     public HttpResult truckEdit(KwfTruck params) {
         if (StringUtils.isBlank(params.getId())) {
             /**唯一性交易**/
-            List<Map<String, Object>> trucks = truckDao.findList(new HashMap(){{ put("truckNo", params.getTruckNo()); }});
+            List<KwfTruck> trucks = truckDao.findTruck(new HashMap(){{ put("truckNo", params.getTruckNo()); }});
             if (!CollectionUtils.isEmpty(trucks)) {
                 return HttpResult.error("车牌号已存在!");
             }
@@ -324,9 +324,9 @@ public class KwfTruckService {
             return count > 0 ? HttpResult.ok() : HttpResult.error("车辆信息新增失败!");
         } else {
             /**唯一性交易**/
-            List<Map<String, Object>> trucks = truckDao.findList(new HashMap(){{ put("truckNo", params.getTruckNo()); }});
+            List<KwfTruck> trucks = truckDao.findTruck(new HashMap(){{ put("truckNo", params.getTruckNo()); }});
             //校验list中对象key值是否存在与value不一致的情况
-            boolean bool = CollectionUtils.listByKeyValueV1(trucks, "id", String.valueOf(params.getId()));
+            boolean bool = listByKeyValue(trucks, params.getId());
             if (bool) {
                 return HttpResult.error("车牌号已存在!");
             }
@@ -508,4 +508,22 @@ public class KwfTruckService {
         truck.setStatus(Global.NUMERICAL_ONE);
         truckDao.updateById(truck);
     }
+
+    /**
+     * 校验list中对象key值是否存在与value不一致的情况
+     * @param list 数据集
+     * @param value 匹配值
+     * @return
+     */
+    public static boolean listByKeyValue(List<KwfTruck> list, Long value) {
+        if (CollectionUtils.isEmpty(list)) {
+            return false;
+        }
+        for (KwfTruck truck:list) {
+            if (value != null && !truck.getId().equals(value)) {
+                return true;
+            }
+        }
+        return false;
+    }
 }

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

@@ -3,12 +3,12 @@ package com.sckw.system.dubbo;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.system.api.model.dto.req.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.KwsEntDeptDao;
 import com.sckw.system.dao.KwsEntTypeDao;
 import com.sckw.system.model.*;
-import com.sckw.system.model.pojo.FindEntDeptInfoPojo;
 import com.sckw.system.model.vo.res.CertificateResVo;
 import com.sckw.system.model.vo.res.KwsDeptResVo;
 import com.sckw.system.service.KwsDeptService;
@@ -164,4 +164,14 @@ public class RemoteBaseService {
     public List<KwsUserResDto> getUserByName(String name) {
         return kwsUserService.getUserByName(name);
     }
+
+    /**
+     * @param entId 企业ID
+     * @desc 企业详情(企业登录/司机登录)
+     * @author zk
+     * @date 2023/8/10
+     **/
+    public REnterpriseVo queryEntDetails(Long entId) {
+        return kwsEnterpriseService.queryEntDetails(entId);
+    }
 }

+ 11 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -1,6 +1,5 @@
 package com.sckw.system.dubbo;
 
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -10,6 +9,7 @@ import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.req.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.SysDictDao;
@@ -19,7 +19,6 @@ import com.sckw.system.service.KwsUserService;
 import com.sckw.system.service.SysAreaService;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.beans.factory.annotation.Autowired;
-
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -575,5 +574,15 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         return result;
     }
 
+    /**
+     * @param entId 企业ID
+     * @desc 企业详情(企业登录/司机登录)
+     * @author zk
+     * @date 2023/8/10
+     *
+     * @return*/
+    public REnterpriseVo queryEntDetails(Long entId) {
+        return remoteBaseService.queryEntDetails(entId);
+    }
 
 }

+ 29 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -11,8 +11,10 @@ import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.EntCertificateInfo;
+import com.sckw.system.api.model.dto.req.REnterpriseVo;
 import com.sckw.system.api.model.dto.req.RegisterReqDto;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import com.sckw.system.api.model.dto.res.EntTypeResDto;
 import com.sckw.system.api.model.dto.res.RegisterResDto;
 import com.sckw.system.dao.*;
 import com.sckw.system.dubbo.RemoteSystemServiceImpl;
@@ -873,4 +875,31 @@ public class KwsEnterpriseService {
 
         return String.join(Global.COMMA, cooperateTypeList.stream().distinct().map(String::valueOf).toList());
     }
+
+    /**
+     * @param entId 企业ID
+     * @desc 企业详情(企业登录/司机登录)
+     * @author zk
+     * @date 2023/8/10
+     **/
+    public REnterpriseVo queryEntDetails(Long entId) {
+        REnterpriseVo enterpriseVo = new REnterpriseVo();
+        //企业信息
+        KwsEnterprise enterprise = kwsEnterpriseDao.selectByKey(entId);
+        BeanUtils.copyPropertiesValue(enterprise, enterpriseVo);
+
+        //企业类型
+        List<KwsEntType> entTypes = kwsEntTypeDao.findListByEntId(entId);
+        enterpriseVo.setEntTypes(entTypes != null ? String.join(Global.COMMA, entTypes.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()) : null);
+        enterpriseVo.setEntTypeNames(enterpriseVo.getEntTypes() != null ?EntTypeEnum.getNames(enterpriseVo.getEntTypes()) : null);
+
+        Map<String, Object> queryParams = new HashMap(){{put("isMain", Global.YES); put("entId", entId); put("systemType", SystemTypeEnum.COMPANY.getCode());}};
+        List<KwsUserResVo> users = kwsUserService.findPage(queryParams);
+        KwsUserResVo user = users != null && users.size() > 0 ? users.get(Global.NUMERICAL_ZERO) : null;
+        enterpriseVo.setMainId(user != null ? user.getId() : null);
+        enterpriseVo.setMainName(user != null ? user.getName() : null);
+        enterpriseVo.setMainPhone(user != null ? user.getPhone() : null);
+        return enterpriseVo;
+    }
+
 }

+ 3 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml

@@ -252,6 +252,9 @@
     <if test="email != null and email != ''">
       and su.email = #{email, jdbcType=VARCHAR}
     </if>
+    <if test="isMain != null and isMain != ''">
+      and su.is_main = #{isMain, jdbcType=INTEGER}
+    </if>
     <if test="deptId != null and deptId != ''">
       and c.id = #{deptId, jdbcType=VARCHAR}
     </if>