Browse Source

当前组织级下级组织网格部门

master
zhaoqifeng 4 years ago
parent
commit
1fdc19d62b
  1. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java
  2. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/OrgTreeResultDTO.java
  3. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  4. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  5. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  6. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  7. 121
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java

@ -15,6 +15,10 @@ public class SubOrgFormDTO implements Serializable {
private static final long serialVersionUID = -3651225675593357002L;
@NotBlank(message = "组织ID不能为空")
private String agencyId;
/**
* 所属端 居民端resi工作端gov
*/
private String client;
/**
* 是否包括我1 0
*/

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/OrgTreeResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dataaggre.dto.govorg.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/16 16:50
*/
@Data
public class OrgTreeResultDTO implements Serializable {
private static final long serialVersionUID = -4304356050545598564L;
private String orgId;
private String orgName;
private String orgType;
private String orgPids;
private List<OrgTreeResultDTO> subOrgList;
}

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java

@ -165,4 +165,18 @@ public class GovOrgController {
return new Result<SubOrgResultDTO>().ok(govOrgService.getSubOrg(formDTO));
}
/**
* @Description 当前组织级下级组织树
* @Param tokenDto
* @Param formDTO
* @Return {@link Result< OrgTreeResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/17 14:02
*/
@PostMapping("agencytree")
public Result<OrgTreeResultDTO> getAgencyTree(@LoginUser TokenDto tokenDto, @RequestBody SubOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<OrgTreeResultDTO>().ok(govOrgService.getAgencyTree(tokenDto, formDTO));
}
}

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -18,10 +18,7 @@
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.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffOrgRelationResultDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -74,4 +71,10 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @return
*/
StaffOrgRelationResultDTO getStaffFromOrgType(@Param("staffId") String staffId);
OrgTreeResultDTO getOrgTree(@Param("agencyId") String agencyId);
List<OrgTreeResultDTO> getSubOrgList(@Param("pid") String pid);
OrgTreeResultDTO getResiOrgTree(@Param("agencyId") String agencyId);
List<OrgTreeResultDTO> getResiSubOrgList(@Param("pid") String pid);
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -135,4 +135,14 @@ public interface GovOrgService {
* @return
*/
StaffOrgRelationResultDTO getStaffFromOrgType(String staffId);
/**
* @Description 当前组织级下级组织树
* @Param tokenDto
* @Param formDTO
* @Return {@link OrgTreeResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/17 14:03
*/
OrgTreeResultDTO getAgencyTree(TokenDto tokenDto, SubOrgFormDTO formDTO);
}

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -491,4 +491,22 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getStaffFromOrgType(staffId);
}
/**
* @param tokenDto
* @param formDTO
* @Description 当前组织级下级组织树
* @Param tokenDto
* @Param formDTO
* @Return {@link OrgTreeResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/17 14:03
*/
@Override
public OrgTreeResultDTO getAgencyTree(TokenDto tokenDto, SubOrgFormDTO formDTO) {
if ("resi".equals(formDTO.getClient())) {
return customerAgencyDao.getResiOrgTree(formDTO.getAgencyId());
}
return customerAgencyDao.getOrgTree(formDTO.getAgencyId());
}
}

121
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -142,4 +142,125 @@
SELECT STAFF_ID,ORG_ID,ORG_TYPE FROM staff_org_relation WHERE del_flag = '0' AND staff_id = #{staffId}
</select>
<resultMap id="BaseResultMap" type="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO">
<result column="orgId" property="orgId"/>
<result column="orgName" property="orgName"/>
<result column="orgType" property="orgType"/>
<result column="orgPids" property="orgPids"/>
</resultMap>
<resultMap id="NodeTreeResult" type="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO"
extends="BaseResultMap">
<collection property="subOrgList" column="orgId" ofType="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO"
javaType="java.util.ArrayList" select="getSubOrgList">
</collection>
</resultMap>
<select id="getSubOrgList" resultMap="NodeTreeResult">
SELECT
*
FROM
(
SELECT
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
FROM
customer_agency a
WHERE
DEL_FLAG = 0
AND PID = #{pid} UNION
SELECT
cd.ID AS orgId,
DEPARTMENT_NAME AS orgName,
'dept' AS orgType,
CONCAT( PIDS, ca.ID, cd.ID ) AS orgPids
FROM
customer_department cd
INNER JOIN customer_agency ca ON cd.AGENCY_ID = ca.ID
WHERE
cd.DEL_FLAG = 0
AND cd.AGENCY_ID = #{pid} UNION
SELECT
ID AS orgId,
GRID_NAME AS orgName,
'grid' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
FROM
customer_grid
WHERE
DEL_FLAG = 0
AND PID = #{pid}
) a
ORDER BY
orgType,
orgId
</select>
<select id="getOrgTree" resultMap="NodeTreeResult">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgName,
CONCAT(PIDS,ID) AS orgPids
from
customer_agency
where
DEL_FLAG = 0
AND ID = #{agencyId}
</select>
<resultMap id="ResiNodeTreeResult" type="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO"
extends="BaseResultMap">
<collection property="subOrgList" column="orgId" ofType="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO"
javaType="java.util.ArrayList" select="getResiSubOrgList">
</collection>
</resultMap>
<select id="getResiSubOrgList" resultMap="ResiNodeTreeResult">
SELECT
*
FROM
(
SELECT
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
FROM
customer_agency a
WHERE
DEL_FLAG = 0
AND PID = #{pid} UNION
SELECT
ID AS orgId,
GRID_NAME AS orgName,
'grid' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
FROM
customer_grid
WHERE
DEL_FLAG = 0
AND PID = #{pid}
) a
ORDER BY
orgType,
orgId
</select>
<select id="getResiOrgTree" resultMap="ResiNodeTreeResult">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgName,
CONCAT(PIDS,ID) AS orgPids
from
customer_agency
where
DEL_FLAG = 0
AND ID = #{agencyId}
</select>
</mapper>

Loading…
Cancel
Save