冀北电网一张图-综合评估趋势对比
This commit is contained in:
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类的介绍:冀北全景一张图-综合评估主界面返回实体
|
* 类的介绍:冀北全景一张图-综合评估主界面返回实体
|
||||||
@@ -24,4 +25,21 @@ public class AssessVo implements Serializable {
|
|||||||
@ApiModelProperty("评估等级")
|
@ApiModelProperty("评估等级")
|
||||||
private String level;
|
private String level;
|
||||||
|
|
||||||
|
@ApiModelProperty("时间")
|
||||||
|
private String dataTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class AssessTrendVo {
|
||||||
|
|
||||||
|
@ApiModelProperty("部门Id")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ApiModelProperty("子集")
|
||||||
|
private List<AssessVo> children;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ public class GridController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getAssessTrend")
|
||||||
|
@ApiOperation("综合评估趋势对比")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<AssessVo.AssessTrendVo>> getAssessTrend(@RequestBody @Validated AssessParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("getAssessTrend");
|
||||||
|
List<AssessVo.AssessTrendVo> result = gridService.getAssessTrend(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getEvaluationOverview")
|
@PostMapping("/getEvaluationOverview")
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ public interface IGridService {
|
|||||||
*/
|
*/
|
||||||
List<AssessDetailVo> getData(AssessParam param);
|
List<AssessDetailVo> getData(AssessParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合评估趋势数据(当前时间统计前三个月时间)
|
||||||
|
*/
|
||||||
|
List<AssessVo.AssessTrendVo> getAssessTrend(AssessParam param);
|
||||||
/**
|
/**
|
||||||
* 查询稳态电能质量水平评价
|
* 查询稳态电能质量水平评价
|
||||||
* @param param
|
* @param param
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.harmonic.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.extra.template.engine.wit.WitTemplate;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||||
@@ -138,6 +139,80 @@ public class GridServiceImpl implements IGridService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AssessVo.AssessTrendVo> getAssessTrend(AssessParam param) {
|
||||||
|
List<AssessVo.AssessTrendVo> result = new ArrayList<>();
|
||||||
|
LinkedHashMap<String,List<PQSComAssesPO>> map = new LinkedHashMap<>();
|
||||||
|
//查询部门监测点关系
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
||||||
|
deptGetLineParam.setServerName("harmonic-boot");
|
||||||
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取所有监测点
|
||||||
|
List<String> lineList = list.stream()
|
||||||
|
.flatMap(item -> item.getLineBaseList().stream())
|
||||||
|
.map(LineDevGetDTO::getPointId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//上报国网监测点
|
||||||
|
if (Objects.equals(param.getIsUpToGrid(), 1)){
|
||||||
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
||||||
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(lineList)){
|
||||||
|
//根据传入的参数,获取返回的月份
|
||||||
|
List<YearMonth> monthList = this.getLastThreeMonth(3);
|
||||||
|
List<String> finalLineList = lineList;
|
||||||
|
monthList.forEach(month->{
|
||||||
|
String firstDayOfMonth = month.atDay(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
String lastDayOfMonth = month.atEndOfMonth().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
List<PQSComAssesPO> comAssesList = rStatComassesDMapper.getAvgCount(finalLineList,firstDayOfMonth,lastDayOfMonth);
|
||||||
|
map.put(month.toString(),comAssesList);
|
||||||
|
});
|
||||||
|
list.forEach(item->{
|
||||||
|
if (!Objects.equals(item.getDeptLevel(), 2)) {
|
||||||
|
AssessVo.AssessTrendVo vo = new AssessVo.AssessTrendVo();
|
||||||
|
vo.setDeptId(item.getUnitId());
|
||||||
|
vo.setDeptName(item.getUnitName());
|
||||||
|
List<AssessVo> children = new ArrayList<>();
|
||||||
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
map.forEach((k,v)->{
|
||||||
|
AssessVo assessVo = new AssessVo();
|
||||||
|
assessVo.setDataTime(k);
|
||||||
|
List<PQSComAssesPO> poList = v.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(poList)){
|
||||||
|
List<PqsComasses> communicateList = BeanUtil.copyToList(poList,PqsComasses.class);
|
||||||
|
float synData = comAssesUtil.getAllComAss(communicateList);
|
||||||
|
assessVo.setScore(PubUtils.floatRound(2,synData));
|
||||||
|
assessVo.setLevel(getLevel(synData));
|
||||||
|
}
|
||||||
|
children.add(assessVo);
|
||||||
|
});
|
||||||
|
vo.setChildren(children);
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据传入的月份数获取时间集合
|
||||||
|
* @param month
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<YearMonth> getLastThreeMonth(int month) {
|
||||||
|
//按月获取时间集合
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
int currentYear = currentDate.getYear();
|
||||||
|
LocalDate beginDay = LocalDate.of(currentYear, 1, 1);
|
||||||
|
List<YearMonth> monthList = getMonthsBetween(beginDay,currentDate);
|
||||||
|
if (monthList.size() > month) {
|
||||||
|
monthList = monthList.subList(monthList.size() - month,monthList.size());
|
||||||
|
}
|
||||||
|
return monthList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EvaluationVo getEvaluationOverview(AssessParam param) {
|
public EvaluationVo getEvaluationOverview(AssessParam param) {
|
||||||
EvaluationVo result = new EvaluationVo();
|
EvaluationVo result = new EvaluationVo();
|
||||||
@@ -285,7 +360,8 @@ public class GridServiceImpl implements IGridService {
|
|||||||
}
|
}
|
||||||
//按月获取时间集合
|
//按月获取时间集合
|
||||||
LocalDate currentDate = LocalDate.now();
|
LocalDate currentDate = LocalDate.now();
|
||||||
int currentYear = currentDate.getYear(); // 获取当前年份
|
// 获取当前年份
|
||||||
|
int currentYear = currentDate.getYear();
|
||||||
LocalDate beginDay = LocalDate.of(currentYear, 1, 1);
|
LocalDate beginDay = LocalDate.of(currentYear, 1, 1);
|
||||||
List<YearMonth> monthList = getMonthsBetween(beginDay,currentDate);
|
List<YearMonth> monthList = getMonthsBetween(beginDay,currentDate);
|
||||||
for (YearMonth month : monthList) {
|
for (YearMonth month : monthList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user