|
@@ -15,14 +15,16 @@ import org.jeecg.modules.dataPower.vo.DataPowerVO;
|
|
import org.jeecg.modules.dataVoltage.service.IDataVoltageService;
|
|
import org.jeecg.modules.dataVoltage.service.IDataVoltageService;
|
|
import org.jeecg.modules.dataVoltage.vo.DataVoltageVO;
|
|
import org.jeecg.modules.dataVoltage.vo.DataVoltageVO;
|
|
import org.jeecg.modules.paramquery.dto.ParamQueryDataDTO;
|
|
import org.jeecg.modules.paramquery.dto.ParamQueryDataDTO;
|
|
-import org.jeecg.modules.paramquery.vo.ParamQueryDataVO;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@Api(tags = "监测参数查询")
|
|
@Api(tags = "监测参数查询")
|
|
@@ -60,28 +62,109 @@ public class ParamQueryDataConotroller {
|
|
*/
|
|
*/
|
|
@ApiOperation(value="监测参数查询", notes="监测参数查询")
|
|
@ApiOperation(value="监测参数查询", notes="监测参数查询")
|
|
@GetMapping(value = "/dataList")
|
|
@GetMapping(value = "/dataList")
|
|
- public Result<ParamQueryDataVO> dataList(ParamQueryDataDTO dto) {
|
|
|
|
- ParamQueryDataVO vo = new ParamQueryDataVO();
|
|
|
|
|
|
+ public Result<List<Map<String,Object>>> dataList(ParamQueryDataDTO dto) {
|
|
|
|
+ List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ Date logtimebegin = dto.getLogtimebegin();
|
|
|
|
+ Date logtimeend = dto.getLogtimeend();
|
|
|
|
+ LocalDate beginDate = logtimebegin.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
|
+ LocalDate endDate = logtimeend.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
|
+
|
|
|
|
+ long daysDiff = ChronoUnit.DAYS.between(beginDate, endDate);
|
|
|
|
+
|
|
|
|
+ if (Math.abs(daysDiff) > 2) {
|
|
|
|
+ return Result.error("时间间隔超过两天!",mapList);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(dto.getQueryparamtype()!=null && !dto.getQueryparamtype().equals("")){
|
|
if(dto.getQueryparamtype()!=null && !dto.getQueryparamtype().equals("")){
|
|
String queryparamtype = dto.getQueryparamtype();
|
|
String queryparamtype = dto.getQueryparamtype();
|
|
- if(queryparamtype.equals("电压")){
|
|
|
|
|
|
+ if(queryparamtype.equals("电压")){ //A相电压、B相电压、C相电压
|
|
List<DataVoltageVO> voltageVOList = voltageService.dataList(dto);
|
|
List<DataVoltageVO> voltageVOList = voltageService.dataList(dto);
|
|
- vo.setVoltageVOList(voltageVOList);
|
|
|
|
- }else if(queryparamtype.equals("电流")){
|
|
|
|
|
|
+ List<Double> atagvalueList = voltageVOList.stream().map(i->i.getAtagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Double> btagvalueList = voltageVOList.stream().map(i->i.getBtagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Double> ctagvalueList = voltageVOList.stream().map(i->i.getCtagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Date> logtimeList = voltageVOList.stream().map(i->i.getLogtime()).collect(Collectors.toList());
|
|
|
|
+ Map<String,Object> amap = new HashMap<>();
|
|
|
|
+ amap.put("data", atagvalueList);
|
|
|
|
+ amap.put("name", "Ua");
|
|
|
|
+ mapList.add(amap);
|
|
|
|
+ Map<String,Object> bmap = new HashMap<>();
|
|
|
|
+ bmap.put("data", btagvalueList);
|
|
|
|
+ bmap.put("name", "Ub");
|
|
|
|
+ mapList.add(bmap);
|
|
|
|
+ Map<String,Object> cmap = new HashMap<>();
|
|
|
|
+ cmap.put("data", ctagvalueList);
|
|
|
|
+ cmap.put("name", "Uc");
|
|
|
|
+ mapList.add(cmap);
|
|
|
|
+ Map<String,Object> timemap = new HashMap<>();
|
|
|
|
+ timemap.put("data", logtimeList);
|
|
|
|
+ timemap.put("name", "logtime");
|
|
|
|
+ mapList.add(timemap);
|
|
|
|
+ return Result.OK(mapList);
|
|
|
|
+ } else if(queryparamtype.equals("电流")){
|
|
List<DataCurrentVO> currentVOList = currentService.dataList(dto);
|
|
List<DataCurrentVO> currentVOList = currentService.dataList(dto);
|
|
- vo.setCurrentVOList(currentVOList);
|
|
|
|
- }else if(queryparamtype.equals("需量")){
|
|
|
|
|
|
+ List<Double> atagvalueList = currentVOList.stream().map(i->i.getAtagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Double> btagvalueList = currentVOList.stream().map(i->i.getBtagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Double> ctagvalueList = currentVOList.stream().map(i->i.getCtagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Date> logtimeList = currentVOList.stream().map(i->i.getLogtime()).collect(Collectors.toList());
|
|
|
|
+ Map<String,Object> amap = new HashMap<>();
|
|
|
|
+ amap.put("data", atagvalueList);
|
|
|
|
+ amap.put("name", "Ia");
|
|
|
|
+ mapList.add(amap);
|
|
|
|
+ Map<String,Object> bmap = new HashMap<>();
|
|
|
|
+ bmap.put("data", btagvalueList);
|
|
|
|
+ bmap.put("name", "Ib");
|
|
|
|
+ mapList.add(bmap);
|
|
|
|
+ Map<String,Object> cmap = new HashMap<>();
|
|
|
|
+ cmap.put("data", ctagvalueList);
|
|
|
|
+ cmap.put("name", "Ic");
|
|
|
|
+ mapList.add(cmap);
|
|
|
|
+ Map<String,Object> timemap = new HashMap<>();
|
|
|
|
+ timemap.put("data", logtimeList);
|
|
|
|
+ timemap.put("name", "logtime");
|
|
|
|
+ mapList.add(timemap);
|
|
|
|
+ return Result.OK(mapList);
|
|
|
|
+ } else if(queryparamtype.equals("需量")){
|
|
List<DataDemandVO> demandVOList = demandService.dataList(dto);
|
|
List<DataDemandVO> demandVOList = demandService.dataList(dto);
|
|
- vo.setDemandVOList(demandVOList);
|
|
|
|
- }else if(queryparamtype.equals("分时电量")){
|
|
|
|
|
|
+ List<Double> tagvalueList = demandVOList.stream().map(i->i.getTagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Date> logtimeList = demandVOList.stream().map(i->i.getLogtime()).collect(Collectors.toList());
|
|
|
|
+ Map<String,Object> amap = new HashMap<>();
|
|
|
|
+ amap.put("data", tagvalueList);
|
|
|
|
+ amap.put("name", "正向有功需量");
|
|
|
|
+ mapList.add(amap);
|
|
|
|
+ Map<String,Object> timemap = new HashMap<>();
|
|
|
|
+ timemap.put("data", logtimeList);
|
|
|
|
+ timemap.put("name", "logtime");
|
|
|
|
+ mapList.add(timemap);
|
|
|
|
+ return Result.OK(mapList);
|
|
|
|
+ } else if(queryparamtype.equals("分时电量")){
|
|
List<DataElectricityVO> electricityVOList = electricityService.dataList(dto);
|
|
List<DataElectricityVO> electricityVOList = electricityService.dataList(dto);
|
|
- vo.setElectricityVOList(electricityVOList);
|
|
|
|
|
|
+ List<Double> tagvalueList = electricityVOList.stream().map(i->i.getTagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Date> logtimeList = electricityVOList.stream().map(i->i.getLogtime()).collect(Collectors.toList());
|
|
|
|
+ Map<String,Object> amap = new HashMap<>();
|
|
|
|
+ amap.put("data", tagvalueList);
|
|
|
|
+ amap.put("name", "分时电量");
|
|
|
|
+ mapList.add(amap);
|
|
|
|
+ Map<String,Object> timemap = new HashMap<>();
|
|
|
|
+ timemap.put("data", logtimeList);
|
|
|
|
+ timemap.put("name", "logtime");
|
|
|
|
+ mapList.add(timemap);
|
|
|
|
+ return Result.OK(mapList);
|
|
}else if(queryparamtype.equals("功率")){
|
|
}else if(queryparamtype.equals("功率")){
|
|
List<DataPowerVO> powerVOList = powerService.dataList(dto);
|
|
List<DataPowerVO> powerVOList = powerService.dataList(dto);
|
|
- vo.setPowerVOList(powerVOList);
|
|
|
|
- }else return Result.error("请输入正确的查询参数类型");
|
|
|
|
- }else return Result.error("请输入查询参数类型");
|
|
|
|
- return Result.OK(vo);
|
|
|
|
|
|
+ List<Double> tagvalueList = powerVOList.stream().map(i->i.getTagvalue()).collect(Collectors.toList());
|
|
|
|
+ List<Date> logtimeList = powerVOList.stream().map(i->i.getLogtime()).collect(Collectors.toList());
|
|
|
|
+ Map<String,Object> amap = new HashMap<>();
|
|
|
|
+ amap.put("data", tagvalueList);
|
|
|
|
+ amap.put("name", "功率");
|
|
|
|
+ mapList.add(amap);
|
|
|
|
+ Map<String,Object> timemap = new HashMap<>();
|
|
|
|
+ timemap.put("data", logtimeList);
|
|
|
|
+ timemap.put("name", "logtime");
|
|
|
|
+ mapList.add(timemap);
|
|
|
|
+ return Result.OK(mapList);
|
|
|
|
+ } else return Result.error("请输入正确的查询参数类型",mapList);
|
|
|
|
+ }else return Result.error("请输入查询参数类型",mapList);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|