报表添加接线方式、一二次值判断

This commit is contained in:
xy
2026-01-28 08:44:45 +08:00
parent 736b0a6e60
commit 05ef7028c4
19 changed files with 413 additions and 55 deletions

View File

@@ -67,7 +67,7 @@ public class IcdController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/bzFileByEventId")
@ApiOperation("指定事件补召波形")
@ApiOperation("指定事件补召波形指令下发")
@ApiImplicitParam(name = "eventId", value = "事件id", required = true)
public HttpResult<String> bzFileByEventId(@RequestParam String eventId){
String methodDescribe = getMethodDescribe("bzFileByEventId");
@@ -77,7 +77,7 @@ public class IcdController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/bzEvent")
@ApiOperation("补召事件")
@ApiOperation("补召事件指令下发")
@ApiImplicitParam(name = "param", value = "参数", required = true)
public HttpResult<String> bzEvent(@RequestBody @Validated IcdBzParam param){
String methodDescribe = getMethodDescribe("bzEvent");
@@ -87,7 +87,7 @@ public class IcdController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/bzFile")
@ApiOperation("补召波形")
@ApiOperation("补召波形指令下发")
@ApiImplicitParam(name = "param", value = "参数", required = true)
public HttpResult<String> bzFile(@RequestBody @Validated IcdBzParam param){
String methodDescribe = getMethodDescribe("bzFile");

View File

@@ -39,15 +39,17 @@
SELECT
line.line_id as lineId,
line.name as lineName,
concat(round(line.pt_ratio,0),concat(':',round(line.pt2_ratio,0))) as pt,
concat(round(line.ct_ratio,0),concat(':',round(line.ct2_ratio,0))) as ct,
concat(round(line.pt_ratio,0), ':', round(IFNULL(line.pt2_ratio, 1), 0)) as pt,
concat(round(line.ct_ratio,0), ':', round(IFNULL(line.ct2_ratio, 1), 0)) as ct,
line.dev_capacity as Dev_Capacity,
line.short_circuit_capacity as Short_Capacity,
line.basic_capacity as Standard_Capacity,
line.protocol_capacity as Deal_Capacity,
line.vol_grade AS voltageLevel
line.vol_grade AS voltageLevel,
dataSet.data_level AS level
FROM
cs_line line
left JOIN cs_data_set dataSet on line.data_set_id = dataSet.id
WHERE
line.line_id = #{lineId}
</select>

View File

@@ -20,7 +20,10 @@ import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.enums.LineBaseEnum;
import com.njcn.csdevice.mapper.*;
import com.njcn.csdevice.mapper.CsDataArrayMapper;
import com.njcn.csdevice.mapper.CsDataSetMapper;
import com.njcn.csdevice.mapper.CsGroArrMapper;
import com.njcn.csdevice.mapper.CsGroupMapper;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
import com.njcn.csdevice.pojo.po.*;
@@ -796,7 +799,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
List<ThdDataVO> result = new ArrayList<>();
CsLinePO finalCsLinePO = csLineFeignClient.getById(trendDataQueryParam.getLineId()).getData();
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePO.getDataSetId()));
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
}
Double ct = finalCsLinePO.getCtRatio();
@@ -1159,7 +1162,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
TrendDataQueryParam queryParam = new TrendDataQueryParam();
queryParam.setFrequency(item.getFrequency());
if (ObjectUtil.isNotNull(param.getHarmonicCount())) {
queryParam.setFrequency(String.valueOf(param.getHarmonicCount()));
}
queryParam.setStatisticalId(item.getStatisticalId());
return queryParam;
}).collect(Collectors.toList());

View File

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.access.api.CsLineLatestDataFeignClient;
import com.njcn.access.pojo.po.CsLineLatestData;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
@@ -41,6 +42,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -140,7 +142,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
//1.新增监测点信息
BeanUtils.copyProperties(param,po);
po.setStatus(1);
po.setRunStatus(2);
po.setRunStatus(param.getRunStatus());
po.setLineId(param.getDevMac().replace(":","") + param.getLineNo());
//模板id
CsDevModelPO po1 = csDevModelService.getCldModel();
@@ -374,14 +376,14 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
// 报告文件
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
// 最新数据时间
// List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
// if (CollUtil.isNotEmpty(lineLatestDataList)) {
// sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
// .filter(item -> item.getLineId().equals(record.getLineId()))
// .map(CsLineLatestData::getTimeId)
// .max(LocalDateTime::compareTo)
// .orElse(null));
// }
List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
if (CollUtil.isNotEmpty(lineLatestDataList)) {
sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
.filter(item -> item.getLineId().equals(record.getLineId()))
.map(CsLineLatestData::getTimeId)
.max(LocalDateTime::compareTo)
.orElse(null));
}
list.add(sensitiveUserLineVO);
}
result.setRecords(list);

View File

@@ -36,4 +36,8 @@ public class SensitiveUserTrendDataQueryParam {
@ApiModelProperty(value = "频次2-50")
private String frequency;
//采用这个频次,上面那个频次用于多指标筛选
@ApiModelProperty(value = "频次2-50")
private Integer harmonicCount;
}

View File

@@ -45,6 +45,12 @@ public class ReportTemplateParam {
@ApiModelProperty(name = "reportForm",value = "报表类型",required = true)
private String reportForm;
@ApiModelProperty(name = "wiringMethod",value = "接线方式",required = true)
private String wiringMethod;
@ApiModelProperty(name = "sort",value = "排序",required = true)
private Integer sort;
@Data
@EqualsAndHashCode(callSuper = true)

View File

@@ -22,8 +22,10 @@ public class TotalLimitStatisticsDetailsVO {
private Integer allTime;
@ApiModelProperty(value = "闪变越限次数")
private Integer flickerOvertime;
private Integer flickerAllTime;
@ApiModelProperty(value = "闪变越限")
private double flickerOvertime;
@ApiModelProperty(value = "频率偏差越限")
private double freqDevOvertime;

View File

@@ -1,6 +1,5 @@
package com.njcn.csharmonic.controller;
import cn.hutool.core.collection.CollUtil;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -92,13 +90,7 @@ public class EventOverviewController extends BaseController {
@ApiOperation("获取暂降方向统计数据")
public HttpResult<List<Map<String,Object>>> getEventDirectionData(@RequestBody EventStatisticParam baseParam){
String methodDescribe = getMethodDescribe("getEventDirectionData");
Map<String,Object> load = new HashMap<>();
load.put("source", "load");
load.put("times", 41);
Map<String,Object> grid = new HashMap<>();
grid.put("source", "grid");
grid.put("times", 4);
List<Map<String,Object>> list = CollUtil.newArrayList(load, grid);
List<Map<String,Object>> list = eventOverviewService.getEventDirectionData(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
}

View File

@@ -0,0 +1,77 @@
package com.njcn.csharmonic.controller;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.common.service.ISysExcelService;
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
import com.njcn.harmonic.pojo.po.excel.SysExcel;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author xy
* @since 2026-01-27
*/
@Slf4j
@RestController
@RequestMapping("/sysExcel")
@Api(tags = "模板类型配置")
@AllArgsConstructor
public class SysExcelController extends BaseController {
private final ISysExcelService sysExcelService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addSysExcel")
@ApiOperation("新增")
@ApiImplicitParam(name = "param", value = "设备数据趋势参数", required = true)
public HttpResult<Boolean> addSysExcel(@RequestBody ExcelParam param) {
String methodDescribe = getMethodDescribe("addSysExcel");
Boolean result = sysExcelService.addSysExcel(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateSysExcel")
@ApiOperation("修改")
public HttpResult<Boolean> updateSysExcel(@RequestBody ExcelParam.UpdateExcelParam param) {
String methodDescribe = getMethodDescribe("updateSysExcel");
Boolean result = sysExcelService.updateSysExcel(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/deleteSysExcel")
@ApiOperation("删除")
public HttpResult<Boolean> deleteSysExcel(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("deleteSysExcel");
Boolean result = sysExcelService.deleteSysExcel(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/querySysExcel")
@ApiOperation("查询")
public HttpResult<List<SysExcel>> querySysExcel() {
String methodDescribe = getMethodDescribe("querySysExcel");
List<SysExcel> result = sysExcelService.querySysExcel();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -0,0 +1,60 @@
package com.njcn.csharmonic.controller;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csharmonic.service.ICsSysExcelRelationService;
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author xy
* @since 2026-01-27
*/
@RequestMapping("/sysExcelRelation")
@Slf4j
@RestController
@Api(tags = "模板关系配置")
@AllArgsConstructor
public class SysExcelRelationController extends BaseController {
private final ICsSysExcelRelationService sysExcelService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryList")
@ApiOperation("查询")
public HttpResult<List<ReportTemplateVO>> queryList(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("queryList");
List<ReportTemplateVO> result = sysExcelService.queryList(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/bandRelation")
@ApiOperation("绑定关系")
public HttpResult<Boolean> bandRelation(@RequestBody ExcelParam.ListExcelParam param) {
String methodDescribe = getMethodDescribe("bandRelation");
Boolean result = sysExcelService.bandRelation(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -107,7 +107,10 @@
AND b.type =#{ csEventUserQueryPage.type}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
AND b.level =#{ csEventUserQueryPage.level}
AND b.level IN
<foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">
#{level}
</foreach>
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.status != null and csEventUserQueryPage.status !=''">
AND a.status =#{ csEventUserQueryPage.status}
@@ -157,9 +160,11 @@
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
AND b.level = #{ csEventUserQueryPage.level}
AND b.level IN
<foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">
#{level}
</foreach>
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
AND b.tag = #{csEventUserQueryPage.eventType}
</if>

View File

@@ -0,0 +1,24 @@
package com.njcn.csharmonic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
import com.njcn.harmonic.pojo.po.excel.SysExcelRelation;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author xy
* @since 2026-01-27
*/
public interface ICsSysExcelRelationService extends IService<SysExcelRelation> {
List<ReportTemplateVO> queryList(String id);
Boolean bandRelation(ExcelParam.ListExcelParam param);
}

View File

@@ -1,15 +1,12 @@
package com.njcn.csharmonic.service.event;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
import com.njcn.csharmonic.pojo.vo.event.EventCoordsVO;
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
import com.njcn.csharmonic.pojo.vo.event.F47Curve;
import com.njcn.web.pojo.param.BaseParam;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
/**
* @Author: cdf
@@ -28,4 +25,6 @@ public interface EventOverviewService {
List<EventStatisticVO> getEventDate(EventStatisticParam baseParam);
EventCoordsVO getEventCoords(EventStatisticParam baseParam);
List<Map<String,Object>> getEventDirectionData(EventStatisticParam baseParam);
}

View File

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.po.CsLinePO;
@@ -35,7 +36,7 @@ import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
import com.njcn.csharmonic.service.CsEventPOService;
import com.njcn.csharmonic.service.CsEventUserPOService;
import com.njcn.event.common.mapper.RmpEventDetailMapper;
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
import com.njcn.event.file.component.WaveFileComponent;
import com.njcn.event.file.component.WavePicComponent;
import com.njcn.event.file.pojo.bo.WaveDataDetail;
@@ -114,7 +115,9 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
private final InfluxDbUtils influxDbUtils;
private final MinIoUtils minIoUtils;
private final DicDataFeignClient dicDataFeignClient;
private final RmpEventDetailMapper rmpEventDetailMapper;
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
//private final CommonEventWaveAnalysisService commonEventWaveAnalysisService;
private final EquipmentFeignClient equipmentFeignClient;
@Override
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
@@ -403,15 +406,24 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
rmpEventDetailPO.setDuration(param.getDuration());
rmpEventDetailPO.setEventDescribe(getTag(param.getEventType()));
rmpEventDetailPO.setPhase(param.getPhase());
rmpEventDetailMapper.insert(rmpEventDetailPO);
rmpEventDetailPO.setDealFlag(0);
wlRmpEventDetailMapper.insert(rmpEventDetailPO);
}
public void updateEvent(CldEventParam param) {
LambdaQueryWrapper<RmpEventDetailPO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(RmpEventDetailPO::getMeasurementPointId,param.getMonitorId()).eq(RmpEventDetailPO::getStartTime,param.getStartTime());
RmpEventDetailPO po = rmpEventDetailMapper.selectOne(wrapper);
RmpEventDetailPO po = wlRmpEventDetailMapper.selectOne(wrapper);
po.setWavePath(param.getWavePath());
rmpEventDetailMapper.updateById(po);
po.setFileFlag(1);
//根据事件获取暂态类型、暂态原因、暂态发生位置
//String ip = equipmentFeignClient.getDevByLineId(param.getMonitorId()).getData().getMac();
//EntityAdvancedData advancedData = commonEventWaveAnalysisService.analysis(po,ip);
//po.setAdvanceReason(advancedData.getSagReason()[0]);
//po.setAdvanceType(advancedData.getSagType()[0]);
wlRmpEventDetailMapper.updateById(po);
}

View File

@@ -537,7 +537,12 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
.eq(CsEventPO::getType, 4)
.orderByDesc(CsEventPO::getStartTime);
if (ObjectUtil.isNotNull(baseParam.getLevel()) && StringUtil.isNotBlank(baseParam.getLevel())) {
queryWrapper.eq(CsEventPO::getLevel, Integer.valueOf(baseParam.getLevel()));
List<Integer> levelList = Arrays.stream(baseParam.getLevel().split(","))
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Integer::parseInt)
.collect(Collectors.toList());
queryWrapper.in(CsEventPO::getLevel, levelList);
}
page = csEventPOMapper.selectPage(page, queryWrapper);
}

View File

@@ -0,0 +1,50 @@
package com.njcn.csharmonic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csharmonic.service.ICsSysExcelRelationService;
import com.njcn.harmonic.common.mapper.ExcelRptTempMapper;
import com.njcn.harmonic.common.mapper.SysExcelRelationMapper;
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
import com.njcn.harmonic.common.pojo.vo.SysExcelRelationVO;
import com.njcn.harmonic.common.service.ISysExcelRelationService;
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
import com.njcn.harmonic.pojo.po.excel.SysExcelRelation;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author xy
* @since 2026-01-27
*/
@Service
@RequiredArgsConstructor
@DS("sjzx")
public class CsSysExcelRelationServiceImpl extends ServiceImpl<SysExcelRelationMapper, SysExcelRelation> implements ICsSysExcelRelationService {
private final ISysExcelRelationService sysExcelRelationService;
private final ExcelRptTempMapper excelRptTempMapper;
@Override
public List<ReportTemplateVO> queryList(String id) {
List<ReportTemplateVO> result = new ArrayList<>();
SysExcelRelationVO sysExcelRelationVO = sysExcelRelationService.getRelation(id);
if (CollectionUtil.isNotEmpty(sysExcelRelationVO.getRelationIds())) {
result = excelRptTempMapper.getReportTemplateByIds(sysExcelRelationVO.getRelationIds());
}
return result;
}
@Override
public Boolean bandRelation(ExcelParam.ListExcelParam param) {
return sysExcelRelationService.bandRelation(param);
}
}

View File

@@ -32,6 +32,7 @@ import com.njcn.csharmonic.pojo.vo.ReportTemplateDataVO;
import com.njcn.csharmonic.pojo.vo.ReportTreeVO;
import com.njcn.csharmonic.pojo.vo.SysDeptTempVO;
import com.njcn.csharmonic.service.CustomReportService;
import com.njcn.csharmonic.service.ICsSysExcelRelationService;
import com.njcn.csharmonic.utils.DataChangeUtil;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
@@ -112,6 +113,7 @@ public class CustomReportServiceImpl implements CustomReportService {
private final WlRecordFeignClient wlRecordFeignClient;
private final UserFeignClient userFeignClient;
private final CsLineFeignClient csLineFeignClient;
private final ICsSysExcelRelationService sysExcelService;
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
private final JdbcTemplate jdbcTemplate;
@@ -156,8 +158,15 @@ public class CustomReportServiceImpl implements CustomReportService {
@Override
public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) {
//获取模板id
String tempId = getTempId(reportSearchParam.getTempId(), reportSearchParam.getLineId());
//修改模板id
reportSearchParam.setTempId(tempId);
//原代码
TimeInterval timeInterval = new TimeInterval();
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
//ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(tempId);
if (Objects.isNull(excelRptTemp)) {
throw new BusinessException(CsHarmonicResponseEnum.CUSTOM_REPORT_ACTIVE);
}
@@ -262,17 +271,29 @@ public class CustomReportServiceImpl implements CustomReportService {
@Override
public void getSensitiveUserReport(SensitiveUserReportQueryParam queryParam, HttpServletResponse response) {
TimeInterval timeInterval = new TimeInterval();
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(queryParam.getTempId());
if (Objects.isNull(excelRptTemp)) {
throw new BusinessException(CsHarmonicResponseEnum.CUSTOM_REPORT_ACTIVE);
}
String sensitiveUserId = queryParam.getSensitiveUserId();
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
CsLinePO loadSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(loadSideDictData.getId())).findFirst().orElse(null);
String tempId = getTempId(queryParam.getTempId(), Objects.isNull(gridSideLine)? loadSideLine.getLineId():gridSideLine.getLineId());
queryParam.setTempId(tempId);
TimeInterval timeInterval = new TimeInterval();
// ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(queryParam.getTempId());
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(tempId);
if (Objects.isNull(excelRptTemp)) {
throw new BusinessException(CsHarmonicResponseEnum.CUSTOM_REPORT_ACTIVE);
}
// String sensitiveUserId = queryParam.getSensitiveUserId();
// List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
// DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
// DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
// CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
// CsLinePO loadSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(loadSideDictData.getId())).findFirst().orElse(null);
String lineName = "";
// 模版内容数据
JSONArray templateData;
@@ -2135,6 +2156,40 @@ public class CustomReportServiceImpl implements CustomReportService {
return dataList;
}
//获取模板id
public String getTempId(String oldTempId, String lineId) {
//根据模板类型的id获取模板
List<ReportTemplateVO> result = sysExcelService.queryList(oldTempId);
if (CollUtil.isEmpty(result)) {
throw new BusinessException("未配置相关模板");
}
//根据监测点获取接线方式
CsLinePO po = csLineFeignClient.getById(lineId).getData();
//根据接线方式获取模板id
int conType = po.getConType();
DictData dicData;
//角型
if (conType == 1) {
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR_TRIANGLE.getCode()).getData();
}
//v型
else if (conType == 2){
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.OPEN_DELTA.getCode()).getData();
}
//星型 或 其他
else {
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR.getCode()).getData();
}
String tempId;
Optional<ReportTemplateVO> vo = result.stream().filter(item -> Objects.equals(dicData.getId(),item.getWiringMethod())).findFirst();
if (vo.isPresent()) {
tempId = vo.get().getId();
} else {
throw new BusinessException("未找到此接线方式的模板");
}
return tempId;
}
}

View File

@@ -30,10 +30,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -373,6 +370,7 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
statisticsVO.setLineName(linePO.getName());
List<RStatLimitRateDPO> lineRateList = lineMap.get(linePO.getLineId());
int totalTime = lineRateList.stream().mapToInt(RStatLimitRateDPO::getAllTime).sum();
int flickerTime = lineRateList.stream().mapToInt(RStatLimitRateDPO::getFlickerAllTime).sum();
int flickerTotalTime = lineRateList.stream().mapToInt(RStatLimitRateDPO::getFlickerOvertime).sum();
int voltageDevTotalTime = lineRateList.stream().mapToInt(RStatLimitRateDPO::getVoltageDevOvertime).sum();
int ubalanceTotalTime = lineRateList.stream().mapToInt(RStatLimitRateDPO::getUbalanceOvertime).sum();
@@ -408,7 +406,7 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
statisticsVO.setUharm(0.0);
statisticsVO.setIharm(0.0);
} else {
statisticsVO.setFlicker(calculatePercentage(flickerTotalTime, totalTime));
statisticsVO.setFlicker(calculatePercentage(flickerTotalTime, flickerTime));
statisticsVO.setVoltageDev(calculatePercentage(voltageDevTotalTime, totalTime));
statisticsVO.setUbalance(calculatePercentage(ubalanceTotalTime, totalTime));
statisticsVO.setUharm(calculatePercentage(uharm, totalTime));
@@ -439,15 +437,22 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
MainLineStatLimitRateDetailsVO vo = BeanUtil.copyProperties(item, MainLineStatLimitRateDetailsVO.class);
vo.setLineName(linePO.getName());
Integer allTime = item.getAllTime();
Integer flickerTime = item.getFlickerAllTime();
JSONObject entries = JSONUtil.parseObj(vo);
for (Map.Entry<String, Object> entry : entries.entrySet()) {
String key = entry.getKey();
if (key.endsWith("Overtime") && allTime != 0) {
if (key.endsWith("Overtime") && allTime != 0 && !Objects.equals("flickerOvertime", key)) {
String value = entry.getValue().toString();
int intValue = new Integer(value);
// 占比 = 越限次数 / 总次数 * 100
double proportion = calculatePercentage(intValue, allTime);
entries.putOpt(key, proportion);
} else if (Objects.equals("flickerOvertime", key)) {
String value = entry.getValue().toString();
int intValue = new Integer(value);
// 占比 = 越限次数 / 总次数 * 100
double proportion = calculatePercentage(intValue, flickerTime);
entries.putOpt(key, proportion);
}
}
return BeanUtil.copyProperties(entries, TotalLimitStatisticsDetailsVO.class);

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.ImmutableMap;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
@@ -20,6 +21,8 @@ import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
import com.njcn.csharmonic.pojo.vo.event.F47Curve;
import com.njcn.csharmonic.service.CsEventPOService;
import com.njcn.csharmonic.service.event.EventOverviewService;
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -50,6 +53,7 @@ public class EventOverviewServiceImpl implements EventOverviewService {
private final CsEventPOService csEventPOService;
private final CsLineFeignClient csLineFeignClient;
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
@Override
public EventStatisticVO netEventEcharts(EventStatisticParam baseParam) {
@@ -294,7 +298,13 @@ public class EventOverviewServiceImpl implements EventOverviewService {
// 0:down, 1:off, 2:up
List<Integer>[] timeSegmentStats = new List[3];
for (int i = 0; i < timeSegmentStats.length; i++) {
timeSegmentStats[i] = IntStream.range(0, 5).boxed().collect(Collectors.toList());
// 创建独立的 ArrayList每个都有初始值 0
timeSegmentStats[i] = new ArrayList<>();
// 5个时间段
for (int j = 0; j < 5; j++) {
timeSegmentStats[i].add(0);
}
// timeSegmentStats[i] = IntStream.range(0, 5).boxed().collect(Collectors.toList());
}
for (CsEventPO event : events) {
double amplitude = event.getAmplitude();
@@ -316,7 +326,7 @@ public class EventOverviewServiceImpl implements EventOverviewService {
inner.setZ(inner.getZ() + 1);
}
int hour = event.getStartTime().getHour();
int hour = event.getStartTime().getHour() + 1;
int startTimeGroup = getRangeGroup(startTimeRanges, hour);
String tag = event.getTag();
@@ -344,6 +354,49 @@ public class EventOverviewServiceImpl implements EventOverviewService {
return eventCoordsVO;
}
@Override
public List<Map<String, Object>> getEventDirectionData(EventStatisticParam baseParam) {
List<Map<String,Object>> list = new ArrayList<>();
Map<String,Object> load = new HashMap<>();
load.put("source", "load");
Map<String,Object> grid = new HashMap<>();
grid.put("source", "grid");
//获取当前用户拥有的监测点
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
if (CollUtil.isEmpty(poList)) {
load.put("times", 0);
grid.put("times", 0);
} else {
List<String> ids = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
//根据监测点获取暂态事件
//安全处理空列表
List<RmpEventDetailPO> events = Optional.ofNullable(selectEventByIds(baseParam, ids))
.orElse(Collections.emptyList());
long lowerCount = events.stream()
.filter(event -> event != null && "Lower".equalsIgnoreCase(event.getSagsource()))
.count();
long upperCount = events.stream()
.filter(event -> event != null && "Upper".equalsIgnoreCase(event.getSagsource()))
.count();
load.put("times", (int) lowerCount);
grid.put("times", (int) upperCount);
}
list.add(load);
list.add(grid);
return list;
}
//根据监测点获取暂态事件
public List<RmpEventDetailPO> selectEventByIds(EventStatisticParam param, List<String> ids) {
LambdaQueryWrapper<RmpEventDetailPO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(RmpEventDetailPO::getMeasurementPointId,ids)
.between(RmpEventDetailPO::getStartTime,param.getSearchBeginTime(),param.getSearchEndTime());
return wlRmpEventDetailMapper.selectList(wrapper);
}
/**
* 根据范围映射表获取分组
*/