Browse Source

组织树修改

master
zxc 5 years ago
parent
commit
362a930c47
  1. 14
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java
  2. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java
  3. 42
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java
  4. 8
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  5. 15
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

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

@ -29,6 +29,20 @@ public class TreeResultDTO implements Serializable {
@JsonIgnore @JsonIgnore
private String pids; private String pids;
/**
* 中心点位
*/
private List<Double> centerMark;
/**
* 机关级别
*/
@JsonIgnore
private String level;
@JsonIgnore
private String centerMarkA;
/** /**
* 子目录 * 子目录
*/ */

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

@ -17,10 +17,7 @@
package com.epmet.datareport.dao.screen; package com.epmet.datareport.dao.screen;
import com.epmet.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.screen.dto.result.*;
import com.epmet.screen.dto.result.BranchResultDTO;
import com.epmet.screen.dto.result.ParymemberDistributionResultDTO;
import com.epmet.screen.dto.result.UserDistributionResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -67,4 +64,12 @@ public interface ScreenCustomerGridDao {
*/ */
List<ParymemberDistributionResultDTO> selectParymemberDistribution(@Param("parentId")String parentId); List<ParymemberDistributionResultDTO> selectParymemberDistribution(@Param("parentId")String parentId);
/**
* @Description 查询机关下的网格
* @param agencyId
* @author zxc
* @date 2020/8/26 5:29 下午
*/
List<TreeResultDTO> selectGridInfo(@Param("agencyId")String agencyId);
} }

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

@ -15,6 +15,7 @@ import com.epmet.datareport.service.screen.AgencyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -52,11 +53,37 @@ public class AgencyServiceImpl implements AgencyService {
if (null == rootAgency){ if (null == rootAgency){
return new TreeResultDTO(); return new TreeResultDTO();
} }
List<TreeResultDTO> departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue():rootAgency.getPids().concat(",").concat(rootAgency.getValue())); List<Double> centerMark = this.getCenterMark(rootAgency.getCenterMarkA());
rootAgency.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark);
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){
List<TreeResultDTO> treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue());
rootAgency.setChildren(treeResultDTOS);
}else {
List<TreeResultDTO> departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue()));
rootAgency.setChildren(departmentList); rootAgency.setChildren(departmentList);
}
return rootAgency; return rootAgency;
} }
/**
* @Description 处理centerMark
* @param centerMark
* @author zxc
* @date 2020/8/26 5:18 下午
*/
public List<Double> getCenterMark(String centerMark){
if (centerMark.length() == NumConstant.ZERO) {
return new ArrayList<>();
}
List<Double> result = new ArrayList<>();
String substring = centerMark.substring(2, centerMark.length() - 2);
String[] split = substring.split(",");
for (String s : split) {
result.add(Double.valueOf(s));
}
return result;
}
/** /**
* @Description 递归查询填充下级 * @Description 递归查询填充下级
* @param subAgencyPids * @param subAgencyPids
@ -66,10 +93,21 @@ public class AgencyServiceImpl implements AgencyService {
private List<TreeResultDTO> getDepartmentList(String subAgencyPids) { private List<TreeResultDTO> getDepartmentList(String subAgencyPids) {
List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids); List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids);
if (subAgencyList.size() > NumConstant.ZERO) { if (subAgencyList.size() > NumConstant.ZERO) {
for (TreeResultDTO sub : subAgencyList) { subAgencyList.forEach(sub -> {
List<Double> centerMark = this.getCenterMark(sub.getCenterMarkA());
sub.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark);
if (sub.getLevel().equals(ScreenConstant.COMMUNITY)){
List<TreeResultDTO> treeResultDTOS = screenCustomerGridDao.selectGridInfo(sub.getValue());
treeResultDTOS.forEach(tree -> {
List<Double> centerMarkTree = this.getCenterMark(tree.getCenterMarkA());
tree.setCenterMark(centerMarkTree.size() == NumConstant.ZERO ? new ArrayList<>() : centerMarkTree);
});
sub.setChildren(treeResultDTOS);
}else {
List<TreeResultDTO> subAgency = getDepartmentList(sub.getPids() + "," + sub.getValue()); List<TreeResultDTO> subAgency = getDepartmentList(sub.getPids() + "," + sub.getValue());
sub.setChildren(subAgency); sub.setChildren(subAgency);
} }
});
} }
return subAgencyList; return subAgencyList;
} }

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

@ -8,7 +8,9 @@
SELECT SELECT
agency_name AS label, agency_name AS label,
agency_id AS value, agency_id AS value,
pids AS pids pids AS pids,
IFNULL(center_mark,'') AS centerMarkA,
level AS level
FROM FROM
screen_customer_agency screen_customer_agency
WHERE WHERE
@ -22,7 +24,9 @@
SELECT SELECT
agency_id AS value, agency_id AS value,
agency_name AS label, agency_name AS label,
pids AS pids pids AS pids,
IFNULL(center_mark,'') AS centerMarkA,
level AS level
FROM FROM
screen_customer_agency screen_customer_agency
WHERE WHERE

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

@ -67,4 +67,19 @@
AND scg.del_flag = 0 AND scg.del_flag = 0
AND sutd.parent_id = #{parentId} AND sutd.parent_id = #{parentId}
</select> </select>
<!-- 查询机关下的网格 -->
<select id="selectGridInfo" resultType="com.epmet.screen.dto.result.TreeResultDTO">
SELECT
grid_id AS value,
grid_name AS label,
IFNULL(center_mark,'') AS centerMarkA
FROM
screen_customer_grid
WHERE
del_flag = '0'
AND parent_agency_id = #{agencyId}
ORDER BY
created_time DESC
</select>
</mapper> </mapper>
Loading…
Cancel
Save