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

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -159,5 +159,6 @@ public class HttpStatus {
     public static final String MSG_023 = "解除成功!";
     public static final String MSG_024 = "名称不能重复!";
     public static final String MSG_025 = "禁止删除本人信息!";
+    public static final String MSG_026 = "资质认证审核中,请等待审核后再提交!";
 
 }

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

@@ -74,4 +74,13 @@ public interface KwsUserDao {
      */
     List<KwsUser> selectByEntId(Long entId);
 
+    /**
+     * @param roleIdList 角色id集合
+     * @return KwsUser
+     * @desc: 根据角色查用户
+     * @author: czh
+     * @date: 2023/7/21
+     */
+    List<KwsUser> selectByRoleIds(List<Long> roleIdList);
+
 }

+ 2 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsDeptResVo.java

@@ -42,8 +42,7 @@ public class KwsDeptResVo implements Serializable {
     /**
      * 创建人
      */
-    @JsonSerialize(using = LongToStringUtils.class)
-    private Long createBy;
+    private String createBy;
 
     /**
      * 创建时间
@@ -53,8 +52,7 @@ public class KwsDeptResVo implements Serializable {
     /**
      * 更新人
      */
-    @JsonSerialize(using = LongToStringUtils.class)
-    private Long updateBy;
+    private String updateBy;
 
 
     /**

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

@@ -303,6 +303,11 @@ public class KwsEnterpriseService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
+        Integer approval = kwsEnterprise.getApproval();
+        if (approval.equals(ApprovalEnum.PROCESS.getCode()) || approval.equals(ApprovalEnum.REFRESH.getCode())) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_026);
+        }
+
         Long entId = kwsEnterprise.getId();
         Date date = new Date();
         Long userId = LoginUserHolder.getUserId();

+ 8 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsRoleService.java

@@ -45,6 +45,9 @@ public class KwsRoleService {
     @Autowired
     KwsRoleDao kwsRoleDao;
 
+    @Autowired
+    KwsUserDao kwsUserDao;
+
     @Autowired
     KwsUserRoleDao kwsUserRoleDao;
 
@@ -175,6 +178,10 @@ public class KwsRoleService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
+        List<KwsUser> kwsUsers = kwsUserDao.selectByRoleIds(idList);
+        if (CollectionUtils.isNotEmpty(kwsUsers)) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_011);
+        }
         deleteRole(kwsRoles);
     }
 
@@ -254,6 +261,7 @@ public class KwsRoleService {
      */
     public PageResult findPage(Map<String, Object> params) throws SystemException {
         PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+        params.put("entId", LoginUserHolder.getEntId());
         List<RoleResVo> roleResVos = kwsRoleDao.findPage(params);
         if (CollectionUtils.isEmpty(roleResVos)) {
             return PageHelperUtil.getPageResult(new PageInfo<>(roleResVos));

+ 3 - 1
sckw-modules/sckw-system/src/main/resources/mapper/KwsDeptDao.xml

@@ -191,10 +191,12 @@
   <select id="findList" resultType="com.sckw.system.model.vo.res.KwsDeptResVo" parameterType="com.sckw.system.model.KwsDept" >
     select
     sd.id, sd.system_type systemType, sd.ent_id entId, sd.name, sd.company, sd.parent_id parentId, sd.level, sd.sort, sd.remark,
-    sd.status, sd.create_by createBy, sd.create_time createTime, sd.update_by updateBy, sd.update_time updateTime,
+    sd.status, u1.name createBy, sd.create_time createTime, u2.name updateBy, sd.update_time updateTime,
     sd2.name parentName
     from kws_dept sd
     left join kws_dept sd2 on sd.parent_id = sd2.id and sd2.del_flag=0
+    left join kws_user u1 on sd.create_by = u1.id
+    left join kws_user u2 on sd.update_by = u1.id
     where sd.del_flag = 0
     <if test="systemType != null and systemType != ''">
       and sd.system_type = #{systemType, jdbcType=VARCHAR}

+ 5 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml

@@ -142,6 +142,7 @@
     sr.del_flag
     from kws_role sr
     left join kws_user su on sr.create_by = su.id
+    left join kws_dept d on sr.dept_id = d.id
     where sr.del_flag = 0
     <if test="name != null and name != ''">
       and sr.name like concat('%', #{name, jdbcType=VARCHAR}, '%')
@@ -149,6 +150,9 @@
     <if test="deptId != null and deptId != ''">
       and sr.deptId = #{deptId, jdbcType=VARCHAR}
     </if>
+    <if test="entId != null and entId != ''">
+      and d.ent_id = #{entId, jdbcType=VARCHAR}
+    </if>
     <if test="startTime != null and startTime != ''">
       and sr.create_time >= #{startTime,jdbcType=DATE}
     </if>
@@ -157,6 +161,7 @@
     </if>
     ORDER BY sr.create_time desc
   </select>
+
   <select id="queryRoleByUserId" resultType="com.sckw.system.model.KwsRole">
     select b.*
       from kws_user_role a

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

@@ -312,4 +312,16 @@
        and c.del_flag = 0
   </select>
 
+  <select id="selectByRoleIds" resultType="com.sckw.system.model.KwsUser">
+    select distinct *
+      from kws_user a
+      left join kws_user_role b on a.id = b.user_id
+     where a.del_flag = 0
+       and b.del_flag = 0
+      and b.role_id in
+     <foreach collection="roleIdList" item="item" open="(" close=")" separator=",">
+       #{item}
+     </foreach>
+  </select>
+
 </mapper>