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

View File

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

View File

@@ -417,30 +417,20 @@ public class GeneralDeviceService {
return generalDeviceDTO; return generalDeviceDTO;
} }
//筛选出终端id理论上监测点的pids中第个id为终端id //1.筛选出母线id理论上监测点的pids中第个id为母线id 联查: pq_line t1 ,pq_voltage t2
List<String> devIds = lines.stream().map(line -> { List<String> voltageIds=lines.stream().map(Line::getPid).collect(Collectors.toList());
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());
//再根据电压等级筛选合法母线信息 //再根据电压等级筛选合法母线信息
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, deviceInfoParam.getScale());
deviceInfoParam.getScale());
//筛选出变电站id理论上监测点的pids中第个id为变电站id 联查: pq_line t1 ,pq_substation t2 //2.筛选出终端id理论上监测点的pids中第个id为终端id
List<String> subIds = lines.stream().map(line -> { List<String> devIds=voltages.stream().map(Line::getPid).collect(Collectors.toList());
String[] idsArray = line.getPids().split(","); // 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
return idsArray[3]; List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer());
}).collect(Collectors.toList());
List<Line> sub = terminalBaseService.getSubByCondition(subIds, //3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
deviceInfoParam.getScale()); 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); dealDeviceData(generalDeviceDTO, lines, devices, voltages, sub);
return generalDeviceDTO; 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.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.GeneralVO; import com.njcn.event.pojo.vo.GeneralVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -69,4 +70,10 @@ public interface EventDetailFeignClient {
*/ */
@PostMapping("/getAppEventDetailLtAmplitude") @PostMapping("/getAppEventDetailLtAmplitude")
HttpResult<List<RmpEventDetailPO>> getAppEventDetailLtAmplitude(@RequestBody EventCountParam param); 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); 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") @ApiModelProperty(name="endTime",value="统计截止日期yyyy-MM-dd")
private String endTime; 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); 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的暂态信息(灿能云) * 根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息(灿能云)
* @return * @return

View File

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

View File

@@ -41,7 +41,7 @@ public class ReportClientFallbackFactory implements FallbackFactory<ReportFeignC
return new ReportFeignClient() { return new ReportFeignClient() {
@Override @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()); log.error("{}异常,降级处理,异常为:{}", "获取谐波报告失败", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }

View File

@@ -26,7 +26,7 @@ public class WordUtil2 {
private final FileStorageUtil fileStorageUtil; 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 { throws Exception {
path = ClearPathUtil.cleanString(path); path = ClearPathUtil.cleanString(path);
InputStream inStream = null; InputStream inStream = null;
@@ -35,7 +35,12 @@ public class WordUtil2 {
try { try {
inStream = new ClassPathResource(path).getInputStream();; inStream = new ClassPathResource(path).getInputStream();;
doc = new CustomXWPFDocument(inStream); 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); // 替换文本里面的变量 this.replaceInPara(doc, params); // 替换文本里面的变量
} catch (IOException e) { } catch (IOException e) {
getError("获取报告模板异常,原因为:" + 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 { throws Exception {
path = ClearPathUtil.cleanString(path); path = ClearPathUtil.cleanString(path);
InputStream inStream = null,in = null; InputStream inStream = null,in = null;
@@ -105,9 +110,12 @@ public class WordUtil2 {
try { try {
inStream = new ClassPathResource(path).getInputStream();; inStream = new ClassPathResource(path).getInputStream();;
doc = new CustomXWPFDocument(inStream); 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); // 替换文本里面的变量 this.replaceInPara(doc, params); // 替换文本里面的变量
//临时缓冲区 //临时缓冲区
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
doc.write(out); doc.write(out);
@@ -299,9 +307,14 @@ public class WordUtil2 {
XWPFTableRow row = table.createRow(); XWPFTableRow row = table.createRow();
List<XWPFTableCell> cells = row.getTableCells(); List<XWPFTableCell> cells = row.getTableCells();
for (int j = 0; j < cells.size(); j++) { for (int j = 0; j < cells.size(); j++) {
XWPFTableCell cell = cells.get(j);
String s = tableList.get(i)[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(); table = iterator.next();
if (table.getRows().size() > 1) { 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(); rows = table.getRows();
for (XWPFTableRow row : rows) { for (XWPFTableRow row : rows) {
cells = row.getTableCells(); cells = row.getTableCells();
@@ -335,7 +348,9 @@ public class WordUtil2 {
} }
} }
}else { }else {
if (CollUtil.isNotEmpty(tableList.get(num))){
insertTable(table, tableList.get(num)); // 插入数据 insertTable(table, tableList.get(num)); // 插入数据
}
num++; num++;
} }
} }
@@ -353,6 +368,11 @@ public class WordUtil2 {
Matcher matcher = pattern.matcher(str); Matcher matcher = pattern.matcher(str);
return matcher; 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") @PostMapping("/exportModel")
@ApiOperation("word报告") @ApiOperation("word报告")
public HttpResult<String> exportWorld(HttpServletResponse response, public HttpResult<String> exportWorld(HttpServletResponse response,
@RequestParam("startTime") String startTime, @RequestParam(value ="startTime",required = false) String startTime,
@RequestParam("endTime") String endTime, @RequestParam(value ="endTime",required = false) String endTime,
@RequestParam("type") Integer type, @RequestParam(value ="type",required = false) Integer type,
@RequestParam("lineIndex") String lineIndex, @RequestParam(value ="lineIndex",required = false) String lineIndex,
@RequestParam("name") String name, @RequestParam(value ="name",required = false) String name,
@RequestParam("reportNumber") String reportNumber, @RequestParam(value ="reportNumber",required = false) String reportNumber,
@RequestParam("crmName") String crmName, @RequestParam(value ="crmName",required = false) String crmName,
@RequestParam("isUrl") Boolean isUrl, @RequestParam(value = "isUrl",required = false) Boolean isUrl,
@RequestPart("file") MultipartFile file) throws IOException { @RequestPart(value ="file",required = false) MultipartFile file) throws IOException {
String methodDescribe = getMethodDescribe("exportWorld"); String methodDescribe = getMethodDescribe("exportWorld");
//获取监测点信息 //获取监测点信息
String bdname; String bdname;
@@ -119,6 +119,9 @@ public class ExportModelController extends BaseController {
} }
bdname = lineDto.getBdName(); bdname = lineDto.getBdName();
areaName = lineDto.getAreaName(); areaName = lineDto.getAreaName();
if(areaName.equals("冀北")){
areaName="国网"+areaName;
}
pttype = PubUtils.ptTypeName(lineDto.getPtType()); pttype = PubUtils.ptTypeName(lineDto.getPtType());
} else { } else {
List<Monitor> monitorList = monitorClient.getMonitorList(Arrays.asList(lineIndex)).getData(); List<Monitor> monitorList = monitorClient.getMonitorList(Arrays.asList(lineIndex)).getData();
@@ -780,11 +783,19 @@ public class ExportModelController extends BaseController {
String strResultFlicker = ""; String strResultFlicker = "";
String tmpstrResultFlicker = ""; String tmpstrResultFlicker = "";
String strResultFlickerValue = ""; String strResultFlickerValue = "";
String strPhase = "";// 相别A、B、C Double fmaxValue1 = 0.0;
String strType = "";// 长闪还是短闪S:短闪L长闪 Double fmaxValue2 = 0.0;
String strValueType = "";// 值类型最大最小平均95%概率值 Double fmaxValue3 = 0.0;
Double flickerLimit = 0.0;
try { try {
if (Double.parseDouble(plt1.getFmaxValue().toString()) > Double.parseDouble(valueOfFlickerLimit)) { 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) {
strResultFlickerValue += "注意:从上表中可以看出" + strLineBaseName + "长时闪变数据存在异常(不是数值类型)。";
}
if (fmaxValue1 > flickerLimit) {
if (!"".equals(tmpstrResultFlicker)) if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ","; tmpstrResultFlicker += ",";
tmpstrResultFlicker += atype + "最大值为:" + plt1.getFmaxValue().toString(); tmpstrResultFlicker += atype + "最大值为:" + plt1.getFmaxValue().toString();
@@ -793,7 +804,7 @@ public class ExportModelController extends BaseController {
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "合格"); reportmap.put("$" + "L" + "V0R_" + "A" + "$", "合格");
} }
if (Double.parseDouble(plt2.getFmaxValue().toString()) > Double.parseDouble(valueOfFlickerLimit)) { if (fmaxValue2 > flickerLimit) {
if (!"".equals(tmpstrResultFlicker)) if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ","; tmpstrResultFlicker += ",";
tmpstrResultFlicker += btype + "最大值为:" + plt2.getFmaxValue().toString(); tmpstrResultFlicker += btype + "最大值为:" + plt2.getFmaxValue().toString();
@@ -802,7 +813,7 @@ public class ExportModelController extends BaseController {
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "合格"); reportmap.put("$" + "L" + "V0R_" + "B" + "$", "合格");
} }
if (Double.parseDouble(plt3.getFmaxValue().toString()) > Double.parseDouble(valueOfFlickerLimit) && pttype != 2) { if (fmaxValue3 > flickerLimit && pttype != 2) {
if (!"".equals(tmpstrResultFlicker)) if (!"".equals(tmpstrResultFlicker))
tmpstrResultFlicker += ","; tmpstrResultFlicker += ",";
tmpstrResultFlicker += ctype + "最大值为:" + plt3.getFmaxValue().toString(); tmpstrResultFlicker += ctype + "最大值为:" + plt3.getFmaxValue().toString();
@@ -810,10 +821,6 @@ public class ExportModelController extends BaseController {
} else { } else {
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "合格"); reportmap.put("$" + "L" + "V0R_" + "C" + "$", "合格");
} }
} catch (Exception e) {
if ("".equals(strResultFlickerValue))
strResultFlickerValue += "注意:从上表中可以看出" + strLineBaseName + "长时闪变数据存在异常(不是数值类型)。";
}
reportmap.put("$PSTX_A$", judgeNull(pst1.getFmaxValue())); reportmap.put("$PSTX_A$", judgeNull(pst1.getFmaxValue()));
reportmap.put("$PSTN_A$", judgeNull(pst1.getMinValue())); reportmap.put("$PSTN_A$", judgeNull(pst1.getMinValue()));
@@ -1227,9 +1234,9 @@ public class ExportModelController extends BaseController {
try { try {
String fileName = name + formatter.format(currentTime) + ".docx"; String fileName = name + formatter.format(currentTime) + ".docx";
if (isUrl) { if (isUrl) {
reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx", reportmap); reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx",null ,reportmap);
} else { } else {
wordUtil2.getWord(rtfPath, reportmap, fileName, response); wordUtil2.getWord(rtfPath, reportmap, fileName,null, response);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("获取报告发生异常,异常是" + e.getMessage()); log.error("获取报告发生异常,异常是" + e.getMessage());

View File

@@ -111,7 +111,10 @@ public class PollutionSubstationController extends BaseController {
@ApiImplicitParam(name = "startTime", value = "开始时间"), @ApiImplicitParam(name = "startTime", value = "开始时间"),
@ApiImplicitParam(name = "endTime", 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"); String methodDescribe = getMethodDescribe("getSubstationInfo");
LogUtil.njcnDebug(log, "{},实体参数:{},{}", methodDescribe, deptIndex, searchValue); LogUtil.njcnDebug(log, "{},实体参数:{},{}", methodDescribe, deptIndex, searchValue);
List<SubstationVo> list = pollutionSubstationService.getSubstationInfo(deptIndex,searchValue,startTime,endTime); 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); List<ReportValue> getFrequencyData(@Param("param")ReportQueryParam param);
/** /**
* *频率
* @param param * @param param
* @return * @return
*/ */
List<ReportValue> getDEVFrequencyData(@Param("param")ReportQueryParam param); 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 from
`r_stat_limit_rate_d` `r_stat_limit_rate_d`
<where> <where>
and time_id between #{startTime} and #{endTime} and time_id between #{statTime} and #{endTime}
<if test=" ids != null and ids.size > 0"> <if test=" ids != null and ids.size > 0">
AND my_index IN AND my_index IN
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'> <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>

View File

@@ -901,5 +901,59 @@
GROUP BY GROUP BY
`phasic_type`; `phasic_type`;
</select> </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> </mapper>

View File

@@ -12,7 +12,7 @@ import java.util.List;
public interface ReportService { public interface ReportService {
/** /**
* * 限值
* @param param * @param param
* @return * @return
*/ */
@@ -80,4 +80,18 @@ public interface ReportService {
* @return * @return
*/ */
List<ReportValue> getVoltageRate(ReportQueryParam param); 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.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept; import com.njcn.user.pojo.po.Dept;
import com.njcn.web.utils.RequestUtil; 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.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@@ -66,8 +61,15 @@ import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; 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: * Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html * 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/10/13 8:56【需求编号】 * Date: 2022/10/13 8:56【需求编号】
@@ -635,7 +637,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
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; return list;
} }
//获取主网监测点信息 //获取主网监测点信息
@@ -817,6 +820,10 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
deptGetLineParam.setDeptId(deptIndex); deptGetLineParam.setDeptId(deptIndex);
deptGetLineParam.setLineRunFlag(0); deptGetLineParam.setLineRunFlag(0);
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData(); 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() List<String> lineList = lineMap.values().stream()
@@ -828,27 +835,56 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
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())); Map<String, RStatLimitRateDPO> monitorMap = limitRateList.stream().collect(Collectors.toMap(RStatLimitRateDPO::getLineId, Function.identity()));
//todo 获取监测点污染数据 //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(); List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(lineList).getData();
Map<String,List<LineDetail>> lineDetailMap = lineDetailList.stream().collect(Collectors.groupingBy(LineDetail::getPowerSubstationName)); if(StrUtil.isNotBlank(searchValue)){
lineDetailMap.forEach((k,v)->{ 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(); AtomicInteger alarmTime = new AtomicInteger();
SubstationVo vo = new SubstationVo(); SubstationVo vo = new SubstationVo();
vo.setDeptName(""); vo.setDeptName(lineOrgName.get(value.get(0).getId()));
vo.setSubstationName(k); vo.setSubstationName(key);
vo.setDwLineList(v.stream().filter(t->Objects.equals(t.getPowerFlag(),0)).map(LineDetail::getId).collect(Collectors.toList())); List<String> gridSide = value.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())); List<String> notGridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
v.forEach(item->{ 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()); 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); result.add(vo);
}); });
} }
return result; return result;
} }
/**
* 监测点名称筛选
* @param list
* @param searchValue
* @return
*/
public Map<String, List<String>> getLineMap(List<DeptGetChildrenMoreDTO> list, String searchValue) { public Map<String, List<String>> getLineMap(List<DeptGetChildrenMoreDTO> list, String searchValue) {
Map<String, List<String>> map = new HashMap<>(); Map<String, List<String>> map = new HashMap<>();
list.forEach(it -> { list.forEach(it -> {

View File

@@ -5,10 +5,12 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.harmonic.mapper.RStatDataIDMapper; import com.njcn.harmonic.mapper.RStatDataIDMapper;
import com.njcn.harmonic.mapper.RStatDataInharmVDMapper;
import com.njcn.harmonic.mapper.ReportMapper; import com.njcn.harmonic.mapper.ReportMapper;
import com.njcn.harmonic.pojo.po.RStatDataVD; import com.njcn.harmonic.pojo.po.RStatDataVD;
import com.njcn.harmonic.pojo.po.day.RStatDataIDPO; import com.njcn.harmonic.pojo.po.day.RStatDataIDPO;
import com.njcn.harmonic.pojo.param.ReportQueryParam; 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.po.report.OverLimitInfo;
import com.njcn.harmonic.pojo.vo.ReportValue; import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.harmonic.service.IRStatDataVDService; import com.njcn.harmonic.service.IRStatDataVDService;
@@ -28,6 +30,7 @@ public class ReportServiceImpl implements ReportService {
private final ReportMapper reportMapper; private final ReportMapper reportMapper;
private final IRStatDataVDService statDataVDService; private final IRStatDataVDService statDataVDService;
private final RStatDataIDMapper rStatDataIDMapper; private final RStatDataIDMapper rStatDataIDMapper;
private final RStatDataInharmVDMapper rStatDataInharmVDMapper;
@Override @Override
public OverLimitInfo getOverLimitData(ReportQueryParam param) { public OverLimitInfo getOverLimitData(ReportQueryParam param) {
@@ -231,6 +234,73 @@ public class ReportServiceImpl implements ReportService {
return list; 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) { private void regroupData(List<ReportValue> list) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
List<ReportValue> list1 = new ArrayList<>(); List<ReportValue> list1 = new ArrayList<>();
@@ -241,6 +311,7 @@ public class ReportServiceImpl implements ReportService {
/** /**
* 电压信息 * 电压信息
*
* @param param 查询条件 * @param param 查询条件
* @param valueTypes 区分类别 例如"A","B","C" * @param valueTypes 区分类别 例如"A","B","C"
* @param num 循环开始 * @param num 循环开始
@@ -337,8 +408,38 @@ public class ReportServiceImpl implements ReportService {
}).collect(Collectors.toList()); }).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);
} 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 param * @param param
* @return * @return
*/ */
@@ -430,6 +531,7 @@ public class ReportServiceImpl implements ReportService {
/** /**
* 获取属性电压 * 获取属性电压
*
* @param i * @param i
* @return * @return
*/ */
@@ -456,8 +558,10 @@ public class ReportServiceImpl implements ReportService {
} }
return str; return str;
} }
/** /**
* 获取属性电流 * 获取属性电流
*
* @param i * @param i
* @return * @return
*/ */

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.text.StrPool; import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -83,7 +84,6 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final DeptLineFeignClient deptLineFeignClient; private final DeptLineFeignClient deptLineFeignClient;
private final UserFeignClient userFeignClient; private final UserFeignClient userFeignClient;
private final TerminalBaseClient terminalBaseClient;
private final UserReportPOService userReportPOService; private final UserReportPOService userReportPOService;
private final UserReportProjectPOService userReportProjectPOService; private final UserReportProjectPOService userReportProjectPOService;
private final UserReportSubstationPOService userReportSubstationPOService; private final UserReportSubstationPOService userReportSubstationPOService;
@@ -93,13 +93,63 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String addTempLineDebug(SupervisionTempLineDebugParam supervisionTempLineReportParam) { 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(); SupervisionTempLineDebugPO supervisionTempLineDebugPO = new SupervisionTempLineDebugPO();
BeanUtils.copyProperties(supervisionTempLineReportParam,supervisionTempLineDebugPO); BeanUtils.copyProperties(supervisionTempLineReportParam,supervisionTempLineDebugPO);
//设置状态 //设置状态
@@ -128,9 +178,6 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
supervisionTempLineDebugPO.setProcessInstanceId(processInstanceId); supervisionTempLineDebugPO.setProcessInstanceId(processInstanceId);
this.updateById(supervisionTempLineDebugPO); this.updateById(supervisionTempLineDebugPO);
} }
return id; return id;
} }
@@ -224,6 +271,7 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
SupervisionTempLineDebugVO supervisionTempLineDebugVO = new SupervisionTempLineDebugVO(); SupervisionTempLineDebugVO supervisionTempLineDebugVO = new SupervisionTempLineDebugVO();
SupervisionTempLineReport supervisionTempLineReport = supervisionTempLineReportService.getById(id); SupervisionTempLineReport supervisionTempLineReport = supervisionTempLineReportService.getById(id);
SupervisionTempLineDebugPO supervisionTempLineDebugPO = this.getById(id); SupervisionTempLineDebugPO supervisionTempLineDebugPO = this.getById(id);
if(ObjectUtil.isNotNull(supervisionTempLineDebugPO)){
supervisionTempLineDebugVO.setId(id); supervisionTempLineDebugVO.setId(id);
supervisionTempLineDebugVO.setUserName(supervisionTempLineReport.getUserName()); supervisionTempLineDebugVO.setUserName(supervisionTempLineReport.getUserName());
@@ -237,6 +285,8 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
supervisionTempLineDebugVO.setReason(supervisionTempLineDebugPO.getReason()); supervisionTempLineDebugVO.setReason(supervisionTempLineDebugPO.getReason());
supervisionTempLineDebugVO.setProcessInstanceId(supervisionTempLineDebugPO.getProcessInstanceId()); supervisionTempLineDebugVO.setProcessInstanceId(supervisionTempLineDebugPO.getProcessInstanceId());
supervisionTempLineDebugVO.setStatus(supervisionTempLineDebugPO.getStatus()); supervisionTempLineDebugVO.setStatus(supervisionTempLineDebugPO.getStatus());
}
return supervisionTempLineDebugVO; return supervisionTempLineDebugVO;
} }
@@ -251,13 +301,18 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
public BpmInstanceInfo getInstanceInfo(String businessId) { public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo(); BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
SupervisionTempLineDebugVO supervisionTempLineDebugVO = this.getDetailTempLineDebug(businessId); SupervisionTempLineDebugVO supervisionTempLineDebugVO = this.getDetailTempLineDebug(businessId);
if(ObjectUtil.isNotNull(supervisionTempLineDebugVO)){
bpmInstanceInfo.setHistoryInstanceId(supervisionTempLineDebugVO.getHistoryInstanceId()); bpmInstanceInfo.setHistoryInstanceId(supervisionTempLineDebugVO.getHistoryInstanceId());
String sign = supervisionTempLineDebugVO.getPowerSubstationName() String sign = "";
if(StrUtil.isNotBlank(supervisionTempLineDebugVO.getPowerSubstationName())){
sign = supervisionTempLineDebugVO.getPowerSubstationName()
.concat(StrPool.SLASH) .concat(StrPool.SLASH)
.concat(supervisionTempLineDebugVO.getMonitoringTerminalName()) .concat(supervisionTempLineDebugVO.getMonitoringTerminalName())
.concat(StrPool.SLASH) .concat(StrPool.SLASH)
.concat(supervisionTempLineDebugVO.getLineName()); .concat(supervisionTempLineDebugVO.getLineName());
}
bpmInstanceInfo.setInstanceSign(sign); bpmInstanceInfo.setInstanceSign(sign);
}
return bpmInstanceInfo; return bpmInstanceInfo;
} }
@@ -276,61 +331,6 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
} }
//获取临时监测点详情 //获取临时监测点详情
SupervisionTempLineReport tempLine = supervisionTempLineReportService.getById(id); 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()); SupervisionTempDeviceReport tempDevice = supervisionTempDeviceReportService.getById(tempLine.getMonitoringTerminalCode());
SyncTerminalParam syncTerminalParam = new SyncTerminalParam(); SyncTerminalParam syncTerminalParam = new SyncTerminalParam();
@@ -379,10 +379,10 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
syncTerminalParam.setSubVoltageParam(subVoltageParam); syncTerminalParam.setSubVoltageParam(subVoltageParam);
syncTerminalParam.setLineParam(lineParam); syncTerminalParam.setLineParam(lineParam);
String substation = terminalBaseClient.terminalSync(syncTerminalParam).getData(); // String substation = terminalBaseClient.terminalSync(syncTerminalParam).getData();
this.updateProcessStatus(id,5); // this.updateProcessStatus(id,5);
tempDevice.setSubstation(substation); // tempDevice.setSubstation(substation);
supervisionTempDeviceReportService.updateById(tempDevice); // supervisionTempDeviceReportService.updateById(tempDevice);
return null; return null;
} }

View File

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

View File

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