2023-06-02 16:30:25 新增获取用户所属可控设备列表接口!

master
魔神煜修罗皇 2 years ago
parent f8293f254a
commit c9afa413ec
  1. 50
      psdc-web/src/main/java/com/psdc/controller/monitor/TotalElectricMeterController.java

@ -106,6 +106,56 @@ public class TotalElectricMeterController {
return AjaxResult.success("用户所属设备列表", maps);
}
@PreAuthorize("@ss.hasPermi('emonitor:db')")
@RequestMapping(value = "/selMyControldevices", method = RequestMethod.GET)
public AjaxResult selControlMydevices() {
List<Map> maps = new ArrayList<>();
List<PsdcDevice> list = psdcDeviceService.queryByUserId(0);
for (PsdcDevice dd : list){
Map<String, Object> map = new HashMap<>();
map.put("modelName", dd.getDeviceModel());
if (2 == dd.getIsControl()){
map.put("isControl", dd.getIsControl());
List<Map> maps2 = new ArrayList<>();
List<PsdcDevice> list2 = psdcDeviceService.queryByModel(dd.getDeviceModel());
if (list2.size() > 0){
for (PsdcDevice dev : list2){
Map<String, Object> map2 = new HashMap<>();
map2.put("deviceId", dev.getDeviceId());
map2.put("deviceName", dev.getDeviceName());
List<ModelVo> modelVoList = psdcModelService.selDevIsControlByModelName(dd.getDeviceModel());
List<Map> ary = new ArrayList<>();
for (ModelVo scr : modelVoList){
Map<String, Object> content = new HashMap<>();
content.put("label", scr.getIoDesc());
content.put("value", scr.getRelationField());
ary.add(content);
}
map2.put("controlKey", ary);
if (ary.size() > 0){
maps2.add(map2);
}
}
} else {
PsdcDevice dev = psdcDeviceService.queryById(dd.getDeviceId());
Map<String, Object> map2 = new HashMap<>();
map2.put("deviceId", dev.getDeviceId());
map2.put("deviceName", dev.getDeviceName());
maps2.add(map2);
}
if (maps2.size() > 0){
map.put("children", maps2);
}
if (map.size() > 2){
maps.add(map);
}
}
}
return AjaxResult.success("用户所属设备列表", maps);
}
@PreAuthorize("@ss.hasPermi('emonitor:db')")
@RequestMapping(value = "/sel1/{deviceId}", method = RequestMethod.GET)
public AjaxResult selzdb1(@PathVariable(value = "deviceId", required = false) Integer deviceId) {

Loading…
Cancel
Save