|
@@ -9,11 +9,9 @@ import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
|
|
|
import com.sooka.sponest.data.digitalresource.domain.CenterdataTFarmGrid;
|
|
|
import com.sooka.sponest.data.digitalresource.domain.bo.VisuGridBO;
|
|
|
import com.sooka.sponest.data.digitalresource.mapper.CenterdataTFarmGridMapper;
|
|
|
-import com.sooka.sponest.data.digitalresource.service.ICenterdataTFarmGridLengthService;
|
|
|
import com.sooka.sponest.data.digitalresource.service.ICenterdataTFarmGridService;
|
|
|
import com.sooka.sponest.data.digitalwater.domain.CenterdataTHydraulicRiverLength;
|
|
|
import com.sooka.sponest.data.digitalwater.service.ICenterdataTHydraulicRiverLengthService;
|
|
|
-import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -32,14 +30,8 @@ public class CenterdataTFarmGridServiceImpl extends BaseServiceImpl implements I
|
|
|
private CenterdataTFarmGridMapper centerdataTFarmGridMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICenterdataTFarmGridLengthService centerdataTFarmGridLengthService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private ICenterdataTHydraulicRiverLengthService iCenterdataTHydraulicRiverLengthService;
|
|
|
|
|
|
- private static final String PARENTID = "parentId";
|
|
|
- private static final String ID = "id";
|
|
|
-
|
|
|
/**
|
|
|
* 查询农业网格管理列表
|
|
|
*
|
|
@@ -58,69 +50,6 @@ public class CenterdataTFarmGridServiceImpl extends BaseServiceImpl implements I
|
|
|
return centerdataTFarmGridMapper.selectCenterdataTFarmGridListTree(centerdataTFarmGrid);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 构建前端所需要树结构
|
|
|
- *
|
|
|
- * @param depts 部门列表
|
|
|
- * @return 树结构列表
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<Map<String, Object>> buildDeptTree(List<Map<String, Object>> depts) {
|
|
|
- List<Map<String, Object>> returnList = new ArrayList<>();
|
|
|
- List<String> tempList = new ArrayList<>();
|
|
|
- for (Map<String, Object> dept : depts) {
|
|
|
- tempList.add(MapUtils.getString(dept, ID));
|
|
|
- }
|
|
|
- for (Map<String, Object> dept : depts) {
|
|
|
- // 如果是顶级节点, 遍历该父节点的所有子节点
|
|
|
- if (!tempList.contains(MapUtils.getString(dept, PARENTID))) {
|
|
|
- recursionFn(depts, dept);
|
|
|
- returnList.add(dept);
|
|
|
- }
|
|
|
- }
|
|
|
- if (returnList.isEmpty()) {
|
|
|
- returnList = depts;
|
|
|
- }
|
|
|
- return returnList;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 递归列表
|
|
|
- */
|
|
|
- private void recursionFn(List<Map<String, Object>> list, Map<String, Object> t) {
|
|
|
- // 得到子节点列表
|
|
|
- List<Map<String, Object>> childList = getChildList(list, t);
|
|
|
- t.put("children", childList);
|
|
|
- for (Map<String, Object> tChild : childList) {
|
|
|
- if (hasChild(list, tChild)) {
|
|
|
- recursionFn(list, tChild);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 得到子节点列表
|
|
|
- */
|
|
|
- private List<Map<String, Object>> getChildList(List<Map<String, Object>> list, Map<String, Object> t) {
|
|
|
- List<Map<String, Object>> tlist = new ArrayList<>();
|
|
|
- Iterator<Map<String, Object>> it = list.iterator();
|
|
|
- while (it.hasNext()) {
|
|
|
- Map<String, Object> n = it.next();
|
|
|
- if (StringUtils.isNotNull(MapUtils.getString(n, PARENTID)) && MapUtils.getString(n, PARENTID).equals(MapUtils.getString(t, ID))) {
|
|
|
- tlist.add(n);
|
|
|
- }
|
|
|
- }
|
|
|
- return tlist;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 判断是否有子节点
|
|
|
- */
|
|
|
- private boolean hasChild(List<Map<String, Object>> list, Map<String, Object> t) {
|
|
|
- return !getChildList(list, t).isEmpty();
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public CenterdataTFarmGrid selectCenterdataTFarmGridById(String id) {
|
|
|
CenterdataTFarmGrid centerdataTFarmGrid = centerdataTFarmGridMapper.selectCenterdataTFarmGridById(id);
|
|
@@ -207,7 +136,6 @@ public class CenterdataTFarmGridServiceImpl extends BaseServiceImpl implements I
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Map selectGridLandInfo(VisuGridBO visuGridBO) {
|
|
|
Map result = new HashMap();
|
|
@@ -217,10 +145,6 @@ public class CenterdataTFarmGridServiceImpl extends BaseServiceImpl implements I
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> selectCommunicationList(CenterdataTFarmGrid grid) {
|
|
|
- return centerdataTFarmGridMapper.selectCommunicationList(grid);
|
|
|
- }
|
|
|
- @Override
|
|
|
public List<CenterdataTFarmGrid> select(CenterdataTFarmGrid centerdataTFarmGrid) {
|
|
|
return centerdataTFarmGridMapper.select(centerdataTFarmGrid);
|
|
|
}
|