|
@ -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.setChildren(departmentList); |
|
|
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); |
|
|
|
|
|
} |
|
|
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<TreeResultDTO> subAgency = getDepartmentList(sub.getPids() + "," + sub.getValue()); |
|
|
List<Double> centerMark = this.getCenterMark(sub.getCenterMarkA()); |
|
|
sub.setChildren(subAgency); |
|
|
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()); |
|
|
|
|
|
sub.setChildren(subAgency); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
return subAgencyList; |
|
|
return subAgencyList; |
|
|
} |
|
|
} |
|
|