Răsfoiți Sursa

Merge remote-tracking branch 'origin/dev' into dev

lengfaqiang 2 ani în urmă
părinte
comite
ad115e8df2

+ 10 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsMenuMappingDao.java

@@ -2,6 +2,7 @@ package com.sckw.system.dao;
 
 import com.sckw.system.model.KwsMenuMapping;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -31,6 +32,15 @@ public interface KwsMenuMappingDao {
      */
     List<KwsMenuMapping> selectByMenuId(Long id);
 
+    /**
+     * @param idList menuId
+     * @return KwsMenuMapping
+     * @desc: 根据菜单id查映射关系
+     * @author: czh
+     * @date: 2023/9/5
+     */
+    List<KwsMenuMapping> selectByMenuIds(@Param(value = "idList") List<Long> idList);
+
     /**
      * @param kwsMenuMapping 实体
      * @desc: 修改

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

@@ -304,7 +304,7 @@ public class KwsEnterpriseService {
         kwsEnterprise.setOrgCode("");
         kwsEnterprise.setRegTime(date);
         kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
-        kwsEnterprise.setApproval(ApprovalEnum.PROCESS.getCode());
+        kwsEnterprise.setApproval(kwsEnterprise.getApproval().equals(ApprovalEnum.OK.getCode()) ? ApprovalEnum.REFRESH.getCode() : ApprovalEnum.PROCESS.getCode());
         if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
@@ -458,7 +458,6 @@ public class KwsEnterpriseService {
         }
         commonService.updateEntCertificate(entId, BeanUtils.copyToList(kwsEntCertificates, EntCertificateInfo.class));
 
-
         Map<String, Object> map = new HashMap<>();
         map.put("entName", kwsEnterprise.getFirmName());
         map.put("createByName", LoginUserHolder.getUserName());

+ 17 - 15
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsMenuService.java

@@ -264,27 +264,27 @@ public class KwsMenuService {
         extracted(reqVo.getUserId(), findMenuTreePojo);
 
         List<KwsMenuResVo> menuList = kwsMenuDao.findList(findMenuTreePojo);
+        if (CollectionUtils.isEmpty(menuList)) {
+            return Collections.emptyList();
+        }
+
         List<KwsMenuResVo> finalList = new ArrayList<>();
         //app菜单特殊处理
         if (SystemTypeEnum.COMPANY.getCode().equals(LoginUserHolder.getSystemType()) &&
                 ClientTypeEnum.app.getValue().equals(LoginUserHolder.getClientType()) &&
-                Objects.equals(LoginUserHolder.getIsMain(), Global.NO) &&
-                Objects.equals(LoginUserHolder.getEntId(), 156382319450525696L)) {
-            for (KwsMenuResVo kwsMenuResVo : menuList) {
-                List<KwsMenuMapping> kwsMenuMappings = kwsMenuMappingDao.selectByMenuId(kwsMenuResVo.getId());
-                if (CollectionUtils.isEmpty(kwsMenuMappings)) {
-                    continue;
-                }
-
-                List<Long> mapIds = kwsMenuMappings.stream().map(KwsMenuMapping::getMappingId).toList();
-                List<KwsMenu> kwsMenus = kwsMenuDao.selectByKeys(mapIds);
-                if (CollectionUtils.isEmpty(kwsMenus)) {
-                    continue;
-                }
+                Objects.equals(LoginUserHolder.getIsMain(), Global.NO)) {
+            List<KwsMenuMapping> kwsMenuMappings = kwsMenuMappingDao.selectByMenuIds(menuList.stream().map(KwsMenuResVo::getId).toList());
+            if (CollectionUtils.isEmpty(kwsMenuMappings)) {
+                return Collections.emptyList();
+            }
 
-                List<KwsMenuResVo> kwsMenuResVos = BeanUtils.copyToList(kwsMenus, KwsMenuResVo.class);
-                finalList.addAll(kwsMenuResVos);
+            List<Long> mapIds = kwsMenuMappings.stream().map(KwsMenuMapping::getMappingId).toList();
+            List<KwsMenu> kwsMenus = kwsMenuDao.selectByKeys(mapIds);
+            if (CollectionUtils.isEmpty(kwsMenus)) {
+                return Collections.emptyList();
             }
+
+            finalList = BeanUtils.copyToList(kwsMenus, KwsMenuResVo.class);
         } else {
             finalList = menuList;
         }
@@ -335,6 +335,8 @@ public class KwsMenuService {
         if (CollectionUtils.isEmpty(allByUserId)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ROLE_NOT_EXISTS);
         }
+        //特殊处理,员工账号先查pc端的菜单,后面会做菜单关联
+        findMenuTreePojo.setClientType(String.valueOf(SystemTypeEnum.COMPANY.getCode()));
         findMenuTreePojo.setRoleIds(allByUserId.stream().map(KwsUserRole::getRoleId).toList());
     }
 

+ 8 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsMenuMappingDao.xml

@@ -48,4 +48,12 @@
     select a.* from kws_menu_mapping a where a.menu_id = #{id} and a.del_flag = 0
   </select>
 
+    <select id="selectByMenuIds" resultType="com.sckw.system.model.KwsMenuMapping">
+        select a.* from kws_menu_mapping a where a.menu_id in
+         <foreach collection="idList" item="item" open="(" close=")" separator=",">
+             #{item}
+         </foreach>
+        and a.del_flag = 0
+    </select>
+
 </mapper>