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

新增模糊匹配企业名dubbo接口

czh 2 лет назад
Родитель
Сommit
6be1f5942a

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

@@ -59,6 +59,15 @@ public interface RemoteSystemService {
      */
      */
     EntCacheResDto queryEntCacheById(Long entId);
     EntCacheResDto queryEntCacheById(Long entId);
 
 
+    /**
+     * @param entName 企业名
+     * @return EntCacheResDto
+     * @desc: 从缓存查企业信息 模糊匹配
+     * @author: czh
+     * @date: 2023/7/7
+     */
+    List<EntCacheResDto> queryEntCacheByName(String entName);
+
     /**
     /**
      * @param userId 用户id
      * @param userId 用户id
      * @return UserCacheResDto
      * @return UserCacheResDto

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

@@ -105,4 +105,13 @@ public interface KwsEnterpriseDao {
      * @date: 2023/6/29
      * @date: 2023/6/29
      */
      */
     FindManagePojo findManageInfoByEntIdBeforeApproval(Long entId);
     FindManagePojo findManageInfoByEntIdBeforeApproval(Long entId);
+
+    /**
+     * @param entName 企业名
+     * @return KwsEnterprise
+     * @desc: 模糊匹配企业名
+     * @author: czh
+     * @date: 2023/7/10
+     */
+    List<KwsEnterprise> queryEntByName(String entName);
 }
 }

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

@@ -106,4 +106,8 @@ public class RemoteBaseService {
         }
         }
         return BeanUtils.copyToList(list, DeptInfoPojo.class);
         return BeanUtils.copyToList(list, DeptInfoPojo.class);
     }
     }
+
+    public List<KwsEnterprise> queryEntByName(String entName) {
+        return kwsEnterpriseService.queryEntByName(entName);
+    }
 }
 }

+ 25 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -11,6 +11,7 @@ import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.SysDictDao;
 import com.sckw.system.dao.SysDictDao;
+import com.sckw.system.model.KwsEnterprise;
 import com.sckw.system.model.KwsUser;
 import com.sckw.system.model.KwsUser;
 import com.sckw.system.model.SysDict;
 import com.sckw.system.model.SysDict;
 import com.sckw.system.service.KwsUserService;
 import com.sckw.system.service.KwsUserService;
@@ -180,6 +181,30 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         return JSONObject.parseObject(dictCache, EntCacheResDto.class);
         return JSONObject.parseObject(dictCache, EntCacheResDto.class);
     }
     }
 
 
+    /**
+     * @param entName 企业名
+     * @return EntCacheResDto
+     * @desc: 从缓存查企业信息 模糊匹配
+     * @author: czh
+     * @date: 2023/7/7
+     */
+    @Override
+    public List<EntCacheResDto> queryEntCacheByName(String entName) {
+        List<KwsEnterprise> kwsEnterprises = remoteBaseService.queryEntByName(entName);
+        if (CollectionUtils.isEmpty(kwsEnterprises)) {
+            return Collections.emptyList();
+        }
+
+        List<EntCacheResDto> list = new ArrayList();
+        for (KwsEnterprise kwsEnterprise : kwsEnterprises) {
+            EntCacheResDto entCacheResDto = queryEntCacheById(kwsEnterprise.getId());
+            if (!Objects.isNull(entCacheResDto)) {
+                list.add(entCacheResDto);
+            }
+        }
+        return list;
+    }
+
     @Override
     @Override
     public UserCacheResDto queryUserCacheById(Long userId) {
     public UserCacheResDto queryUserCacheById(Long userId) {
         String key = Global.REDIS_USER_PREFIX + userId;
         String key = Global.REDIS_USER_PREFIX + userId;

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

@@ -545,4 +545,15 @@ public class KwsEnterpriseService {
             kwsEnterpriseDao.update(kwsEnterprise);
             kwsEnterpriseDao.update(kwsEnterprise);
         }
         }
     }
     }
+
+    /**
+     * @param entName 企业名
+     * @return KwsEnterprise
+     * @desc: 模糊匹配企业名
+     * @author: czh
+     * @date: 2023/7/10
+     */
+    public List<KwsEnterprise> queryEntByName(String entName) {
+        return kwsEnterpriseDao.queryEntByName(entName);
+    }
 }
 }

+ 4 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -161,6 +161,10 @@
       and f.name = '系统管理员'
       and f.name = '系统管理员'
   </select>
   </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>
+
   <insert id="insert" parameterType="com.sckw.system.model.KwsEnterprise">
   <insert id="insert" parameterType="com.sckw.system.model.KwsEnterprise">
     insert into kws_enterprise
     insert into kws_enterprise
     <trim prefix="(" suffix=")" suffixOverrides=",">
     <trim prefix="(" suffix=")" suffixOverrides=",">