报表添加接线方式、一二次值判断
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据范围映射表获取分组
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user