|
@@ -0,0 +1,540 @@
|
|
|
|
+package com.sooka.sponest.data.commandcenter.service.impl;
|
|
|
|
+
|
|
|
|
+import com.ruoyi.common.core.utils.SpringUtils;
|
|
|
|
+import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
+import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
|
|
|
|
+import com.ruoyi.common.security.utils.DictUtils;
|
|
|
|
+import com.ruoyi.system.api.RemoteConfigService;
|
|
|
|
+import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
|
|
|
|
+import com.sooka.sponest.data.commandcenter.domian.AreaBody;
|
|
|
|
+import com.sooka.sponest.data.commandcenter.domian.CommandCenterBO;
|
|
|
|
+import com.sooka.sponest.data.commandcenter.domian.ProjectBody;
|
|
|
|
+import com.sooka.sponest.data.commandcenter.mapper.CommandCenterMapper;
|
|
|
|
+import com.sooka.sponest.data.commandcenter.service.ICommandCenterService;
|
|
|
|
+import com.sooka.sponest.data.digitalagriculture.domain.bo.AgricultureViewBO;
|
|
|
|
+import com.sooka.sponest.data.digitalagriculture.service.IAgricultureViewService;
|
|
|
|
+import com.sooka.sponest.data.digitalemergency.service.IEmergencyViewService;
|
|
|
|
+import com.sooka.sponest.data.digitalenvironment.service.IEnvironmentViewService;
|
|
|
|
+import com.sooka.sponest.data.digitalfirecontrol.service.IFireControlViewService;
|
|
|
|
+import com.sooka.sponest.data.digitalforest.service.IForestViewService;
|
|
|
|
+import com.sooka.sponest.data.digitalresource.domain.CenterdataTFarmGrid;
|
|
|
|
+import com.sooka.sponest.data.digitalresource.service.ICenterdataTFarmGridService;
|
|
|
|
+import com.sooka.sponest.data.digitalresource.service.IResourceViewService;
|
|
|
|
+import com.sooka.sponest.data.digitaltraffic.service.ITrafficViewService;
|
|
|
|
+import com.sooka.sponest.data.digitalwater.service.IWaterViewService;
|
|
|
|
+import com.sooka.sponest.data.generalbusiness.domain.CenterdataTForestNetworkprocessing;
|
|
|
|
+import com.sooka.sponest.data.generalbusiness.domain.CenterdataTKeyProjectsSchedule;
|
|
|
|
+import com.sooka.sponest.data.utils.BigDecimalUtil;
|
|
|
|
+import com.sooka.sponest.data.utils.DataConstants;
|
|
|
|
+import com.sooka.sponest.data.utils.TreeUtil;
|
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
|
+
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @author hanfucheng
|
|
|
|
+ * @date 2023/4/25 9:44
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class ICommandCenterServiceImpl extends BaseServiceImpl implements ICommandCenterService {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommandCenterMapper commandCenterMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICenterdataTFarmGridService centerdataTFarmGridService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAgricultureViewService agricultureViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IEmergencyViewService emergencyViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IEnvironmentViewService environmentViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IFireControlViewService fireControlViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IForestViewService forestViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IResourceViewService resourceViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITrafficViewService trafficViewService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IWaterViewService waterViewService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> fourLengthOverview(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ resultMap.put("total", commandCenterMapper.getFourLengthCount(commandCenterBO));
|
|
|
|
+ resultMap.put("patrol", commandCenterMapper.getFourLengthPatrolDistance(commandCenterBO));
|
|
|
|
+ return resultMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> getOverview(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> mapList = commandCenterMapper.getOverview(commandCenterBO);
|
|
|
|
+ Map<String, Object> result = new LinkedHashMap<>();
|
|
|
|
+ for (int a = 1; a <= 4; a++) {
|
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
|
+ if (String.valueOf(a).equals(MapUtils.getString(map, "name"))) {
|
|
|
|
+ result.put(String.valueOf(a), map.get("num"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.putIfAbsent(String.valueOf(a), 0);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int fourLengNum(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ return commandCenterMapper.getFourLengthCount(commandCenterBO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> patrolDistance(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ return commandCenterMapper.getFourLengthPatrolDistance(commandCenterBO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> planDegree(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> list = commandCenterMapper.planDegree(commandCenterBO);
|
|
|
|
+ return fill(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> taskDegree(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> list = commandCenterMapper.taskDegree(commandCenterBO);
|
|
|
|
+ return fill(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String, Object> fill(List<Map<String, Object>> list) {
|
|
|
|
+ Map<String, Object> result = new LinkedHashMap<>();
|
|
|
|
+ String[] number = {"1", "2", "3", "6"};
|
|
|
|
+ for (String s : number) {
|
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
+ if (s.equals(MapUtils.getString(map, "name"))) {
|
|
|
|
+ result.put(s, map.get("num"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.putIfAbsent(s, "0.00");
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 重点工程
|
|
|
|
+ *
|
|
|
|
+ * @param commandCenterBO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<ProjectBody> getKeyProjects(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<ProjectBody> projectBodies = commandCenterMapper.getKeyProjects(commandCenterBO);
|
|
|
|
+ List<String> projectIds = projectBodies.stream().map(ProjectBody::getProjectId).collect(Collectors.toList());
|
|
|
|
+ commandCenterBO.getParams().put("projectIds", projectIds);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> environmentMap = DictUtils.getDictCacheToMap("centerdata_environment");
|
|
|
|
+ Map<String, Object> zjNatureMap = DictUtils.getDictCacheToMap("centerdata_zj_nature");
|
|
|
|
+ Map<String, Object> industryTypeMap = DictUtils.getDictCacheToMap("centerdata_industry_type");
|
|
|
|
+ Map<String, Object> parkMap = DictUtils.getDictCacheToMap("centerdata_park");
|
|
|
|
+ projectBodies.forEach(item -> {
|
|
|
|
+ if (!StringUtils.isEmpty(item.getEnvironment()) && environmentMap.containsKey(item.getEnvironment())){
|
|
|
|
+ item.setEnvironment(environmentMap.get(item.getEnvironment()).toString());
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(item.getNature()) && zjNatureMap.containsKey(item.getNature())){
|
|
|
|
+ item.setNature(zjNatureMap.get(item.getNature()).toString());
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(item.getIndustryType()) && industryTypeMap.containsKey(item.getIndustryType())){
|
|
|
|
+ item.setIndustryType(industryTypeMap.get(item.getIndustryType()).toString());
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(item.getPark()) && parkMap.containsKey(item.getPark())){
|
|
|
|
+ item.setPark(parkMap.get(item.getPark()).toString());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ List<Map<String, Object>> cameraList = commandCenterMapper.getKeyProjectsCamera(commandCenterBO);
|
|
|
|
+ projectBodies.forEach(project -> cameraList.forEach(item -> {
|
|
|
|
+ if (project.getProjectId().equals(MapUtils.getString(item, "projectId"))) {
|
|
|
|
+ project.getCameraList().add(item);
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ List<CenterdataTKeyProjectsSchedule> scheduleList = commandCenterMapper.getKeyProjectsSchedule(commandCenterBO);
|
|
|
|
+ projectBodies.forEach(project -> scheduleList.forEach(schedule -> {
|
|
|
|
+ if (project.getProjectId().equals(schedule.getKeyProjectsId())) {
|
|
|
|
+ project.getScheduleList().add(schedule);
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ return projectBodies;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 重点区域
|
|
|
|
+ *
|
|
|
|
+ * @param commandCenterBO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<AreaBody> getImportAreaList(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<AreaBody> typeList = commandCenterMapper.getImportAreaType(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> areaList = commandCenterMapper.getImportAreaList(commandCenterBO);
|
|
|
|
+ List<String> areaIds = areaList.stream().map(item -> MapUtils.getString(item, "id")).collect(Collectors.toList());
|
|
|
|
+ commandCenterBO.getParams().put("areaIds", areaIds);
|
|
|
|
+ List<Map<String, Object>> cameraList = commandCenterMapper.getImportAreaCamera(commandCenterBO);
|
|
|
|
+ // 区域绑定摄像头
|
|
|
|
+ areaList.forEach(area -> {
|
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
+ cameraList.forEach(camera -> {
|
|
|
|
+ if (MapUtils.getString(area, "id").equals(MapUtils.getString(camera, "areaId"))) {
|
|
|
|
+ list.add(camera);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ area.put("cameraList", list);
|
|
|
|
+ });
|
|
|
|
+ // 类型绑定区域
|
|
|
|
+ typeList.forEach(type -> areaList.forEach(item -> {
|
|
|
|
+ if (type.getAreaType().equals(MapUtils.getString(item, "projectType"))) {
|
|
|
|
+ type.getAreaList().add(item);
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ return typeList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 重点区域 分页
|
|
|
|
+ *
|
|
|
|
+ * @param commandCenterBO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> getImportAreaListPage(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> areaList = commandCenterMapper.getImportAreaList(commandCenterBO);
|
|
|
|
+ List<String> areaIds = areaList.stream().map(item -> MapUtils.getString(item, "id")).collect(Collectors.toList());
|
|
|
|
+ commandCenterBO.getParams().put("areaIds", areaIds);
|
|
|
|
+ List<Map<String, Object>> cameraList = commandCenterMapper.getImportAreaCamera(commandCenterBO);
|
|
|
|
+ // 区域绑定摄像头
|
|
|
|
+ areaList.forEach(area -> {
|
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
+ cameraList.forEach(camera -> {
|
|
|
|
+ if (MapUtils.getString(area, "id").equals(MapUtils.getString(camera, "areaId"))) {
|
|
|
|
+ list.add(camera);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ area.put("cameraList", list);
|
|
|
|
+ });
|
|
|
|
+ return areaList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 一网通办
|
|
|
|
+ *
|
|
|
|
+ * @param commandCenterBO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public CenterdataTForestNetworkprocessing allAtOnce(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ // 查询当天的数据实例
|
|
|
|
+ commandCenterBO.setTimeTag("0");
|
|
|
|
+ CenterdataTForestNetworkprocessing networkprocessing = commandCenterMapper.allAtOnce(commandCenterBO);
|
|
|
|
+ if (StringUtils.isNull(networkprocessing)) {
|
|
|
|
+ return null;// 当天数据为null,直接返回空对象
|
|
|
|
+ }
|
|
|
|
+ // 设置前日大厅办件总数
|
|
|
|
+ Long yesTodayTotal = 0L;
|
|
|
|
+ commandCenterBO.setTimeTag("1");
|
|
|
|
+ CenterdataTForestNetworkprocessing yestodaynetworkprocessing = commandCenterMapper.allAtOnce(commandCenterBO);
|
|
|
|
+ if (StringUtils.isNotNull(yestodaynetworkprocessing) && StringUtils.isNotNull(yestodaynetworkprocessing.getHallProcessingTotalNumber())) {
|
|
|
|
+ yesTodayTotal = yestodaynetworkprocessing.getHallProcessingTotalNumber();
|
|
|
|
+ }
|
|
|
|
+ networkprocessing.setPreviousDayHallProcessingTotalNumber(yesTodayTotal);
|
|
|
|
+ // 设置同比
|
|
|
|
+ String num = BigDecimalUtil.getPercentage(BigDecimalUtil.subtractionDouble(networkprocessing.getHallProcessingTotalNumber().doubleValue(),
|
|
|
|
+ yesTodayTotal.doubleValue(), 2), yesTodayTotal.doubleValue());
|
|
|
|
+ networkprocessing.setUpDown(num);
|
|
|
|
+ // 设置法人办结率
|
|
|
|
+ num = BigDecimalUtil.getPercentage(networkprocessing.getLegalPersonCompletionNumber().doubleValue(), networkprocessing.getLegalPersonProcessingNumber().doubleValue());
|
|
|
|
+ networkprocessing.setLegalPersonCompletionRate(num);
|
|
|
|
+ // 设置自然人办件办结率
|
|
|
|
+ num = BigDecimalUtil.getPercentage(networkprocessing.getNaturalPersonCompletionNumber().doubleValue(), networkprocessing.getNaturalPersonProcessingNumber().doubleValue());
|
|
|
|
+ networkprocessing.setNaturalPersonCompletionRate(num);
|
|
|
|
+ return networkprocessing;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Object searchAllYouWant(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ Object obj = null;
|
|
|
|
+ if ("操作手册".equals(commandCenterBO.getKeyWord())) {
|
|
|
|
+ String prefix = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("downloadUrl").getData();
|
|
|
|
+ List<Map<String, Object>> result = commandCenterMapper.getOperationManual(commandCenterBO);
|
|
|
|
+ result.forEach(item -> {
|
|
|
|
+ String path = MapUtils.getString(item, "path");
|
|
|
|
+ String group = path.substring(0, path.indexOf('/'));
|
|
|
|
+ item.put("path", prefix + "Download?fileName=" + MapUtils.getString(item, "fileName")
|
|
|
|
+ + "&&group=" + group + "&&path=" + path.substring(path.indexOf('/') + 1));
|
|
|
|
+ });
|
|
|
|
+ obj = result;
|
|
|
|
+ }
|
|
|
|
+ return obj;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @DataScopeMutiDept(deptAlias = "d")
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> fourLengthOverTree(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ if ("1".equals(commandCenterBO.getTimeTag())) {
|
|
|
|
+ List<Map<String, Object>> resultList = commandCenterMapper.getForestGridLevel(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> lineList = commandCenterMapper.getLineList(commandCenterBO);
|
|
|
|
+ return TreeUtil.listToTree(lineList, resultList);
|
|
|
|
+ }
|
|
|
|
+ // 获取河长、路长、田长
|
|
|
|
+ List<Map<String, Object>> leaderList = commandCenterMapper.getLeaderList(commandCenterBO);
|
|
|
|
+ // 获取所有网格
|
|
|
|
+ CenterdataTFarmGrid grid = new CenterdataTFarmGrid();
|
|
|
|
+ grid.setType(commandCenterBO.getTimeTag());
|
|
|
|
+ List<Map<String, Object>> gridList = centerdataTFarmGridService.selectCenterdataTFarmGridListTree(grid);
|
|
|
|
+ return TreeUtil.getAllTreeNew(leaderList, gridList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @DataScopeMutiDept(deptAlias = "d")
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> fourLengthOver(CommandCenterBO commandCenterBO) {
|
|
|
|
+ setSookaDataBase(commandCenterBO);
|
|
|
|
+ List<Map<String, Object>> resultList = getForestLeader(commandCenterBO);
|
|
|
|
+ if (resultList != null) return resultList;
|
|
|
|
+ // 获取河长、路长、田长 2,3,6
|
|
|
|
+ List<Map<String, Object>> leaderList = commandCenterMapper.getLeaderList(commandCenterBO);
|
|
|
|
+ // 获取所有网格
|
|
|
|
+ CenterdataTFarmGrid grid = new CenterdataTFarmGrid();
|
|
|
|
+ grid.setType(commandCenterBO.getTimeTag());
|
|
|
|
+ List<Map<String, Object>> gridList = new ArrayList<>();
|
|
|
|
+ List<Map<String, Object>> tempList = centerdataTFarmGridService.selectCenterdataTFarmGridListTree(grid);
|
|
|
|
+ if (StringUtils.isNotBlank(commandCenterBO.getKeyWord())) {
|
|
|
|
+ List<Map<String, Object>> maps = tempList.stream().filter(o -> o.get("label").toString().contains(commandCenterBO.getKeyWord())).collect(Collectors.toList());
|
|
|
|
+ if (StringUtils.isNotEmpty(maps)) {
|
|
|
|
+ Set<String> ids = new HashSet<>();
|
|
|
|
+ maps.forEach(e -> {
|
|
|
|
+ Object o = e.get("ancestors");
|
|
|
|
+ ids.add(e.get("id").toString());
|
|
|
|
+ ids.addAll(Arrays.asList(o.toString().split(",")));
|
|
|
|
+ });
|
|
|
|
+ List<String> list = new ArrayList<>(ids);
|
|
|
|
+ grid.getParams().put("list", list);
|
|
|
|
+ gridList = centerdataTFarmGridService.selectCenterdataTFarmGridListTree(grid);
|
|
|
|
+ } else {
|
|
|
|
+ return gridList;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ gridList = centerdataTFarmGridService.selectCenterdataTFarmGridListTree(grid);
|
|
|
|
+ }
|
|
|
|
+ Map<String, Map<String, Object>> map = new HashMap<>();// 使用Map来存储所有查询结果,以id为key
|
|
|
|
+ for (Map<String, Object> item : gridList) {
|
|
|
|
+ item.put(DataConstants.TITLE, new ArrayList<>());// 初始化title为空
|
|
|
|
+ item.put("children", new ArrayList<>());// 初始化children空数组
|
|
|
|
+ map.put(String.valueOf(item.get("id")), item);// 将单个查询结果以id为键加入map
|
|
|
|
+ }
|
|
|
|
+ // 分组
|
|
|
|
+ MultiValueMap<String, Map<String, Object>> groupMap = new LinkedMultiValueMap();
|
|
|
|
+ leaderList.forEach(item -> groupMap.add(String.valueOf(item.get("id")), item));
|
|
|
|
+ // 设置title
|
|
|
|
+ Set<String> grids = new HashSet<>();
|
|
|
|
+ for (Map.Entry<String, List<Map<String, Object>>> key : groupMap.entrySet()) {
|
|
|
|
+ Map<String, Object> result = map.get(key.getKey());
|
|
|
|
+ if (result != null) {
|
|
|
|
+ result.put(DataConstants.TITLE, groupMap.get(key.getKey()));
|
|
|
|
+ grids.add(key.getKey());
|
|
|
|
+ grids.addAll(Arrays.asList(String.valueOf(result.get("ancestors")).split(",")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 提取有效数据
|
|
|
|
+ Iterator<Map<String, Object>> iterator = gridList.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ Map<String, Object> mapItem = iterator.next();
|
|
|
|
+ if (!grids.contains(String.valueOf(mapItem.get("id")))) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return gridList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<Map<String, Object>> getForestLeader(CommandCenterBO commandCenterBO) {
|
|
|
|
+ if ("1".equals(commandCenterBO.getTimeTag())) {
|
|
|
|
+ List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isNotBlank(commandCenterBO.getKeyWord())) {
|
|
|
|
+ List<String> collect = commandCenterMapper.getForestGridLevel(commandCenterBO).stream().map(o -> String.valueOf(o.get("id"))).collect(Collectors.toList());
|
|
|
|
+ if (StringUtils.isNotEmpty(collect)) {
|
|
|
|
+ Set<String> ids = new HashSet<>();
|
|
|
|
+ for (String s : collect) {
|
|
|
|
+ String str = commandCenterMapper.getUpPoint(Long.valueOf(s));
|
|
|
|
+ ids.addAll(Arrays.asList(str.split(",")));
|
|
|
|
+ }
|
|
|
|
+ List<String> list = new ArrayList<>(ids);
|
|
|
|
+ commandCenterBO.getParams().put("list", list);
|
|
|
|
+ resultList = commandCenterMapper.getForestGridLevel(commandCenterBO);
|
|
|
|
+ } else {
|
|
|
|
+ return resultList;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ resultList = commandCenterMapper.getForestGridLevel(commandCenterBO);
|
|
|
|
+ }
|
|
|
|
+ // 人员
|
|
|
|
+ List<Map<String, Object>> lineList = commandCenterMapper.getLineList(commandCenterBO);
|
|
|
|
+ Map<String, Map<String, Object>> map = new HashMap<>();// 使用Map来存储所有查询结果,以id为key
|
|
|
|
+ for (Map<String, Object> item : resultList) {
|
|
|
|
+ item.put(DataConstants.TITLE, new ArrayList<>());// 初始化title为空
|
|
|
|
+ item.put("children", new ArrayList<>());// 初始化children空数组
|
|
|
|
+ map.put(String.valueOf(item.get("id")), item);// 将单个查询结果以id为键加入map
|
|
|
|
+ }
|
|
|
|
+ // 分组
|
|
|
|
+ MultiValueMap<String, Map<String, Object>> groupMap = new LinkedMultiValueMap();
|
|
|
|
+ lineList.forEach(item -> groupMap.add(String.valueOf(item.get("id")), item));
|
|
|
|
+ // 设置title
|
|
|
|
+ for (Map.Entry<String, List<Map<String, Object>>> key : groupMap.entrySet()) {
|
|
|
|
+ Map<String, Object> result = map.get(key.getKey());
|
|
|
|
+ if (result != null) {
|
|
|
|
+ result.put(DataConstants.TITLE, groupMap.get(key.getKey()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return resultList;
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> resourceList(AgricultureViewBO agricultureViewBO) {
|
|
|
|
+ setSookaDataBase(agricultureViewBO);
|
|
|
|
+ List<Map<String, Object>> mapList = null;
|
|
|
|
+ switch (agricultureViewBO.getResourceType()) {
|
|
|
|
+ case "1":
|
|
|
|
+ // 林业
|
|
|
|
+ mapList = commandCenterMapper.forestryList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ // 农业
|
|
|
|
+ mapList = commandCenterMapper.agricultureList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ // 水利
|
|
|
|
+ mapList = commandCenterMapper.waterList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ case "4":
|
|
|
|
+ // 环保
|
|
|
|
+ mapList = commandCenterMapper.environmentalList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ case "5":
|
|
|
|
+ // 应急 + 消防
|
|
|
|
+ mapList = commandCenterMapper.emergencyList(agricultureViewBO);
|
|
|
|
+ List<Map<String, Object>> fireList = commandCenterMapper.fireList(agricultureViewBO);
|
|
|
|
+ mapList.addAll(fireList);
|
|
|
|
+ break;
|
|
|
|
+ case "6":
|
|
|
|
+ // 交通
|
|
|
|
+ mapList = commandCenterMapper.trafficList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ case "7":
|
|
|
|
+ // 资源
|
|
|
|
+ mapList = commandCenterMapper.resourceList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ case "8":
|
|
|
|
+ // 消防
|
|
|
|
+ mapList = commandCenterMapper.fireList(agricultureViewBO);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ mapList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ return mapList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @DataScopeMutiDept(deptAlias = "d")
|
|
|
|
+ public List<Map<String, Object>> resourcePoint(AgricultureViewBO agricultureViewBO) {
|
|
|
|
+ setSookaDataBase(agricultureViewBO);
|
|
|
|
+ if ("centerdata_t_farm_agricultural_cooperatives".equals(agricultureViewBO.getType()) || "centerdata_t_farm_botany_protect_info".equals(agricultureViewBO.getType())
|
|
|
|
+ || "centerdata_t_farm_agricultural_machinery_info".equals(agricultureViewBO.getType())) {
|
|
|
|
+ agricultureViewBO.setDel("0");
|
|
|
|
+ }
|
|
|
|
+ if (agricultureViewBO.getType().contains("centerdata_t_farm_enterprise")) {
|
|
|
|
+ int a = agricultureViewBO.getType().indexOf('@');
|
|
|
|
+ agricultureViewBO.setAssort(agricultureViewBO.getType().substring(a + 1));
|
|
|
|
+ agricultureViewBO.setType(agricultureViewBO.getType().substring(0, a));
|
|
|
|
+ }
|
|
|
|
+ if (agricultureViewBO.getType().contains("centerdata_t_forest_firehydrant")) {
|
|
|
|
+ int a = agricultureViewBO.getType().indexOf('@');
|
|
|
|
+ agricultureViewBO.setFirehydrantType("firehydrant_" + agricultureViewBO.getType().substring(a + 1));
|
|
|
|
+ agricultureViewBO.setType(agricultureViewBO.getType().substring(0, a));
|
|
|
|
+ }
|
|
|
|
+ List<Map<String, Object>> pointList = null;
|
|
|
|
+ if ("centerdata_t_hydraulic_reach".equals(agricultureViewBO.getType())) {
|
|
|
|
+ pointList = commandCenterMapper.getLocation(agricultureViewBO);
|
|
|
|
+ } else {
|
|
|
|
+ pointList = commandCenterMapper.getLocationWithCamera(agricultureViewBO);
|
|
|
|
+ }
|
|
|
|
+ switch (agricultureViewBO.getResourceType()) {
|
|
|
|
+ case "1":
|
|
|
|
+ // 林业
|
|
|
|
+ pointList = forestViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ // 农业
|
|
|
|
+ agricultureViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ // 水利
|
|
|
|
+ waterViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "4":
|
|
|
|
+ // 环保
|
|
|
|
+ environmentViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "5":
|
|
|
|
+ // 应急
|
|
|
|
+ emergencyViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "6":
|
|
|
|
+ // 交通
|
|
|
|
+ trafficViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "7":
|
|
|
|
+ // 资源
|
|
|
|
+ resourceViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ case "8":
|
|
|
|
+ // 消防
|
|
|
|
+ pointList = fireControlViewService.dataFilter(pointList);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ List<String> ids = pointList.stream().map(item -> MapUtils.getString(item, "id")).collect(Collectors.toList());
|
|
|
|
+ List<Map<String, Object>> cameraList = getCameraList(ids);
|
|
|
|
+ pointList.forEach(point -> {
|
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
+ cameraList.forEach(camera -> {
|
|
|
|
+ if (MapUtils.getString(point, "id").equals(MapUtils.getString(camera, "businessId"))) {
|
|
|
|
+ list.add(camera);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ point.put("cameraList", list);
|
|
|
|
+ });
|
|
|
|
+ return pointList;
|
|
|
|
+ }
|
|
|
|
+}
|