+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 客户部门表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Data
+public class CustomerDepartmentDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID 唯一标识
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 所属组织机构ID(customer_organization.id)AGENCY_ID
+ */
+ private String agencyId;
+
+ /**
+ * 部门名称
+ */
+ private String departmentName;
+
+ /**
+ * 部门职责
+ */
+ private String departmentDuty;
+
+ /**
+ * 总人数
+ */
+ private Integer totalUser;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java
new file mode 100644
index 0000000000..10620c89d2
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java
@@ -0,0 +1,126 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 人员-机关单位关系表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Data
+public class CustomerStaffAgencyDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 组织机构ID customer_agency.id
+ */
+ private String agencyId;
+
+ /**
+ * 删除标识
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerStaffDepartmentDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerStaffDepartmentDTO.java
new file mode 100644
index 0000000000..08bab4309f
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerStaffDepartmentDTO.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 部门人员关系表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Data
+public class CustomerStaffDepartmentDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 部门ID customer_department.id
+ */
+ private String departmentId;
+
+ /**
+ * 删除标识
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerStaffGridDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerStaffGridDTO.java
new file mode 100644
index 0000000000..61fabd36c0
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerStaffGridDTO.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 工作人员调动记录表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-08-27
+ */
+@Data
+public class StaffTransferRecordDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 调动人员Id(操作人)
+ */
+ private String operateStaffId;
+
+ /**
+ * 被调动人员Id
+ */
+ private String operatedStaffId;
+
+ /**
+ * 调动前组织Id
+ */
+ private String oldAgencyId;
+
+ /**
+ * 调动后组织Id
+ */
+ private String agencyId;
+
+ /**
+ * 备注说明
+ */
+ private String remarks;
+
+ /**
+ * 删除标识
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/UserIdAndPidDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/UserIdAndPidDTO.java
new file mode 100644
index 0000000000..0fc0abf32c
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/UserIdAndPidDTO.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 网格人员关系表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Data
+public class UserIdAndPidDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * 用户id, user.id
+ */
+ private String userId;
+
+ /**
+ * pid 所属机关id
+ */
+ private String pid;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/UserIdDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/UserIdDTO.java
new file mode 100644
index 0000000000..bb9a694d53
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/UserIdDTO.java
@@ -0,0 +1,21 @@
+package com.epmet.dataaggre.dto.govorg;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Auther zxc
+ * @Create 2020-04-24 9:06
+ */
+@Data
+public class UserIdDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * userId
+ */
+ private String userId;
+
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/.gitkeep b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/AgencyGridListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/AgencyGridListResultDTO.java
new file mode 100644
index 0000000000..11511bedf4
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/AgencyGridListResultDTO.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 组织、网格树结构
+ *
+ * @author sun
+ */
+@Data
+public class AgencyGridListResultDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 树结构对象
+ */
+ private AgencyGridResultDTO agencyGridList;
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/AgencyGridResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/AgencyGridResultDTO.java
new file mode 100644
index 0000000000..8066a7cc16
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/AgencyGridResultDTO.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg.result;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 获取工作人员所属组织及下级组织和网格树结构-接口返参
+ *
+ * @author sun
+ */
+@Data
+public class AgencyGridResultDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 机关组织Id
+ */
+ private String agencyId = "";
+ /**
+ * 机关组织名称
+ */
+ private String agencyName = "";
+ /**
+ * 当前机关的下属网格列表
+ */
+ private List gridList = new ArrayList<>();
+ /**
+ * 当前组织的所有下级组织信息(递归)
+ */
+ private List subAgencyGridList = new ArrayList<>();
+ /**
+ * 所有上级组织机构ID(以英文:隔开)
+ */
+ @JsonIgnore
+ private String pids = "";
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridInfoResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridInfoResultDTO.java
new file mode 100644
index 0000000000..45618fbff5
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridInfoResultDTO.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dto.govorg.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 获取工作人员所属组织及下级组织和网格树结构-接口返参
+ *
+ * @author sun
+ */
+@Data
+public class GridInfoResultDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 机关组织Id
+ */
+ private String gridId = "";
+ private String gridName = "";
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
index bc1799d843..b96c22263d 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
@@ -1,5 +1,12 @@
package com.epmet.dataaggre.controller;
+import com.epmet.commons.tools.annotation.LoginUser;
+import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dataaggre.dto.govorg.result.AgencyGridListResultDTO;
+import com.epmet.dataaggre.service.govorg.GovOrgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -8,6 +15,23 @@ import org.springframework.web.bind.annotation.RestController;
* @DateTime 2020/12/25 上午9:45
*/
@RestController
-@RequestMapping("govorg")
+@RequestMapping("org")
public class GovOrgController {
+
+ @Autowired
+ private GovOrgService govOrgService;
+
+
+ /**
+ * @param tokenDTO
+ * @Author sun
+ * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
+ **/
+ @PostMapping("agencygridlist")
+ public Result agencyGridList(@LoginUser TokenDto tokenDTO) {
+ AgencyGridListResultDTO agencyGridList = new AgencyGridListResultDTO();
+ agencyGridList.setAgencyGridList(govOrgService.agencyGridList(tokenDTO.getUserId()));
+ return new Result().ok(agencyGridList);
+ }
+
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
index b35728830b..de8b19b050 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
@@ -18,8 +18,12 @@
package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* 机关单位信息表
@@ -29,4 +33,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerAgencyDao extends BaseDao {
+
+ /**
+ * @Author sun
+ * @Description 递归查询当前机关的下一级机关列表
+ **/
+ List selectAllSubAgency(@Param("subPids") String subPids);
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
index ff6db1850e..a58bc9c32e 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
@@ -18,8 +18,12 @@
package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* 客户网格表
@@ -30,4 +34,10 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerGridDao extends BaseDao {
+ /**
+ * @Author sun
+ * @Description 查询组织下直属网格列表
+ **/
+ List selectAgencyGridList(@Param("agencyId") String agencyId);
+
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java
index 5446078ac1..f8b58c698b 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java
@@ -18,8 +18,10 @@
package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
import com.epmet.dataaggre.entity.govorg.CustomerStaffAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
/**
* 人员-机关单位关系表
@@ -30,4 +32,10 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerStaffAgencyDao extends BaseDao {
+ /**
+ * @Author sun
+ * @Description 根据staffId查询客户、组织信息
+ **/
+ CustomerStaffAgencyDTO selectByStaffId(@Param("userId") String userId);
+
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
index 862a7babc5..6e3a6d0904 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
@@ -1,8 +1,18 @@
package com.epmet.dataaggre.service.govorg;
+import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
+
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:15
*/
public interface GovOrgService {
+
+ /**
+ * @param staffId
+ * @Author sun
+ * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
+ **/
+ AgencyGridResultDTO agencyGridList(String staffId);
+
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
index ce2b198850..ab8bf7ea61 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
@@ -1,11 +1,25 @@
package com.epmet.dataaggre.service.govorg.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
+import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.exception.RenException;
import com.epmet.dataaggre.constant.DataSourceConstant;
+import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao;
+import com.epmet.dataaggre.dao.govorg.CustomerGridDao;
+import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao;
+import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
+import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
+import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO;
+import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:15
@@ -14,4 +28,63 @@ import org.springframework.stereotype.Service;
@DataSource(DataSourceConstant.GOV_ORG)
@Slf4j
public class GovOrgServiceImpl implements GovOrgService {
+ private static final Logger logger = LoggerFactory.getLogger(GovOrgServiceImpl.class);
+
+ @Autowired
+ private CustomerAgencyDao customerAgencyDao;
+ @Autowired
+ private CustomerStaffAgencyDao customerStaffAgencyDao;
+ @Autowired
+ private CustomerGridDao customerGridDao;
+
+
+ /**
+ * @param staffId
+ * @Author sun
+ * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
+ **/
+ @Override
+ public AgencyGridResultDTO agencyGridList(String staffId) {
+ AgencyGridResultDTO returnDTO = new AgencyGridResultDTO();
+
+ //1:根据staffId查询该工作人员对应的机关Id、客户Id
+ CustomerStaffAgencyDTO staffAgencyDTO = customerStaffAgencyDao.selectByStaffId(staffId);
+ if (null == staffAgencyDTO || null == staffAgencyDTO.getId()) {
+ throw new RenException(String.format("获取工作人员组织信息失败,staffId->%s", staffId));
+ }
+
+ //2:查询当前组织机关信息
+ CustomerAgencyEntity agencyEntity = customerAgencyDao.selectById(staffAgencyDTO.getAgencyId());
+ returnDTO.setAgencyId(agencyEntity.getId());
+ returnDTO.setAgencyName(agencyEntity.getOrganizationName());
+
+ //3:查询当前机关下的网格列表
+ List gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
+ returnDTO.setGridList(gridList);
+
+ //4:递归查询当前组织的下级组织以及每个下级组织对应的网格列表
+ //根组织pids为空
+ List subAgencyGridList = getGridList(("".equals(agencyEntity.getPids()) ? "" : agencyEntity.getPids() + ":") + agencyEntity.getId());
+ returnDTO.setSubAgencyGridList(subAgencyGridList);
+
+ return returnDTO;
+ }
+
+ /**
+ * @Author sun
+ * @Description 递归查询当前机关的下一级机关列表
+ **/
+ private List getGridList(String subPids) {
+ List subAgencyList = customerAgencyDao.selectAllSubAgency(subPids);
+ if (subAgencyList.size() > NumConstant.ZERO) {
+ for (AgencyGridResultDTO sub : subAgencyList) {
+ List gridList = customerGridDao.selectAgencyGridList(sub.getAgencyId());
+ sub.setGridList(gridList);
+ List subAgency = getGridList(sub.getPids() + ":" + sub.getAgencyId());
+ sub.setSubAgencyGridList(subAgency);
+ }
+ }
+ return subAgencyList;
+ }
+
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
index d8f7048a54..b0b9200359 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
@@ -3,24 +3,18 @@
-
- ca.id AS "id",
- ca.customer_id AS "customerId",
- ca.pid AS "pid",
- ca.pids AS "pids",
- ca.all_parent_name AS "allParentName",
- ca.organization_name AS "organizationName",
- ca.level AS "level",
- ca.area_code AS "areaCode",
- ca.total_user AS "totalUser",
- ca.province AS "province",
- ca.city AS "city",
- ca.district AS "district",
- ca.del_flag AS "delflag",
- ca.revision AS "revision",
- ca.created_by AS "createdby",
- ca.created_time AS "createdtime",
- ca.updated_by AS "updatedby",
- ca.updated_time AS "updatedtime"
-
+
+
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
index 37c6addcbb..1e5bced068 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
@@ -2,4 +2,16 @@
+
+
+
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml
index 7b0b7a02c5..50269ca116 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml
@@ -2,4 +2,18 @@
+
+
+
\ No newline at end of file