Bläddra i källkod

1、系统服务添加企业查询和用户查询;
2、车辆档案和车辆上报关键词支持企业名称和用户名称查询;

zk 2 år sedan
förälder
incheckning
828a87fe2f
16 ändrade filer med 278 tillägg och 46 borttagningar
  1. 26 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteUserService.java
  2. 15 7
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  3. 28 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckReportService.java
  4. 33 5
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  5. 30 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml
  6. 46 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckReportMapper.xml
  7. 2 5
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java
  8. 3 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java
  9. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserDao.java
  10. 7 8
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  11. 5 4
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java
  12. 45 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java
  13. 4 4
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  14. 7 5
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java
  15. 15 2
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml
  16. 11 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml

+ 26 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteUserService.java

@@ -135,6 +135,14 @@ public interface RemoteUserService {
      */
     List<EntCheckTrackResDto> checkTrackByEntId(Long entId);
 
+    /**
+     * @param updatePassword 修改密码入参
+     * @desc: 修改密码
+     * @author: czh
+     * @date: 2023/7/3
+     */
+    void updatePassword(UpdatePasswordReqDto updatePassword);
+
     /**
      * @param id 用户id
      * @desc: 重置密码
@@ -211,4 +219,22 @@ public interface RemoteUserService {
      * @date: 2023/10/8
      */
     List<AreaTreeFrontResDto> findAllArea(Integer code);
+
+    /**
+     * @param firmName 企业名称
+     * @param entTypes 企业类型
+     * @desc 根据企业名称搜索企业ID(适用于关键字搜索)
+     * @author zk
+     * @date 2023/10/11
+     **/
+    List<Long> findEntIds(List<Integer> entTypes, String firmName);
+
+    /**
+     * @param entIds 企业ID
+     * @param userName 用户名称
+     * @desc 根据企业ID或用户名称搜索用户ID(适用于关键字搜索)
+     * @author zk
+     * @date 2023/10/11
+     **/
+    List<Long> findUserIds(List<Long> entIds, String userName);
 }

+ 15 - 7
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -223,7 +223,8 @@ public class KwfDriverService {
         for (KwfDriverVo driver:drivers) {
             createBys.add(Long.parseLong(driver.getCreateBy()));
             entIds.add(Long.parseLong(driver.getEntId()));
-            dictKey.add(StringUtils.isNotBlank(driver.getLicenseType()) ? DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType() : null);
+            dictKey.add(StringUtils.isNotBlank(driver.getLicenseType())
+                    ? DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType() : null);
         }
         //用户数据集
         createBys = createBys.stream().distinct().collect(Collectors.toList());
@@ -238,7 +239,8 @@ public class KwfDriverService {
         for (KwfDriverVo driver:drivers) {
             UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driver.getCreateBy()));
             EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driver.getEntId()));
-            SysDictResDto licenseType = dicts == null ? null : dicts.get(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType());
+            SysDictResDto licenseType = dicts == null
+                    ? null : dicts.get(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType());
             driver.setCreateByName(user != null ? user.getName() : null);
             driver.setFirmName(ent != null ? ent.getFirmName() : null);
             driver.setLicenseTypeName(licenseType != null ? licenseType.getLabel() : null);
@@ -524,8 +526,10 @@ public class KwfDriverService {
             driverCard.setCertificateMain(Global.EMPTY_STRING);
             driverCard.setCertificateRevolt(Global.EMPTY_STRING);
         }
-        driverCard.setCertificateMain(StringUtils.isBlank(certificateMain) ? Global.EMPTY_STRING : driverCard.getCertificateMain());
-        driverCard.setCertificateRevolt(StringUtils.isBlank(certificateRevolt) ? Global.EMPTY_STRING : driverCard.getCertificateRevolt());
+        driverCard.setCertificateMain(StringUtils.isBlank(certificateMain)
+                ? Global.EMPTY_STRING : driverCard.getCertificateMain());
+        driverCard.setCertificateRevolt(StringUtils.isBlank(certificateRevolt)
+                ? Global.EMPTY_STRING : driverCard.getCertificateRevolt());
 
         /**数据更新**/
         int count = 0;
@@ -579,8 +583,10 @@ public class KwfDriverService {
             driverLicense.setCertificateMain(Global.EMPTY_STRING);
             driverLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
-        driverLicense.setCertificateMain(StringUtils.isBlank(certificateMain) ? Global.EMPTY_STRING : driverLicense.getCertificateMain());
-        driverLicense.setCertificateRevolt(StringUtils.isBlank(certificateRevolt) ? Global.EMPTY_STRING : driverLicense.getCertificateRevolt());
+        driverLicense.setCertificateMain(StringUtils.isBlank(certificateMain)
+                ? Global.EMPTY_STRING : driverLicense.getCertificateMain());
+        driverLicense.setCertificateRevolt(StringUtils.isBlank(certificateRevolt)
+                ? Global.EMPTY_STRING : driverLicense.getCertificateRevolt());
 
         /**数据更新**/
         int count = 0;
@@ -736,7 +742,9 @@ public class KwfDriverService {
         }
 
         /**校验**/
-        String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_UPDATE_PASSWORD.getValue(), params.getAccount());
+        String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY,
+                DictEnum.SMS_UPDATE_PASSWORD.getValue(),
+                params.getAccount());
         RedissonUtils.putString(key, params.getCaptcha(), RedisConstant.SMS_VERIFY_CODE_VALID_TIME);
         String smsCaptcha = RedissonUtils.getString(key);
         if (StringUtils.isBlank(smsCaptcha)){

+ 28 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckReportService.java

@@ -8,6 +8,7 @@ import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.common.enums.enums.FileEnum;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.model.file.FileInfo;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
@@ -24,6 +25,7 @@ import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.KwfTableTopCount;
 import com.sckw.fleet.model.vo.KwfTruckReportVo;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
@@ -63,6 +65,8 @@ public class KwfTruckReportService {
     KwfTruckService truckService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false,timeout = 8000)
+    private RemoteUserService remoteUserService;
 
     /**
      * @param key 主键id
@@ -81,6 +85,18 @@ public class KwfTruckReportService {
      * @date 2023/7/11
      **/
     public Map statistics(Map<String, Object> params) {
+        /**参数处理**/
+        Object keywords = params.get("keywords");
+        if (StringUtils.isNotBlank(keywords)) {
+            //查询企业
+            List<Integer> entTypes = new ArrayList<>(){{add(EntTypeEnum.LOGISTICS3.getCode()); add(EntTypeEnum.LOGISTICS4.getCode());}};
+            List<Long> entIds = remoteUserService.findEntIds(entTypes, StringUtils.objectStr(keywords));
+            params.put("entIds", entIds);
+            //查询用户
+            List<Long> userIds = remoteUserService.findUserIds(new ArrayList<>(){{add(LoginUserHolder.getEntId());}}, StringUtils.objectStr(keywords));
+            params.put("createBys", userIds);
+        }
+
         /**统计数据**/
         List<KwfTableTopCount> counts = truckReportDao.statistics(params);
         long tatol = 0;
@@ -125,6 +141,18 @@ public class KwfTruckReportService {
      * @date 2023/7/15
      **/
     public List<KwfTruckReportVo> findPage(Map<String, Object> params) {
+        /**参数处理**/
+        Object keywords = params.get("keywords");
+        if (StringUtils.isNotBlank(keywords)) {
+            //查询企业
+            List<Integer> entTypes = new ArrayList<>(){{add(EntTypeEnum.LOGISTICS3.getCode()); add(EntTypeEnum.LOGISTICS4.getCode());}};
+            List<Long> entIds = remoteUserService.findEntIds(entTypes, StringUtils.objectStr(keywords));
+            params.put("entIds", entIds);
+            //查询用户
+            List<Long> userIds = remoteUserService.findUserIds(new ArrayList<>(){{add(LoginUserHolder.getEntId());}}, StringUtils.objectStr(keywords));
+            params.put("createBys", userIds);
+        }
+
         /**查询分页数据**/
         List<KwfTruckReportVo> trucks = truckReportDao.findPage(params);
         if (CollectionUtils.isEmpty(trucks)) {

+ 33 - 5
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -26,6 +26,7 @@ import com.sckw.fleet.model.*;
 import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.*;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
@@ -70,6 +71,8 @@ public class KwfTruckService {
     KwfFleetTruckMapper fleetTruckDao;
     @DubboReference(version = "1.0.0", group = "design", check = false,timeout = 8000)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false,timeout = 8000)
+    private RemoteUserService remoteUserService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private TransportService transportDubboService;
 
@@ -178,6 +181,16 @@ public class KwfTruckService {
             List<KwfTableTopCount> counts = truckDao.statisticsAll(params);
             return counts;
         } else {
+            Object keywords = params.get("keywords");
+            if (StringUtils.isNotBlank(keywords)) {
+                //查询企业
+                List<Integer> entTypes = new ArrayList<>(){{add(EntTypeEnum.LOGISTICS3.getCode()); add(EntTypeEnum.LOGISTICS4.getCode());}};
+                List<Long> entIds = remoteUserService.findEntIds(entTypes, StringUtils.objectStr(keywords));
+                params.put("entIds", entIds);
+                //查询用户
+                List<Long> userIds = remoteUserService.findUserIds(new ArrayList<>(){{add(LoginUserHolder.getEntId());}}, StringUtils.objectStr(keywords));
+                params.put("createBys", userIds);
+            }
             params.put("entId", LoginUserHolder.getEntId());
             List<KwfTableTopCount> counts = truckDao.statistics(params);
             return counts;
@@ -251,6 +264,16 @@ public class KwfTruckService {
             List<KwfTruckVo> counts = truckDao.findPageAll(params);
             return counts;
         } else {
+            Object keywords = params.get("keywords");
+            if (StringUtils.isNotBlank(keywords)) {
+                //查询企业
+                List<Integer> entTypes = new ArrayList<>(){{add(EntTypeEnum.LOGISTICS3.getCode()); add(EntTypeEnum.LOGISTICS4.getCode());}};
+                List<Long> entIds = remoteUserService.findEntIds(entTypes, StringUtils.objectStr(keywords));
+                params.put("entIds", entIds);
+                //查询用户
+                List<Long> userIds = remoteUserService.findUserIds(new ArrayList<>(){{add(LoginUserHolder.getEntId());}}, StringUtils.objectStr(keywords));
+                params.put("createBys", userIds);
+            }
             params.put("entId", LoginUserHolder.getEntId());
             List<KwfTruckVo> counts = truckDao.findPage(params);
             return counts;
@@ -487,8 +510,10 @@ public class KwfTruckService {
             truckLicense.setCertificateMain(Global.EMPTY_STRING);
             truckLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
-        truckLicense.setCertificateMain(StringUtils.isBlank(certificateMain) ? Global.EMPTY_STRING : truckLicense.getCertificateMain());
-        truckLicense.setCertificateRevolt(StringUtils.isBlank(certificateRevolt) ? Global.EMPTY_STRING : truckLicense.getCertificateRevolt());
+        truckLicense.setCertificateMain(StringUtils.isBlank(certificateMain)
+                ? Global.EMPTY_STRING : truckLicense.getCertificateMain());
+        truckLicense.setCertificateRevolt(StringUtils.isBlank(certificateRevolt)
+                ? Global.EMPTY_STRING : truckLicense.getCertificateRevolt());
 
         /**数据更新**/
         int count = 0;
@@ -533,8 +558,10 @@ public class KwfTruckService {
             transportLicense.setCertificateMain(Global.EMPTY_STRING);
             transportLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
-        transportLicense.setCertificateMain(StringUtils.isBlank(certificateMain) ? Global.EMPTY_STRING : transportLicense.getCertificateMain());
-        transportLicense.setCertificateRevolt(StringUtils.isBlank(certificateRevolt) ? Global.EMPTY_STRING : transportLicense.getCertificateRevolt());
+        transportLicense.setCertificateMain(StringUtils.isBlank(certificateMain)
+                ? Global.EMPTY_STRING : transportLicense.getCertificateMain());
+        transportLicense.setCertificateRevolt(StringUtils.isBlank(certificateRevolt)
+                ? Global.EMPTY_STRING : transportLicense.getCertificateRevolt());
 
         /**数据更新**/
         int count = 0;
@@ -792,7 +819,8 @@ public class KwfTruckService {
         }
         //详细地址
         String detailAddress = truckGps != null
-                ? StringUtils.isNotBlank(truckGps.getDetailAddress()) ? truckGps.getDetailAddress() : LocUtils.regeo(truckGps.getLng(), truckGps.getLat())
+                ? StringUtils.isNotBlank(truckGps.getDetailAddress())
+                ? truckGps.getDetailAddress() : LocUtils.regeo(truckGps.getLng(), truckGps.getLat())
                 : null;
 
         Map<String, Object> detail = new HashMap<>(Global.NUMERICAL_SIXTEEN);

+ 30 - 2
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -83,7 +83,21 @@
         </if>
         <if test="keywords != null and keywords != ''">
             and (
-            tr.truck_no like concat('%',#{keywords},'%')
+                tr.truck_no like concat('%',#{keywords},'%')
+                <choose>
+                    <when test="entIds != null and entIds != '' and entIds.size() > 0">
+                        or tre.ent_id in
+                        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                    </when>
+                    <when test="createBys != null and createBys != '' and createBys.size() > 0">
+                        or tr.create_by in
+                        <foreach collection="createBys" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                    </when>
+                </choose>
             )
         </if>
         GROUP BY tr.`auth_status`
@@ -206,7 +220,21 @@
         </choose>
         <if test="keywords != null and keywords != ''">
             and (
-            tr.truck_no like concat('%',#{keywords},'%')
+                tr.truck_no like concat('%',#{keywords},'%')
+                <choose>
+                    <when test="entIds != null and entIds != '' and entIds.size() > 0">
+                        or tre.ent_id in
+                        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                    </when>
+                    <when test="createBys != null and createBys != '' and createBys.size() > 0">
+                        or tr.create_by in
+                        <foreach collection="createBys" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                    </when>
+                </choose>
             )
         </if>
         ORDER BY tr.create_time desc

+ 46 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckReportMapper.xml

@@ -40,6 +40,29 @@
             tr.truck_no like concat('%',#{keywords},'%')
             or dr.name like concat('%',#{keywords},'%')
             or dr.phone like concat('%',#{keywords},'%')
+            <choose>
+                <when test="entIds != null and entIds != '' and entIds.size() > 0">
+                    or (
+                        trr.truck_id in (select truck_id from kwf_truck_ent where del_flag = 0 and ent_id in
+                        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                        or
+                        trr.driver_id in (select driver_id from kwf_driver_ent where del_flag = 0 and ent_id in
+                        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                    )
+                </when>
+                <when test="createBys != null and createBys != '' and createBys.size() > 0">
+                    or trr.create_by in
+                    <foreach collection="createBys" item="id" open="(" close=")" separator=",">
+                        #{id,jdbcType=BIGINT}
+                    </foreach>
+                </when>
+            </choose>
             )
         </if>
         GROUP BY tr.`auth_status`
@@ -102,6 +125,29 @@
             tr.truck_no like concat('%',#{keywords},'%')
             or dr.name like concat('%',#{keywords},'%')
             or dr.phone like concat('%',#{keywords},'%')
+            <choose>
+                <when test="entIds != null and entIds != '' and entIds.size() > 0">
+                    or (
+                        trr.truck_id in (select truck_id from kwf_truck_ent where del_flag = 0 and ent_id in
+                        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                        or
+                        trr.driver_id in (select driver_id from kwf_driver_ent where del_flag = 0 and ent_id in
+                        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                            #{id,jdbcType=BIGINT}
+                        </foreach>
+                        )
+                    )
+                </when>
+                <when test="createBys != null and createBys != '' and createBys.size() > 0">
+                    or trr.create_by in
+                    <foreach collection="createBys" item="id" open="(" close=")" separator=",">
+                        #{id,jdbcType=BIGINT}
+                    </foreach>
+                </when>
+            </choose>
             )
         </if>
         ORDER BY tr.create_time desc

+ 2 - 5
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java

@@ -26,10 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 /**
  * 用户
@@ -77,7 +74,7 @@ public class KwsUserController {
      * @date 2023/5/30
      **/
     @PostMapping("/findList")
-    public HttpResult findList(@RequestBody KwsUser params) {
+    public HttpResult findList(@RequestBody Map<String, Object> params) {
         return HttpResult.ok(kwsUserService.findList(params));
     }
 

+ 3 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java

@@ -134,13 +134,13 @@ public interface KwsEnterpriseDao {
     FindManagePojo findManageInfoByEntIdBeforeApproval(Long entId);
 
     /**
-     * @param entName 企业名
+     * @param params 参数
      * @return KwsEnterprise
-     * @desc: 模糊匹配企业名
+     * @desc: 企业查询
      * @author: czh
      * @date: 2023/7/10
      */
-    List<KwsEnterprise> queryEntByName(String entName);
+    List<KwsEnterprise> findEnts(Map<String, Object> params);
 
     /**
      * @param entName 企业名

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserDao.java

@@ -58,7 +58,7 @@ public interface KwsUserDao {
      * @param params
      * @return
      */
-    List<KwsUserResVo> findList(KwsUser params);
+    List<KwsUserResVo> findList(Map<String, Object> params);
 
     /**
      * 根据用户id查用户机构

+ 7 - 8
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -22,9 +22,7 @@ import com.sckw.system.service.KwsUserService;
 import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * @author czh
@@ -71,9 +69,10 @@ public class RemoteBaseService {
     }
 
     public KwsUserResDto getUserByAccount(String username) {
-        KwsUser kwsUser = new KwsUser();
-        kwsUser.setAccount(username);
-        List<KwsUserResVo> list = kwsUserService.findList(kwsUser);
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+            put("account", username);
+        }};
+        List<KwsUserResVo> list = kwsUserService.findList(params);
         if (CollectionUtils.isEmpty(list)) {
             return null;
         }
@@ -134,8 +133,8 @@ public class RemoteBaseService {
         return BeanUtils.copyToList(list, DeptInfoPojo.class);
     }
 
-    public List<KwsEnterprise> queryEntByName(String entName) {
-        return kwsEnterpriseService.queryEntByName(entName);
+    public List<KwsEnterprise> findEnts(Map<String, Object> params) {
+        return kwsEnterpriseService.findEnts(params);
     }
 
 

+ 5 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -389,7 +389,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         if (StringUtils.isBlank(entName)) {
             return Collections.emptyList();
         }
-        List<KwsEnterprise> kwsEnterprises = remoteBaseService.queryEntByName(entName);
+        List<KwsEnterprise> kwsEnterprises = remoteBaseService.findEnts(new HashMap<>(Global.NUMERICAL_SIXTEEN){{put("firmName", entName);}});
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
             return Collections.emptyList();
         }
@@ -762,9 +762,10 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         if (Objects.isNull(systemType) || StringUtils.isBlank(account)) {
             return null;
         }
-        KwsUser params = new KwsUser();
-        params.setAccount(account);
-        params.setSystemType(systemType);
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+            put("account", account);
+            put("systemType", systemType);
+        }};
         List<KwsUserResVo> users = kwsUserService.findList(params);
         if (CollectionUtils.isEmpty(users)) {
             return null;

+ 45 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java

@@ -8,6 +8,7 @@ import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.PasswordUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.system.api.RemoteUserService;
@@ -135,6 +136,11 @@ public class RemoteUserServiceImpl implements RemoteUserService {
     }
 
 
+    @Override
+    public void updatePassword(UpdatePasswordReqDto updatePassword) {
+        kwsUserService.updatePassword(updatePassword);
+    }
+
     @Override
     public void resetPassword(Long id) {
         kwsUserService.resetPassword(id);
@@ -175,6 +181,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
 
 
     /**
+     * @param reqDto{cityCode 区域code  entTypeList 企业类型  entIdList 企业id page 页数 pageSize页大小}
      * @return PageResult
      * @desc: 根据区域code和企业类型分页查询企业信息
      * @author: czh
@@ -250,6 +257,44 @@ public class RemoteUserServiceImpl implements RemoteUserService {
         return BeanUtils.copyToList(list, AreaTreeFrontResDto.class);
     }
 
+    /**
+     * @param firmName 企业名称
+     * @param entTypes 企业类型
+     * @desc 根据企业名称搜索企业ID(适用于关键字搜索)
+     * @author zk
+     * @date 2023/10/11
+     **/
+    @Override
+    public List<Long> findEntIds(List<Integer> entTypes, String firmName) {
+        Map<String, Object> params  = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+            put("entTypes", entTypes);
+            put("firmName", firmName);
+        }};
+        List<KwsEnterprise> ents = remoteBaseService.findEnts(params);
+        List<Long> endIds = new ArrayList<>();
+        ents.forEach(ent -> endIds.add(ent.getId()));
+        return endIds;
+    }
+
+    /**
+     * @param entIds 企业ID
+     * @param userName 用户名称
+     * @desc 根据企业ID或用户名称搜索用户ID(适用于关键字搜索)
+     * @author zk
+     * @date 2023/10/11
+     **/
+    @Override
+    public List<Long> findUserIds(List<Long> entIds, String userName) {
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+            put("entIds", entIds);
+            put("userName", userName);
+        }};
+        List<KwsUserResVo> users = kwsUserService.findList(params);
+        List<Long> userIds = new ArrayList<>();
+        users.forEach(user -> userIds.add(user.getId()));
+        return userIds;
+    }
+
 
     /**
      * 根据用户名查用户信息

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

@@ -840,14 +840,14 @@ public class KwsEnterpriseService {
     }
 
     /**
-     * @param entName 企业名
+     * @param params 查询参数
      * @return KwsEnterprise
-     * @desc: 模糊匹配企业名
+     * @desc: 查询企业
      * @author: czh
      * @date: 2023/7/10
      */
-    public List<KwsEnterprise> queryEntByName(String entName) {
-        return kwsEnterpriseDao.queryEntByName(entName);
+    public List<KwsEnterprise> findEnts(Map<String, Object> params) {
+        return kwsEnterpriseDao.findEnts(params);
     }
 
 

+ 7 - 5
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -380,7 +380,7 @@ public class KwsUserService {
     /**
      * 查询
      */
-    public List<KwsUserResVo> findList(KwsUser params) {
+    public List<KwsUserResVo> findList(Map<String, Object> params) {
         return kwsUserDao.findList(params);
     }
 
@@ -388,13 +388,15 @@ public class KwsUserService {
      * 根据用户名查用户信息
      */
     public KwsUser getUserByAccount(String username, int systemType) {
-        KwsUser kwsUser = new KwsUser();
-        kwsUser.setAccount(username);
-        kwsUser.setSystemType(systemType);
-        List<KwsUserResVo> list = kwsUserDao.findList(kwsUser);
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+            put("account", username);
+            put("systemType", systemType);
+        }};
+        List<KwsUserResVo> list = kwsUserDao.findList(params);
         if (CollectionUtils.isEmpty(list)) {
             return null;
         }
+        KwsUser kwsUser = new KwsUser();
         KwsUserResVo kwsUserResVo = list.get(0);
         BeanUtils.copyProperties(kwsUserResVo, kwsUser);
         return kwsUser;

+ 15 - 2
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -294,8 +294,21 @@
       and a.id = #{entId}
   </select>
 
-  <select id="queryEntByName" resultType="com.sckw.system.model.KwsEnterprise">
-    select * from kws_enterprise where firm_name like concat('%', #{entName}, '%') and del_flag = 0
+  <select id="findEnts" resultType="com.sckw.system.model.KwsEnterprise" parameterType="java.util.Map" >
+    select * from kws_enterprise ke
+    where ke.del_flag = 0
+    <if test="firmName != null and firmName != ''">
+      and ke.firm_name like concat('%', #{firmName}, '%')
+    </if>
+    <choose>
+      <when test="entTypes != null and entTypes != '' and entTypes.size() > 0">
+        and exists (select 1 from kws_ent_type ket where ket.del_flag = 0 and ke.id = ket.ent_id and ket.type in
+        <foreach collection="entTypes" item="type" open="(" close=")" separator=",">
+          #{type,jdbcType=BIGINT}
+        </foreach>
+        )
+      </when>
+    </choose>
   </select>
 
   <select id="checkEntRepeat" resultType="com.sckw.system.model.KwsEnterprise">

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

@@ -304,9 +304,20 @@
     <if test="name != null and name != ''">
       and su.name = #{name, jdbcType=VARCHAR}
     </if>
+    <if test="userName != null and userName != ''">
+      and su.name like concat('%', #{userName}, '%')
+    </if>
     <if test="phone != null and phone != ''">
       and su.phone = #{phone, jdbcType=VARCHAR}
     </if>
+    <choose>
+      <when test="entIds != null and entIds != '' and entIds.size() > 0">
+        and c.ent_id in
+        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+          #{id,jdbcType=BIGINT}
+        </foreach>
+      </when>
+    </choose>
     ORDER BY su.create_time desc
   </select>