change - 监控单元模块图片动态配置
parent
8fcab9dccc
commit
6db5feb919
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.web.controller.iot;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.ruoyi.system.domain.BaseMonitorunitInfo;
|
||||
import com.ruoyi.system.domain.BaseSensorInfo;
|
||||
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
|
||||
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
|
||||
import com.ruoyi.system.service.IBaseMonitorunitInfoService;
|
||||
import com.ruoyi.system.service.IBaseSensorInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 智慧场景Controller
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022年03月14日 11:18
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/iot/wisdomScenario")
|
||||
public class WisdomScenarioContorller {
|
||||
|
||||
@Autowired private IBaseMonitorunitInfoService baseMonitorunitInfoService;
|
||||
|
||||
@Autowired private IBaseSensorInfoService baseSensorInfoService;
|
||||
|
||||
/**
|
||||
* 数量统计:传感器数量、监控单元数量
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022/3/14 16:45
|
||||
* @param monitorUnitType
|
||||
* @return java.lang.String
|
||||
*/
|
||||
@GetMapping("/quantityStatistics")
|
||||
@ResponseBody
|
||||
public String quantityStatistics(String monitorUnitType) {
|
||||
|
||||
List<BaseMonitorunitInfo> baseMonitorunitInfos =
|
||||
baseMonitorunitInfoService.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo());
|
||||
List<BaseMonitorunitInfo> collect =
|
||||
baseMonitorunitInfos.stream()
|
||||
.filter(
|
||||
x ->
|
||||
!x.getParentId().isEmpty()
|
||||
&& x.getEnableFlag() == 0L
|
||||
&& x.getMonitorunitType().equals(monitorUnitType))
|
||||
.collect(Collectors.toList());
|
||||
int sensorAmount = 0;
|
||||
for (BaseMonitorunitInfo x : collect) {
|
||||
List<BaseSensorInfoDto> baseSensorInfoDtos =
|
||||
baseSensorInfoService.selectBaseSensorInfoList(
|
||||
new BaseSensorInfo(null, null, null, x.getMonitorunitId()));
|
||||
sensorAmount = sensorAmount + baseSensorInfoDtos.size();
|
||||
}
|
||||
|
||||
int finalSensorAmount = sensorAmount;
|
||||
List<Integer> result =
|
||||
new ArrayList<Integer>() {
|
||||
{
|
||||
this.add(finalSensorAmount);
|
||||
this.add(collect.size());
|
||||
}
|
||||
};
|
||||
return JSONArray.toJSONString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控单元模块
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022/3/14 16:46
|
||||
* @param monitorUnitType
|
||||
* @return java.lang.String
|
||||
*/
|
||||
@GetMapping("/getMonitorUnitModule")
|
||||
@ResponseBody
|
||||
public String getMonitorUnitModule(String monitorUnitType) {
|
||||
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
|
||||
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
|
||||
List<BaseMonitorunitInfoDto> collect =
|
||||
baseMonitorunitInfoDtos.stream()
|
||||
.filter(
|
||||
x ->
|
||||
!x.getParentId().isEmpty()
|
||||
&& x.getEnableFlag() == 0L
|
||||
&& x.getMonitorunitType().equals(monitorUnitType))
|
||||
.collect(Collectors.toList());
|
||||
collect.forEach(x->{
|
||||
x.setUnitUrl("/sections/transformer-detail?id="+x.getMonitorunitId());
|
||||
});
|
||||
|
||||
return JSONArray.toJSONString(collect);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('监控单元模型上传')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue