1.解决pq公共方法查询监测点信息,母线,终端等信息

2.解决device模块swagger页面出不来问题
3.技术监督变电站台账接口增加
4.监测点试运行报告增加,间谐波电压和暂态列表
This commit is contained in:
wr
2024-08-01 11:41:19 +08:00
parent d972bbef80
commit cdbb4fe428
25 changed files with 2753 additions and 501 deletions

View File

@@ -509,7 +509,6 @@ public class LineController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据装置部门和模糊搜索获取装置详情")
@ApiImplicitParam(name = "id", value = "装置id", required = true)
@PostMapping("/getDeptDeviceDetailData")
HttpResult<List<LineDetailVO.Detail>> getDeptDeviceDetailData(@RequestBody DataParam param){
String methodDescribe = getMethodDescribe("getDeptDeviceDetailData");

View File

@@ -98,11 +98,11 @@
<select id="orgSubStationInfoGet" resultType="com.njcn.device.biz.pojo.dto.TerminalGetBase$Extend">
select
DISTINCT
point.id lineId,
pq_dept_line.id unitId,
substation.id ledgerId,
substation.name subName,
sub.Scale voltageLevel,
point.id lineId,
lineDetail.Monitor_Flag as monitorFlag
from pq_dept_line pq_dept_line
inner join pq_line point on pq_dept_line.line_id = point.id

View File

@@ -417,30 +417,20 @@ public class GeneralDeviceService {
return generalDeviceDTO;
}
//筛选出终端id理论上监测点的pids中第个id为终端id
List<String> devIds = lines.stream().map(line -> {
String[] idsArray = line.getPids().split(",");
return idsArray[4];
}).collect(Collectors.toList());
// 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds,
deviceType,
deviceInfoParam.getManufacturer());
//筛选出母线id理论上监测点的pids中第六个id为母线id 联查: pq_line t1 ,pq_voltage t2
List<String> voltageIds = lines.stream().map(line -> {
String[] idsArray = line.getPids().split(",");
return idsArray[5];
}).collect(Collectors.toList());
//1.筛选出母线id理论上监测点的pids中第个id为母线id 联查: pq_line t1 ,pq_voltage t2
List<String> voltageIds=lines.stream().map(Line::getPid).collect(Collectors.toList());
//再根据电压等级筛选合法母线信息
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds,
deviceInfoParam.getScale());
//筛选出变电站id理论上监测点的pids中第个id为变电站id 联查: pq_line t1 ,pq_substation t2
List<String> subIds = lines.stream().map(line -> {
String[] idsArray = line.getPids().split(",");
return idsArray[3];
}).collect(Collectors.toList());
List<Line> sub = terminalBaseService.getSubByCondition(subIds,
deviceInfoParam.getScale());
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, deviceInfoParam.getScale());
//2.筛选出终端id理论上监测点的pids中第个id为终端id
List<String> devIds=voltages.stream().map(Line::getPid).collect(Collectors.toList());
// 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer());
//3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
List<String> subIds=devices.stream().map(Line::getPid).collect(Collectors.toList());
List<Line> sub = terminalBaseService.getSubByCondition(subIds, deviceInfoParam.getScale());
//筛选最终的数据
dealDeviceData(generalDeviceDTO, lines, devices, voltages, sub);
return generalDeviceDTO;

View File

@@ -7,6 +7,7 @@ import com.njcn.event.pojo.param.EventCountParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.GeneralVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -69,4 +70,10 @@ public interface EventDetailFeignClient {
*/
@PostMapping("/getAppEventDetailLtAmplitude")
HttpResult<List<RmpEventDetailPO>> getAppEventDetailLtAmplitude(@RequestBody EventCountParam param);
/**
* 根据监测点id集合和统计类型,查询暂态信息
*/
@PostMapping("/getEventDetailByEventType")
HttpResult<List<RmpEventDetailPO>> getEventDetailByEventType(@RequestBody EventCountParam param);
}

View File

@@ -76,6 +76,12 @@ public class EventDetailFeignClientFallbackFactory implements FallbackFactory<Ev
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<RmpEventDetailPO>> getEventDetailByEventType(EventCountParam param) {
log.error("{}异常,降级处理,异常为:{}", "根据监测点id集合和统计类型,查询暂态信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -22,4 +22,8 @@ public class EventCountParam implements Serializable {
@ApiModelProperty(name="endTime",value="统计截止日期yyyy-MM-dd")
private String endTime;
@ApiModelProperty(name="eventType",value="统计类型")
private List<String> eventType;
}

View File

@@ -177,6 +177,24 @@ public class EventDetailController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, count, methodDescribe);
}
/**
* 根据监测点id集合和统计类型,查询暂态信息
* @return
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getEventDetailByEventType")
@ApiOperation("根据监测点id集合和统计类型,查询暂态信息")
public HttpResult<List<RmpEventDetailPO>> getEventDetailByEventType(@RequestBody EventCountParam param) {
String methodDescribe = getMethodDescribe("getAppEventDetailLtAmplitude");
List<RmpEventDetailPO> list = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(CollUtil.isNotEmpty(param.getIds()), RmpEventDetailPO::getLineId, param.getIds())
.in(CollUtil.isNotEmpty(param.getEventType()), RmpEventDetailPO::getEventType, param.getEventType())
.ge(StrUtil.isNotBlank(param.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息(灿能云)
* @return

View File

@@ -21,16 +21,16 @@ import java.io.IOException;
contextId = "exportmodel")
public interface ReportFeignClient {
@PostMapping(value ="/exportModel",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
HttpResult<String> exportWorld(
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") Integer type,
@RequestParam("lineIndex") String lineIndex,
@RequestParam("name") String name,
@RequestParam("reportNumber") String reportNumber,
@RequestParam("crmName") String crmName,
@RequestParam("isUrl") Boolean isUrl,
@RequestPart("file") MultipartFile file) throws IOException;
@PostMapping(value ="/exportModelJB",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
HttpResult<String> exportModelJB(
@RequestParam(value ="startTime",required = false) String startTime,
@RequestParam(value ="endTime",required = false) String endTime,
@RequestParam(value ="type",required = false) Integer type,
@RequestParam(value ="lineIndex",required = false) String lineIndex,
@RequestParam(value ="name",required = false) String name,
@RequestParam(value ="reportNumber",required = false) String reportNumber,
@RequestParam(value ="crmName",required = false) String crmName,
@RequestParam(value = "isUrl",required = false) Boolean isUrl,
@RequestPart(value ="file",required = false) MultipartFile file) throws IOException;
}

View File

@@ -41,7 +41,7 @@ public class ReportClientFallbackFactory implements FallbackFactory<ReportFeignC
return new ReportFeignClient() {
@Override
public HttpResult<String> exportWorld( String startTime, String endTime, Integer type, String lineIndex, String name, String reportNumber, String crmName, Boolean isUrl, MultipartFile file) throws IOException {
public HttpResult<String> exportModelJB( String startTime, String endTime, Integer type, String lineIndex, String name, String reportNumber, String crmName, Boolean isUrl, MultipartFile file) throws IOException {
log.error("{}异常,降级处理,异常为:{}", "获取谐波报告失败", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -26,7 +26,7 @@ public class WordUtil2 {
private final FileStorageUtil fileStorageUtil;
public void getWord(String path, Map<String, Object> params, String fileName, HttpServletResponse response)
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList, HttpServletResponse response)
throws Exception {
path = ClearPathUtil.cleanString(path);
InputStream inStream = null;
@@ -35,7 +35,12 @@ public class WordUtil2 {
try {
inStream = new ClassPathResource(path).getInputStream();;
doc = new CustomXWPFDocument(inStream);
this.replaceInTable(doc, params); // 替换表格里面的变量
if(CollUtil.isNotEmpty(tableList)){
this.replaceInTable(doc, params,tableList);
}else{
this.replaceInTable(doc, params);
}
// 替换表格里面的变量
this.replaceInPara(doc, params); // 替换文本里面的变量
} catch (IOException e) {
getError("获取报告模板异常,原因为:" + e);
@@ -96,7 +101,7 @@ public class WordUtil2 {
public String getReportFileUrl(String path,String fileName, Map<String, Object> params)
public String getReportFileUrl(String path,String fileName,List<List<String[]>> tableList, Map<String, Object> params)
throws Exception {
path = ClearPathUtil.cleanString(path);
InputStream inStream = null,in = null;
@@ -105,9 +110,12 @@ public class WordUtil2 {
try {
inStream = new ClassPathResource(path).getInputStream();;
doc = new CustomXWPFDocument(inStream);
this.replaceInTable(doc, params); // 替换表格里面的变量
if(CollUtil.isNotEmpty(tableList)){
this.replaceInTable(doc, params,tableList);
}else{
this.replaceInTable(doc, params);
}
this.replaceInPara(doc, params); // 替换文本里面的变量
//临时缓冲区
ByteArrayOutputStream out = new ByteArrayOutputStream();
doc.write(out);
@@ -299,9 +307,14 @@ public class WordUtil2 {
XWPFTableRow row = table.createRow();
List<XWPFTableCell> cells = row.getTableCells();
for (int j = 0; j < cells.size(); j++) {
XWPFTableCell cell = cells.get(j);
String s = tableList.get(i)[j];
cell.setText(s);
XWPFTableCell cell = cells.get(j);
cell.removeParagraph(0);
XWPFParagraph paragraph = cell.addParagraph();
paragraph.setAlignment(ParagraphAlignment.CENTER);
// 在段落中添加文本
XWPFRun run = paragraph.createRun();
run.setText(s);
}
}
}
@@ -325,7 +338,7 @@ public class WordUtil2 {
table = iterator.next();
if (table.getRows().size() > 1) {
// 判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
if (this.matcher(table.getText()).find()) {
if (this.matcher(table.getText()).find()||this.matcherS(table.getText()).find()) {
rows = table.getRows();
for (XWPFTableRow row : rows) {
cells = row.getTableCells();
@@ -334,8 +347,10 @@ public class WordUtil2 {
processParagraphs(paragraphListTable, params, doc);
}
}
} else {
insertTable(table, tableList.get(num)); // 插入数据
}else {
if (CollUtil.isNotEmpty(tableList.get(num))){
insertTable(table, tableList.get(num)); // 插入数据
}
num++;
}
}
@@ -353,6 +368,11 @@ public class WordUtil2 {
Matcher matcher = pattern.matcher(str);
return matcher;
}
private Matcher matcherS(String str) {
Pattern pattern = Pattern.compile("\\$(.*?)\\$");
Matcher matcher = pattern.matcher(str);
return matcher;
}
/**
* 根据图片类型,取得对应的图片类型代码

View File

@@ -94,15 +94,15 @@ public class ExportModelController extends BaseController {
@PostMapping("/exportModel")
@ApiOperation("word报告")
public HttpResult<String> exportWorld(HttpServletResponse response,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") Integer type,
@RequestParam("lineIndex") String lineIndex,
@RequestParam("name") String name,
@RequestParam("reportNumber") String reportNumber,
@RequestParam("crmName") String crmName,
@RequestParam("isUrl") Boolean isUrl,
@RequestPart("file") MultipartFile file) throws IOException {
@RequestParam(value ="startTime",required = false) String startTime,
@RequestParam(value ="endTime",required = false) String endTime,
@RequestParam(value ="type",required = false) Integer type,
@RequestParam(value ="lineIndex",required = false) String lineIndex,
@RequestParam(value ="name",required = false) String name,
@RequestParam(value ="reportNumber",required = false) String reportNumber,
@RequestParam(value ="crmName",required = false) String crmName,
@RequestParam(value = "isUrl",required = false) Boolean isUrl,
@RequestPart(value ="file",required = false) MultipartFile file) throws IOException {
String methodDescribe = getMethodDescribe("exportWorld");
//获取监测点信息
String bdname;
@@ -119,6 +119,9 @@ public class ExportModelController extends BaseController {
}
bdname = lineDto.getBdName();
areaName = lineDto.getAreaName();
if(areaName.equals("冀北")){
areaName="国网"+areaName;
}
pttype = PubUtils.ptTypeName(lineDto.getPtType());
} else {
List<Monitor> monitorList = monitorClient.getMonitorList(Arrays.asList(lineIndex)).getData();
@@ -780,39 +783,43 @@ public class ExportModelController extends BaseController {
String strResultFlicker = "";
String tmpstrResultFlicker = "";
String strResultFlickerValue = "";
String strPhase = "";// 相别A、B、C
String strType = "";// 长闪还是短闪S:短闪L长闪
String strValueType = "";// 值类型最大最小平均95%概率值
Double fmaxValue1 = 0.0;
Double fmaxValue2 = 0.0;
Double fmaxValue3 = 0.0;
Double flickerLimit = 0.0;
try {
if (Double.parseDouble(plt1.getFmaxValue().toString()) > Double.parseDouble(valueOfFlickerLimit)) {
if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ",";
tmpstrResultFlicker += atype + "最大值为:" + plt1.getFmaxValue().toString();
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "不合格");
} else {
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "合格");
}
if (Double.parseDouble(plt2.getFmaxValue().toString()) > Double.parseDouble(valueOfFlickerLimit)) {
if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ",";
tmpstrResultFlicker += btype + "最大值为:" + plt2.getFmaxValue().toString();
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "不合格");
} else {
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "合格");
}
if (Double.parseDouble(plt3.getFmaxValue().toString()) > Double.parseDouble(valueOfFlickerLimit) && pttype != 2) {
if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ",";
tmpstrResultFlicker += ctype + "最大值为:" + plt3.getFmaxValue().toString();
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "不合格");
} else {
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "合格");
}
fmaxValue1 = Double.parseDouble(plt1.getFmaxValue().toString());
fmaxValue2 = Double.parseDouble(plt2.getFmaxValue().toString());
fmaxValue3 = Double.parseDouble(plt3.getFmaxValue().toString());
flickerLimit = Double.parseDouble(valueOfFlickerLimit);
} catch (Exception e) {
if ("".equals(strResultFlickerValue))
strResultFlickerValue += "注意:从上表中可以看出" + strLineBaseName + "长时闪变数据存在异常(不是数值类型)。";
strResultFlickerValue += "注意:从上表中可以看出" + strLineBaseName + "长时闪变数据存在异常(不是数值类型)。";
}
if (fmaxValue1 > flickerLimit) {
if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ",";
tmpstrResultFlicker += atype + "最大值为:" + plt1.getFmaxValue().toString();
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "不合格");
} else {
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "合格");
}
if (fmaxValue2 > flickerLimit) {
if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ",";
tmpstrResultFlicker += btype + "最大值为:" + plt2.getFmaxValue().toString();
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "不合格");
} else {
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "合格");
}
if (fmaxValue3 > flickerLimit && pttype != 2) {
if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ",";
tmpstrResultFlicker += ctype + "最大值为:" + plt3.getFmaxValue().toString();
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "不合格");
} else {
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "合格");
}
reportmap.put("$PSTX_A$", judgeNull(pst1.getFmaxValue()));
@@ -1227,9 +1234,9 @@ public class ExportModelController extends BaseController {
try {
String fileName = name + formatter.format(currentTime) + ".docx";
if (isUrl) {
reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx", reportmap);
reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx",null ,reportmap);
} else {
wordUtil2.getWord(rtfPath, reportmap, fileName, response);
wordUtil2.getWord(rtfPath, reportmap, fileName,null, response);
}
} catch (Exception e) {
log.error("获取报告发生异常,异常是" + e.getMessage());

View File

@@ -111,7 +111,10 @@ public class PollutionSubstationController extends BaseController {
@ApiImplicitParam(name = "startTime", value = "开始时间"),
@ApiImplicitParam(name = "endTime", value = "结束时间")
})
public HttpResult<List<SubstationVo>> getSubstationInfo(@RequestParam(value = "deptIndex") String deptIndex, @RequestParam(value = "searchValue") String searchValue, @RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime) {
public HttpResult<List<SubstationVo>> getSubstationInfo(@RequestParam(value = "deptIndex") String deptIndex,
@RequestParam(value = "searchValue",required=false) String searchValue,
@RequestParam(value = "startTime") String startTime,
@RequestParam(value = "endTime") String endTime) {
String methodDescribe = getMethodDescribe("getSubstationInfo");
LogUtil.njcnDebug(log, "{},实体参数:{},{}", methodDescribe, deptIndex, searchValue);
List<SubstationVo> list = pollutionSubstationService.getSubstationInfo(deptIndex,searchValue,startTime,endTime);

View File

@@ -0,0 +1,13 @@
package com.njcn.harmonic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO;
/**
* @Description:
* @Author: wr
* @Date: 2024/7/31 9:24
*/
public interface RStatDataInharmVDMapper extends BaseMapper<RStatDataInharmVDPO> {
}

View File

@@ -122,9 +122,16 @@ public interface ReportMapper {
List<ReportValue> getFrequencyData(@Param("param")ReportQueryParam param);
/**
*
*频率
* @param param
* @return
*/
List<ReportValue> getDEVFrequencyData(@Param("param")ReportQueryParam param);
/**
* 负序电流
* @param param
* @return
*/
List<ReportValue> getINegData(@Param("param")ReportQueryParam param);
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.RStatDataInharmVDMapper">
</mapper>

View File

@@ -346,7 +346,7 @@
from
`r_stat_limit_rate_d`
<where>
and time_id between #{startTime} and #{endTime}
and time_id between #{statTime} and #{endTime}
<if test=" ids != null and ids.size > 0">
AND my_index IN
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>

View File

@@ -901,5 +901,59 @@
GROUP BY
`phasic_type`;
</select>
<select id="getINegData" resultType="com.njcn.harmonic.pojo.vo.ReportValue">
SELECT
`phasic_type` AS phaseType,
AVG( CASE WHEN value_type = 'AVG' THEN rms END ) AS meanValue,
MIN( CASE WHEN value_type = 'MIN' THEN rms END ) AS minValue,
MAX( CASE WHEN value_type = 'MAX' THEN rms END ) AS fmaxValue,
MAX( CASE WHEN rankSum = #{param.count} THEN rms END ) AS cp95Value
FROM
(
SELECT
phasic_type,
value_type,
rms,
rankSum
FROM
(
SELECT
phasic_type,
value_type,
i_neg as rms,
@rankSum := IF( @CI := phasic_type, @rankSum + 1, 1 ) AS rankSum,
@CI := phasic_type
FROM
r_stat_data_i_d
<where>
phasic_type IN ( 'A', 'B', 'C' )
and quality_flag = 0
<if test="param.startTime != null and param.startTime != ''">
and `time` >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and `time` &lt;= #{param.endTime}
</if>
<if test="param.lineId != null and param.lineId != ''">
and line_id = #{param.lineId}
</if>
</where>
ORDER BY
phasic_type,
(
CASE
WHEN value_type = 'CP95' THEN 1
WHEN value_type = 'MAX' THEN 2
WHEN value_type = 'MIN' THEN 3
WHEN value_type = 'AVG' THEN 4
ELSE 5
END
),
rms DESC
) AS t1
) a
GROUP BY
`phasic_type`;
</select>
</mapper>

View File

@@ -12,7 +12,7 @@ import java.util.List;
public interface ReportService {
/**
*
* 限值
* @param param
* @return
*/
@@ -80,4 +80,18 @@ public interface ReportService {
* @return
*/
List<ReportValue> getVoltageRate(ReportQueryParam param);
/**
* 间谐波
* @param param
* @return
*/
List<ReportValue> getInharmVeRate(ReportQueryParam param);
/**
* 负序电流
* @param param
* @return
*/
List<ReportValue> getINegDataRate(ReportQueryParam param);
}

View File

@@ -3,6 +3,7 @@ package com.njcn.harmonic.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -51,12 +52,6 @@ import com.njcn.system.enums.DicDataEnum;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import com.njcn.web.utils.RequestUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -66,8 +61,15 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/10/13 8:56【需求编号】
@@ -123,66 +125,66 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override
public List<PollutionSubstationVO> getPollutionSubstationData(PollutionSubstationQuryParam pollutionSubstationQuryParam) {
List<PollutionSubstationVO> pollutionSubstationVOList = new ArrayList<> ();
List<PollutionSubstationVO> pollutionSubstationVOList = new ArrayList<>();
/*根据部门获取变电站详情*/
HarmonicPublicParam harmonicPublicParam = new HarmonicPublicParam();
BeanUtils.copyProperties (pollutionSubstationQuryParam, harmonicPublicParam);
BeanUtils.copyProperties(pollutionSubstationQuryParam, harmonicPublicParam);
harmonicPublicParam.setServerName(generalInfo.getMicroServiceName());
List<PollutionSubstationDTO> pollutionSubstationDTOList = new ArrayList<>();
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(harmonicPublicParam).getData();
sub.forEach(item->{
sub.forEach(item -> {
PollutionSubstationDTO pollutionSubstationDTO = lineFeignClient.getSubstationInfo(item.getIndex()).getData();
pollutionSubstationDTOList.add(pollutionSubstationDTO);
});
List<String> collect = pollutionSubstationDTOList.stream ( ).map (PollutionSubstationDTO::getId).collect (Collectors.toList ( ));
List<SubstationDTO> locationData = substationFeignClient.getSubstationById (collect).getData ( );
List<String> collect = pollutionSubstationDTOList.stream().map(PollutionSubstationDTO::getId).collect(Collectors.toList());
List<SubstationDTO> locationData = substationFeignClient.getSubstationById(collect).getData();
/*todo 后期可以把locationData存入redis*/
/*把所有的变电站的污染指数查出来*/
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<> ();
wrapper.in ("substation_id",collect).
eq ("pollution_type", pollutionSubstationQuryParam.getPollutionStatis ().getId ()).
eq("DATE_FORMAT( data_date ,'%Y-%m')",pollutionSubstationQuryParam.getLocalDate ());
List<RStatPollutionSubstationM> rStatPollutionSubstationMList = pollutionSubstationMMapper.selectList (wrapper);
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<>();
wrapper.in("substation_id", collect).
eq("pollution_type", pollutionSubstationQuryParam.getPollutionStatis().getId()).
eq("DATE_FORMAT( data_date ,'%Y-%m')", pollutionSubstationQuryParam.getLocalDate());
List<RStatPollutionSubstationM> rStatPollutionSubstationMList = pollutionSubstationMMapper.selectList(wrapper);
pollutionSubstationDTOList.forEach (substationInfo ->{
pollutionSubstationDTOList.forEach(substationInfo -> {
Integer lineCount = lineFeignClient.getLineCountBySubstation (substationInfo.getId ( )).getData ( );
Integer deviceCount = lineFeignClient.getDeviceCountBySubstation (substationInfo.getId ()).getData ();
PollutionSubstationVO pollutionSubstationVO =new PollutionSubstationVO ();
pollutionSubstationVO.setSubstationId (substationInfo.getId ());
pollutionSubstationVO.setSubstationName (substationInfo.getName ());
pollutionSubstationVO.setDeviceCount (deviceCount);
pollutionSubstationVO.setLineCount (lineCount);
Integer lineCount = lineFeignClient.getLineCountBySubstation(substationInfo.getId()).getData();
Integer deviceCount = lineFeignClient.getDeviceCountBySubstation(substationInfo.getId()).getData();
PollutionSubstationVO pollutionSubstationVO = new PollutionSubstationVO();
pollutionSubstationVO.setSubstationId(substationInfo.getId());
pollutionSubstationVO.setSubstationName(substationInfo.getName());
pollutionSubstationVO.setDeviceCount(deviceCount);
pollutionSubstationVO.setLineCount(lineCount);
/*todo 添加经纬度接口返回数据暂时没有*/
List<SubstationDTO> substationDTOList = locationData.stream ( )
.filter (temp -> Objects.equals (substationInfo.getId ( ), temp.getId ( )))
.collect (Collectors.toList ( ));
List<SubstationDTO> substationDTOList = locationData.stream()
.filter(temp -> Objects.equals(substationInfo.getId(), temp.getId()))
.collect(Collectors.toList());
SubstationDTO substationDTO = new SubstationDTO ();
if(CollectionUtils.isEmpty (substationDTOList)){
throw new BusinessException (CommonResponseEnum.INTERNAL_ERROR);
}else{
substationDTO = substationDTOList.get (0);
SubstationDTO substationDTO = new SubstationDTO();
if (CollectionUtils.isEmpty(substationDTOList)) {
throw new BusinessException(CommonResponseEnum.INTERNAL_ERROR);
} else {
substationDTO = substationDTOList.get(0);
}
pollutionSubstationVO.setLatitude (substationDTO.getLat ());
pollutionSubstationVO.setLongitude (substationDTO.getLng ());
pollutionSubstationVO.setLatitude(substationDTO.getLat());
pollutionSubstationVO.setLongitude(substationDTO.getLng());
List<RStatPollutionSubstationM> rStatPollutionSubstationMS = rStatPollutionSubstationMList.stream ( ).
filter (temp -> Objects.equals (substationInfo.getId ( ), temp.getSubstationId ( )))
.collect (Collectors.toList ( ));
List<RStatPollutionSubstationM> rStatPollutionSubstationMS = rStatPollutionSubstationMList.stream().
filter(temp -> Objects.equals(substationInfo.getId(), temp.getSubstationId()))
.collect(Collectors.toList());
Double value = 3.14159;
if(!CollectionUtils.isEmpty (rStatPollutionSubstationMS)){
value = rStatPollutionSubstationMS.get (0).getValue ();
if (!CollectionUtils.isEmpty(rStatPollutionSubstationMS)) {
value = rStatPollutionSubstationMS.get(0).getValue();
}
pollutionSubstationVO.setPollutionData (value);
pollutionSubstationVO.setPollutionStatis ( pollutionSubstationQuryParam.getStatisticalType ().getName ());
pollutionSubstationVOList.add (pollutionSubstationVO);
pollutionSubstationVO.setPollutionData(value);
pollutionSubstationVO.setPollutionStatis(pollutionSubstationQuryParam.getStatisticalType().getName());
pollutionSubstationVOList.add(pollutionSubstationVO);
});
List<PollutionSubstationVO> result = pollutionSubstationVOList.stream ( ).sorted (Comparator.comparing (PollutionSubstationVO::getPollutionData).reversed ( )).collect (Collectors.toList ( ));
List<PollutionSubstationVO> result = pollutionSubstationVOList.stream().sorted(Comparator.comparing(PollutionSubstationVO::getPollutionData).reversed()).collect(Collectors.toList());
return result;
}
@@ -197,8 +199,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override
public List<PollutionVO> getDeptSubstationRelations(HarmonicPublicParam harmonicPublicParam) {
List<PollutionVO> list = new ArrayList<>();
String pollutionType = harmonicPublicParam.getStatisticalType ().getId ();
String searchBeginTime = harmonicPublicParam.getSearchBeginTime ().substring (0,10);
String pollutionType = harmonicPublicParam.getStatisticalType().getId();
String searchBeginTime = harmonicPublicParam.getSearchBeginTime().substring(0, 10);
if (StringUtils.isBlank(RequestUtil.getDeptIndex())) {
return list;
}
@@ -210,18 +212,18 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
//获取主网台账信息
List<PmsGeneralDeviceDTO> orgList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
orgList.forEach(temp -> {
PollutionVO pollutionVO = new PollutionVO ();
String detpid = temp.getIndex ();
String name =temp.getName ();
List<String> powers = temp.getPowerrIdList ( );
pollutionVO.setId (detpid);
pollutionVO.setName (name+"\n("+temp.getMonitorIdList().size()+")");
pollutionVO.setData (3.14159);
setData(harmonicPublicParam, pollutionType, searchBeginTime,harmonicPublicParam.getSearchEndTime(), pollutionVO, detpid);
if(CollectionUtil.isNotEmpty(powers)) {
PollutionVO pollutionVO = new PollutionVO();
String detpid = temp.getIndex();
String name = temp.getName();
List<String> powers = temp.getPowerrIdList();
pollutionVO.setId(detpid);
pollutionVO.setName(name + "\n(" + temp.getMonitorIdList().size() + ")");
pollutionVO.setData(3.14159);
setData(harmonicPublicParam, pollutionType, searchBeginTime, harmonicPublicParam.getSearchEndTime(), pollutionVO, detpid);
if (CollectionUtil.isNotEmpty(powers)) {
//子集变电站
List<PollutionVO> powersVO = new ArrayList<>();
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
PmsStatationStatInfoParam param = new PmsStatationStatInfoParam();
param.setPowerIds(powers);
List<PmsStatationStatInfoDTO> data = statationStatClient.getStatationStatInfo(param).getData();
//去重解决重复数据
@@ -229,24 +231,24 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getPowerId()))), ArrayList::new));
Map<String, Double> stringDoubleMap = setPmsSubData(harmonicPublicParam, pollutionType, searchBeginTime, powers);
if(CollectionUtil.isNotEmpty(data)) {
dsData.forEach(power->{
PollutionVO pollutionsubVO = new PollutionVO ();
pollutionsubVO.setId (power.getPowerId());
pollutionsubVO.setName ( power.getPowerName ());
pollutionsubVO.setPid (temp.getIndex ());
if(CollectionUtil.isNotEmpty(stringDoubleMap)){
if(stringDoubleMap.containsKey(power.getPowerId())){
if (CollectionUtil.isNotEmpty(data)) {
dsData.forEach(power -> {
PollutionVO pollutionsubVO = new PollutionVO();
pollutionsubVO.setId(power.getPowerId());
pollutionsubVO.setName(power.getPowerName());
pollutionsubVO.setPid(temp.getIndex());
if (CollectionUtil.isNotEmpty(stringDoubleMap)) {
if (stringDoubleMap.containsKey(power.getPowerId())) {
pollutionsubVO.setData(stringDoubleMap.get(power.getPowerId()));
}
}
powersVO.add (pollutionsubVO) ;
powersVO.add(pollutionsubVO);
});
}
powersVO.sort((item1, item2) -> item2.getData().compareTo(item1.getData()));
pollutionVO.setChildren (powersVO);
pollutionVO.setChildren(powersVO);
}
list.add (pollutionVO);
list.add(pollutionVO);
});
} else {
@@ -254,7 +256,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfo(harmonicPublicParam).getData();
for (GeneralDeviceDTO temp : sub) {
List<String> subIndexes = temp.getSubIndexes();
if(CollectionUtil.isEmpty(subIndexes)){
if (CollectionUtil.isEmpty(subIndexes)) {
continue;
}
PollutionVO pollutionVO = new PollutionVO();
@@ -262,9 +264,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
String name = temp.getName();
pollutionVO.setId(detpid);
pollutionVO.setName(name+"\n("+temp.getLineIndexes().size()+")");
pollutionVO.setName(name + "\n(" + temp.getLineIndexes().size() + ")");
pollutionVO.setData(3.14159);
setData(harmonicPublicParam, pollutionType, searchBeginTime,harmonicPublicParam.getSearchEndTime(), pollutionVO, detpid);
setData(harmonicPublicParam, pollutionType, searchBeginTime, harmonicPublicParam.getSearchEndTime(), pollutionVO, detpid);
List<PollutionVO> subPollutionVO = new ArrayList<>();
subIndexes.forEach(subIndex -> {
PollutionVO pollutionsubVO = new PollutionVO();
@@ -274,14 +276,14 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pollutionsubVO.setName(pollutionSubstationDTO.getName());
pollutionsubVO.setPid(temp.getIndex());
pollutionsubVO.setData(3.14159);
setSubData(harmonicPublicParam, pollutionType, searchBeginTime,harmonicPublicParam.getSearchEndTime(), pollutionsubVO, id);
setSubData(harmonicPublicParam, pollutionType, searchBeginTime, harmonicPublicParam.getSearchEndTime(), pollutionsubVO, id);
subPollutionVO.add(pollutionsubVO);
});
pollutionVO.setChildren(subPollutionVO);
list.add(pollutionVO);
}
}
if (!CollectionUtils.isEmpty(list)){
if (!CollectionUtils.isEmpty(list)) {
List<PollutionVO> listSort = list.stream().filter(x -> x.getData() != 3.14159).sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList());
listSort.addAll(list.stream().filter(x -> x.getData() == 3.14159).collect(Collectors.toList()));
return listSort;
@@ -289,125 +291,125 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
return list;
}
private Map<String,Double> setPmsSubData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime, List<String> id) {
if(Objects.equals (harmonicPublicParam.getReportFlag (), BizParamConstant.STAT_BIZ_YEAR) ){
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<> ();
wrapper.in ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
private Map<String, Double> setPmsSubData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime, List<String> id) {
if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_YEAR)) {
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<>();
wrapper.in("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
List<RStatPollutionSubstationYPO> s = pollutionSubstationYPOMapper.selectList(wrapper);
return s.stream().collect(Collectors.toMap(RStatPollutionSubstationYPO::getSubstationId, RStatPollutionSubstationYPO::getValue));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_QUARTER)){
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<> ();
wrapper.in ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
return s.stream().collect(Collectors.toMap(RStatPollutionSubstationYPO::getSubstationId, RStatPollutionSubstationYPO::getValue));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<>();
wrapper.in("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
List<RStatPollutionSubstationQPO> s = pollutionSubstationQPOMapper.selectList(wrapper);
return s.stream().collect(Collectors.toMap(RStatPollutionSubstationQPO::getSubstationId, RStatPollutionSubstationQPO::getValue));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_MONTH)){
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<> ();
wrapper.in ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<>();
wrapper.in("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
List<RStatPollutionSubstationM> s = pollutionSubstationMMapper.selectList(wrapper);
return s.stream().collect(Collectors.toMap(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_DAY)){
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<> ();
wrapper.in ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<>();
wrapper.in("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
List<RStatPollutionSubstationDPO> s = pollutionSubstationDPOMapper.selectList(wrapper);
return s.stream().collect(Collectors.toMap(RStatPollutionSubstationDPO::getSubstationId, RStatPollutionSubstationDPO::getValue));
}
return null;
}
private void setSubData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime,String searchEndTime, PollutionVO pollutionsubVO, String id) {
if(Objects.equals (harmonicPublicParam.getReportFlag (), BizParamConstant.STAT_BIZ_YEAR) ){
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationYPO rStatPollutionSubstationYPO = pollutionSubstationYPOMapper.selectOne (wrapper);
private void setSubData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime, String searchEndTime, PollutionVO pollutionsubVO, String id) {
if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_YEAR)) {
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationYPO rStatPollutionSubstationYPO = pollutionSubstationYPOMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationYPO).ifPresent (t->pollutionsubVO.setData (t.getValue ()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_QUARTER)){
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationQPO rStatPollutionSubstationQPO = pollutionSubstationQPOMapper.selectOne (wrapper);
Optional.ofNullable(rStatPollutionSubstationYPO).ifPresent(t -> pollutionsubVO.setData(t.getValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationQPO rStatPollutionSubstationQPO = pollutionSubstationQPOMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationQPO).ifPresent (t->pollutionsubVO.setData (t.getValue ()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_MONTH)){
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationM rStatPollutionSubstationM = pollutionSubstationMMapper.selectOne (wrapper);
Optional.ofNullable(rStatPollutionSubstationQPO).ifPresent(t -> pollutionsubVO.setData(t.getValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationM rStatPollutionSubstationM = pollutionSubstationMMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationM).ifPresent (t->pollutionsubVO.setData (t.getValue ()));
Optional.ofNullable(rStatPollutionSubstationM).ifPresent(t -> pollutionsubVO.setData(t.getValue()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_DAY)){
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne (wrapper);
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationDPO).ifPresent (t->pollutionsubVO.setData (t.getValue ()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_WEEK)){
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
between("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime,searchEndTime)
.orderByDesc("value").last(" limit 1");
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne (wrapper);
Optional.ofNullable (rStatPollutionSubstationDPO).ifPresent (t->pollutionsubVO.setData (t.getValue ()));
Optional.ofNullable(rStatPollutionSubstationDPO).ifPresent(t -> pollutionsubVO.setData(t.getValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_WEEK)) {
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
between("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime, searchEndTime)
.orderByDesc("value").last(" limit 1");
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne(wrapper);
Optional.ofNullable(rStatPollutionSubstationDPO).ifPresent(t -> pollutionsubVO.setData(t.getValue()));
}
}
private void setData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime,String searchEndTime, PollutionVO pollutionVO, String detpid) {
private void setData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime, String searchEndTime, PollutionVO pollutionVO, String detpid) {
if(Objects.equals (harmonicPublicParam.getReportFlag (), BizParamConstant.STAT_BIZ_YEAR) ) {
QueryWrapper<RStatPollutionOrgYPO> rStatPollutionOrgYPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgYPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgYPO rStatPollutionOrgYPO = rStatPollutionOrgYPOMapper.selectOne (rStatPollutionOrgYPOQueryWrapper);
Optional.ofNullable (rStatPollutionOrgYPO).ifPresent (a->pollutionVO.setData (BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionOrgQPO> rStatPollutionOrgQPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgQPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgQPO rStatPollutionOrgQPO = rStatPollutionOrgQPOMapper.selectOne (rStatPollutionOrgQPOQueryWrapper);
Optional.ofNullable (rStatPollutionOrgQPO).ifPresent (a->pollutionVO.setData (BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionOrgMPO> rStatPollutionOrgMPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgMPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgMPO rStatPollutionOrgMPO = rStatPollutionOrgMPOMapper.selectOne (rStatPollutionOrgMPOQueryWrapper);
Optional.ofNullable (rStatPollutionOrgMPO).ifPresent (a->pollutionVO.setData (BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionOrgDPO> rStatPollutionOrgDPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgDPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
between("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime,searchEndTime)
if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_YEAR)) {
QueryWrapper<RStatPollutionOrgYPO> rStatPollutionOrgYPOQueryWrapper = new QueryWrapper<>();
rStatPollutionOrgYPOQueryWrapper.eq("org_id", detpid).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionOrgYPO rStatPollutionOrgYPO = rStatPollutionOrgYPOMapper.selectOne(rStatPollutionOrgYPOQueryWrapper);
Optional.ofNullable(rStatPollutionOrgYPO).ifPresent(a -> pollutionVO.setData(BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionOrgQPO> rStatPollutionOrgQPOQueryWrapper = new QueryWrapper<>();
rStatPollutionOrgQPOQueryWrapper.eq("org_id", detpid).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionOrgQPO rStatPollutionOrgQPO = rStatPollutionOrgQPOMapper.selectOne(rStatPollutionOrgQPOQueryWrapper);
Optional.ofNullable(rStatPollutionOrgQPO).ifPresent(a -> pollutionVO.setData(BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionOrgMPO> rStatPollutionOrgMPOQueryWrapper = new QueryWrapper<>();
rStatPollutionOrgMPOQueryWrapper.eq("org_id", detpid).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionOrgMPO rStatPollutionOrgMPO = rStatPollutionOrgMPOMapper.selectOne(rStatPollutionOrgMPOQueryWrapper);
Optional.ofNullable(rStatPollutionOrgMPO).ifPresent(a -> pollutionVO.setData(BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionOrgDPO> rStatPollutionOrgDPOQueryWrapper = new QueryWrapper<>();
rStatPollutionOrgDPOQueryWrapper.eq("org_id", detpid).
eq("pollution_type", pollutionType).
between("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime, searchEndTime)
.orderByDesc("value").last(" limit 1");
RStatPollutionOrgDPO rStatPollutionOrgDPO = rStatPollutionOrgDPOMapper.selectOne (rStatPollutionOrgDPOQueryWrapper);
Optional.ofNullable (rStatPollutionOrgDPO).ifPresent (a->pollutionVO.setData (BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_WEEK)){
QueryWrapper<RStatPollutionOrgDPO> rStatPollutionOrgDPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgDPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
between("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime,searchEndTime)
RStatPollutionOrgDPO rStatPollutionOrgDPO = rStatPollutionOrgDPOMapper.selectOne(rStatPollutionOrgDPOQueryWrapper);
Optional.ofNullable(rStatPollutionOrgDPO).ifPresent(a -> pollutionVO.setData(BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
} else if (Objects.equals(harmonicPublicParam.getReportFlag(), BizParamConstant.STAT_BIZ_WEEK)) {
QueryWrapper<RStatPollutionOrgDPO> rStatPollutionOrgDPOQueryWrapper = new QueryWrapper<>();
rStatPollutionOrgDPOQueryWrapper.eq("org_id", detpid).
eq("pollution_type", pollutionType).
between("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime, searchEndTime)
.orderByDesc("value").last(" limit 1");
RStatPollutionOrgDPO rStatPollutionOrgDPO = rStatPollutionOrgDPOMapper.selectOne (rStatPollutionOrgDPOQueryWrapper);
Optional.ofNullable (rStatPollutionOrgDPO).ifPresent (a->pollutionVO.setData (BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
RStatPollutionOrgDPO rStatPollutionOrgDPO = rStatPollutionOrgDPOMapper.selectOne(rStatPollutionOrgDPOQueryWrapper);
Optional.ofNullable(rStatPollutionOrgDPO).ifPresent(a -> pollutionVO.setData(BigDecimal.valueOf(a.getValue()).setScale(2, RoundingMode.UP).doubleValue()));
}
}
@@ -422,15 +424,15 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
*/
@Override
public List<PollutionSubstationDTO> getSubstationInfoById(HarmonicPublicParam deptParam) {
String pollutionType = deptParam.getStatisticalType ( ).getId ();
String searchBeginTime = deptParam.getSearchBeginTime ( ).substring (0,10);
String pollutionType = deptParam.getStatisticalType().getId();
String searchBeginTime = deptParam.getSearchBeginTime().substring(0, 10);
List<PollutionSubstationDTO> list = new ArrayList<>();
if (deptParam.getType() != 0) {
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
//根据部门code获取部门id
Dept dept = deptFeignClient.getDeptByCode(deptParam.getDeptIndex()).getData();
if(ObjectUtil.isNull(dept)){
if (ObjectUtil.isNull(dept)) {
return list;
}
pmsDeviceInfoParam.setDeptIndex(dept.getId());
@@ -438,11 +440,11 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pmsDeviceInfoParam.setStatisticalType(deptParam.getStatisticalType());
//获取主网台账信息
List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
deviceList.forEach(temp->{
List<String> powers = temp.getPowerrIdList ( );
deviceList.forEach(temp -> {
List<String> powers = temp.getPowerrIdList();
//变电站不为空
if(CollectionUtil.isNotEmpty(powers)){
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
if (CollectionUtil.isNotEmpty(powers)) {
PmsStatationStatInfoParam param = new PmsStatationStatInfoParam();
param.setPowerIds(powers);
List<PmsStatationStatInfoDTO> data = statationStatClient.getStatationStatInfo(param).getData();
//去重解决重复数据
@@ -450,68 +452,68 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getPowerId()))), ArrayList::new));
Map<String, Double> stringDoubleMap = setPmsSubData(deptParam, pollutionType, searchBeginTime, powers);
if(CollectionUtil.isNotEmpty(data)){
dsData.forEach(power->{
PollutionSubstationDTO dto=new PollutionSubstationDTO();
if (CollectionUtil.isNotEmpty(data)) {
dsData.forEach(power -> {
PollutionSubstationDTO dto = new PollutionSubstationDTO();
dto.setId(power.getPowerId());
dto.setName(power.getPowerName());
dto.setVoltageLevel(power.getPowerVoltageLevel());
if(CollectionUtil.isNotEmpty(stringDoubleMap)){
if(stringDoubleMap.containsKey(power.getPowerId())){
if (CollectionUtil.isNotEmpty(stringDoubleMap)) {
if (stringDoubleMap.containsKey(power.getPowerId())) {
dto.setData(stringDoubleMap.get(power.getPowerId()));
}
}
list.add (dto) ;
list.add(dto);
});
}
}
});
}else{
} else {
deptParam.setServerName(generalInfo.getMicroServiceName());
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(deptParam).getData();
sub.forEach(item->{
sub.forEach(item -> {
PollutionSubstationDTO pollutionSubstationDTO = lineFeignClient.getSubstationInfo(item.getIndex()).getData();
String id = pollutionSubstationDTO.getId ();
if(Objects.equals (deptParam.getReportFlag (),BizParamConstant.STAT_BIZ_YEAR) ){
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationYPO rStatPollutionSubstationYPO = pollutionSubstationYPOMapper.selectOne (wrapper);
String id = pollutionSubstationDTO.getId();
if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_YEAR)) {
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationYPO rStatPollutionSubstationYPO = pollutionSubstationYPOMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationYPO).ifPresent (t->pollutionSubstationDTO.setData (t.getValue ()));
}else if(Objects.equals (deptParam.getReportFlag (),BizParamConstant.STAT_BIZ_QUARTER)){
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationQPO rStatPollutionSubstationQPO = pollutionSubstationQPOMapper.selectOne (wrapper);
Optional.ofNullable(rStatPollutionSubstationYPO).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue()));
} else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationQPO rStatPollutionSubstationQPO = pollutionSubstationQPOMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationQPO).ifPresent (t->pollutionSubstationDTO.setData (t.getValue ()));
}else if(Objects.equals (deptParam.getReportFlag (),BizParamConstant.STAT_BIZ_MONTH)){
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationM rStatPollutionSubstationM = pollutionSubstationMMapper.selectOne (wrapper);
Optional.ofNullable(rStatPollutionSubstationQPO).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue()));
} else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationM rStatPollutionSubstationM = pollutionSubstationMMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationM).ifPresent (t->pollutionSubstationDTO.setData (t.getValue ()));
Optional.ofNullable(rStatPollutionSubstationM).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue()));
}else if(Objects.equals (deptParam.getReportFlag (),BizParamConstant.STAT_BIZ_DAY)){
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne (wrapper);
} else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id).
eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne(wrapper);
Optional.ofNullable (rStatPollutionSubstationDPO).ifPresent (t->pollutionSubstationDTO.setData (t.getValue ()));
Optional.ofNullable(rStatPollutionSubstationDPO).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue()));
}
list.add(pollutionSubstationDTO);
});
}
if (!CollectionUtils.isEmpty(list)){
if (!CollectionUtils.isEmpty(list)) {
return list.stream().sorted(Comparator.comparing(PollutionSubstationDTO::getData).reversed().thenComparing(PollutionSubstationDTO::getName)).collect(Collectors.toList());
}
return list;
@@ -529,54 +531,54 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
harmonicPublicParam.setServerName(generalInfo.getMicroServiceName());
List<PollutionLineDTO> list = new ArrayList<>();
String pollutionType = harmonicPublicParam.getStatisticalType ( ).getId ();
String pollutionType = harmonicPublicParam.getStatisticalType().getId();
PollutionParamDTO paramDTO = new PollutionParamDTO();
if (StringUtils.isBlank(RequestUtil.getDeptIndex())){
if (StringUtils.isBlank(RequestUtil.getDeptIndex())) {
return list;
}
if (harmonicPublicParam.getType() != 0) {
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
PmsStatationStatInfoParam param = new PmsStatationStatInfoParam();
param.setPowerIds(Arrays.asList(harmonicPublicParam.getId()));
//获取变电站详情
List<PmsStatationStatInfoDTO> data = statationStatClient.getStatationStatInfo(param).getData();
if(CollectionUtil.isNotEmpty(data)){
if (CollectionUtil.isNotEmpty(data)) {
List<String> monitorId = data.stream().map(PmsStatationStatInfoDTO::getMonitorId).collect(Collectors.toList());
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList ( monitorId,pollutionType,harmonicPublicParam.getSearchBeginTime(),harmonicPublicParam.getSearchEndTime());
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList(monitorId, pollutionType, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
Map<String, Double> lineMap = lineData.stream().collect(Collectors.toMap(RMpPollutionDPO::getLineId, RMpPollutionDPO::getValue));
PollutionLineDTO dto;
for (PmsStatationStatInfoDTO power : data) {
dto=new PollutionLineDTO();
dto = new PollutionLineDTO();
dto.setId(power.getMonitorId());
dto.setName(power.getMonitorName());
dto.setPowerCompany(power.getOrgName());
dto.setSubstation(power.getPowerName());
dto.setBusBar(power.getBusBarName());
dto.setSubstationId(power.getPowerId());
if(CollectionUtil.isNotEmpty(lineMap)){
if(lineMap.containsKey(power.getMonitorId())){
if (CollectionUtil.isNotEmpty(lineMap)) {
if (lineMap.containsKey(power.getMonitorId())) {
dto.setData(lineMap.get(power.getMonitorId()));
}
}
list.add (dto) ;
list.add(dto);
}
}
}else{
} else {
List<String> line = new ArrayList<>();
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(harmonicPublicParam).getData();
sub.forEach(item->{
if (Objects.equals(harmonicPublicParam.getId(),item.getIndex())){
if (!CollectionUtils.isEmpty(item.getLineIndexes())){
sub.forEach(item -> {
if (Objects.equals(harmonicPublicParam.getId(), item.getIndex())) {
if (!CollectionUtils.isEmpty(item.getLineIndexes())) {
line.addAll(item.getLineIndexes());
}
}
});
if (!CollectionUtils.isEmpty(line)){
if (!CollectionUtils.isEmpty(line)) {
paramDTO.setLineList(line);
list = lineFeignClient.getLineInfo(paramDTO).getData();
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList ( line,pollutionType,harmonicPublicParam.getSearchBeginTime(),harmonicPublicParam.getSearchEndTime());
if (!CollectionUtils.isEmpty(lineData)){
list.stream().map(list1->lineData.stream().filter(list2-> Objects.equals(list1.getId(),list2.getLineId ())).findAny().map(m->{
list1.setData (m.getValue ());
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList(line, pollutionType, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
if (!CollectionUtils.isEmpty(lineData)) {
list.stream().map(list1 -> lineData.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getLineId())).findAny().map(m -> {
list1.setData(m.getValue());
return list1;
})).collect(Collectors.toList());
}
@@ -589,9 +591,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override
public List<PollutionLineDTO> getLineRankTop10 (HarmonicPublicParam param) {
List<PollutionLineDTO> list= new ArrayList<>();
if(param.getType()==0) {
public List<PollutionLineDTO> getLineRankTop10(HarmonicPublicParam param) {
List<PollutionLineDTO> list = new ArrayList<>();
if (param.getType() == 0) {
param.setServerName(generalInfo.getMicroServiceName());
List<String> lineList = new ArrayList<>();
PollutionParamDTO paramDTO = new PollutionParamDTO();
@@ -607,7 +609,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
if (!CollectionUtils.isEmpty(lineList)) {
paramDTO.setLineList(lineList);
list = lineFeignClient.getLineInfo(paramDTO).getData();
List<PublicDTO> result =rMpPollutionDPOMapper.getTop10Line(lineList,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())), param.getStatisticalType().getId());
List<PublicDTO> result = rMpPollutionDPOMapper.getTop10Line(lineList, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())), param.getStatisticalType().getId());
if (!CollectionUtils.isEmpty(result)) {
list.stream().map(list1 -> result.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getId())).findAny().map(m -> {
list1.setData(m.getData());
@@ -628,14 +630,15 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pmsDeviceInfoParam.setStatisticalType(param.getStatisticalType());
//获取主网台账信息
List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
List<String> monitorIdList=new ArrayList<>();
List<String> monitorIdList = new ArrayList<>();
deviceList.forEach(dept -> {
monitorIdList.addAll(dept.getMonitorIdList());
});
if(CollectionUtil.isNotEmpty(monitorIdList)){
if (CollectionUtil.isNotEmpty(monitorIdList)) {
//获取监测点数据
List<PublicDTO> lineData =rMpPollutionDPOMapper.getTop10Line(monitorIdList,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())), param.getStatisticalType().getId()); if(CollectionUtil.isEmpty(lineData)){
List<PublicDTO> lineData = rMpPollutionDPOMapper.getTop10Line(monitorIdList, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())), param.getStatisticalType().getId());
if (CollectionUtil.isEmpty(lineData)) {
return list;
}
//获取主网监测点信息
@@ -643,9 +646,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
Map<String, Monitor> monitorMap = data.stream().collect(Collectors.toMap(Monitor::getId, Function.identity(), (key1, kye2) -> key1));
PollutionLineDTO dto;
for (PublicDTO lineDatum : lineData) {
if(monitorMap.containsKey(lineDatum.getId())){
if (monitorMap.containsKey(lineDatum.getId())) {
Monitor monitor = monitorMap.get(lineDatum.getId());
dto=new PollutionLineDTO();
dto = new PollutionLineDTO();
dto.setId(monitor.getId());
dto.setName(monitor.getName());
dto.setPowerCompany(monitor.getOrgName());
@@ -672,16 +675,16 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
//全部变电站
List<String> subAll = collect.stream().map(SubGetBase::getId).distinct().collect(Collectors.toList());
//国网变电站
List<String> subGw = collect.stream().filter(x -> 1==x.getIsUpToGrid()).map(SubGetBase::getId).distinct().collect(Collectors.toList());
List<String> subGw = collect.stream().filter(x -> 1 == x.getIsUpToGrid()).map(SubGetBase::getId).distinct().collect(Collectors.toList());
GridDiagramVO vo=new GridDiagramVO();
GridDiagramVO vo = new GridDiagramVO();
List<Double> info = new ArrayList<>();
List<Double> gwInfo = new ArrayList<>();
if(CollUtil.isNotEmpty(subAll)){
switch (param.getType()){
if (CollUtil.isNotEmpty(subAll)) {
switch (param.getType()) {
case 1:
List<RStatPollutionSubstationYPO> substationYlist = pollutionSubstationYPOMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationYPO>()
.select(RStatPollutionSubstationYPO::getSubstationId,RStatPollutionSubstationYPO::getValue)
.select(RStatPollutionSubstationYPO::getSubstationId, RStatPollutionSubstationYPO::getValue)
.in(CollUtil.isNotEmpty(subAll), RStatPollutionSubstationYPO::getSubstationId, subAll)
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationYPO::getPollutionType, param.getIds())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationYPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
@@ -689,12 +692,12 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
);
info.addAll(substationYlist.stream().map(RStatPollutionSubstationYPO::getValue).collect(Collectors.toList()));
gwInfo.addAll(substationYlist.stream()
.filter(x->subGw.contains(x.getSubstationId()))
.map(RStatPollutionSubstationYPO::getValue).collect(Collectors.toList()));
.filter(x -> subGw.contains(x.getSubstationId()))
.map(RStatPollutionSubstationYPO::getValue).collect(Collectors.toList()));
break;
case 2:
List<RStatPollutionSubstationQPO> substationQlist = pollutionSubstationQPOMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationQPO>()
.select(RStatPollutionSubstationQPO::getSubstationId,RStatPollutionSubstationQPO::getValue)
.select(RStatPollutionSubstationQPO::getSubstationId, RStatPollutionSubstationQPO::getValue)
.in(CollUtil.isNotEmpty(subAll), RStatPollutionSubstationQPO::getSubstationId, subAll)
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationQPO::getPollutionType, param.getIds())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationQPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
@@ -702,12 +705,12 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
);
info.addAll(substationQlist.stream().map(RStatPollutionSubstationQPO::getValue).collect(Collectors.toList()));
gwInfo.addAll(substationQlist.stream()
.filter(x->subGw.contains(x.getSubstationId()))
.filter(x -> subGw.contains(x.getSubstationId()))
.map(RStatPollutionSubstationQPO::getValue).collect(Collectors.toList()));
break;
case 3:
List<RStatPollutionSubstationM> substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>()
.select(RStatPollutionSubstationM::getSubstationId,RStatPollutionSubstationM::getValue)
.select(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue)
.in(CollUtil.isNotEmpty(subAll), RStatPollutionSubstationM::getSubstationId, subAll)
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationM::getPollutionType, param.getIds())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
@@ -715,12 +718,12 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
);
info.addAll(substationMlist.stream().map(RStatPollutionSubstationM::getValue).collect(Collectors.toList()));
gwInfo.addAll(substationMlist.stream()
.filter(x->subGw.contains(x.getSubstationId()))
.filter(x -> subGw.contains(x.getSubstationId()))
.map(RStatPollutionSubstationM::getValue).collect(Collectors.toList()));
break;
case 4:
List<RStatPollutionSubstationDPO> substationDlist = pollutionSubstationDPOMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationDPO>()
.select(RStatPollutionSubstationDPO::getSubstationId,RStatPollutionSubstationDPO::getValue)
.select(RStatPollutionSubstationDPO::getSubstationId, RStatPollutionSubstationDPO::getValue)
.in(CollUtil.isNotEmpty(subAll), RStatPollutionSubstationDPO::getSubstationId, subAll)
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationDPO::getPollutionType, param.getIds())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationDPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
@@ -728,7 +731,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
);
info.addAll(substationDlist.stream().map(RStatPollutionSubstationDPO::getValue).collect(Collectors.toList()));
gwInfo.addAll(substationDlist.stream()
.filter(x->subGw.contains(x.getSubstationId()))
.filter(x -> subGw.contains(x.getSubstationId()))
.map(RStatPollutionSubstationDPO::getValue).collect(Collectors.toList()));
break;
@@ -741,9 +744,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override
public Page<PollutionGridDiagramDTO> getPollutionAlarmPageData(StatSubstationBizBaseParam param) {
Map<String,String> map=new HashMap<>();
map.put("V",dicDataFeignClient.getDicDataByCode(DicDataEnum.V_HARMONIC.getCode()).getData().getId());
map.put("I",dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL.getCode()).getData().getId());
Map<String, String> map = new HashMap<>();
map.put("V", dicDataFeignClient.getDicDataByCode(DicDataEnum.V_HARMONIC.getCode()).getData().getId());
map.put("I", dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL.getCode()).getData().getId());
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(param.getId());
deptGetLineParam.setPowerFlag(0);
@@ -758,21 +761,21 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
//根据部门统计有多少干扰源(设备数量)
Map<String, SubGetBase> substationMap = substationList.stream().collect(Collectors.toMap(SubGetBase::getId, Function.identity()));
List<String> subIDS=new ArrayList<>();
if(0==param.getType()){
List<String> subIDS = new ArrayList<>();
if (0 == param.getType()) {
//全部变电站
subIDS.addAll(collect.stream().map(SubGetBase::getId).distinct().collect(Collectors.toList()));
}else{
} else {
//国网变电站
subIDS.addAll(collect.stream().filter(x -> 1==x.getIsUpToGrid()).map(SubGetBase::getId).distinct().collect(Collectors.toList()));
subIDS.addAll(collect.stream().filter(x -> 1 == x.getIsUpToGrid()).map(SubGetBase::getId).distinct().collect(Collectors.toList()));
}
Page<PollutionGridDiagramDTO> pollutionPage = pollutionSubstationMMapper.selectBySubstationPage(new Page<>(param.getPageNum(), param.getPageSize())
, subIDS, map, param.getStartTime(), param.getEndTime());
List<PollutionGridDiagramDTO> records = pollutionPage.getRecords();
if(CollUtil.isNotEmpty(records)){
records.forEach(x->{
if(substationMap.containsKey(x.getId())){
if (CollUtil.isNotEmpty(records)) {
records.forEach(x -> {
if (substationMap.containsKey(x.getId())) {
SubGetBase subGetBase = substationMap.get(x.getId());
x.setName(subGetBase.getName());
x.setPowerCompany(subGetBase.getOrgName());
@@ -791,7 +794,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData();
List<String> subIds = data.stream().flatMap(x -> x.getSubIndexes().stream()).collect(Collectors.toList());
List<RStatPollutionSubstationM> substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>()
.select(RStatPollutionSubstationM::getSubstationId,RStatPollutionSubstationM::getValue)
.select(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue)
.in(CollUtil.isNotEmpty(subIds), RStatPollutionSubstationM::getSubstationId, subIds)
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationM::getPollutionType, param.getIds())
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatPollutionSubstationM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
@@ -800,7 +803,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
List<String> dept;
for (GeneralDeviceDTO datum : data) {
List<RStatPollutionSubstationM> collect = substationMlist.stream().filter(x -> datum.getSubIndexes().contains(x.getSubstationId())).collect(Collectors.toList());
dept=new ArrayList<>();
dept = new ArrayList<>();
dept.add(datum.getName());
dept.add(String.valueOf(datum.getSubIndexes().size()));
dept.addAll(addList(collect));
@@ -817,47 +820,80 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
deptGetLineParam.setDeptId(deptIndex);
deptGetLineParam.setLineRunFlag(0);
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
//获取所有监测信息
List<LineDevGetDTO> lineNameList = list.stream().flatMap(x -> x.getLineBaseList().stream()).distinct().collect(Collectors.toList());
Map<String, String> lineOrgName = lineNameList.stream().collect(Collectors.toMap(LineDevGetDTO::getPointId, LineDevGetDTO::getUnitName));
//获取监测点集合
Map<String,List<String>> lineMap = this.getLineMap(list, searchValue);
Map<String, List<String>> lineMap = this.getLineMap(list, searchValue);
List<String> lineList = lineMap.values().stream()
.flatMap(List::stream)
.distinct()
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(lineList)){
if (CollUtil.isNotEmpty(lineList)) {
//获取监测点的超标数据
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAllOverTimes(lineList,startTime,endTime);
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAllOverTimes(lineList, startTime, endTime);
Map<String, RStatLimitRateDPO> monitorMap = limitRateList.stream().collect(Collectors.toMap(RStatLimitRateDPO::getLineId, Function.identity()));
//todo 获取监测点污染数据
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectList(new LambdaQueryWrapper<RMpPollutionDPO>()
.in(CollUtil.isNotEmpty(lineList), RMpPollutionDPO::getLineId, lineList)
.ge(StrUtil.isNotBlank(startTime), RMpPollutionDPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(StrUtil.isNotBlank(endTime), RMpPollutionDPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(endTime)))
);
//谐波电压
String v = dicDataFeignClient.getDicDataByCode(DicDataEnum.V_HARMONIC.getCode()).getData().getId();
List<RMpPollutionDPO> harmonicV = lineData.stream().filter(x -> v.equals(x.getPollutionType())).collect(Collectors.toList());
//谐波电流
String i = dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL.getCode()).getData().getId();
List<RMpPollutionDPO> harmonicI = lineData.stream().filter(x -> i.equals(x.getPollutionType())).collect(Collectors.toList());
//获取监测点详细信息
List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(lineList).getData();
Map<String,List<LineDetail>> lineDetailMap = lineDetailList.stream().collect(Collectors.groupingBy(LineDetail::getPowerSubstationName));
lineDetailMap.forEach((k,v)->{
if(StrUtil.isNotBlank(searchValue)){
lineDetailList= lineDetailList.stream().filter(item -> item.getPowerSubstationName().contains(searchValue)).collect(Collectors.toList());
}
Map<String, List<LineDetail>> lineDetailMap = lineDetailList.stream().filter(x -> StrUtil.isNotBlank(x.getPowerSubstationName())).collect(Collectors.groupingBy(LineDetail::getPowerSubstationName));
lineDetailMap.forEach((key, value) -> {
AtomicInteger alarmTime = new AtomicInteger();
SubstationVo vo = new SubstationVo();
vo.setDeptName("");
vo.setSubstationName(k);
vo.setDwLineList(v.stream().filter(t->Objects.equals(t.getPowerFlag(),0)).map(LineDetail::getId).collect(Collectors.toList()));
vo.setYhLineList(v.stream().filter(t->Objects.equals(t.getPowerFlag(),1)).map(LineDetail::getId).collect(Collectors.toList()));
v.forEach(item->{
alarmTime.set(alarmTime.get() + monitorMap.get(item.getId()).getAllTime());
vo.setDeptName(lineOrgName.get(value.get(0).getId()));
vo.setSubstationName(key);
List<String> gridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 0)).map(LineDetail::getId).collect(Collectors.toList());
List<String> notGridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
vo.setDwLineList(lineNameList.stream().filter(x->gridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
vo.setYhLineList(lineNameList.stream().filter(x->notGridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
value.forEach(item -> {
if(monitorMap.containsKey(item.getId())){
alarmTime.set(alarmTime.get() + monitorMap.get(item.getId()).getAllTime());
}
});
vo.setAlarmFreq(alarmTime.get() * 1.0 / v.size());
vo.setAlarmFreq(NumberUtil.round(alarmTime.get() * 1.0 / value.size(), 2).doubleValue());
OptionalDouble maxV = harmonicV.stream().filter(x -> value.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
vo.setVPollutionData(maxV.isPresent() ? maxV.getAsDouble() : 0.0D);
OptionalDouble maxI = harmonicI.stream().filter(x -> value.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
vo.setIPollutionData(maxI.isPresent() ? maxV.getAsDouble() : 0.0D);
result.add(vo);
});
}
return result;
}
public Map<String,List<String>> getLineMap(List<DeptGetChildrenMoreDTO> list, String searchValue) {
Map<String,List<String>> map = new HashMap<>();
list.forEach(it->{
/**
* 监测点名称筛选
* @param list
* @param searchValue
* @return
*/
public Map<String, List<String>> getLineMap(List<DeptGetChildrenMoreDTO> list, String searchValue) {
Map<String, List<String>> map = new HashMap<>();
list.forEach(it -> {
Predicate<LineDevGetDTO> voltageFilter = item -> true;
if (!Objects.isNull(searchValue) && !Objects.equals(searchValue,"")) {
if (!Objects.isNull(searchValue) && !Objects.equals(searchValue, "")) {
voltageFilter = item -> item.getPointName().contains(searchValue);
}
Predicate<LineDevGetDTO> combinedFilter = voltageFilter;
map.put(it.getUnitName(),it.getLineBaseList().stream()
map.put(it.getUnitName(), it.getLineBaseList().stream()
.filter(combinedFilter)
.map(LineDevGetDTO::getPointId)
.distinct()
@@ -868,7 +904,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
private List<String> addList(List<RStatPollutionSubstationM> substationMlist) {
List<String> info=new ArrayList<>();
List<String> info = new ArrayList<>();
Integer num1 = 0;
Integer num2 = 0;
Integer num3 = 0;

View File

@@ -5,10 +5,12 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.harmonic.mapper.RStatDataIDMapper;
import com.njcn.harmonic.mapper.RStatDataInharmVDMapper;
import com.njcn.harmonic.mapper.ReportMapper;
import com.njcn.harmonic.pojo.po.RStatDataVD;
import com.njcn.harmonic.pojo.po.day.RStatDataIDPO;
import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO;
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.harmonic.service.IRStatDataVDService;
@@ -28,6 +30,7 @@ public class ReportServiceImpl implements ReportService {
private final ReportMapper reportMapper;
private final IRStatDataVDService statDataVDService;
private final RStatDataIDMapper rStatDataIDMapper;
private final RStatDataInharmVDMapper rStatDataInharmVDMapper;
@Override
public OverLimitInfo getOverLimitData(ReportQueryParam param) {
@@ -166,9 +169,9 @@ public class ReportServiceImpl implements ReportService {
public List<ReportValue> getThreephase(ReportQueryParam param) {
List<ReportValue> list = new ArrayList<>();
//电压三相不平衡度
List<ReportValue> listV = dataV(param, Arrays.asList("T"),1, 5,true,0);
List<ReportValue> listV = dataV(param, Arrays.asList("T"), 1, 5, true, 0);
//电流三相不平衡度
List<ReportValue> listI = dataI(param, Arrays.asList("T"),1, 5,true,0);
List<ReportValue> listI = dataI(param, Arrays.asList("T"), 1, 5, true, 0);
if (CollUtil.isNotEmpty(listV)) {
list.addAll(listV);
@@ -189,7 +192,7 @@ public class ReportServiceImpl implements ReportService {
List<ReportValue> list = new ArrayList<>();
//获取电流幅值,包含基波
List<ReportValue> listI = dataI(param, Arrays.asList("A","B","C"),1, 51,false,0);
List<ReportValue> listI = dataI(param, Arrays.asList("A", "B", "C"), 1, 51, false, 0);
if (CollUtil.isEmpty(listI)) {
for (int i = 0; i < 50; i++) {
RegroupData.regroupData(list, true, true);
@@ -205,7 +208,7 @@ public class ReportServiceImpl implements ReportService {
List<ReportValue> list = new ArrayList<>();
//获取基波电压幅值单位kV
List<ReportValue> listV = dataV(param, Arrays.asList("A","B","C"),0, 1,true,5);
List<ReportValue> listV = dataV(param, Arrays.asList("A", "B", "C"), 0, 1, true, 5);
if (CollUtil.isEmpty(listV)) {
RegroupData.regroupData(list, true, true);
@@ -214,7 +217,7 @@ public class ReportServiceImpl implements ReportService {
}
//获取电压含有率,不包含基波
List<ReportValue> listRate = dataV(param, Arrays.asList("A","B","C"),2, 51,false,1);
List<ReportValue> listRate = dataV(param, Arrays.asList("A", "B", "C"), 2, 51, false, 1);
if (CollUtil.isEmpty(listRate)) {
for (int i = 0; i < 49; i++) {
@@ -231,6 +234,73 @@ public class ReportServiceImpl implements ReportService {
return list;
}
@Override
public List<ReportValue> getInharmVeRate(ReportQueryParam param) {
List<RStatDataInharmVDPO> inharm = rStatDataInharmVDMapper.selectList(new LambdaQueryWrapper<RStatDataInharmVDPO>()
.eq(RStatDataInharmVDPO::getLineId, param.getLineId())
.in(RStatDataInharmVDPO::getPhaseType, Arrays.asList("A", "B", "C"))
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataInharmVDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataInharmVDPO::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
String max = "MAX";
String avg = "AVG";
String min = "MIN";
String cp95 = "CP95";
List<ReportValue> a = new ArrayList<>();
Map<String, List<RStatDataInharmVDPO>> collect = inharm.stream().collect(Collectors.groupingBy(RStatDataInharmVDPO::getPhaseType));
collect.forEach((key, value) -> {
Map<String, List<RStatDataInharmVDPO>> valueTypeMap = value.stream().collect(Collectors.groupingBy(RStatDataInharmVDPO::getValueType));
for (int i = 1; i < 17; i++) {
ReportValue reportValue = new ReportValue();
String attribute = "v" + i;
if (valueTypeMap.containsKey(max)) {
List<Float> aa = reflectDataInV(valueTypeMap.get(max), max, attribute);
reportValue.setPhaseType(key);
Float maxNum = aa.stream().distinct().max(Float::compareTo).get();
reportValue.setFmaxValue(maxNum);
}
if (valueTypeMap.containsKey(avg)) {
List<Float> aa = reflectDataInV(valueTypeMap.get(avg), avg, attribute);
reportValue.setPhaseType(key);
Double avgNum = aa.stream().distinct().collect(Collectors.averagingDouble(Float::doubleValue));
reportValue.setMeanValue(avgNum.floatValue());
}
if (valueTypeMap.containsKey(min)) {
List<Float> aa = reflectDataInV(valueTypeMap.get(min), min, attribute);
reportValue.setPhaseType(key);
double minNum = aa.stream().distinct().min(Float::compareTo).get();
reportValue.setMinValue((float) minNum);
}
if (valueTypeMap.containsKey(cp95)) {
List<Float> aa = reflectDataInV(valueTypeMap.get(cp95), cp95, attribute);
reportValue.setPhaseType(key);
List<Float> cp95Num = aa.stream().distinct().sorted(Comparator.comparing(Float::doubleValue).reversed()).collect(Collectors.toList());
reportValue.setCp95Value(cp95Num.get(0).floatValue());
}
a.add(reportValue);
}
});
if (CollUtil.isEmpty(a)) {
for (int i = 1; i < 17; i++) {
RegroupData.regroupData(a, true, true);
}
}
return a;
}
@Override
public List<ReportValue> getINegDataRate(ReportQueryParam param) {
List<ReportValue> list = new ArrayList<>();
//负序电流
List<ReportValue> iNegData = reportMapper.getINegData(param);
RegroupData.regroupData(iNegData, true);
list.addAll(iNegData);
return list;
}
//赋值默认值
private void regroupData(List<ReportValue> list) {
for (int i = 0; i < 4; i++) {
List<ReportValue> list1 = new ArrayList<>();
@@ -241,18 +311,19 @@ public class ReportServiceImpl implements ReportService {
/**
* 电压信息
* @param param 查询条件
*
* @param param 查询条件
* @param valueTypes 区分类别 例如"A","B","C"
* @param num 循环开始
* @param size 循环结束
* @param fly 否是启用获取属性电压
* @param index 获取属性位置名称
* @param num 循环开始
* @param size 循环结束
* @param fly 否是启用获取属性电压
* @param index 获取属性位置名称
* @return
*/
private List<ReportValue> dataV(ReportQueryParam param,List<String> valueTypes,Integer num,Integer size,Boolean fly,Integer index){
private List<ReportValue> dataV(ReportQueryParam param, List<String> valueTypes, Integer num, Integer size, Boolean fly, Integer index) {
List<RStatDataVD> rStatDataVDS = statDataVDService.list(new LambdaQueryWrapper<RStatDataVD>()
.eq(RStatDataVD::getLineId, param.getLineId())
.in(CollUtil.isNotEmpty(valueTypes),RStatDataVD::getPhasicType,valueTypes)
.in(CollUtil.isNotEmpty(valueTypes), RStatDataVD::getPhasicType, valueTypes)
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataVD::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataVD::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
@@ -267,37 +338,37 @@ public class ReportServiceImpl implements ReportService {
for (int i = num; i < size; i++) {
ReportValue reportValue = new ReportValue();
String attribute="";
if(fly){
if (index==0){
String attribute = "";
if (fly) {
if (index == 0) {
attribute = attributeV(i);
}else{
} else {
attribute = attributeV(index);
}
}else{
attribute = "v"+i;
} else {
attribute = "v" + i;
}
if (valueTypeMap.containsKey(max)) {
List<Float> aa = reflectDataV(valueTypeMap.get(max), max,attribute);
List<Float> aa = reflectDataV(valueTypeMap.get(max), max, attribute);
reportValue.setPhaseType(key);
Float maxNum = aa.stream().distinct().max(Float::compareTo).get();
reportValue.setFmaxValue(maxNum);
}
if (valueTypeMap.containsKey(avg)) {
List<Float> aa = reflectDataV(valueTypeMap.get(avg), avg,attribute);
List<Float> aa = reflectDataV(valueTypeMap.get(avg), avg, attribute);
reportValue.setPhaseType(key);
Double avgNum = aa.stream().distinct().collect(Collectors.averagingDouble(Float::doubleValue));
reportValue.setMeanValue(avgNum.floatValue());
}
if (valueTypeMap.containsKey(min)) {
List<Float> aa = reflectDataV(valueTypeMap.get(min), min,attribute);
List<Float> aa = reflectDataV(valueTypeMap.get(min), min, attribute);
reportValue.setPhaseType(key);
double minNum = aa.stream().distinct().min(Float::compareTo).get();
reportValue.setMinValue((float) minNum);
}
if (valueTypeMap.containsKey(cp95)) {
List<Float> aa = reflectDataV(valueTypeMap.get(cp95), cp95,attribute);
List<Float> aa = reflectDataV(valueTypeMap.get(cp95), cp95, attribute);
reportValue.setPhaseType(key);
List<Float> cp95Num = aa.stream().distinct().sorted(Comparator.comparing(Float::doubleValue).reversed()).collect(Collectors.toList());
reportValue.setCp95Value(cp95Num.get(0).floatValue());
@@ -315,7 +386,36 @@ public class ReportServiceImpl implements ReportService {
* @param name
* @return
*/
private List<Float> reflectDataV(List<RStatDataVD> value, String name,String attribute) {
private List<Float> reflectDataV(List<RStatDataVD> value, String name, String attribute) {
Field field = null;
try {
field = RStatDataVD.class.getDeclaredField(attribute);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
field.setAccessible(true);
Field finalField = field;
return value.stream().filter(x -> x.getValueType().equals(name)).map(temp -> {
BigDecimal o = null;
try {
o = (BigDecimal) finalField.get(temp);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return o.floatValue();
}).collect(Collectors.toList());
}
/**
* 电压反射取属性值
*
* @param value
* @param name
* @return
*/
private List<Float> reflectDataInV(List<RStatDataInharmVDPO> value, String name, String attribute) {
Field field = null;
try {
field = RStatDataVD.class.getDeclaredField(attribute);
@@ -339,13 +439,14 @@ public class ReportServiceImpl implements ReportService {
/**
* 电流信息
*
* @param param
* @return
*/
private List<ReportValue> dataI(ReportQueryParam param,List<String> valueTypes,Integer num,Integer size,Boolean fly,Integer index){
private List<ReportValue> dataI(ReportQueryParam param, List<String> valueTypes, Integer num, Integer size, Boolean fly, Integer index) {
List<RStatDataIDPO> rStatDataVDS = rStatDataIDMapper.selectList(new LambdaQueryWrapper<RStatDataIDPO>()
.eq(RStatDataIDPO::getLineId, param.getLineId())
.in(CollUtil.isNotEmpty(valueTypes),RStatDataIDPO::getPhaseType,valueTypes)
.in(CollUtil.isNotEmpty(valueTypes), RStatDataIDPO::getPhaseType, valueTypes)
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataIDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataIDPO::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
@@ -360,36 +461,36 @@ public class ReportServiceImpl implements ReportService {
for (int i = num; i < size; i++) {
ReportValue reportValue = new ReportValue();
String attribute="";
if(fly){
if (index==0){
String attribute = "";
if (fly) {
if (index == 0) {
attribute = attributeI(i);
}else{
} else {
attribute = attributeI(index);
}
}else{
attribute = "i"+i;
} else {
attribute = "i" + i;
}
if (valueTypeMap.containsKey(max)) {
List<Float> aa = reflectDataI(valueTypeMap.get(max), max,attribute);
List<Float> aa = reflectDataI(valueTypeMap.get(max), max, attribute);
reportValue.setPhaseType(key);
Float maxNum = aa.stream().distinct().max(Float::compareTo).get();
reportValue.setFmaxValue(maxNum);
}
if (valueTypeMap.containsKey(avg)) {
List<Float> aa = reflectDataI(valueTypeMap.get(avg), avg,attribute);
List<Float> aa = reflectDataI(valueTypeMap.get(avg), avg, attribute);
reportValue.setPhaseType(key);
Double avgNum = aa.stream().distinct().collect(Collectors.averagingDouble(Float::doubleValue));
reportValue.setMeanValue(avgNum.floatValue());
}
if (valueTypeMap.containsKey(min)) {
List<Float> aa = reflectDataI(valueTypeMap.get(min), min,attribute);
List<Float> aa = reflectDataI(valueTypeMap.get(min), min, attribute);
reportValue.setPhaseType(key);
double minNum = aa.stream().distinct().min(Float::compareTo).get();
reportValue.setMinValue((float) minNum);
}
if (valueTypeMap.containsKey(cp95)) {
List<Float> aa = reflectDataI(valueTypeMap.get(cp95), cp95,attribute);
List<Float> aa = reflectDataI(valueTypeMap.get(cp95), cp95, attribute);
reportValue.setPhaseType(key);
List<Float> cp95Num = aa.stream().distinct().sorted(Comparator.comparing(Float::doubleValue).reversed()).collect(Collectors.toList());
reportValue.setCp95Value(cp95Num.get(0).floatValue());
@@ -430,11 +531,12 @@ public class ReportServiceImpl implements ReportService {
/**
* 获取属性电压
*
* @param i
* @return
*/
private String attributeV(Integer i) {
String str=null;
String str = null;
switch (i) {
case 1:
str = "vUnbalance";
@@ -456,13 +558,15 @@ public class ReportServiceImpl implements ReportService {
}
return str;
}
/**
* 获取属性电流
*
* @param i
* @return
*/
private String attributeI(Integer i) {
String str=null;
String str = null;
switch (i) {
case 1:
str = "iUnbalance";

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -83,7 +84,6 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
private final DicDataFeignClient dicDataFeignClient;
private final DeptLineFeignClient deptLineFeignClient;
private final UserFeignClient userFeignClient;
private final TerminalBaseClient terminalBaseClient;
private final UserReportPOService userReportPOService;
private final UserReportProjectPOService userReportProjectPOService;
private final UserReportSubstationPOService userReportSubstationPOService;
@@ -93,13 +93,63 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
@Override
@Transactional(rollbackFor = Exception.class)
public String addTempLineDebug(SupervisionTempLineDebugParam supervisionTempLineReportParam) {
//获取临时监测点详情
SupervisionTempLineReport tempLine = supervisionTempLineReportService.getById(supervisionTempLineReportParam.getId());
//需要审核报告是否审核通过
UserReportPO temp = userReportPOService.getById(tempLine.getUserId());
//是否存在治理方案
Integer needGovernance = 0;
if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_POWER_GRID.getCode(),
UserNatureEnum.EXTEND_POWER_GRID.getCode()
).contains(temp.getUserType())) {
//电网工程类用户额外数据
needGovernance = userReportProjectPOService.getById(temp.getId()).getNeedGovernance();
} else if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
).contains(temp.getUserType())) {
//非线性负荷用户 & 新能源发电站用户
needGovernance = userReportSubstationPOService.getById(temp.getId()).getNeedGovernance();
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(temp.getUserType())) {
// 敏感及重要用户
needGovernance = userReportSensitivePOService.getById(temp.getId()).getNeedGovernance();
}
//添加治理评估文件,需先判断入网评估是否审核通过
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
.eq(UserReportNormalPO::getUserReportId, temp.getId())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
.orderByDesc(UserReportNormalPO::getCreateTime)
);
if (CollUtil.isNotEmpty(list)) {
Optional<UserReportNormalPO> netInReport = list.stream().filter(x -> 0 == x.getType()).findFirst();
if(netInReport.isPresent()){
if(netInReport.get().getStatus()!=2){
throw new BusinessException("最新入网验收方案流程,暂未审核通过!");
}
}else{
throw new BusinessException("请填写入网验收方案流程,审核通过后方可操作!");
}
if (needGovernance == 1) {
Optional<UserReportNormalPO> governReport = list.stream().filter(x -> 1 == x.getType()).findFirst();
if(governReport.isPresent()){
if(governReport.get().getStatus()!=2){
throw new BusinessException("最新治理工程验收方案流程,暂未审核通过!");
}
}else{
throw new BusinessException("请填写治理工程验收方案流程,审核通过后方可操作!");
}
}
} else {
throw new BusinessException("请上传,入网设计方案或者治理工程验收方案");
}
// SupervisionTempLineDebugPO byId = this.getById(supervisionTempLineReportParam.getId());
// if(Objects.nonNull(byId)){
// if(byId.getState() == 1) {
// throw new BusinessException("该监测点已申请联调");
// }
// }
SupervisionTempLineDebugPO supervisionTempLineDebugPO = new SupervisionTempLineDebugPO();
BeanUtils.copyProperties(supervisionTempLineReportParam,supervisionTempLineDebugPO);
//设置状态
@@ -128,9 +178,6 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
supervisionTempLineDebugPO.setProcessInstanceId(processInstanceId);
this.updateById(supervisionTempLineDebugPO);
}
return id;
}
@@ -224,19 +271,22 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
SupervisionTempLineDebugVO supervisionTempLineDebugVO = new SupervisionTempLineDebugVO();
SupervisionTempLineReport supervisionTempLineReport = supervisionTempLineReportService.getById(id);
SupervisionTempLineDebugPO supervisionTempLineDebugPO = this.getById(id);
supervisionTempLineDebugVO.setId(id);
if(ObjectUtil.isNotNull(supervisionTempLineDebugPO)){
supervisionTempLineDebugVO.setId(id);
supervisionTempLineDebugVO.setUserName(supervisionTempLineReport.getUserName());
supervisionTempLineDebugVO.setConnectedBus(supervisionTempLineReport.getConnectedBus());
supervisionTempLineDebugVO.setMonitoringTerminalCode(supervisionTempLineReport.getMonitoringTerminalCode());
supervisionTempLineDebugVO.setMonitoringTerminalName(supervisionTempLineReport.getMonitoringTerminalName());
supervisionTempLineDebugVO.setPowerSubstationName(supervisionTempLineReport.getPowerSubstationName());
supervisionTempLineDebugVO.setUserName(supervisionTempLineReport.getUserName());
supervisionTempLineDebugVO.setConnectedBus(supervisionTempLineReport.getConnectedBus());
supervisionTempLineDebugVO.setMonitoringTerminalCode(supervisionTempLineReport.getMonitoringTerminalCode());
supervisionTempLineDebugVO.setMonitoringTerminalName(supervisionTempLineReport.getMonitoringTerminalName());
supervisionTempLineDebugVO.setPowerSubstationName(supervisionTempLineReport.getPowerSubstationName());
supervisionTempLineDebugVO.setLineId(supervisionTempLineReport.getLineId());
supervisionTempLineDebugVO.setLineName(supervisionTempLineReport.getLineName());
supervisionTempLineDebugVO.setReason(supervisionTempLineDebugPO.getReason());
supervisionTempLineDebugVO.setProcessInstanceId(supervisionTempLineDebugPO.getProcessInstanceId());
supervisionTempLineDebugVO.setStatus(supervisionTempLineDebugPO.getStatus());
}
supervisionTempLineDebugVO.setLineId(supervisionTempLineReport.getLineId());
supervisionTempLineDebugVO.setLineName(supervisionTempLineReport.getLineName());
supervisionTempLineDebugVO.setReason(supervisionTempLineDebugPO.getReason());
supervisionTempLineDebugVO.setProcessInstanceId(supervisionTempLineDebugPO.getProcessInstanceId());
supervisionTempLineDebugVO.setStatus(supervisionTempLineDebugPO.getStatus());
return supervisionTempLineDebugVO;
}
@@ -251,13 +301,18 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
SupervisionTempLineDebugVO supervisionTempLineDebugVO = this.getDetailTempLineDebug(businessId);
bpmInstanceInfo.setHistoryInstanceId(supervisionTempLineDebugVO.getHistoryInstanceId());
String sign = supervisionTempLineDebugVO.getPowerSubstationName()
.concat(StrPool.SLASH)
.concat(supervisionTempLineDebugVO.getMonitoringTerminalName())
.concat(StrPool.SLASH)
.concat(supervisionTempLineDebugVO.getLineName());
bpmInstanceInfo.setInstanceSign(sign);
if(ObjectUtil.isNotNull(supervisionTempLineDebugVO)){
bpmInstanceInfo.setHistoryInstanceId(supervisionTempLineDebugVO.getHistoryInstanceId());
String sign = "";
if(StrUtil.isNotBlank(supervisionTempLineDebugVO.getPowerSubstationName())){
sign = supervisionTempLineDebugVO.getPowerSubstationName()
.concat(StrPool.SLASH)
.concat(supervisionTempLineDebugVO.getMonitoringTerminalName())
.concat(StrPool.SLASH)
.concat(supervisionTempLineDebugVO.getLineName());
}
bpmInstanceInfo.setInstanceSign(sign);
}
return bpmInstanceInfo;
}
@@ -276,61 +331,6 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
}
//获取临时监测点详情
SupervisionTempLineReport tempLine = supervisionTempLineReportService.getById(id);
//需要审核报告是否审核通过
UserReportPO temp = userReportPOService.getById(tempLine.getUserId());
//是否存在治理方案
Integer needGovernance = 0;
if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_POWER_GRID.getCode(),
UserNatureEnum.EXTEND_POWER_GRID.getCode()
).contains(temp.getUserType())) {
//电网工程类用户额外数据
needGovernance = userReportProjectPOService.getById(temp.getId()).getNeedGovernance();
} else if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
).contains(temp.getUserType())) {
//非线性负荷用户 & 新能源发电站用户
needGovernance = userReportSubstationPOService.getById(temp.getId()).getNeedGovernance();
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(temp.getUserType())) {
// 敏感及重要用户
needGovernance = userReportSensitivePOService.getById(temp.getId()).getNeedGovernance();
}
//添加治理评估文件,需先判断入网评估是否审核通过
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
.eq(UserReportNormalPO::getUserReportId, temp.getId())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
.orderByDesc(UserReportNormalPO::getCreateTime)
);
if (CollUtil.isNotEmpty(list)) {
Optional<UserReportNormalPO> netInReport = list.stream().filter(x -> 0 == x.getType()).findFirst();
if(netInReport.isPresent()){
if(netInReport.get().getStatus()!=2){
throw new BusinessException("最新入网验收方案流程,暂未审核通过!");
}
}else{
throw new BusinessException("请填写入网验收方案流程,审核通过后方可操作!");
}
if (needGovernance == 1) {
Optional<UserReportNormalPO> governReport = list.stream().filter(x -> 1 == x.getType()).findFirst();
if(governReport.isPresent()){
if(governReport.get().getStatus()!=2){
throw new BusinessException("最新治理工程验收方案流程,暂未审核通过!");
}
}else{
throw new BusinessException("请填写治理工程验收方案流程,审核通过后方可操作!");
}
}
} else {
throw new BusinessException("请上传,入网设计方案或者治理工程验收方案");
}
//获取关联的设备信息
SupervisionTempDeviceReport tempDevice = supervisionTempDeviceReportService.getById(tempLine.getMonitoringTerminalCode());
SyncTerminalParam syncTerminalParam = new SyncTerminalParam();
@@ -379,10 +379,10 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
syncTerminalParam.setSubVoltageParam(subVoltageParam);
syncTerminalParam.setLineParam(lineParam);
String substation = terminalBaseClient.terminalSync(syncTerminalParam).getData();
this.updateProcessStatus(id,5);
tempDevice.setSubstation(substation);
supervisionTempDeviceReportService.updateById(tempDevice);
// String substation = terminalBaseClient.terminalSync(syncTerminalParam).getData();
// this.updateProcessStatus(id,5);
// tempDevice.setSubstation(substation);
// supervisionTempDeviceReportService.updateById(tempDevice);
return null;
}

View File

@@ -253,7 +253,8 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl<Supervisio
LambdaQueryWrapper<SupervisionTempLineReport> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper
.eq(SupervisionTempLineReport::getMonitoringTerminalCode, supervisionTempLineReportParam.getMonitoringTerminalCode())
.and(wrapper -> wrapper.eq(SupervisionTempLineReport::getNum, supervisionTempLineReportParam.getNum()).or()
.and(wrapper -> wrapper.eq(SupervisionTempLineReport::getNum, supervisionTempLineReportParam.getNum())
.or()
.eq(SupervisionTempLineReport::getLineName, supervisionTempLineReportParam.getLineName())
)
.eq(SupervisionTempLineReport::getState, DataStateEnum.ENABLE.getCode());

View File

@@ -294,7 +294,7 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
try {
startTime = DateUtil.beginOfDay(DateUtil.parse(startTime)).toString();
endTime = DateUtil.endOfDay(DateUtil.parse(endTime)).toString();
String fileUrl = reportFeignClient.exportWorld(
String fileUrl = reportFeignClient.exportModelJB(
startTime,
endTime,
0,