Browse Source

组织区域查询

dev_shibei_match
zxc 5 years ago
parent
commit
c5d22cb697
  1. 11
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java
  2. 14
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java
  3. 24
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java
  4. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java
  5. 26
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java
  6. 30
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  7. 16
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

11
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java

@ -0,0 +1,11 @@
package com.epmet.screen.constant;
/**
* @Author zxc
* @DateTime 2020/8/18 5:02 下午
*/
public interface ScreenConstant {
String COMMUNITY = "community";
}

14
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -29,8 +30,19 @@ public class CompartmentResultDTO implements Serializable {
*/
private String areaMarks;
/**
* 机关级别
* 社区级community
* 街道:street,
* 区县级: district,
* 市级: city
* 省级:province
*/
@JsonIgnore
private String level;
/**
* 子级用户分布
*/
private List<AgencyDistributionResultDTO> userDistribution;
private List<AgencyDistributionResultDTO> agencyDistribution;
}

24
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java

@ -17,6 +17,8 @@
package com.epmet.datareport.dao.screen;
import com.epmet.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.screen.dto.result.CompartmentResultDTO;
import com.epmet.screen.dto.result.TreeResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -40,6 +42,28 @@ public interface ScreenCustomerAgencyDao {
*/
TreeResultDTO selectRootAgencyId(@Param("customerId")String customerId);
/**
* @Description 查询下级机关的 名称和id
* @param subAgencyPids
* @author zxc
* @date 2020/8/18 4:48 下午
*/
List<TreeResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids);
/**
* @Description 查询当前机关的区域信息
* @param agencyId
* @author zxc
* @date 2020/8/18 4:51 下午
*/
CompartmentResultDTO getAgencyAreaInfo(@Param("agencyId")String agencyId);
/**
* @Description 查询子级区域分布信息机关级别
* @param agencyId
* @author zxc
* @date 2020/8/18 5:12 下午
*/
List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java

@ -17,7 +17,11 @@
package com.epmet.datareport.dao.screen;
import com.epmet.screen.dto.result.AgencyDistributionResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 网格信息
@ -27,5 +31,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ScreenCustomerGridDao {
/**
* @Description 查询子级区域分布信息网格级别
* @param agencyId
* @author zxc
* @date 2020/8/18 5:12 下午
*/
List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId);
}

26
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java

@ -1,10 +1,11 @@
package com.epmet.datareport.service.screen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.datareport.dao.screen.ScreenCustomerAgencyDao;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.datareport.dao.screen.ScreenCustomerGridDao;
import com.epmet.screen.dto.form.CompartmentFormDTO;
import com.epmet.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.screen.constant.*;
import com.epmet.screen.dto.result.CompartmentResultDTO;
import com.epmet.screen.dto.result.TreeResultDTO;
import com.epmet.datareport.service.screen.AgencyService;
@ -22,10 +23,10 @@ import java.util.List;
@Service
public class AgencyServiceImpl implements AgencyService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
/**
* @Description 1组织机构树
@ -47,6 +48,12 @@ public class AgencyServiceImpl implements AgencyService {
return rootAgency;
}
/**
* @Description 递归查询填充下级
* @param subAgencyPids
* @author zxc
* @date 2020/8/18 4:42 下午
*/
private List<TreeResultDTO> getDepartmentList(String subAgencyPids) {
List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids);
if (subAgencyList.size() > NumConstant.ZERO) {
@ -66,6 +73,15 @@ public class AgencyServiceImpl implements AgencyService {
*/
@Override
public CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO) {
return null;
CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(compartmentFormDTO.getAgencyId());
if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){
// 当level为"community"时,查询screen_customer_grid表
List<AgencyDistributionResultDTO> agencyDistributionResultDTOS = screenCustomerGridDao.selectSubDistribution(compartmentFormDTO.getAgencyId());
agencyAreaInfo.setAgencyDistribution(agencyDistributionResultDTOS);
}else {
List<AgencyDistributionResultDTO> agencyDistributionResultDTOS = screenCustomerAgencyDao.selectSubDistribution(compartmentFormDTO.getAgencyId());
agencyAreaInfo.setAgencyDistribution(agencyDistributionResultDTOS);
}
return agencyAreaInfo;
}
}

30
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -17,6 +17,7 @@
AND customer_id = #{customerId}
</select>
<!-- 查询下级机关的 名称和id -->
<select id="selectSubAgencyList" resultType="com.epmet.screen.dto.result.TreeResultDTO">
SELECT
agency_id AS value,
@ -31,4 +32,33 @@
created_time DESC
</select>
<!-- 查询当前机关的区域信息 -->
<select id="getAgencyAreaInfo" resultType="com.epmet.screen.dto.result.CompartmentResultDTO">
SELECT
agency_id AS agencyId,
agency_name AS name,
area_marks AS areaMarks,
level AS level
FROM
screen_customer_agency
WHERE
del_flag = 0
AND agency_id = #{agencyId}
</select>
<!-- 查询子级区域分布信息【机关级别】 -->
<select id="selectSubDistribution" resultType="com.epmet.screen.dto.result.AgencyDistributionResultDTO">
SELECT
agency_id AS subId,
agency_name AS subName,
area_marks AS subAreaMarks,
center_mark AS subCenterMark,
'agency' AS type
FROM
screen_customer_agency
WHERE
del_flag = 0
AND pid = #{agencyId}
</select>
</mapper>

16
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

@ -3,6 +3,18 @@
<mapper namespace="com.epmet.datareport.dao.screen.ScreenCustomerGridDao">
<!-- 查询子级区域分布信息 -->
<select id="selectSubDistribution" resultType="com.epmet.screen.dto.result.AgencyDistributionResultDTO">
SELECT
grid_id AS subId,
grid_name AS subName,
area_marks AS subAreaMarks,
center_mark AS subCenterMark,
'grid' AS type
FROM
screen_customer_grid
WHERE
del_flag = 0
AND parent_agency_id = #{agencyId}
</select>
</mapper>
Loading…
Cancel
Save