|
@@ -14,6 +14,7 @@ import com.ruoyi.ems.enums.FacTypes;
|
|
import com.ruoyi.ems.mapper.AdmEmsElecPgIndexMapper;
|
|
import com.ruoyi.ems.mapper.AdmEmsElecPgIndexMapper;
|
|
import com.ruoyi.ems.mapper.AdmEmsIndexRangeMapper;
|
|
import com.ruoyi.ems.mapper.AdmEmsIndexRangeMapper;
|
|
import com.ruoyi.ems.mapper.EmsFacsMapper;
|
|
import com.ruoyi.ems.mapper.EmsFacsMapper;
|
|
|
|
+import com.ruoyi.ems.model.BoundaryObj;
|
|
import com.ruoyi.ems.model.QueryDevice;
|
|
import com.ruoyi.ems.model.QueryDevice;
|
|
import com.ruoyi.ems.model.TreeEntity;
|
|
import com.ruoyi.ems.model.TreeEntity;
|
|
import com.ruoyi.ems.service.IAreaService;
|
|
import com.ruoyi.ems.service.IAreaService;
|
|
@@ -21,12 +22,14 @@ import com.ruoyi.ems.service.IEmsDeviceService;
|
|
import com.ruoyi.ems.service.IEmsFacsService;
|
|
import com.ruoyi.ems.service.IEmsFacsService;
|
|
import com.ruoyi.ems.util.AreaUtils;
|
|
import com.ruoyi.ems.util.AreaUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
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.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -101,7 +104,8 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
|
|
if (StringUtils.isEmpty(queryDevice.getAreaCode())) {
|
|
if (StringUtils.isEmpty(queryDevice.getAreaCode())) {
|
|
List<Area> areaTree = areaService.selectAreaTree("0", true);
|
|
List<Area> areaTree = areaService.selectAreaTree("0", true);
|
|
List<Area> areaList = AreaUtils.compressTree(areaTree);
|
|
List<Area> areaList = AreaUtils.compressTree(areaTree);
|
|
- Map<String, Area> areaMap = areaList.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
|
|
|
|
|
|
+ Map<String, Area> areaMap = areaList.stream()
|
|
|
|
+ .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(areaTree)) {
|
|
if (CollectionUtils.isNotEmpty(areaTree)) {
|
|
EmsFacs facsParam = new EmsFacs();
|
|
EmsFacs facsParam = new EmsFacs();
|
|
@@ -114,7 +118,8 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
|
|
param.setAreaCode(area.getAreaCode());
|
|
param.setAreaCode(area.getAreaCode());
|
|
|
|
|
|
List<EmsDevice> devices = deviceService.selectList(param);
|
|
List<EmsDevice> devices = deviceService.selectList(param);
|
|
- Map<String, List<EmsDevice>> deviceMap = devices.stream().collect(Collectors.groupingBy(EmsDevice::getRefFacs));
|
|
|
|
|
|
+ Map<String, List<EmsDevice>> deviceMap = devices.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(EmsDevice::getRefFacs));
|
|
|
|
|
|
TreeEntity entity = new TreeEntity();
|
|
TreeEntity entity = new TreeEntity();
|
|
entity.setId(area.getAreaCode());
|
|
entity.setId(area.getAreaCode());
|
|
@@ -128,7 +133,8 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
|
|
Area area = areaService.selectAreaByCode(queryDevice.getAreaCode());
|
|
Area area = areaService.selectAreaByCode(queryDevice.getAreaCode());
|
|
List<Area> areaTree = areaService.selectAreaTree(queryDevice.getAreaCode(), true);
|
|
List<Area> areaTree = areaService.selectAreaTree(queryDevice.getAreaCode(), true);
|
|
List<Area> areaList = AreaUtils.compressTree(areaTree);
|
|
List<Area> areaList = AreaUtils.compressTree(areaTree);
|
|
- Map<String, Area> areaMap = areaList.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
|
|
|
|
|
|
+ Map<String, Area> areaMap = areaList.stream()
|
|
|
|
+ .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
|
|
|
|
|
|
if (null != area) {
|
|
if (null != area) {
|
|
EmsFacs facsParam = new EmsFacs();
|
|
EmsFacs facsParam = new EmsFacs();
|
|
@@ -141,7 +147,8 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
|
|
param.setAreaCode(queryDevice.getAreaCode());
|
|
param.setAreaCode(queryDevice.getAreaCode());
|
|
|
|
|
|
List<EmsDevice> devices = deviceService.selectList(param);
|
|
List<EmsDevice> devices = deviceService.selectList(param);
|
|
- Map<String, List<EmsDevice>> deviceMap = devices.stream().collect(Collectors.groupingBy(EmsDevice::getRefFacs));
|
|
|
|
|
|
+ Map<String, List<EmsDevice>> deviceMap = devices.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(EmsDevice::getRefFacs));
|
|
|
|
|
|
TreeEntity entity = new TreeEntity();
|
|
TreeEntity entity = new TreeEntity();
|
|
entity.setId(area.getAreaCode());
|
|
entity.setId(area.getAreaCode());
|
|
@@ -155,7 +162,25 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
|
|
return retList;
|
|
return retList;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<TreeEntity> buildFacsDevSub(List<EmsFacs> facsList, Map<String, List<EmsDevice>> deviceMap, Map<String, Area> areaMap) {
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<BoundaryObj> getFacsWithMeterDev(String category, String subCategory) {
|
|
|
|
+ List<BoundaryObj> facsMeterObjs = emsFacsMapper.selectFacsWithMeter(category, subCategory);
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isNotEmpty(facsMeterObjs)) {
|
|
|
|
+ for (BoundaryObj obj : facsMeterObjs) {
|
|
|
|
+ String[] array = StringUtils.split(obj.getBindMeterDevs(), ",");
|
|
|
|
+ List<String> devList = ArrayUtils.isNotEmpty(array) ? Arrays.asList(array) : new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ Set<String> bindDevs = devList.stream().map(String::trim).filter(s -> !s.isEmpty())
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
+ obj.setBindElecMeterDevs(bindDevs);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return facsMeterObjs;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<TreeEntity> buildFacsDevSub(List<EmsFacs> facsList, Map<String, List<EmsDevice>> deviceMap,
|
|
|
|
+ Map<String, Area> areaMap) {
|
|
List<TreeEntity> retList = new ArrayList<>();
|
|
List<TreeEntity> retList = new ArrayList<>();
|
|
|
|
|
|
for (EmsFacs facs : facsList) {
|
|
for (EmsFacs facs : facsList) {
|
|
@@ -163,7 +188,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
|
|
List<TreeEntity> subList = null;
|
|
List<TreeEntity> subList = null;
|
|
List<EmsDevice> devices = deviceMap.get(facs.getFacsCode());
|
|
List<EmsDevice> devices = deviceMap.get(facs.getFacsCode());
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(devices)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(devices)) {
|
|
subList = new ArrayList<>();
|
|
subList = new ArrayList<>();
|
|
|
|
|
|
for (EmsDevice device : devices) {
|
|
for (EmsDevice device : devices) {
|