Ver Fonte

init: init project step4: biz code support 2 (user dept menu)

shc há 1 ano atrás
pai
commit
802bb986dc
21 ficheiros alterados com 1149 adições e 1187 exclusões
  1. 5 8
      hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/ReAlbumDrug.java
  2. 12 13
      hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/ReDeptDrug.java
  3. 0 2
      hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth.java
  4. 8 6
      hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysCsmUserRelation.java
  5. 0 2
      hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysDeptCsm.java
  6. 0 1
      hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysDeptRechargeRecord.java
  7. 503 526
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/SysDeptController.java
  8. 47 47
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/mapper/SysDeptMapper.java
  9. 7 7
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/MedicalEquipmentService.java
  10. 24 22
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/MobileService.java
  11. 0 5
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/MonitoringIndicatorService.java
  12. 0 1
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/ReAlbumDrugService.java
  13. 0 1
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/ReDeptDrugService.java
  14. 0 1
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SingleMemberSettleAmountOverrunInSeveralMonthsService.java
  15. 32 26
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SysDeptRelationService.java
  16. 81 81
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SysDeptService.java
  17. 0 1
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmWkAlbumService.java
  18. 0 1
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmWkArticleService.java
  19. 1 2
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmWkArticleShareService.java
  20. 104 109
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/SysDeptRelationServiceImpl.java
  21. 325 325
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/SysDeptServiceImpl.java

+ 5 - 8
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/ReAlbumDrug.java

@@ -1,21 +1,18 @@
 package com.qunzhixinxi.hnqz.admin.api.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
 
 /**
- *
- *
  * @author pigx code generator
  * @date 2020-12-11 13:23:56
  */
 @Data
 @TableName("re_album_drug")
-@EqualsAndHashCode(callSuper = true)
-public class ReAlbumDrug extends Model<ReAlbumDrug> {
-private static final long serialVersionUID = 1L;
+public class ReAlbumDrug implements Serializable {
+    private static final long serialVersionUID = 1L;
 
     /**
      * 产品相册ID
@@ -25,4 +22,4 @@ private static final long serialVersionUID = 1L;
      * 药品ID
      */
     private Integer drugId;
-    }
+}

+ 12 - 13
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/ReDeptDrug.java

@@ -1,9 +1,9 @@
 package com.qunzhixinxi.hnqz.admin.api.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
 
 /**
  * @author pigx code generator
@@ -11,17 +11,16 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @TableName("re_dept_drug")
-@EqualsAndHashCode(callSuper = true)
-public class ReDeptDrug extends Model<ReDeptDrug> {
-	private static final long serialVersionUID = 1L;
+public class ReDeptDrug implements Serializable {
+    private static final long serialVersionUID = 1L;
 
-	/**
-	 * 药品id
-	 */
-	private Integer drugId;
+    /**
+     * 药品id
+     */
+    private Integer drugId;
 
-	/**
-	 * 企业id
-	 */
-	private Integer deptId;
+    /**
+     * 企业id
+     */
+    private Integer deptId;
 }

+ 0 - 2
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth.java

@@ -3,7 +3,6 @@ package com.qunzhixinxi.hnqz.admin.api.entity;
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -12,7 +11,6 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
-
 @Data
 @TableName(value = "single_ent_settle_same_amount_for_members_in_current_month")
 public class SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth implements Serializable {

+ 8 - 6
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysCsmUserRelation.java

@@ -1,19 +1,21 @@
 package com.qunzhixinxi.hnqz.admin.api.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 
+import java.io.Serializable;
+
 /**
  * csm用户关系表
+ *
  * @TableName sys_csm_user_relation
  */
-@TableName(value ="sys_csm_user_relation")
+@TableName(value = "sys_csm_user_relation")
 @Data
-public class SysCsmUserRelation extends Model<SysCsmUserRelation> {
-	private static final long serialVersionUID = 7840785954434505720L;
-	
-	/**
+public class SysCsmUserRelation implements Serializable {
+    private static final long serialVersionUID = 7840785954434505720L;
+
+    /**
      * csm用户id
      */
     private Integer userId;

+ 0 - 2
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysDeptCsm.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
-import lombok.ToString;
 
 import java.io.Serializable;
 
@@ -17,7 +16,6 @@ import java.io.Serializable;
  * @date 2022-10-10 12:07
  */
 @Data
-@ToString
 @TableName(value = "sys_dept_csm")
 public class SysDeptCsm implements Serializable {
 	private static final long serialVersionUID = -5999156304188019589L;

+ 0 - 1
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysDeptRechargeRecord.java

@@ -8,7 +8,6 @@ import com.qunzhixinxi.hnqz.admin.api.constant.enums.RechargeRecordType;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
 /**

Diff do ficheiro suprimidas por serem muito extensas
+ 503 - 526
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/SysDeptController.java


+ 47 - 47
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/mapper/SysDeptMapper.java

@@ -26,69 +26,69 @@ import java.util.Map;
  */
 @Mapper
 public interface SysDeptMapper extends DataScopeMapper<SysDept> {
-	List<SysDept> selectDeptList(@Param("query") SysDept sysDept);
+    List<SysDept> selectDeptList(@Param("query") SysDept sysDept);
 
-	List<SysDept> selectListByDept(@Param("query") SysDept sysDept);
+    List<SysDept> selectListByDept(@Param("query") SysDept sysDept);
 
-	List<SysDept> selectDeptByIds(@Param("query") SysDept sysDept);
+    List<SysDept> selectDeptByIds(@Param("query") SysDept sysDept);
 
-	List<SysDept> getAllParentDept(@Param("query") SysDept sysDept);
+    List<SysDept> getAllParentDept(@Param("query") SysDept sysDept);
 
-	SysDept selectDistinctDeptId(@Param("query") SysDept sysDept);
+    SysDept selectDistinctDeptId(@Param("query") SysDept sysDept);
 
-	List<SysDept> selectDeptByName(@Param("query") SysDept sysDept);
+    List<SysDept> selectDeptByName(@Param("query") SysDept sysDept);
 
-	List<Map<String, Object>> selectDeptById(@Param("query") SysDept sysDept);
+    List<Map<String, Object>> selectDeptById(@Param("query") SysDept sysDept);
 
-	List<SysDept> selectByName(String entname);
+    List<SysDept> selectByName(String entname);
 
 
-	String selectEntCodeByLevelId(@Param(value = "levelId") long levelId,
-								  @Param(value = "level") int level);
+    String selectEntCodeByLevelId(@Param(value = "levelId") long levelId,
+                                  @Param(value = "level") int level);
 
-	/**
-	 * 修改名称 结算渠道
-	 */
-	void updateByPrimaryKeySelective(SysDept sysDept);
+    /**
+     * 修改名称 结算渠道
+     */
+    void updateByPrimaryKeySelective(SysDept sysDept);
 
-	SysDept selectDept(SysDept sysDept);
+    SysDept selectDept(SysDept sysDept);
 
-	List<SysDept> getParentDept(@Param("query") SysDept sysDept);
+    List<SysDept> getParentDept(@Param("query") SysDept sysDept);
 
-	List getDeptConvertToName();
+    List<Map<String, Object>> getDeptConvertToName();
 
-	List getChildDept(@Param("query") SysDept sysDept);
+    List<Map<String, Object>> getChildDept(@Param("query") SysDept sysDept);
 
-	/**
-	 * 查询所有dept
-	 *
-	 * @return
-	 */
-	List<SysDept> listAllDept();
+    /**
+     * 查询所有dept
+     *
+     * @return
+     */
+    List<SysDept> listAllDept();
 
-	/**
-	 * 分页查询所有dept
-	 *
-	 * @param page         页
-	 * @param queryWrapper 查询包装器
-	 * @return {@link IPage}<{@link SysDept}> 结果
-	 */
-	IPage<SysDept> pageAllDept(Page<SysDept> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<SysDept> queryWrapper);
+    /**
+     * 分页查询所有dept
+     *
+     * @param page         页
+     * @param queryWrapper 查询包装器
+     * @return {@link IPage}<{@link SysDept}> 结果
+     */
+    IPage<SysDept> pageAllDept(Page<SysDept> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<SysDept> queryWrapper);
 
-	/**
-	 * 根据id批量查询
-	 *
-	 * @param ids
-	 * @return
-	 */
-	List<SysDept> selectByIds(@Param("ids") List<Integer> ids);
+    /**
+     * 根据id批量查询
+     *
+     * @param ids
+     * @return
+     */
+    List<SysDept> selectByIds(@Param("ids") List<Integer> ids);
 
-	/**
-	 * 获取企业关系分页
-	 *
-	 * @param entName 企业名称
-	 * @param page    分页信息
-	 * @return 分页结果
-	 */
-	Page<SysEnterpriseRelationVO> pageEntRels(Page<SysEnterpriseRelationVO> page, @Param("entName") String entName);
+    /**
+     * 获取企业关系分页
+     *
+     * @param entName 企业名称
+     * @param page    分页信息
+     * @return 分页结果
+     */
+    Page<SysEnterpriseRelationVO> pageEntRels(Page<SysEnterpriseRelationVO> page, @Param("entName") String entName);
 }

+ 7 - 7
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/MedicalEquipmentService.java

@@ -12,11 +12,11 @@ import java.util.List;
  */
 public interface MedicalEquipmentService extends IService<MedicalEquipment> {
 
-	/**
-	 * 查询指定企业对应的医疗器械
-	 *
-	 * @param deptId
-	 * @return
-	 */
-	List<MedicalEquipment> listByDrugId(Integer deptId);
+    /**
+     * 查询指定企业对应的医疗器械
+     *
+     * @param deptId 企业ID
+     * @return 医疗器械列表
+     */
+    List<MedicalEquipment> listByDrugId(Integer deptId);
 }

+ 24 - 22
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/MobileService.java

@@ -3,34 +3,36 @@ package com.qunzhixinxi.hnqz.admin.service;
 import com.qunzhixinxi.hnqz.common.core.util.R;
 
 /**
+ * 短信服务
+ *
  * @author hnqz
  * @date 2018/11/14
  */
 public interface MobileService {
 
-	/**
-	 * 发送手机验证码
-	 *
-	 * @param mobile mobile
-	 * @return code
-	 */
-	R<Boolean> sendSmsCode(String mobile);
+    /**
+     * 发送手机验证码
+     *
+     * @param mobile mobile
+     * @return code
+     */
+    R<Boolean> sendSmsCode(String mobile);
 
 
-	/**
-	 * 发送手机验证码
-	 *
-	 * @param mobile mobile
-	 * @return code
-	 */
-	R<Boolean> sendSmsCodePc(String mobile);
+    /**
+     * 发送手机验证码
+     *
+     * @param mobile mobile
+     * @return code
+     */
+    R<Boolean> sendSmsCodePc(String mobile);
 
-	/**
-	 * 发送短信验证码给财务管理员
-	 *
-	 * @param mobile 手机号
-	 * @param need   是否需要发送
-	 * @return 发送结果
-	 */
-	Boolean sendSmsCodeForFina(String mobile, Boolean need);
+    /**
+     * 发送短信验证码给财务管理员
+     *
+     * @param mobile 手机号
+     * @param need   是否需要发送
+     * @return 发送结果
+     */
+    Boolean sendSmsCodeForFina(String mobile, Boolean need);
 }

+ 0 - 5
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/MonitoringIndicatorService.java

@@ -1,12 +1,7 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qunzhixinxi.hnqz.admin.api.entity.MonitoringIndicator;
-import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackageSettleNote;
-
-import java.math.BigDecimal;
-import java.util.Collection;
 
 /**
  * 风险监控

+ 0 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/ReAlbumDrugService.java

@@ -1,4 +1,3 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;

+ 0 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/ReDeptDrugService.java

@@ -1,4 +1,3 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;

+ 0 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SingleMemberSettleAmountOverrunInSeveralMonthsService.java

@@ -1,6 +1,5 @@
 package com.qunzhixinxi.hnqz.admin.service;
 
-
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qunzhixinxi.hnqz.admin.api.entity.SingleMemberSettleAmountOverrunInSeveralMonths;
 

+ 32 - 26
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SysDeptRelationService.java

@@ -1,16 +1,15 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.qunzhixinxi.hnqz.admin.api.dto.UserDTO;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptRelation;
 
+import java.util.Map;
+
 /**
  * <p>
- * 服务
+ * 企业关系服务
  * </p>
  *
  * @author hnqz
@@ -18,27 +17,34 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptRelation;
  */
 public interface SysDeptRelationService extends IService<SysDeptRelation> {
 
-	/**
-	 * 新建部门关系
-	 * @param sysDept 部门
-	 */
-	void insertDeptRelation(SysDept sysDept);
-
-	/**
-	 * 通过ID删除部门关系
-	 * @param id
-	 */
-	void deleteAllDeptRealtion(Integer id);
-
-
-	void deleteDeptById(Integer id);
-
-	IPage selectSysDeptList(Page page, SysDept sysDept);
-
-	/**
-	 * 更新部门关系
-	 * @param relation
-	 */
-	void updateDeptRealtion(SysDeptRelation relation);
+    /**
+     * 新建部门关系
+     *
+     * @param sysDept 部门
+     */
+    void insertDeptRelation(SysDept sysDept);
+
+    /**
+     * 通过ID删除部门关系
+     *
+     * @param id 企业ID
+     */
+    void deleteAllDeptRelation(Integer id);
+
+    /**
+     * 根据ID删除企业
+     *
+     * @param id 企业ID
+     */
+    void deleteDeptById(Integer id);
+
+	Page<Map<String, Object>> selectSysDeptList(Page<?> page, SysDept sysDept);
+
+    /**
+     * 更新部门关系
+     *
+     * @param relation 关系
+     */
+    void updateDeptRelation(SysDeptRelation relation);
 
 }

+ 81 - 81
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SysDeptService.java

@@ -21,85 +21,85 @@ import java.util.Map;
  */
 public interface SysDeptService extends IService<SysDept> {
 
-	/**
-	 * 查询部门树菜单
-	 *
-	 * @return 树
-	 */
-	List<DeptTree> selectTree(SysDept sysDept);
-
-	List<DeptTree> selectTreeAddUser(SysDept sysDept);
-
-	/**
-	 * 添加信息部门
-	 *
-	 * @param sysDept
-	 * @return
-	 */
-	Integer saveDept(SysDept sysDept);
-
-	/**
-	 * 删除部门
-	 *
-	 * @param id 部门 ID
-	 * @return 成功、失败
-	 */
-	Boolean removeDeptById(Integer id);
-
-
-	/**
-	 * 更新部门
-	 *
-	 * @param sysDept 部门信息
-	 * @return 成功、失败
-	 */
-	Boolean updateDeptById(SysDept sysDept);
-
-	List<SysDept> listScope(SysDept sysDept);
-
-	List<SysDept> selectDeptByName(@Param("query") SysDept sysDept);
-
-	SysDept selectDeptId(SysDept sysDept);
-
-	SysDept selectDeptById(SysDept sysDept);
-
-	List<SysDept> getAllParentDept(SysDept sysDept);
-
-	/**
-	 * 针对级别获取企业组织码
-	 *
-	 * @param levelId id
-	 * @param level   层级
-	 * @return 企业组织码
-	 */
-	String selectEntCodeByLevelId(long levelId, int level);
-
-
-	SysDept selectByDeptId(Integer deptId);
-
-	List<SysDept> selectByName(String entname);
-
-	List getParentDept(SysDept sysDept);
-
-	List convertToName();
-
-	List getChildDept(SysDept sysDept);
-
-	/**
-	 * 分页查询药企和CSO代理商
-	 *
-	 * @param page     分页参数
-	 * @param deptName 部门名称
-	 * @return
-	 */
-	Map<String, Object> listEntAndAgent(Page page, String deptName);
-
-	/**
-	 * 获取分页
-	 *
-	 * @param entName 企业名称
-	 * @param page    分页参数
-	 * @return 翻页结果
-	 */
-	Page<SysEnterpriseRelationVO> pageEntRels(Page<SysEnterpriseRelationVO> page, String entName);
+    /**
+     * 查询部门树菜单
+     *
+     * @return 树
+     */
+    List<DeptTree> selectTree(SysDept sysDept);
+
+    List<DeptTree> selectTreeAddUser(SysDept sysDept);
+
+    /**
+     * 添加信息部门
+     *
+     * @param sysDept 企业信息
+     * @return 企业ID
+     */
+    Integer saveDept(SysDept sysDept);
+
+    /**
+     * 删除部门
+     *
+     * @param id 部门 ID
+     * @return 成功、失败
+     */
+    Boolean removeDeptById(Integer id);
+
+
+    /**
+     * 更新部门
+     *
+     * @param sysDept 部门信息
+     * @return 成功、失败
+     */
+    Boolean updateDeptById(SysDept sysDept);
+
+    List<SysDept> listScope(SysDept sysDept);
+
+    List<SysDept> selectDeptByName(@Param("query") SysDept sysDept);
+
+    SysDept selectDeptId(SysDept sysDept);
+
+    SysDept selectDeptById(SysDept sysDept);
+
+    List<SysDept> getAllParentDept(SysDept sysDept);
+
+    /**
+     * 针对级别获取企业组织码
+     *
+     * @param levelId id
+     * @param level   层级
+     * @return 企业组织码
+     */
+    String selectEntCodeByLevelId(long levelId, int level);
+
+
+    SysDept selectByDeptId(Integer deptId);
+
+    List<SysDept> selectByName(String entname);
+
+    List<SysDept> getParentDept(SysDept sysDept);
+
+    List<Map<String, Object>> convertToName();
+
+    List<Map<String, Object>> getChildDept(SysDept sysDept);
+
+    /**
+     * 分页查询药企和CSO代理商
+     *
+     * @param page     分页参数
+     * @param deptName 部门名称
+     * @return 分页集合
+     */
+    Map<String, Object> listEntAndAgent(Page<SysDept> page, String deptName);
+
+    /**
+     * 获取分页
+     *
+     * @param entName 企业名称
+     * @param page    分页参数
+     * @return 翻页结果
+     */
+    Page<SysEnterpriseRelationVO> pageEntRels(Page<SysEnterpriseRelationVO> page, String entName);
 }

+ 0 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmWkAlbumService.java

@@ -1,4 +1,3 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

+ 0 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmWkArticleService.java

@@ -1,4 +1,3 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;

+ 1 - 2
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmWkArticleShareService.java

@@ -1,4 +1,3 @@
-
 package com.qunzhixinxi.hnqz.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -13,5 +12,5 @@ import com.qunzhixinxi.hnqz.common.core.util.R;
  */
 public interface WmWkArticleShareService extends IService<WmWkArticleShare> {
 
-	public R saveWmWkArticleShare(String artileId, String shareUserId, String openUserId, int type);
+    R<?> saveWmWkArticleShare(String artileId, String shareUserId, String openUserId, int type);
 }

+ 104 - 109
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/SysDeptRelationServiceImpl.java

@@ -1,19 +1,14 @@
-
-
 package com.qunzhixinxi.hnqz.admin.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptRelation;
-import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
 import com.qunzhixinxi.hnqz.admin.mapper.SysDeptMapper;
 import com.qunzhixinxi.hnqz.admin.mapper.SysDeptRelationMapper;
 import com.qunzhixinxi.hnqz.admin.service.SysDeptRelationService;
-import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
 import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -34,109 +29,109 @@ import java.util.stream.Collectors;
  */
 @Service
 @AllArgsConstructor
-public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMapper, SysDeptRelation>
-		implements SysDeptRelationService {
-
-	private final SysDeptRelationMapper sysDeptRelationMapper;
-
-	private final SysDeptMapper sysDeptMapper;
-
-	/**
-	 * 维护部门关系
-	 * @param sysDept 部门
-	 */
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void insertDeptRelation(SysDept sysDept) {
-		// 增加部门关系表
-		List<SysDeptRelation> relationList = sysDeptRelationMapper.selectList(
-				Wrappers.<SysDeptRelation>query().lambda().eq(SysDeptRelation::getDescendant, sysDept.getParentId()))
-				.stream().map(relation -> {
-					relation.setDescendant(sysDept.getDeptId());
-					return relation;
-				}).collect(Collectors.toList());
-		if (CollUtil.isNotEmpty(relationList)) {
-			this.saveBatch(relationList);
-		}
-
-		// 自己也要维护到关系表中
-		SysDeptRelation own = new SysDeptRelation();
-		own.setDescendant(sysDept.getDeptId());
-		own.setAncestor(sysDept.getDeptId());
-		sysDeptRelationMapper.insert(own);
-	}
-
-	/**
-	 * 通过ID删除部门关系
-	 * @param id
-	 */
-	@Override
-	public void deleteAllDeptRealtion(Integer id) {
-		baseMapper.deleteDeptRelationsById(id);
-	}
-
-	/**
-	 * 通过ID删除部门关系
-	 * @param id
-	 */
-	@Override
-	public void deleteDeptById(Integer id) {
-		baseMapper.deleteDeptById(id);
-	}
-
-	@Override
-	public IPage selectSysDeptList(Page page, SysDept sysDept) {
-		if (sysDept.getDeptId()==null){
-			sysDept.setDeptId(SecurityUtils.getUser().getDeptId());
-		}
-		SysDeptRelation sysDeptRelation  = new SysDeptRelation();
-		sysDeptRelation.setAncestor(sysDept.getDeptId());
-		List<Map<String,Object>> list1 = new ArrayList<>();
-		List<SysDeptRelation> sysDeptRelationList = sysDeptRelationMapper.selectListByAncestor(sysDeptRelation);
-		SysDeptRelation sysDeptRelation1  = new SysDeptRelation();
-		sysDeptRelation1.setDescendant(sysDept.getDeptId());
-		List<SysDeptRelation> sysDeptRelationList1 = sysDeptRelationMapper.selectListByDescendant(sysDeptRelation1);
-		for (int i = 0; i < sysDeptRelationList.size(); i++) {
-			SysDept sysDept1 = new SysDept();
-			sysDept1.setDeptId(sysDeptRelationList.get(i).getDescendant());
-				List<Map<String,Object>> sysDept2 = sysDeptMapper.selectDeptById(sysDept1);
-				list1.addAll(sysDept2);
-		}
-		for (int i = 0; i < sysDeptRelationList1.size(); i++) {
-			SysDept sysDept1 = new SysDept();
-			sysDept1.setDeptId(sysDeptRelationList1.get(i).getAncestor());
-				List<Map<String,Object>> sysDept2 = sysDeptMapper.selectDeptById(sysDept1);
-				list1.addAll(sysDept2);
-		}
-
-		Page<Map<String,Object>> page1 = new Page<>();
-		int current = new Long(page.getCurrent()).intValue();
-		int size = new Long(page.getSize()).intValue();
-
-		int count = list1.size();
-		List<Map<String,Object>> pageList = new ArrayList<>();
-		//计算当前页第一条数据的下标
-		int currId = current>1 ? (current-1)*size:0;
-		for (int i=0; i<size && i<count - currId;i++){
-			pageList.add(list1.get(currId+i));
-		}
-		page1.setSize(size);
-		page1.setCurrent(current);
-		page1.setTotal(count);
-		//计算分页总页数
-		page1.setPages(count %10 == 0 ? count/10 :count/10+1);
-		page1.setRecords(pageList);
-		return page1;
-	}
-
-
-	/**
-	 * 更新部门关系
-	 * @param relation
-	 */
-	@Override
-	public void updateDeptRealtion(SysDeptRelation relation) {
-		baseMapper.updateDeptRelations(relation);
-	}
+public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMapper, SysDeptRelation> implements SysDeptRelationService {
+
+    private final SysDeptRelationMapper sysDeptRelationMapper;
+    private final SysDeptMapper sysDeptMapper;
+
+    /**
+     * 维护部门关系
+     *
+     * @param sysDept 部门
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void insertDeptRelation(SysDept sysDept) {
+        // 增加部门关系表
+        List<SysDeptRelation> relationList =
+                sysDeptRelationMapper.selectList(Wrappers.<SysDeptRelation>query().lambda().eq(SysDeptRelation::getDescendant, sysDept.getParentId()))
+                        .stream()
+                        .peek(relation -> relation.setDescendant(sysDept.getDeptId())).collect(Collectors.toList());
+        if (CollUtil.isNotEmpty(relationList)) {
+            this.saveBatch(relationList);
+        }
+
+        // 自己也要维护到关系表中
+        SysDeptRelation own = new SysDeptRelation();
+        own.setDescendant(sysDept.getDeptId());
+        own.setAncestor(sysDept.getDeptId());
+        sysDeptRelationMapper.insert(own);
+    }
+
+    /**
+     * 通过ID删除部门关系
+     *
+     * @param id 企业ID
+     */
+    @Override
+    public void deleteAllDeptRelation(Integer id) {
+        baseMapper.deleteDeptRelationsById(id);
+    }
+
+    /**
+     * 通过ID删除部门关系
+     *
+     * @param id 企业ID
+     */
+    @Override
+    public void deleteDeptById(Integer id) {
+        baseMapper.deleteDeptById(id);
+    }
+
+    @Override
+    public Page<Map<String, Object>> selectSysDeptList(Page<?> page, SysDept sysDept) {
+        if (sysDept.getDeptId() == null) {
+            sysDept.setDeptId(SecurityUtils.getUser().getDeptId());
+        }
+        SysDeptRelation sysDeptRelation = new SysDeptRelation();
+        sysDeptRelation.setAncestor(sysDept.getDeptId());
+        List<Map<String, Object>> list1 = new ArrayList<>();
+        List<SysDeptRelation> sysDeptRelationList = sysDeptRelationMapper.selectListByAncestor(sysDeptRelation);
+        SysDeptRelation sysDeptRelation1 = new SysDeptRelation();
+        sysDeptRelation1.setDescendant(sysDept.getDeptId());
+        List<SysDeptRelation> sysDeptRelationList1 = sysDeptRelationMapper.selectListByDescendant(sysDeptRelation1);
+        for (SysDeptRelation deptRelation : sysDeptRelationList) {
+            SysDept sysDept1 = new SysDept();
+            sysDept1.setDeptId(deptRelation.getDescendant());
+            List<Map<String, Object>> sysDept2 = sysDeptMapper.selectDeptById(sysDept1);
+            list1.addAll(sysDept2);
+        }
+        for (SysDeptRelation deptRelation : sysDeptRelationList1) {
+            SysDept sysDept1 = new SysDept();
+            sysDept1.setDeptId(deptRelation.getAncestor());
+            List<Map<String, Object>> sysDept2 = sysDeptMapper.selectDeptById(sysDept1);
+            list1.addAll(sysDept2);
+        }
+
+        Page<Map<String, Object>> page1 = new Page<>();
+        int current = Long.valueOf(page.getCurrent()).intValue();
+        int size = Long.valueOf(page.getSize()).intValue();
+
+        int count = list1.size();
+        List<Map<String, Object>> pageList = new ArrayList<>();
+        //计算当前页第一条数据的下标
+        int currId = current > 1 ? (current - 1) * size : 0;
+        for (int i = 0; i < size && i < count - currId; i++) {
+            pageList.add(list1.get(currId + i));
+        }
+        page1.setSize(size);
+        page1.setCurrent(current);
+        page1.setTotal(count);
+        //计算分页总页数
+        page1.setPages(count % 10 == 0 ? count / 10 : count / 10 + 1);
+        page1.setRecords(pageList);
+        return page1;
+    }
+
+
+    /**
+     * 更新部门关系
+     *
+     * @param relation 企业关系
+     */
+    @Override
+    public void updateDeptRelation(SysDeptRelation relation) {
+        baseMapper.updateDeptRelations(relation);
+    }
 
 }

+ 325 - 325
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/SysDeptServiceImpl.java

@@ -49,161 +49,161 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
 
-	private final SysDeptRelationService sysDeptRelationService;
-
-	private final SysDeptRelationMapper sysDeptRelationMapper;
-
-	private final SysDeptMapper deptMapper;
-
-	private final SysCsmUserRelationService sysCsmUserRelationService;
-
-	private final SysDeptCsmMapper sysDeptCsmMapper;
-
-	@Override
-	public List convertToName() {
-		return deptMapper.getDeptConvertToName();
-	}
-
-	@Override
-	public List getChildDept(SysDept sysDept) {
-		return deptMapper.getChildDept(sysDept);
-	}
-
-	@Override
-	public List getParentDept(SysDept sysDept) {
-		return deptMapper.getParentDept(sysDept);
-	}
-
-	@Override
-	public SysDept selectByDeptId(Integer deptId) {
-		SysDept sysDept1 = new SysDept();
-		sysDept1.setDeptId(deptId);
-		return deptMapper.selectDistinctDeptId(sysDept1);
-	}
-
-	@Override
-	public List<SysDept> selectByName(String entname) {
-		return deptMapper.selectByName(entname);
-	}
-
-	/**
-	 * 添加信息部门
-	 *
-	 * @param dept 部门
-	 * @return
-	 */
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Integer saveDept(SysDept dept) {
-		SysDept sysDept = new SysDept();
-		BeanUtils.copyProperties(dept, sysDept);
-		this.save(sysDept);
-		sysDeptRelationService.insertDeptRelation(sysDept);
-		return dept.getDeptId();
-	}
-
-
-	/**
-	 * 删除部门
-	 *
-	 * @param id 部门 ID
-	 * @return 成功、失败
-	 */
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Boolean removeDeptById(Integer id) {
-		// 级联删除部门
-		List<Integer> idList = sysDeptRelationService
-				.list(Wrappers.<SysDeptRelation>query().lambda().eq(SysDeptRelation::getAncestor, id)).stream()
-				.map(SysDeptRelation::getDescendant).collect(Collectors.toList());
-
-		if (CollUtil.isNotEmpty(idList)) {
-			this.removeByIds(idList);
-		}
-
-		//删除组织机构
-		sysDeptRelationService.deleteDeptById(id);
-
-		// 删除部门级联关系
-		sysDeptRelationService.deleteAllDeptRealtion(id);
-		return Boolean.TRUE;
-	}
-
-
-	/**
-	 * 更新部门
-	 *
-	 * @param sysDept 部门信息
-	 * @return 成功、失败
-	 */
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Boolean updateDeptById(SysDept sysDept) {
-		// 更新部门状态
-		this.updateById(sysDept);
-		// 更新部门关系
-		SysDeptRelation relation = new SysDeptRelation();
-		relation.setAncestor(sysDept.getParentId());
-		relation.setDescendant(sysDept.getDeptId());
-		sysDeptRelationService.updateDeptRealtion(relation);
-		return Boolean.TRUE;
-	}
-
-	@Override
-	public List<SysDept> listScope(SysDept sysDept) {
-		QueryWrapper<SysDept> queryWrapper = Wrappers.query(sysDept);
-
-		if (SecurityUtils.getRoles().contains(19)) {
-			// CSM只能查看自己维护的企业下的数据, 以及下属维护的企业下的数据
-			Integer userId = SecurityUtils.getUser().getId();
-			// 递归查询下属关联的userId
-			Set<Integer> allUserIds = sysCsmUserRelationService.recurseCsmLowerUserId(Collections.singleton(userId), new AtomicInteger(10));
-			// 查询企业id
-			List<SysDeptCsm> deptCsms = sysDeptCsmMapper.selectList(Wrappers.<SysDeptCsm>lambdaQuery()
-					.in(SysDeptCsm::getUserId, allUserIds));
-			if (CollUtil.isEmpty(deptCsms)) {
-				return Collections.emptyList();
-			}
-
-			Set<Integer> deptIds = deptCsms.stream().map(SysDeptCsm::getDeptId).collect(Collectors.toSet());
-			queryWrapper.in("dept_id", deptIds);
-		}
-
-		return deptMapper.selectListByScope(queryWrapper, new DataScope());
-	}
-
-	@Override
-	public List<SysDept> selectDeptByName(SysDept sysDept) {
-		List<SysDept> deptList = new ArrayList<>();
-		if (SecurityUtils.getRoles().contains(1) || SecurityUtils.getRoles().contains(2)) {
-			List<SysDept> sysDeptList = deptMapper.selectListByDept(sysDept);
-			return sysDeptList;
-		} else {
-			sysDept.setDeptId(SecurityUtils.getUser().getDeptId());
-			deptList = deptMapper.selectDeptByName(sysDept);
-		}
-		return deptList;
-	}
-
-	@Override
-	public SysDept selectDeptId(SysDept sysDept) {
-		return deptMapper.selectById(sysDept.getDeptId());
-	}
-
-	@Override
-	public SysDept selectDeptById(SysDept sysDept) {
-		return this.getById(sysDept.getDeptId());
-	}
-
-	/**
-	 * 查询全部部门树
-	 *
-	 * @return 树
-	 */
-	@Override
-	public List<DeptTree> selectTreeAddUser(SysDept sysDept) {
-		// 查询数据权限内部门
-		List<Integer> roles = SecurityUtils.getRoles();
+    private final SysDeptRelationService sysDeptRelationService;
+
+    private final SysDeptRelationMapper sysDeptRelationMapper;
+
+    private final SysDeptMapper deptMapper;
+
+    private final SysCsmUserRelationService sysCsmUserRelationService;
+
+    private final SysDeptCsmMapper sysDeptCsmMapper;
+
+    @Override
+    public List<Map<String, Object>> convertToName() {
+        return deptMapper.getDeptConvertToName();
+    }
+
+    @Override
+    public List<Map<String, Object>> getChildDept(SysDept sysDept) {
+        return deptMapper.getChildDept(sysDept);
+    }
+
+    @Override
+    public List<SysDept> getParentDept(SysDept sysDept) {
+        return deptMapper.getParentDept(sysDept);
+    }
+
+    @Override
+    public SysDept selectByDeptId(Integer deptId) {
+        SysDept sysDept1 = new SysDept();
+        sysDept1.setDeptId(deptId);
+        return deptMapper.selectDistinctDeptId(sysDept1);
+    }
+
+    @Override
+    public List<SysDept> selectByName(String entname) {
+        return deptMapper.selectByName(entname);
+    }
+
+    /**
+     * 添加信息部门
+     *
+     * @param dept 部门
+     * @return 企业ID
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Integer saveDept(SysDept dept) {
+        SysDept sysDept = new SysDept();
+        BeanUtils.copyProperties(dept, sysDept);
+        this.save(sysDept);
+        sysDeptRelationService.insertDeptRelation(sysDept);
+        return dept.getDeptId();
+    }
+
+
+    /**
+     * 删除部门
+     *
+     * @param id 部门 ID
+     * @return 成功、失败
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean removeDeptById(Integer id) {
+        // 级联删除部门
+        List<Integer> idList = sysDeptRelationService
+                .list(Wrappers.<SysDeptRelation>query().lambda().eq(SysDeptRelation::getAncestor, id)).stream()
+                .map(SysDeptRelation::getDescendant).collect(Collectors.toList());
+
+        if (CollUtil.isNotEmpty(idList)) {
+            this.removeByIds(idList);
+        }
+
+        //删除组织机构
+        sysDeptRelationService.deleteDeptById(id);
+
+        // 删除部门级联关系
+        sysDeptRelationService.deleteAllDeptRelation(id);
+        return Boolean.TRUE;
+    }
+
+
+    /**
+     * 更新部门
+     *
+     * @param sysDept 部门信息
+     * @return 成功、失败
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updateDeptById(SysDept sysDept) {
+        // 更新部门状态
+        this.updateById(sysDept);
+        // 更新部门关系
+        SysDeptRelation relation = new SysDeptRelation();
+        relation.setAncestor(sysDept.getParentId());
+        relation.setDescendant(sysDept.getDeptId());
+        sysDeptRelationService.updateDeptRelation(relation);
+        return Boolean.TRUE;
+    }
+
+    @Override
+    public List<SysDept> listScope(SysDept sysDept) {
+        QueryWrapper<SysDept> queryWrapper = Wrappers.query(sysDept);
+
+        if (SecurityUtils.getRoles().contains(19)) {
+            // CSM只能查看自己维护的企业下的数据, 以及下属维护的企业下的数据
+            Integer userId = SecurityUtils.getUser().getId();
+            // 递归查询下属关联的userId
+            Set<Integer> allUserIds = sysCsmUserRelationService.recurseCsmLowerUserId(Collections.singleton(userId), new AtomicInteger(10));
+            // 查询企业id
+            List<SysDeptCsm> deptCsms = sysDeptCsmMapper.selectList(Wrappers.<SysDeptCsm>lambdaQuery()
+                    .in(SysDeptCsm::getUserId, allUserIds));
+            if (CollUtil.isEmpty(deptCsms)) {
+                return Collections.emptyList();
+            }
+
+            Set<Integer> deptIds = deptCsms.stream().map(SysDeptCsm::getDeptId).collect(Collectors.toSet());
+            queryWrapper.in("dept_id", deptIds);
+        }
+
+        return deptMapper.selectListByScope(queryWrapper, new DataScope());
+    }
+
+    @Override
+    public List<SysDept> selectDeptByName(SysDept sysDept) {
+        List<SysDept> deptList = new ArrayList<>();
+        if (SecurityUtils.getRoles().contains(1) || SecurityUtils.getRoles().contains(2)) {
+            List<SysDept> sysDeptList = deptMapper.selectListByDept(sysDept);
+            return sysDeptList;
+        } else {
+            sysDept.setDeptId(SecurityUtils.getUser().getDeptId());
+            deptList = deptMapper.selectDeptByName(sysDept);
+        }
+        return deptList;
+    }
+
+    @Override
+    public SysDept selectDeptId(SysDept sysDept) {
+        return deptMapper.selectById(sysDept.getDeptId());
+    }
+
+    @Override
+    public SysDept selectDeptById(SysDept sysDept) {
+        return this.getById(sysDept.getDeptId());
+    }
+
+    /**
+     * 查询全部部门树
+     *
+     * @return 树
+     */
+    @Override
+    public List<DeptTree> selectTreeAddUser(SysDept sysDept) {
+        // 查询数据权限内部门
+        List<Integer> roles = SecurityUtils.getRoles();
 //		List<SysDept> deptList = new ArrayList<>();
 //		sysDept.setDeptId(SecurityUtils.getUser().getDeptId());
 //		List<SysDept> list1 = deptMapper.selectDeptByIds(sysDept);
@@ -220,73 +220,73 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
 //				deptList.addAll(list);
 //			}
 //		}
-		List<SysDept> deptList = new ArrayList<>();
-
-		if (roles.contains(1) || roles.contains(2)) {
-			deptList = deptMapper.selectDeptList(sysDept);
-		} else {
-			SysDeptRelation sysDeptRelation = new SysDeptRelation();
-			sysDeptRelation.setAncestor(SecurityUtils.getUser().getDeptId());
-			List<SysDeptRelation> sysDeptRelationList = sysDeptRelationMapper.selectDeptRelationsList(sysDeptRelation);
-			List<Integer> ids = sysDeptRelationList.stream().map(p -> p.getDescendant()).collect(Collectors.toList());
-			for (Integer id : ids) {
-				SysDept sysDept1 = new SysDept();
-				sysDept1.setDeptId(id);
-				SysDept sysDept2 = this.getById(sysDept1.getDeptId());
-
-				if (null != sysDept2) {
-					deptList.add(sysDept2);
-				}
-			}
-		}
-		// 权限内部门
-		final boolean[] isFisrt = {true};
-		List<DeptTree> collect = deptList.stream().filter(dept -> dept.getDeptId().intValue() > 0)
-				.sorted(Comparator.comparingInt(SysDept::getSort)).map(dept -> {
-					DeptTree node = new DeptTree();
-					node.setId(dept.getDeptId());
-
-					if (isFisrt[0]) {
+        List<SysDept> deptList = new ArrayList<>();
+
+        if (roles.contains(1) || roles.contains(2)) {
+            deptList = deptMapper.selectDeptList(sysDept);
+        } else {
+            SysDeptRelation sysDeptRelation = new SysDeptRelation();
+            sysDeptRelation.setAncestor(SecurityUtils.getUser().getDeptId());
+            List<SysDeptRelation> sysDeptRelationList = sysDeptRelationMapper.selectDeptRelationsList(sysDeptRelation);
+            List<Integer> ids = sysDeptRelationList.stream().map(p -> p.getDescendant()).collect(Collectors.toList());
+            for (Integer id : ids) {
+                SysDept sysDept1 = new SysDept();
+                sysDept1.setDeptId(id);
+                SysDept sysDept2 = this.getById(sysDept1.getDeptId());
+
+                if (null != sysDept2) {
+                    deptList.add(sysDept2);
+                }
+            }
+        }
+        // 权限内部门
+        final boolean[] isFisrt = {true};
+        List<DeptTree> collect = deptList.stream().filter(dept -> dept.getDeptId().intValue() > 0)
+                .sorted(Comparator.comparingInt(SysDept::getSort)).map(dept -> {
+                    DeptTree node = new DeptTree();
+                    node.setId(dept.getDeptId());
+
+                    if (isFisrt[0]) {
 //						node.setParentId(dept.getAncestor());
-						isFisrt[0] = false;
-					} else {
+                        isFisrt[0] = false;
+                    } else {
 //						node.setParentId(dept.getAncestor());
-					}
-					node.setName(dept.getName());
+                    }
+                    node.setName(dept.getName());
 
-					// 有权限不返回标识
+                    // 有权限不返回标识
 //					if (deptList.contains(dept.getDeptId())) {
 //						node.setIsLock(Boolean.FALSE);
 //					}
-					return node;
-				}).collect(Collectors.toList());
-		return TreeUtil.build(collect, 0);
-	}
-
-
-	/**
-	 * 查询全部部门树
-	 *
-	 * @return 树
-	 */
-	@Override
-	public List<DeptTree> selectTree(SysDept sysDept) {
-		List<SysDept> deptList = deptMapper.selectDeptList(sysDept);
-
-		List<DeptTree> collect = deptList.stream().filter(dept -> dept.getDeptId().intValue() > 0)
-				.sorted(Comparator.comparingInt(SysDept::getSort)).map(dept -> {
-					DeptTree node = new DeptTree();
-					node.setId(dept.getDeptId());
+                    return node;
+                }).collect(Collectors.toList());
+        return TreeUtil.build(collect, 0);
+    }
+
+
+    /**
+     * 查询全部部门树
+     *
+     * @return 树
+     */
+    @Override
+    public List<DeptTree> selectTree(SysDept sysDept) {
+        List<SysDept> deptList = deptMapper.selectDeptList(sysDept);
+
+        List<DeptTree> collect = deptList.stream().filter(dept -> dept.getDeptId().intValue() > 0)
+                .sorted(Comparator.comparingInt(SysDept::getSort)).map(dept -> {
+                    DeptTree node = new DeptTree();
+                    node.setId(dept.getDeptId());
 //					node.setParentId(dept.getParentId());
-					node.setName(dept.getName());
+                    node.setName(dept.getName());
 
-					// 有权限不返回标识
-					if (deptList.contains(dept.getDeptId())) {
-						node.setIsLock(Boolean.FALSE);
-					}
-					return node;
-				}).collect(Collectors.toList());
-		return TreeUtil.build(collect, 0);
+                    // 有权限不返回标识
+                    if (deptList.contains(dept.getDeptId())) {
+                        node.setIsLock(Boolean.FALSE);
+                    }
+                    return node;
+                }).collect(Collectors.toList());
+        return TreeUtil.build(collect, 0);
 
 
 //		List<Integer> roles=SecurityUtils.getRoles();
@@ -436,115 +436,115 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
 //				}).collect(Collectors.toList());
 //		return TreeUtil.build(collect, 0);
 
-	}
-
-
-	/**
-	 * 查询所有关联服务企业
-	 */
-	@Override
-	public List<SysDept> getAllParentDept(SysDept sysDept) {
-		List<SysDept> deptList = deptMapper.getAllParentDept(sysDept);
-		//一个机构同时是一级cso和二级cso时,可以自己给自己发包
-		Map<Integer, SysDept> partsMap = deptList.stream().collect(
-				Collectors.toMap(SysDept::getLevel, Function.identity(), (dto1, dto2) -> dto1));
-		//没有药企,有一级cso和二级cso时,这个时候不返回二级cso
-		if ((!partsMap.containsKey(2)) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
-			deptList.remove(partsMap.get(4));
-		}
-		//二级CSO只展示上级一级CSO
-		if (partsMap.containsKey(2) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
-			SysDept sysDept1 = this.getById(SecurityUtils.getUser().getDeptId());
-			if (sysDept1.getLevel() == 4) {
-				deptList.remove(partsMap.get(2));
-			}
-		}
-		return deptList;
-	}
-
-	@Override
-	public String selectEntCodeByLevelId(long levelId, int level) {
-		return deptMapper.selectEntCodeByLevelId(levelId, level);
-	}
-
-	/**
-	 * 分页查询药企和CSO代理商
-	 *
-	 * @param page     分页参数
-	 * @param deptName 部门名称
-	 * @return
-	 */
-	@Override
-	public Map<String, Object> listEntAndAgent(Page page, String deptName) {
-		// 药企wrapper
-		LambdaQueryWrapper<SysDept> entWrapper = Wrappers.lambdaQuery();
-		entWrapper.eq(SysDept::getDelFlag, DelEnum.NOT_DEL.val());
-		entWrapper.eq(SysDept::getLevel, DeptLevelEnum.ENT.getVal());
-		if (StringUtils.isNotBlank(deptName)) {
-			entWrapper.like(SysDept::getName, deptName);
-		}
-
-		// CSO wrapper
-		LambdaQueryWrapper<SysDept> csoWrapper = Wrappers.lambdaQuery();
-		csoWrapper.eq(SysDept::getDelFlag, DelEnum.NOT_DEL.val());
-		csoWrapper.in(SysDept::getLevel, DeptLevelEnum.CSO_L1.getVal(), DeptLevelEnum.CSO_L2.getVal());
-		if (StringUtils.isNotBlank(deptName)) {
-			csoWrapper.like(SysDept::getName, deptName);
-		}
-
-		if (SecurityUtils.getRoles().contains(19)) {
-			// CSM只能查看自己维护的企业下的用户, 以及下属维护的企业下的用户
-			Integer userId = SecurityUtils.getUser().getId();
-			// 递归查询下属关联的userId
-			Set<Integer> allUserIds = sysCsmUserRelationService.recurseCsmLowerUserId(Collections.singleton(userId), new AtomicInteger(10));
-			// 查询企业id
-			List<SysDeptCsm> deptCsms = sysDeptCsmMapper.selectList(Wrappers.<SysDeptCsm>lambdaQuery()
-					.in(SysDeptCsm::getUserId, allUserIds));
-			if (CollUtil.isEmpty(deptCsms)) {
-				return new HashMap<>();
-			}
-
-			Set<Integer> deptIds = deptCsms.stream().map(SysDeptCsm::getDeptId).collect(Collectors.toSet());
-			entWrapper.in(SysDept::getDeptId, deptIds);
-			csoWrapper.in(SysDept::getDeptId, deptIds);
-		}
-
-		Page<SysDept> entPage = this.page(page, entWrapper);
-		List<Map<String, Object>> entMapList = entPage.getRecords().stream().map(sysDept -> {
-			Map<String, Object> deptMap = MapUtil.newHashMap(2);
-			deptMap.put("deptId", sysDept.getDeptId());
-			deptMap.put("name", sysDept.getName());
-			return deptMap;
-		}).collect(Collectors.toList());
-		Page<Map<String, Object>> entHnqzPage = BeanUtil.copyProperties(entPage, Page.class);
-		entHnqzPage.setRecords(entMapList);
-
-		// CSO
-		Page<SysDept> csoPage = this.page(page, csoWrapper);
-		List<Map<String, Object>> csoMapList = csoPage.getRecords().stream().map(sysDept -> {
-			Map<String, Object> deptMap = MapUtil.newHashMap(2);
-			deptMap.put("deptId", sysDept.getDeptId());
-			deptMap.put("name", sysDept.getName());
-			return deptMap;
-		}).collect(Collectors.toList());
-		Page<Map<String, Object>> csoHnqzPage = BeanUtil.copyProperties(entPage, Page.class);
-		csoHnqzPage.setRecords(csoMapList);
-
-		Map<String, Object> resultMap = MapUtil.newHashMap(2);
-		resultMap.put("entPage", new HnqzPage<>(entHnqzPage));
-		resultMap.put("csoPage", new HnqzPage<>(csoHnqzPage));
-		return resultMap;
-	}
-
-	/**
-	 * 获取分页
-	 *
-	 * @param entName 企业名称
-	 * @param page    分页参数
-	 * @return 翻页结果
-	 */
-	@Override
-	public Page<SysEnterpriseRelationVO> pageEntRels(Page<SysEnterpriseRelationVO> page, String entName) {
-		return this.baseMapper.pageEntRels(page, entName);
-	}
+    }
+
+
+    /**
+     * 查询所有关联服务企业
+     */
+    @Override
+    public List<SysDept> getAllParentDept(SysDept sysDept) {
+        List<SysDept> deptList = deptMapper.getAllParentDept(sysDept);
+        //一个机构同时是一级cso和二级cso时,可以自己给自己发包
+        Map<Integer, SysDept> partsMap = deptList.stream().collect(
+                Collectors.toMap(SysDept::getLevel, Function.identity(), (dto1, dto2) -> dto1));
+        //没有药企,有一级cso和二级cso时,这个时候不返回二级cso
+        if ((!partsMap.containsKey(2)) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
+            deptList.remove(partsMap.get(4));
+        }
+        //二级CSO只展示上级一级CSO
+        if (partsMap.containsKey(2) && partsMap.containsKey(3) && partsMap.containsKey(4)) {
+            SysDept sysDept1 = this.getById(SecurityUtils.getUser().getDeptId());
+            if (sysDept1.getLevel() == 4) {
+                deptList.remove(partsMap.get(2));
+            }
+        }
+        return deptList;
+    }
+
+    @Override
+    public String selectEntCodeByLevelId(long levelId, int level) {
+        return deptMapper.selectEntCodeByLevelId(levelId, level);
+    }
+
+    /**
+     * 分页查询药企和CSO代理商
+     *
+     * @param page     分页参数
+     * @param deptName 部门名称
+     * @return 分页集合
+     */
+    @Override
+    public Map<String, Object> listEntAndAgent(Page<SysDept> page, String deptName) {
+        // 药企wrapper
+        LambdaQueryWrapper<SysDept> entWrapper = Wrappers.lambdaQuery();
+        entWrapper.eq(SysDept::getDelFlag, DelEnum.NOT_DEL.val());
+        entWrapper.eq(SysDept::getLevel, DeptLevelEnum.ENT.getVal());
+        if (StringUtils.isNotBlank(deptName)) {
+            entWrapper.like(SysDept::getName, deptName);
+        }
+
+        // CSO wrapper
+        LambdaQueryWrapper<SysDept> csoWrapper = Wrappers.lambdaQuery();
+        csoWrapper.eq(SysDept::getDelFlag, DelEnum.NOT_DEL.val());
+        csoWrapper.in(SysDept::getLevel, DeptLevelEnum.CSO_L1.getVal(), DeptLevelEnum.CSO_L2.getVal());
+        if (StringUtils.isNotBlank(deptName)) {
+            csoWrapper.like(SysDept::getName, deptName);
+        }
+
+        if (SecurityUtils.getRoles().contains(19)) {
+            // CSM只能查看自己维护的企业下的用户, 以及下属维护的企业下的用户
+            Integer userId = SecurityUtils.getUser().getId();
+            // 递归查询下属关联的userId
+            Set<Integer> allUserIds = sysCsmUserRelationService.recurseCsmLowerUserId(Collections.singleton(userId), new AtomicInteger(10));
+            // 查询企业id
+            List<SysDeptCsm> deptCsms = sysDeptCsmMapper.selectList(Wrappers.<SysDeptCsm>lambdaQuery()
+                    .in(SysDeptCsm::getUserId, allUserIds));
+            if (CollUtil.isEmpty(deptCsms)) {
+                return new HashMap<>();
+            }
+
+            Set<Integer> deptIds = deptCsms.stream().map(SysDeptCsm::getDeptId).collect(Collectors.toSet());
+            entWrapper.in(SysDept::getDeptId, deptIds);
+            csoWrapper.in(SysDept::getDeptId, deptIds);
+        }
+
+        Page<SysDept> entPage = this.page(page, entWrapper);
+        List<Map<String, Object>> entMapList = entPage.getRecords().stream().map(sysDept -> {
+            Map<String, Object> deptMap = MapUtil.newHashMap(2);
+            deptMap.put("deptId", sysDept.getDeptId());
+            deptMap.put("name", sysDept.getName());
+            return deptMap;
+        }).collect(Collectors.toList());
+        Page<Map<String, Object>> entHnqzPage = BeanUtil.copyProperties(entPage, Page.class);
+        entHnqzPage.setRecords(entMapList);
+
+        // CSO
+        Page<SysDept> csoPage = this.page(page, csoWrapper);
+        List<Map<String, Object>> csoMapList = csoPage.getRecords().stream().map(sysDept -> {
+            Map<String, Object> deptMap = MapUtil.newHashMap(2);
+            deptMap.put("deptId", sysDept.getDeptId());
+            deptMap.put("name", sysDept.getName());
+            return deptMap;
+        }).collect(Collectors.toList());
+        Page<Map<String, Object>> csoHnqzPage = BeanUtil.copyProperties(entPage, Page.class);
+        csoHnqzPage.setRecords(csoMapList);
+
+        Map<String, Object> resultMap = MapUtil.newHashMap(2);
+        resultMap.put("entPage", new HnqzPage<>(entHnqzPage));
+        resultMap.put("csoPage", new HnqzPage<>(csoHnqzPage));
+        return resultMap;
+    }
+
+    /**
+     * 获取分页
+     *
+     * @param entName 企业名称
+     * @param page    分页参数
+     * @return 翻页结果
+     */
+    @Override
+    public Page<SysEnterpriseRelationVO> pageEntRels(Page<SysEnterpriseRelationVO> page, String entName) {
+        return this.baseMapper.pageEntRels(page, entName);
+    }
 }

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff