Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -51,6 +51,10 @@ public interface CommTerminalGeneralClient {
|
||||
@PostMapping("deptGetLine")
|
||||
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
||||
|
||||
@PostMapping("deptGetLineInfo")
|
||||
HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
||||
|
||||
|
||||
@PostMapping("deptGetAllLine")
|
||||
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
@@ -50,6 +51,13 @@ public class CommTerminalGeneralClientFallbackFactory implements FallbackFactory
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(DeptGetLineParam deptGetLineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据部门获取监测点信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(DeptGetLineParam deptGetLineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据单位获取all监测点信息", throwable.toString());
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-06
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class MonitorCommLedgerInfoDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private String monitorId;
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private String gdName;
|
||||
|
||||
private String bdName;
|
||||
|
||||
private String busBarName;
|
||||
|
||||
private String voltageLevel;
|
||||
|
||||
private String shortCapacity;
|
||||
|
||||
private String devCapacity;
|
||||
|
||||
private String dealCapacity;
|
||||
|
||||
private String standardCapacity;
|
||||
|
||||
private Integer timeInterval;
|
||||
|
||||
}
|
||||
@@ -42,6 +42,13 @@ public enum LineBaseEnum {
|
||||
POWER_FLAG_NOT(1,"非电网侧"),
|
||||
|
||||
|
||||
/**
|
||||
* 装置系统类型
|
||||
*/
|
||||
DEV_DATA_TYPE_ZT(0,"暂态系统装置"),
|
||||
DEV_DATA_TYPE_WT(1,"稳态系统装置"),
|
||||
DEV_DATA_TYPE_ALL(2,"全部系统装置")
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqsDeviceUnitService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -108,6 +109,23 @@ public class CommTerminalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门监测点台账信息
|
||||
* @param deptGetLineParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("deptGetLineInfo")
|
||||
@ApiOperation("根据部门id获取部门监测点台账信息")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
String methodDescribe = getMethodDescribe("deptGetLineInfo");
|
||||
List<MonitorCommLedgerInfoDTO> result = commTerminalService.deptGetLineInfo(deptGetLineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("deptGetAllLine")
|
||||
@ApiOperation("根据单位获取监测点信息(all line)")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.njcn.device.pq.service;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -40,6 +40,9 @@ public interface CommTerminalService {
|
||||
*/
|
||||
List<DeptGetChildrenMoreDTO> deptGetLine(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
|
||||
List<MonitorCommLedgerInfoDTO> deptGetLineInfo(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
List<DeptGetChildrenMoreDTO> deptGetAllLine(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
List<LineDevGetDTO> deptGetLineByIdList(List<String> monitorIds);
|
||||
|
||||
@@ -11,9 +11,10 @@ import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
@@ -28,6 +29,8 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.device.pq.enums.LineBaseEnum.DEV_DATA_TYPE_ALL;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
@@ -49,6 +52,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
private final DeptLineMapper deptLineMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -59,10 +63,6 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
*/
|
||||
@Override
|
||||
public List<DeptGetBase> getDeptChildrenByParent(DeptGetLineParam deptGetLineParam) {
|
||||
/*List<DeptGetBase> redisResult = (List<DeptGetBase>) redisUtil.getObjectByKey(commTerminal + deptGetLineParam.getDeptId());
|
||||
if (CollectionUtil.isNotEmpty(redisResult)) {
|
||||
return redisResult;
|
||||
}*/
|
||||
List<DeptGetBase> result = new ArrayList<>();
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptGetLineParam.getDeptId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
deptDTOList.forEach(it -> {
|
||||
@@ -119,6 +119,13 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MonitorCommLedgerInfoDTO> deptGetLineInfo(DeptGetLineParam deptGetLineParam) {
|
||||
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(deptGetLineParam.getDeptId()).getData();
|
||||
List<MonitorCommLedgerInfoDTO> ledgerList = deptLineMapper.getMonitorByDeptIds(Stream.of(DEV_DATA_TYPE_ALL.getCode()).collect(Collectors.toList()),deptIds);
|
||||
return ledgerList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetChildrenMoreDTO> deptGetAllLine(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetChildrenMoreDTO> result = new ArrayList<>();
|
||||
|
||||
@@ -471,6 +471,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
|
||||
private List<PqDataVerifyBak> baseDataVerifyQuery(List<String> monitorIds, MonitorBaseParam monitorBaseParam) {
|
||||
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
|
||||
monitorBaseParam.setErrorTimeCount(720);
|
||||
}
|
||||
LambdaQueryWrapper<PqDataVerifyBak> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorIds)
|
||||
|
||||
@@ -369,7 +369,7 @@ public class GeneralDeviceService {
|
||||
StatisticsEnum statisticsEnum = StatisticsEnum.getStatisticsEnumByCode(deviceInfoParam.getStatisticalType().getCode());
|
||||
switch (statisticsEnum) {
|
||||
case VOLTAGE_LEVEL:
|
||||
return filterDataByScale(deviceInfos, deviceInfoParam.getScale());
|
||||
return filterDataByScale(deviceInfos, deviceInfoParam.getScale(),deviceInfoParam.getLineOrDevice());
|
||||
case LOAD_TYPE:
|
||||
return filterDataByLoadType(deviceInfos, deviceInfoParam.getLoadType());
|
||||
case MANUFACTURER:
|
||||
@@ -474,11 +474,12 @@ public class GeneralDeviceService {
|
||||
generalDeviceDTO.setLineIndexes(lineIndexes.stream().distinct().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private List<GeneralDeviceDTO> filterDataByScale(List<GeneralDeviceDTO> deviceInfos, List<SimpleDTO> scales) {
|
||||
private List<GeneralDeviceDTO> filterDataByScale(List<GeneralDeviceDTO> deviceInfos, List<SimpleDTO> scales,Integer type) {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOS = new ArrayList<>();
|
||||
List<String> subIds = new ArrayList<>(), lineIds = new ArrayList<>();
|
||||
List<String> subIds = new ArrayList<>(), subVIds = new ArrayList<>(),lineIds = new ArrayList<>();
|
||||
for (GeneralDeviceDTO generalDeviceDTO : deviceInfos) {
|
||||
subIds.addAll(generalDeviceDTO.getSubIndexes());
|
||||
subVIds.addAll(generalDeviceDTO.getVoltageIndexes());
|
||||
lineIds.addAll(generalDeviceDTO.getLineIndexes());
|
||||
}
|
||||
//如果电压等级集合为空,则查询所有的电压等级
|
||||
@@ -496,8 +497,13 @@ public class GeneralDeviceService {
|
||||
}
|
||||
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
||||
for (SimpleDTO simpleDTO : scales) {
|
||||
List<String> voltageScaleIds = terminalBaseService.getSubIdByScale(subIds, simpleDTO.getId());
|
||||
generalDeviceDTOS.add(assembleDataByLine(simpleDTO, lines, voltageScaleIds, LineBaseEnum.SUB_LEVEL.getCode()));
|
||||
if(ObjectUtil.isNull(type)){
|
||||
List<String> voltageScaleIds = terminalBaseService.getSubIdByScale(subIds, simpleDTO.getId());
|
||||
generalDeviceDTOS.add(assembleDataByLine(simpleDTO, lines, voltageScaleIds, LineBaseEnum.SUB_LEVEL.getCode()));
|
||||
}else{
|
||||
List<String> voltageScaleIds = terminalBaseService.getVoltageIdByScale(subVIds, simpleDTO.getId());
|
||||
generalDeviceDTOS.add(assembleDataByLine(simpleDTO, lines, voltageScaleIds, LineBaseEnum.SUB_V_LEVEL.getCode()));
|
||||
}
|
||||
}
|
||||
return generalDeviceDTOS;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.dto.SubGetBase;
|
||||
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -74,6 +75,9 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
|
||||
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type,@Param("lineRunFlag") Integer lineRunFlag);
|
||||
|
||||
List<MonitorCommLedgerInfoDTO> getMonitorByDeptIds(@Param("list")List<Integer> devType,@Param("deptIds")List<String> deptIds);
|
||||
|
||||
|
||||
List<LineDevGetDTO> lineDevAllGet(@Param("list")List<Integer> devType,@Param("type")Integer type,@Param("lineRunFlag") Integer lineRunFlag, @Param("lineType") Integer lineType);
|
||||
|
||||
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
||||
|
||||
@@ -74,6 +74,45 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getMonitorByDeptIds" resultType="com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO">
|
||||
select
|
||||
point.id monitorId,
|
||||
point.name monitorName,
|
||||
lineDetail.Time_Interval timeInterval,
|
||||
lineDetail.Dev_Capacity devCapacity,
|
||||
lineDetail.Short_Capacity shortCapacity,
|
||||
lineDetail.Standard_Capacity standardCapacity,
|
||||
lineDetail.Deal_Capacity dealCapacity,
|
||||
voltage.name busBarname,
|
||||
pq_voltage.scale voltageLevel,
|
||||
bd.name bdName,
|
||||
gd.name gdName
|
||||
from pq_dept_line pq_dept_line
|
||||
inner join pq_line point on pq_dept_line.line_id = point.id
|
||||
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
||||
inner join pq_line voltage on point.pid = voltage.id
|
||||
inner join pq_voltage pq_voltage on voltage.id = pq_voltage.id
|
||||
inner join pq_line dev on voltage.pid = dev.id
|
||||
inner join pq_device device on dev.id = device.id
|
||||
inner join pq_line bd on dev.pid = bd.id
|
||||
inner join pq_line gd on bd.pid = gd.id
|
||||
where device.Dev_Model = 1
|
||||
and point.state = 1
|
||||
and device.Dev_Data_Type in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
and device.Run_Flag = 0
|
||||
and pq_dept_line.id in
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by point.name asc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="lineDevAllGet" resultType="com.njcn.device.biz.pojo.dto.LineDevGetDTO">
|
||||
select
|
||||
<!--监测点-->
|
||||
|
||||
@@ -1565,7 +1565,6 @@
|
||||
lineDetail.Power_Flag powerFlag,
|
||||
lineDetail.Run_Flag lineRunType
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line voltage,
|
||||
pq_line device,
|
||||
pq_line substation,
|
||||
@@ -1574,12 +1573,11 @@
|
||||
pq_device deviceDetail,
|
||||
pq_line_detail lineDetail,
|
||||
pq_voltage vg,
|
||||
pq_dept_line deptLine,
|
||||
sys_dept dept
|
||||
pq_line line
|
||||
LEFT JOIN pq_dept_line deptLine on line.id = deptLine.Line_Id
|
||||
LEFT JOIN sys_dept dept on deptLine.Id = dept.Id
|
||||
<where>
|
||||
line.id = deptLine.Line_Id
|
||||
AND deptLine.Id = dept.Id
|
||||
AND line.pid = voltage.id
|
||||
line.pid = voltage.id
|
||||
AND voltage.pid = device.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.pid = gd.id
|
||||
|
||||
@@ -48,13 +48,6 @@ public class IpUtils {
|
||||
public static String getRealIpAddress(ServerHttpRequest request) {
|
||||
HttpHeaders headers = request.getHeaders();
|
||||
String ipAddress = headers.getFirst(HEADER_X_FORWARDED_FOR);
|
||||
log.info("X-Forwarded-For:"+ipAddress);
|
||||
ipAddress = headers.getFirst("X-Real-IP");
|
||||
log.error("X-Real-IP:"+ipAddress);
|
||||
ipAddress = headers.getFirst("Proxy-Client-IP");
|
||||
log.error("Proxy-Client-IP:"+ipAddress);
|
||||
ipAddress = headers.getFirst("REMOTE-HOST");
|
||||
log.error("REMOTE-HOST:"+ipAddress);
|
||||
if (StrUtil.isBlankIfStr(ipAddress) || UNKNOWN.equalsIgnoreCase(ipAddress)) {
|
||||
ipAddress = headers.getFirst(HEADER_PROXY_CLIENT_IP);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.harmonic.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class THDistortionDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStation;
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端IP")
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
|
||||
/**
|
||||
* 总畸变率
|
||||
*/
|
||||
@ApiModelProperty("总畸变率")
|
||||
private Double distortion = 3.14159;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.harmonic.pojo.dto.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-06
|
||||
* @Description: 公共台账
|
||||
*/
|
||||
@Data
|
||||
public class CommReportLedgerDto {
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private List<MonitorLedgerInfo> monitorNameList;
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
static class MonitorLedgerInfo {
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private String gdName;
|
||||
|
||||
private String bdName;
|
||||
|
||||
private String busBarName;
|
||||
|
||||
private String voltageLevel;
|
||||
|
||||
private String shortCapacity;
|
||||
|
||||
private String devCapacity;
|
||||
|
||||
private String dealCapacity;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.harmonic.pojo.dto.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-07
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class TableMergeRule {
|
||||
|
||||
/** 文档中表格的索引(从0开始) */
|
||||
private Integer tableIndex;
|
||||
/** 要合并的列索引(比如0=第0列) */
|
||||
private Integer mergeColIndex;
|
||||
/** 从第几行开始合并(从0开始计数,比如从第2行开始填2) */
|
||||
private Integer startRow = 0;
|
||||
/** 每多少行合并一次(比如5=每5行合并一组) */
|
||||
private Integer mergeRowsPerGroup;
|
||||
/** 是否启用该规则 */
|
||||
private boolean enable = true;
|
||||
|
||||
// 快捷构造方法(包含起始行)
|
||||
public static TableMergeRule build(int tableIndex, int mergeColIndex, int startRow, int mergeRowsPerGroup) {
|
||||
TableMergeRule rule = new TableMergeRule();
|
||||
rule.setTableIndex(tableIndex);
|
||||
rule.setMergeColIndex(mergeColIndex);
|
||||
rule.setStartRow(startRow);
|
||||
rule.setMergeRowsPerGroup(mergeRowsPerGroup);
|
||||
rule.setEnable(true);
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.harmonic.pojo.param.report;
|
||||
|
||||
import com.njcn.harmonic.pojo.dto.report.CommReportLedgerDto;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-06
|
||||
* @Description: 谐波区域报告
|
||||
*/
|
||||
@Data
|
||||
public class AreaHarmReportParam {
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String deptId;
|
||||
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
@@ -37,24 +40,44 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer frequencyMonitorNumber = 0;
|
||||
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> freqMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double frequencyBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double frequencyDayAvgBiLi = -1.0;
|
||||
|
||||
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
private Double frequencyOverDayBiLi = -1.0;
|
||||
|
||||
|
||||
//电压偏差超标情况
|
||||
/**
|
||||
* 个数
|
||||
*/
|
||||
private Integer voltageMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> voltageMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double voltageBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double voltageDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -65,10 +88,19 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer harmonicVoltageMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> harmonicVoltageMonitorList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double harmonicVoltageBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double harmonicVoltageDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -79,10 +111,18 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer harmonicCurrentMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> harmonicCurrentMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double harmonicCurrentBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double harmonicCurrentDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -93,10 +133,18 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer threePhaseVoltageMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> threePhaseVoltageMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double threePhaseVoltageBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double threePhaseVoltageDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -107,10 +155,18 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer flickerMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> flickerMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double flickerBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double flickerDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -125,6 +181,10 @@ public class OverAreaLimitVO {
|
||||
* 占比
|
||||
*/
|
||||
private Double negativeBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double negativeDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -139,8 +199,48 @@ public class OverAreaLimitVO {
|
||||
* 占比
|
||||
*/
|
||||
private Double interHarmonicBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double interHarmonicDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
private Double interHarmonicOverDayBiLi = -1.0;
|
||||
|
||||
|
||||
|
||||
private List<InnerHarmV> innerHarmVList;
|
||||
|
||||
|
||||
private List<InnerHarmV> innerHarmIList;
|
||||
|
||||
|
||||
@Data
|
||||
public static class InnerHarmV{
|
||||
|
||||
private String name;
|
||||
//谐波电压超标情况
|
||||
/**
|
||||
* 个数
|
||||
*/
|
||||
private Integer limitCount = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> limitIdList;
|
||||
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double limitRate = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double dayAvg = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
private Double dayLimit = -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +31,7 @@ public class OverAreaVO extends DeviceInfoParam.BusinessParam{
|
||||
@Range(min = 1,message = "条数必须大于0")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("1.报告标志")
|
||||
private Integer areaReportFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: hongawen
|
||||
*/
|
||||
@Data
|
||||
public class SteadyQualifyDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStation;
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端IP")
|
||||
private String ip;
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
// @ApiModelProperty("终端运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||
// private String runFlag;
|
||||
//
|
||||
// @ApiModelProperty("终端通讯状态(0:中断;1:正常)")
|
||||
// private String comFlag;
|
||||
//
|
||||
// @ApiModelProperty("最新数据时间")
|
||||
// private LocalDateTime timeID;
|
||||
|
||||
/**
|
||||
* 谐波电压
|
||||
*/
|
||||
@ApiModelProperty("谐波电压")
|
||||
private Double harmonicVoltage =3.14159;
|
||||
/**
|
||||
* 电压偏差
|
||||
*/
|
||||
@ApiModelProperty("电压偏差")
|
||||
private Double voltageOffset =3.14159;
|
||||
/**
|
||||
* 相电压不平衡度
|
||||
*/
|
||||
@ApiModelProperty("相电压不平衡度")
|
||||
private Double voltageUnbalance =3.14159;
|
||||
/**
|
||||
* 间谐波电压含有率
|
||||
*/
|
||||
@ApiModelProperty("间谐波电压含有率")
|
||||
private Double interHarmonic =3.14159;
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
@ApiModelProperty("谐波电流")
|
||||
private Double harmonicCurrent =3.14159;
|
||||
/**
|
||||
* 负序电流
|
||||
*/
|
||||
@ApiModelProperty("负序电流")
|
||||
private Double negativeCurrent =3.14159;
|
||||
/**
|
||||
* 频率偏差
|
||||
*/
|
||||
@ApiModelProperty("频率偏差")
|
||||
private Double freqOffset =3.14159;
|
||||
/**
|
||||
* 闪变
|
||||
*/
|
||||
@ApiModelProperty("闪变")
|
||||
private Double flicker =3.14159;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.njcn.harmonic.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.harmonic.pojo.dto.report.TableMergeRule;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -26,7 +29,13 @@ public class WordUtil2 {
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList, HttpServletResponse response)
|
||||
// 保留原有getWord方法(兼容旧调用,无合并规则时直接执行)
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,
|
||||
List<List<String[]>> tableList, HttpServletResponse response) throws Exception {
|
||||
this.getWord(path, params, fileName, tableList, null, response);
|
||||
}
|
||||
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList,List<TableMergeRule> mergeRules, HttpServletResponse response)
|
||||
throws Exception {
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
InputStream inStream = null;
|
||||
@@ -35,20 +44,29 @@ public class WordUtil2 {
|
||||
try {
|
||||
inStream = new ClassPathResource(path).getInputStream();;
|
||||
doc = new CustomXWPFDocument(inStream);
|
||||
// 替换表格里面的变量
|
||||
if(CollUtil.isNotEmpty(tableList)){
|
||||
this.replaceInTable(doc, params,tableList);
|
||||
}else{
|
||||
this.replaceInTable(doc, params);
|
||||
}
|
||||
// 替换表格里面的变量
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
// 替换文本里面的变量
|
||||
this.replaceInPara(doc, params);
|
||||
|
||||
//新增:执行动态合并规则
|
||||
if(CollUtil.isNotEmpty(mergeRules)) {
|
||||
this.dynamicMergeTables(doc, mergeRules);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
@@ -223,6 +241,74 @@ public class WordUtil2 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* public static void processParagraphs(List<XWPFParagraph> paragraphList, Map<String, Object> param,
|
||||
CustomXWPFDocument doc) {
|
||||
if (paragraphList != null && !paragraphList.isEmpty()) {
|
||||
for (XWPFParagraph paragraph : paragraphList) {
|
||||
// 先获取整个段落的完整文本
|
||||
String fullText = paragraph.getText();
|
||||
|
||||
// 检查是否包含变量
|
||||
boolean hasVariable = false;
|
||||
for (String key : param.keySet()) {
|
||||
if (fullText.contains(key)) {
|
||||
hasVariable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasVariable) {
|
||||
// 进行变量替换
|
||||
String replacedText = fullText;
|
||||
boolean hasImage = false;
|
||||
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (replacedText.contains(key)) {
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
replacedText = replacedText.replace(key, value.toString());
|
||||
} else if (value instanceof Map) {
|
||||
// 处理图片:需要特殊处理
|
||||
hasImage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasImage) {
|
||||
// 如果没有图片,直接替换整个段落文本
|
||||
// 清空原有 Runs
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
for (int i = runs.size() - 1; i >= 0; i--) {
|
||||
paragraph.removeRun(i);
|
||||
}
|
||||
|
||||
// 创建新的 Run
|
||||
XWPFRun newRun = paragraph.createRun();
|
||||
newRun.setText(replacedText);
|
||||
} else {
|
||||
// 有图片的情况:逐个 Run 处理(保留原逻辑)
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
for (XWPFRun run : runs) {
|
||||
String text = run.getText(0);
|
||||
if (text != null) {
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (text.contains(key)) {
|
||||
// ... 原图片处理逻辑
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 替换段落里面的变量
|
||||
*
|
||||
@@ -292,33 +378,6 @@ public class WordUtil2 {
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 为表格插入数据,行数不够添加新行
|
||||
*
|
||||
* @param table 需要插入数据的表格
|
||||
* @param tableList 插入数据集合
|
||||
*/
|
||||
private static void insertTable(XWPFTable table, List<String[]> tableList) {
|
||||
//删除占位符行数
|
||||
table.removeRow(1);
|
||||
if (CollUtil.isNotEmpty(tableList)) {
|
||||
// 创建行,根据需要插入的数据添加新行,不处理表头
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
XWPFTableRow row = table.createRow();
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
for (int j = 0; j < cells.size(); j++) {
|
||||
String s = tableList.get(i)[j];
|
||||
XWPFTableCell cell = cells.get(j);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph paragraph = cell.addParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
// 在段落中添加文本
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换表格里面的变量
|
||||
@@ -350,6 +409,7 @@ public class WordUtil2 {
|
||||
}else {
|
||||
if (CollUtil.isNotEmpty(tableList.get(num))){
|
||||
insertTable(table, tableList.get(num)); // 插入数据
|
||||
|
||||
}
|
||||
num++;
|
||||
}
|
||||
@@ -357,6 +417,53 @@ public class WordUtil2 {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为表格插入数据,行数不够添加新行
|
||||
*
|
||||
* @param table 需要插入数据的表格
|
||||
* @param tableList 插入数据集合
|
||||
*/
|
||||
private static void insertTable(XWPFTable table, List<String[]> tableList) {
|
||||
//删除占位符行数
|
||||
table.removeRow(1);
|
||||
if (CollUtil.isNotEmpty(tableList)) {
|
||||
// 创建行,根据需要插入的数据添加新行,不处理表头
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
XWPFTableRow row = table.createRow();
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
String[] rowData = tableList.get(i);
|
||||
|
||||
for (int j = 0; j < cells.size(); j++) {
|
||||
String s = tableList.get(i)[j];
|
||||
XWPFTableCell cell = cells.get(j);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph paragraph = cell.addParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
// 在段落中添加文本
|
||||
XWPFRun run = paragraph.createRun();
|
||||
// 处理普通数据
|
||||
if (j < rowData.length && !rowData[j].startsWith("merge:")) {
|
||||
run.setText(rowData[j] == null ? "" : rowData[j]);
|
||||
}
|
||||
// 处理合并配置
|
||||
else if (j < rowData.length && rowData[j].startsWith("merge:")) {
|
||||
String[] mergeParams = rowData[j].replace("merge:", "").split(",");
|
||||
int rowMerge = Integer.parseInt(mergeParams[0]);
|
||||
int colMerge = Integer.parseInt(mergeParams[1]);
|
||||
// 调用合并方法
|
||||
setCellMerge(cell, rowMerge, colMerge);
|
||||
// 清空跨列后续单元格
|
||||
for (int k = j + 1; k < j + colMerge && k < cells.size(); k++) {
|
||||
cells.get(k).removeParagraph(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 正则匹配字符串
|
||||
*
|
||||
@@ -398,4 +505,144 @@ public class WordUtil2 {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 适配 POI 4.1.1 的单元格合并核心方法
|
||||
* @param cell 要合并的单元格
|
||||
* @param rowMerge 纵向合并行数(1=不合并,>1=合并行数)
|
||||
* @param colMerge 横向合并列数(1=不合并,>1=合并列数)
|
||||
*/
|
||||
private static void setCellMerge(XWPFTableCell cell, int rowMerge, int colMerge) {
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.getTcPr() == null ? ctTc.addNewTcPr() : ctTc.getTcPr();
|
||||
tcPr.addNewVAlign().setVal(STVerticalJc.CENTER);
|
||||
|
||||
// 1. 横向合并(跨列)- POI 4.1.1 写法
|
||||
if (colMerge > 1) {
|
||||
// 直接创建 gridSpan 并设置值
|
||||
tcPr.addNewGridSpan().setVal(BigInteger.valueOf(colMerge));
|
||||
}
|
||||
|
||||
// 2. 纵向合并(跨行)- POI 4.1.1 写法
|
||||
if (rowMerge > 1) {
|
||||
// 起始单元格标记为 RESTART
|
||||
tcPr.addNewVMerge().setVal(STMerge.RESTART);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配 POI 4.1.1 的表格单元格合并工具方法
|
||||
* @param table Word表格对象
|
||||
* @param rowIndex 行索引(从0开始)
|
||||
* @param colIndex 列索引(从0开始)
|
||||
* @param mergeRows 跨行数(如2表示合并当前行和下一行)
|
||||
* @param mergeCols 跨列数(如2表示合并当前列和下一列)
|
||||
*/
|
||||
public static void mergeTableCell(XWPFTable table, int rowIndex, int colIndex, int mergeRows, int mergeCols) {
|
||||
// 参数校验
|
||||
if (table == null || rowIndex < 0 || colIndex < 0 || mergeRows < 1 || mergeCols < 1) {
|
||||
log.error("表格合并参数无效:行{} 列{} 跨行{} 跨列{}", rowIndex, colIndex, mergeRows, mergeCols);
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取目标行和单元格
|
||||
XWPFTableRow targetRow = table.getRow(rowIndex);
|
||||
if (targetRow == null) {
|
||||
log.error("指定行不存在:{}", rowIndex);
|
||||
return;
|
||||
}
|
||||
XWPFTableCell targetCell = targetRow.getCell(colIndex);
|
||||
if (targetCell == null) {
|
||||
log.error("指定列不存在:{}", colIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置起始单元格的合并属性
|
||||
setCellMerge(targetCell, mergeRows, mergeCols);
|
||||
|
||||
// 处理跨行合并的后续单元格(标记为 CONTINUE)
|
||||
for (int i = rowIndex + 1; i < rowIndex + mergeRows; i++) {
|
||||
XWPFTableRow row = table.getRow(i);
|
||||
if (row == null) break;
|
||||
|
||||
XWPFTableCell cell = row.getCell(colIndex);
|
||||
if (cell == null) continue;
|
||||
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.getTcPr() == null ? ctTc.addNewTcPr() : ctTc.getTcPr();
|
||||
// 后续单元格标记为 CONTINUE
|
||||
tcPr.addNewVMerge().setVal(STMerge.CONTINUE);
|
||||
}
|
||||
|
||||
// 处理跨列合并的后续单元格(清空并标记为 CONTINUE)
|
||||
for (int j = colIndex + 1; j < colIndex + mergeCols; j++) {
|
||||
XWPFTableCell cell = targetRow.getCell(j);
|
||||
if (cell == null) break;
|
||||
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.getTcPr() == null ? ctTc.addNewTcPr() : ctTc.getTcPr();
|
||||
tcPr.addNewVMerge().setVal(STMerge.CONTINUE);
|
||||
// 清空跨列后续单元格的内容
|
||||
cell.removeParagraph(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ========== 新增:动态合并核心方法 ==========
|
||||
/**
|
||||
* 动态执行多个表格的合并规则
|
||||
* @param doc Word文档对象
|
||||
* @param mergeRules 合并规则列表
|
||||
*/
|
||||
public void dynamicMergeTables(CustomXWPFDocument doc, List<TableMergeRule> mergeRules) {
|
||||
// 遍历文档中的所有表格,按规则合并
|
||||
Iterator<XWPFTable> tableIterator = doc.getTablesIterator();
|
||||
int currentTableIndex = 0; // 当前遍历到的表格索引(从0开始)
|
||||
while (tableIterator.hasNext()) {
|
||||
XWPFTable table = tableIterator.next();
|
||||
// 查找当前表格是否有匹配的合并规则
|
||||
for (TableMergeRule rule : mergeRules) {
|
||||
if (rule.isEnable() && rule.getTableIndex().equals(currentTableIndex)) {
|
||||
// 执行该表格的合并规则
|
||||
mergeTableByRule(table, rule);
|
||||
break; // 一个表格只执行一条规则,避免重复处理
|
||||
}
|
||||
}
|
||||
currentTableIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单条规则合并指定表格(支持指定起始行)
|
||||
* @param table 要合并的表格
|
||||
* @param rule 合并规则
|
||||
*/
|
||||
private void mergeTableByRule(XWPFTable table, TableMergeRule rule) {
|
||||
if (table == null || rule == null || !rule.isEnable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int totalRows = table.getRows().size();
|
||||
int mergeCol = rule.getMergeColIndex();
|
||||
int startRow = rule.getStartRow(); // 新增:获取指定的起始行
|
||||
int mergeRowsPerGroup = rule.getMergeRowsPerGroup();
|
||||
|
||||
// 参数校验:起始行不能大于总行数、行数不足、列索引非法、合并行数小于2
|
||||
if (startRow >= totalRows || totalRows < 2 || mergeCol < 0 || mergeRowsPerGroup < 2) {
|
||||
log.warn("表格{}合并规则无效:总行数{} 起始行{} 合并列{} 每组行数{}",
|
||||
rule.getTableIndex(), totalRows, startRow, mergeCol, mergeRowsPerGroup);
|
||||
return;
|
||||
}
|
||||
|
||||
// 核心改动:从startRow开始,每mergeRowsPerGroup行合并一组
|
||||
for (int currentStart = startRow; currentStart < totalRows; currentStart += mergeRowsPerGroup) {
|
||||
// 最后一组可能不足N行,取实际行数
|
||||
int actualMergeRows = Math.min(mergeRowsPerGroup, totalRows - currentStart);
|
||||
// 复用原有mergeTableCell方法执行合并
|
||||
mergeTableCell(table, currentStart, mergeCol, actualMergeRows, 1);
|
||||
}
|
||||
log.info("表格{}合并完成:第{}列 从第{}行开始 每{}行合并一次",
|
||||
rule.getTableIndex(), mergeCol, startRow, mergeRowsPerGroup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -25,7 +26,6 @@ import com.njcn.event.pojo.param.EventCountParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.harmonic.pojo.param.ReportQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.report.EnumPass;
|
||||
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
|
||||
import com.njcn.harmonic.pojo.po.report.Pass;
|
||||
import com.njcn.harmonic.pojo.po.report.ReportTarget;
|
||||
import com.njcn.harmonic.pojo.vo.ReportValue;
|
||||
@@ -145,7 +145,7 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
bdname = lineDto.getBdName();
|
||||
areaName = lineDto.getAreaName();
|
||||
if(areaName.equals("冀北")){
|
||||
if("冀北".equals(areaName)){
|
||||
areaName="国网"+areaName;
|
||||
}
|
||||
pttype = PubUtils.ptTypeName(lineDto.getPtType());
|
||||
@@ -198,18 +198,14 @@ public class ExportModelJBController extends BaseController {
|
||||
param.setB(day == 0);
|
||||
|
||||
//限值
|
||||
OverLimitInfo overLimitData = reportService.getOverLimitData(param);
|
||||
Overlimit overLimit;
|
||||
if (type == 0) {
|
||||
overLimit = lineFeignClient.getOverLimitData(param.getLineId()).getData();
|
||||
} else {
|
||||
overLimit = monitorClient.getOverLimitData(param.getLineId()).getData();
|
||||
}
|
||||
param.setCount(overLimitData.getCount());
|
||||
overLimitData.setOverLimitRate(Arrays.asList(overLimit));
|
||||
|
||||
|
||||
if (0 == overLimitData.getOverLimitRate().size()) {
|
||||
if (ObjUtil.isNull(overLimit)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "dataFail", methodDescribe);
|
||||
}
|
||||
|
||||
@@ -237,7 +233,7 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> reportmap = new HashMap<>();// 报告Map
|
||||
Map<String, Object> reportmap = new HashMap<>(200);
|
||||
//数据单位
|
||||
PqsDeviceUnit deviceUnit = deviceUnitClient.lineUnitDetail(lineIndex).getData();
|
||||
reportmap.putAll(unitMap(deviceUnit));
|
||||
@@ -245,7 +241,7 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$btype$", btype);
|
||||
reportmap.put("$ctype$", ctype);
|
||||
|
||||
Map<String, Object> header = new HashMap<String, Object>();
|
||||
Map<String, Object> header = new HashMap<String, Object>(2);
|
||||
if (ObjectUtil.isNotEmpty(file)) {
|
||||
byte[] bytes = file.getBytes();
|
||||
if(bytes.length>0){
|
||||
@@ -302,16 +298,24 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$image$", header);
|
||||
|
||||
getVirtualData(param);
|
||||
ReportValue voltage1 = this.listVirtual.get(0).getList().get(0);// 电压幅值
|
||||
ReportValue voltage2 = this.listVirtual.get(0).getList().get(1);// 电压幅值
|
||||
ReportValue voltage3 = this.listVirtual.get(0).getList().get(2);// 电压幅值
|
||||
ReportValue current1 = this.listVirtual.get(1).getList().get(0);// 电流幅值
|
||||
ReportValue current2 = this.listVirtual.get(1).getList().get(1);// 电流幅值
|
||||
ReportValue current3 = this.listVirtual.get(1).getList().get(2);// 电流幅值
|
||||
//电压幅值
|
||||
ReportValue voltage1 = this.listVirtual.get(0).getList().get(0);
|
||||
// 电压幅值
|
||||
ReportValue voltage2 = this.listVirtual.get(0).getList().get(1);
|
||||
// 电压幅值
|
||||
ReportValue voltage3 = this.listVirtual.get(0).getList().get(2);
|
||||
// 电流幅值
|
||||
ReportValue current1 = this.listVirtual.get(1).getList().get(0);
|
||||
// 电流幅值
|
||||
ReportValue current2 = this.listVirtual.get(1).getList().get(1);
|
||||
// 电流幅值
|
||||
ReportValue current3 = this.listVirtual.get(1).getList().get(2);
|
||||
|
||||
String strLineBaseName = String.format("%s%s", new String[]{bdname + "_", name});
|
||||
String strAnalysis = "";// 分析建议
|
||||
String strError = "";// 报表错误
|
||||
// 分析建议
|
||||
String strAnalysis = "";
|
||||
// 报表错误
|
||||
String strError = "";
|
||||
|
||||
/**************************************************************
|
||||
**** 基波电压/电流有效值表格
|
||||
@@ -421,8 +425,9 @@ public class ExportModelJBController extends BaseController {
|
||||
int iCount = 0;
|
||||
// 判断所取的基波电压、基波电流值是否为null
|
||||
for (Object value : reportmap.values()) {
|
||||
if (value == null)
|
||||
if (value == null){
|
||||
iCount++;
|
||||
}
|
||||
}
|
||||
// 假如所有的数据都为null,则返回(所选的时间段内未找到数据)
|
||||
if (iCount == reportmap.size()) {
|
||||
@@ -485,50 +490,65 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
}
|
||||
reportmap.put("$BaseVIResult$", strBaseVIResult);
|
||||
if (!"".equals(strBaseVIResult))
|
||||
if (!"".equals(strBaseVIResult)){
|
||||
strError += strBaseVIResult;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
**** 所选的时间段内有数据存在则进行其他加载
|
||||
***************************************************************/
|
||||
|
||||
// Depts dep = R.getCurrentDept();
|
||||
// String detpName = dep.getArea();
|
||||
reportmap.put("$detpName$", areaName); // 区域名称
|
||||
// 区域名称
|
||||
reportmap.put("$detpName$", areaName);
|
||||
// 获取报告生成时间
|
||||
Date currentTime = new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");// 报告时分秒格式
|
||||
// 报告时分秒格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
|
||||
String strTime = String.format("%s——%s。",
|
||||
new String[]{DateUtil.format(startDate, "yyyy年MM月dd日 HH时mm分ss秒"),
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒")});
|
||||
reportmap.put("$number$", StrUtil.isBlank(reportNumber)?"":reportNumber); // 报告编号
|
||||
reportmap.put("$titlePoint$",StrUtil.isBlank(crmName)?"":crmName); // 客户名称
|
||||
|
||||
reportmap.put("$TitleTime$", formatter.format(currentTime)); // 报告生成时间
|
||||
reportmap.put("$ReportTitle$",
|
||||
String.format("对该地区%s电能质量在线监测数据进行分析, 以判断电能质量指标是否满足国标。", new String[]{strLineBaseName}));// 报告标题
|
||||
reportmap.put("$ReportTime$", strTime);// 报告分析时间段
|
||||
reportmap.put("$RunBaseName$", String.format("以下将对%s电能质量统计数据进行分析,数据包括基波电压/电流、谐波电压/电流、电压偏差、频率偏差、电压总谐波畸变率、2-25次谐波电压含有率、2-25次谐波电流、0.5-15.5次间谐波电压含有率、负序电压不平衡度、负序电流、电压闪变。",
|
||||
new String[]{strLineBaseName}));// 运行数据分析
|
||||
reportmap.put("$BaseVITable$", String.format("报告分析时间段内%s的基波电压/电流分钟统计数据见下表。", new String[]{strLineBaseName}));// 基波电压和电流
|
||||
reportmap.put("$VDTable$", String.format("报告分析时间段内%s的电压偏差统计数据见下表。", new String[]{strLineBaseName}));// 供电电压偏差
|
||||
reportmap.put("$FRETable$", String.format("报告分析时间段内%s的频率偏差统计数据见下表。", new String[]{strLineBaseName}));// 频率偏差
|
||||
reportmap.put("$THETable$", String.format("报告分析时间段内%s的三相电压不平衡度统计数据见下表。", new String[]{strLineBaseName}));// 三相电压不平衡度
|
||||
reportmap.put("$PLTTable$", String.format("报告分析时间段内%s的闪变统计数据见下表。", new String[]{strLineBaseName}));// 闪变
|
||||
reportmap.put("$ThdTable$", String.format("报告分析时间段内%s的电压总谐波畸变率统计数据见下表。", new String[]{strLineBaseName}));// 电压总谐波畸变率
|
||||
reportmap.put("$IneTable$", String.format("报告分析时间段内%s的负序电流统计数据见下表。", new String[]{strLineBaseName}));// 负序电流
|
||||
reportmap.put("$RVTable$",
|
||||
String.format("报告分析时间段内%s的2-25次谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));// 谐波电压
|
||||
reportmap.put("$INTable$",
|
||||
String.format("报告分析时间段内%s的0.5-15.5次间谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));// 间谐波
|
||||
reportmap.put("$RITable$",
|
||||
String.format("报告分析时间段内%s的2-25次谐波电流幅值CP95概率值统计数据见下表。", new String[]{strLineBaseName}));// 谐波电流
|
||||
|
||||
reportmap.put("$LineName1$", name);// 监测点名称1
|
||||
reportmap.put("$LineName2$", name);// 监测点名称2
|
||||
reportmap.put("$LineName3$", name);// 监测点名称3
|
||||
reportmap.put("$LineName4$", name);// 监测点名称4
|
||||
reportmap.put("$LineName5$", name);// 监测点名称5
|
||||
// 报告编号
|
||||
reportmap.put("$number$", StrUtil.isBlank(reportNumber)?"":reportNumber);
|
||||
// 客户名称
|
||||
reportmap.put("$titlePoint$",StrUtil.isBlank(crmName)?"":crmName);
|
||||
// 报告生成时间
|
||||
reportmap.put("$TitleTime$", formatter.format(currentTime));
|
||||
// 报告标题
|
||||
reportmap.put("$ReportTitle$", String.format("对该地区%s电能质量在线监测数据进行分析, 以判断电能质量指标是否满足国标。", new String[]{strLineBaseName}));
|
||||
// 报告分析时间段
|
||||
reportmap.put("$ReportTime$", strTime);
|
||||
// 运行数据分析
|
||||
reportmap.put("$RunBaseName$", String.format("以下将对%s电能质量统计数据进行分析,数据包括基波电压/电流、谐波电压/电流、电压偏差、频率偏差、电压总谐波畸变率、2-25次谐波电压含有率、2-25次谐波电流、0.5-15.5次间谐波电压含有率、负序电压不平衡度、负序电流、电压闪变。", new String[]{strLineBaseName}));
|
||||
// 基波电压和电流
|
||||
reportmap.put("$BaseVITable$", String.format("报告分析时间段内%s的基波电压/电流分钟统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 供电电压偏差
|
||||
reportmap.put("$VDTable$", String.format("报告分析时间段内%s的电压偏差统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 频率偏差
|
||||
reportmap.put("$FRETable$", String.format("报告分析时间段内%s的频率偏差统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 三相电压不平衡度
|
||||
reportmap.put("$THETable$", String.format("报告分析时间段内%s的三相电压不平衡度统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 闪变
|
||||
reportmap.put("$PLTTable$", String.format("报告分析时间段内%s的闪变统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 电压总谐波畸变率
|
||||
reportmap.put("$ThdTable$", String.format("报告分析时间段内%s的电压总谐波畸变率统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 负序电流
|
||||
reportmap.put("$IneTable$", String.format("报告分析时间段内%s的负序电流统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 谐波电压
|
||||
reportmap.put("$RVTable$", String.format("报告分析时间段内%s的2-25次谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 间谐波
|
||||
reportmap.put("$INTable$", String.format("报告分析时间段内%s的0.5-15.5次间谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 谐波电流
|
||||
reportmap.put("$RITable$", String.format("报告分析时间段内%s的2-25次谐波电流幅值CP95概率值统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 监测点名称1
|
||||
reportmap.put("$LineName1$", name);
|
||||
// 监测点名称2
|
||||
reportmap.put("$LineName2$", name);
|
||||
// 监测点名称3
|
||||
reportmap.put("$LineName3$", name);
|
||||
// 监测点名称4
|
||||
reportmap.put("$LineName4$", name);
|
||||
// 监测点名称5
|
||||
reportmap.put("$LineName5$", name);
|
||||
|
||||
/**********************
|
||||
**** 数据获取
|
||||
@@ -544,16 +564,20 @@ public class ExportModelJBController extends BaseController {
|
||||
getCurrentRate(param, overLimit);
|
||||
getInRate(param, overLimit);
|
||||
getIne(param, overLimit);
|
||||
|
||||
ReportValue pst1 = this.listFlicker.get(0).getList().get(0);// 短闪
|
||||
ReportValue pst2 = this.listFlicker.get(0).getList().get(1);// 短闪
|
||||
ReportValue pst3 = this.listFlicker.get(0).getList().get(2);// 短闪
|
||||
ReportValue plt1 = this.listFlicker.get(1).getList().get(0);// 长闪
|
||||
ReportValue plt2 = this.listFlicker.get(1).getList().get(1);// 长闪
|
||||
ReportValue plt3 = this.listFlicker.get(1).getList().get(2);// 长闪
|
||||
|
||||
reportmap.put("$LineBase$", String.format("%s%s,CT变比为:%s,PT变比为:%s。",
|
||||
new String[]{bdname, name, lineDto.getCt(), lineDto.getPt()}));// 监测点基本信息
|
||||
// 短闪 A
|
||||
ReportValue pst1 = this.listFlicker.get(0).getList().get(0);
|
||||
// 短闪 B
|
||||
ReportValue pst2 = this.listFlicker.get(0).getList().get(1);
|
||||
// 短闪 C
|
||||
ReportValue pst3 = this.listFlicker.get(0).getList().get(2);
|
||||
// 长闪 A
|
||||
ReportValue plt1 = this.listFlicker.get(1).getList().get(0);
|
||||
// 长闪 B
|
||||
ReportValue plt2 = this.listFlicker.get(1).getList().get(1);
|
||||
// 长闪 C
|
||||
ReportValue plt3 = this.listFlicker.get(1).getList().get(2);
|
||||
// 监测点基本信息
|
||||
reportmap.put("$LineBase$", String.format("%s%s,CT变比为:%s,PT变比为:%s。", new String[]{bdname, name, lineDto.getCt(), lineDto.getPt()}));
|
||||
|
||||
/**************************************************************
|
||||
**** 三张大表基础数据幅值
|
||||
@@ -604,74 +628,105 @@ public class ExportModelJBController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 电压偏差(上偏差和下偏差)
|
||||
***************************************************************/
|
||||
ReportValue vdeviation1 = this.listVdeviation.get(0).getList().get(0);
|
||||
ReportValue vdeviation2 = this.listVdeviation.get(0).getList().get(1);
|
||||
ReportValue vdeviation3 = this.listVdeviation.get(0).getList().get(2);
|
||||
String vdeviationLimit = judgeNull(this.listVdeviation.get(0).getOverLimit());// 获取电压上下偏差的国标限值
|
||||
// 获取电压上偏差的国标限值
|
||||
String vdeviationLimit = judgeNull(this.listVdeviation.get(0).getOverLimit());
|
||||
reportmap.put("$VD_L$", vdeviationLimit);
|
||||
reportmap.put("$VD_U$", judgeNull(this.listVdeviation.get(1).getOverLimit()));
|
||||
//获取电压下偏差的国标限值
|
||||
String ldeviationLimit = judgeNull(this.listVdeviation.get(1).getOverLimit());
|
||||
reportmap.put("$VD_U$", ldeviationLimit);
|
||||
String strResultVdeviationdata = "";
|
||||
String tmpstrResultVdeviationdata = "";
|
||||
String strResultVdeviationdataValue = "";
|
||||
// 获取电压偏差
|
||||
String tmpstrMap = "";
|
||||
reportmap.put("$VDTX_A$", judgeNull(vdeviation1.getFmaxValue()));
|
||||
reportmap.put("$VDTN_A$", judgeNull(vdeviation1.getMinValue()));
|
||||
reportmap.put("$VDTE_A$", judgeNull(vdeviation1.getMeanValue()));
|
||||
reportmap.put("$VDT%_A$", judgeNull(vdeviation1.getCp95Value()));
|
||||
reportmap.put("$VDTX_B$", judgeNull(vdeviation2.getFmaxValue()));
|
||||
reportmap.put("$VDTN_B$", judgeNull(vdeviation2.getMinValue()));
|
||||
reportmap.put("$VDTE_B$", judgeNull(vdeviation2.getMeanValue()));
|
||||
reportmap.put("$VDT%_B$", judgeNull(vdeviation2.getCp95Value()));
|
||||
if (pttype != 2) {
|
||||
reportmap.put("$VDTX_C$", judgeNull(vdeviation3.getFmaxValue()));
|
||||
reportmap.put("$VDTN_C$", judgeNull(vdeviation3.getMinValue()));
|
||||
reportmap.put("$VDTE_C$", judgeNull(vdeviation3.getMeanValue()));
|
||||
reportmap.put("$VDT%_C$", judgeNull(vdeviation3.getCp95Value()));
|
||||
} else {
|
||||
reportmap.put("$VDTX_C$", "-");
|
||||
reportmap.put("$VDTN_C$", "-");
|
||||
reportmap.put("$VDTE_C$", "-");
|
||||
reportmap.put("$VDT%_C$", "-");
|
||||
}
|
||||
|
||||
// 值错误判断
|
||||
try {
|
||||
maxValue = Math.abs(Double.parseDouble(vdeviation1.getFmaxValue().toString()));
|
||||
minValue = Math.abs(Double.parseDouble(vdeviation1.getMinValue().toString()));
|
||||
aveValue = Math.abs(Double.parseDouble(vdeviation1.getMeanValue().toString()));
|
||||
cp95Value = Math.abs(Double.parseDouble(vdeviation1.getCp95Value().toString()));
|
||||
limit = Math.abs(Double.parseDouble(vdeviationLimit));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
String tmpstrMap ;
|
||||
switch (i) {
|
||||
case 0:
|
||||
tmpstrMap = "A";
|
||||
break;
|
||||
case 1:
|
||||
tmpstrMap = "B";
|
||||
break;
|
||||
default:
|
||||
tmpstrMap = "C";
|
||||
break;
|
||||
}
|
||||
ReportValue vdeviation = this.listVdeviation.get(0).getList().get(i);
|
||||
if(Objects.equals("C",tmpstrMap)&&pttype == 2){
|
||||
reportmap.put("$VDTX_C$", "-");
|
||||
reportmap.put("$VDTN_C$", "-");
|
||||
reportmap.put("$VDTE_C$", "-");
|
||||
reportmap.put("$VDT%_C$", "-");
|
||||
continue;
|
||||
}else {
|
||||
reportmap.put("$VDTX_" + tmpstrMap + "$", judgeNull(vdeviation.getFmaxValue()));
|
||||
reportmap.put("$VDTN_" + tmpstrMap + "$", judgeNull(vdeviation.getMinValue()));
|
||||
reportmap.put("$VDTE_" + tmpstrMap + "$", judgeNull(vdeviation.getMeanValue()));
|
||||
reportmap.put("$VDT%_" + tmpstrMap + "$", judgeNull(vdeviation.getCp95Value()));
|
||||
}
|
||||
|
||||
|
||||
// 电压偏差
|
||||
Double vmaxValue = Double.parseDouble(reportmap.get("$VDTX_" + tmpstrMap + "$").toString());
|
||||
Double vminValue = Double.parseDouble(reportmap.get("$VDTX_" + tmpstrMap + "$").toString());
|
||||
Double vaveValue = Double.parseDouble(reportmap.get("$VDTX_" + tmpstrMap + "$").toString());
|
||||
Double vcp95Value = Double.parseDouble(reportmap.get("$VDT%_" + tmpstrMap + "$").toString());
|
||||
|
||||
if("".equals(strResultVdeviationdataValue)){
|
||||
if (!(vmaxValue >= vminValue && vmaxValue >= vaveValue && vmaxValue >= vcp95Value)) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (vaveValue < vminValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (vcp95Value < vminValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
}
|
||||
}
|
||||
|
||||
if(vmaxValue>Double.valueOf(vdeviationLimit)||vmaxValue<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相最大值";
|
||||
|
||||
}
|
||||
if(vminValue>Double.valueOf(vdeviationLimit)||vminValue<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相最小值";
|
||||
|
||||
}
|
||||
if(vaveValue>Double.valueOf(vdeviationLimit)||vaveValue<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相平均值";
|
||||
|
||||
}
|
||||
if(vcp95Value>Double.valueOf(vdeviationLimit)||vcp95Value<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相95%概率值";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName + "电压偏差数据存在异常(不是数值类型)。";
|
||||
}
|
||||
|
||||
if ("".equals(strResultVdeviationdataValue)) {
|
||||
if (!(maxValue >= minValue && maxValue >= aveValue && maxValue >= cp95Value)) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (aveValue < minValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (cp95Value < minValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
}
|
||||
}
|
||||
// 限值判断
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResultVdeviationdata))
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相";
|
||||
}
|
||||
|
||||
// 假如为空则所有的都满足
|
||||
if ("".equals(tmpstrResultVdeviationdata)) {
|
||||
strResultVdeviationdata += "从上表中可以看出" + strLineBaseName + "A、B、C三相电压偏差满足国标限值(10%)的要求。";
|
||||
strResultVdeviationdata += "从上表中可以看出" + strLineBaseName + "A、B、C三相电压偏差满足国标限值("+ldeviationLimit+"%至"+vdeviationLimit+"%)的要求。";
|
||||
} else {
|
||||
strAnalysis += tmpstrResultVdeviationdata + "电压偏差不满足国标限值(10%)的要求。";
|
||||
strAnalysis += tmpstrResultVdeviationdata + "电压偏差不满足国标限值("+vdeviationLimit+")的要求。";
|
||||
strResultVdeviationdata += "从上表中可以看出" + strLineBaseName + tmpstrResultVdeviationdata
|
||||
+ "电压偏差不满足国标限值(10%)的要求。";
|
||||
+ "电压偏差不满足国标限值("+ldeviationLimit+"%至"+vdeviationLimit+"%)的要求。";
|
||||
}
|
||||
|
||||
reportmap.put("$ResultVdeviationdata$", strResultVdeviationdata);
|
||||
@@ -682,7 +737,8 @@ public class ExportModelJBController extends BaseController {
|
||||
**** 频率偏差
|
||||
***************************************************************/
|
||||
ReportValue valueOfFreValue = this.listFrequency.get(1).getList().get(0);
|
||||
String valueOfFreLimit = judgeNull(this.listFrequency.get(1).getOverLimit());// 获取频率偏差国标限值
|
||||
// 获取频率偏差国标限值
|
||||
String valueOfFreLimit = judgeNull(this.listFrequency.get(1).getOverLimit());
|
||||
reportmap.put("$FRE_L$", valueOfFreLimit);
|
||||
String strResultFre = "";
|
||||
String tmpstrResultFre = "";
|
||||
@@ -703,25 +759,25 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$FV0%$", judgeNull(valueOfFreValue.getCp95Value()));
|
||||
|
||||
try {
|
||||
maxValue = Math.abs(Double.parseDouble(valueOfFreValue.getFmaxValue().toString()));
|
||||
minValue = Math.abs(Double.parseDouble(valueOfFreValue.getMinValue().toString()));
|
||||
aveValue = Math.abs(Double.parseDouble(valueOfFreValue.getMeanValue().toString()));
|
||||
cp95Value = Math.abs(Double.parseDouble(valueOfFreValue.getCp95Value().toString()));
|
||||
maxValue = Double.parseDouble(valueOfFreValue.getFmaxValue().toString());
|
||||
minValue = Double.parseDouble(valueOfFreValue.getMinValue().toString());
|
||||
aveValue = Double.parseDouble(valueOfFreValue.getMeanValue().toString());
|
||||
cp95Value = Double.parseDouble(valueOfFreValue.getCp95Value().toString());
|
||||
limit = Math.abs(Double.parseDouble(valueOfFreLimit));
|
||||
} catch (Exception e) {
|
||||
strResultFreValue += "注意:从上表中可以看出" + strLineBaseName + "频率偏差数据存在异常(不是数值类型)。";
|
||||
}
|
||||
|
||||
if (maxValue > limit) {
|
||||
if (Math.abs(maxValue) > limit) {
|
||||
tmpstrResultFre += "最大值为:" + valueOfFreValue.getFmaxValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (Math.abs(minValue) > limit) {
|
||||
tmpstrResultFre += "最小值为:" + valueOfFreValue.getMinValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (Math.abs(aveValue) > limit) {
|
||||
tmpstrResultFre += "平均值为:" + valueOfFreValue.getMeanValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (cp95Value > limit) {
|
||||
if (Math.abs(cp95Value) > limit) {
|
||||
tmpstrResultFre += "95%概率值为:" + valueOfFreValue.getCp95Value().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
|
||||
@@ -737,10 +793,12 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if ("".equals(tmpstrResultFre)) {
|
||||
reportmap.put("$FV0R$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$FV0R$", "合格");
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差均满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
} else {
|
||||
reportmap.put("$FV0R$", "不合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$FV0R$", "不合格");
|
||||
strAnalysis += tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差" + tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit
|
||||
+ deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
@@ -754,7 +812,8 @@ public class ExportModelJBController extends BaseController {
|
||||
**** 三相电压不平衡度
|
||||
***************************************************************/
|
||||
ReportValue valueOfThree = this.listThreephase.get(0).getList().get(0);
|
||||
String valueOfThreeLimit = judgeNull(this.listThreephase.get(0).getOverLimit());// 获取三相电压不平衡度国标限值
|
||||
// 获取三相电压不平衡度国标限值
|
||||
String valueOfThreeLimit = judgeNull(this.listThreephase.get(0).getOverLimit());
|
||||
reportmap.put("$THE_L$", valueOfThreeLimit);
|
||||
String strResultThree = "";
|
||||
String tmpstrResultThree = "";
|
||||
@@ -783,10 +842,12 @@ public class ExportModelJBController extends BaseController {
|
||||
strResultThreeValue += "注意:从上表中可以看出" + strLineBaseName + "三相电压不平衡度数据存在异常(不是数值类型)。";
|
||||
}
|
||||
if (cp95Value > limit) {
|
||||
reportmap.put("$TV0R$", "不合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$TV0R$", "不合格");
|
||||
tmpstrResultThree += "三相电压不平衡度95%概率值为:" + valueOfThree.getCp95Value().toString();
|
||||
} else {
|
||||
reportmap.put("$TV0R$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$TV0R$", "合格");
|
||||
}
|
||||
|
||||
if (!(maxValue >= minValue && maxValue >= aveValue && maxValue >= cp95Value)) {
|
||||
@@ -816,7 +877,8 @@ public class ExportModelJBController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 电压闪变
|
||||
***************************************************************/
|
||||
String valueOfFlickerLimit = judgeNull(this.listFlicker.get(1).getOverLimit());// 获取电压长时闪变的限值
|
||||
// 获取电压长时闪变的限值
|
||||
String valueOfFlickerLimit = judgeNull(this.listFlicker.get(1).getOverLimit());
|
||||
reportmap.put("$PLT_L$", valueOfFlickerLimit);
|
||||
String strResultFlicker = "";
|
||||
String tmpstrResultFlicker = "";
|
||||
@@ -836,8 +898,9 @@ public class ExportModelJBController extends BaseController {
|
||||
strResultFlickerValue += "注意:从上表中可以看出" + strLineBaseName + "长时闪变数据存在异常(不是数值类型)。";
|
||||
}
|
||||
if (fmaxValue1 > flickerLimit) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultFlicker += ",";
|
||||
}
|
||||
tmpstrResultFlicker += atype + "最大值为:" + plt1.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "不合格");
|
||||
} else {
|
||||
@@ -845,8 +908,9 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (fmaxValue2 > flickerLimit) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultFlicker += ",";
|
||||
}
|
||||
tmpstrResultFlicker += btype + "最大值为:" + plt2.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "不合格");
|
||||
} else {
|
||||
@@ -854,8 +918,9 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (fmaxValue3 > flickerLimit && pttype != 2) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultFlicker += ",";
|
||||
}
|
||||
tmpstrResultFlicker += ctype + "最大值为:" + plt3.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "不合格");
|
||||
} else {
|
||||
@@ -1021,26 +1086,38 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
String tmpstrResult = "";
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "A";
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "不合格");
|
||||
} else {
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "合格");
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "B";
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "不合格");
|
||||
} else {
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "合格");
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "C";
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "不合格");
|
||||
} else {
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "合格");
|
||||
}
|
||||
// 判断单个结论是否存在
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResultVoltageRate += (i + 1) + "次谐波电压含有率95%概率值" + tmpstrResult + ";";
|
||||
@@ -1054,6 +1131,9 @@ public class ExportModelJBController extends BaseController {
|
||||
strAnalysis += tmpstrResultVoltageRate + "2-25次谐波电压含有率95%概率值均不满足国标限值要求。";
|
||||
strResultVoltageRate += "从上表中可以看出" + strLineBaseName + tmpstrResultVoltageRate + "均不满足国标限值要求。";
|
||||
}
|
||||
reportmap.put("$ResultVoltageRate$", strResultVoltageRate );
|
||||
reportmap.put("$ResultVoltageRateValue$", strResultVoltageRateValue);
|
||||
|
||||
|
||||
/**************************************************************
|
||||
**** 电压总谐波畸变率(THD)
|
||||
@@ -1102,28 +1182,31 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
// 限值判断
|
||||
if (cp95ValueA > limit) {
|
||||
if (!"".equals(tmpstrResultDistortion))
|
||||
if (!"".equals(tmpstrResultDistortion)) {
|
||||
tmpstrResultDistortion += "、";
|
||||
}
|
||||
tmpstrResultDistortion += atype;
|
||||
reportmap.put("$TV0R_A$", "不合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_A$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$TV0R_A$", "合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_A$", "合格");
|
||||
}
|
||||
if (cp95ValueB > limit) {
|
||||
if (!"".equals(tmpstrResultDistortion))
|
||||
if (!"".equals(tmpstrResultDistortion)) {
|
||||
tmpstrResultDistortion += "、";
|
||||
}
|
||||
tmpstrResultDistortion += btype;
|
||||
reportmap.put("$TV0R_B$", "不合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_B$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$TV0R_B$", "合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_B$", "合格");
|
||||
}
|
||||
if (cp95ValueC > limit && pttype != 2) {
|
||||
if (!"".equals(tmpstrResultDistortion))
|
||||
if (!"".equals(tmpstrResultDistortion)){
|
||||
tmpstrResultDistortion += "、";
|
||||
}
|
||||
tmpstrResultDistortion += ctype;
|
||||
reportmap.put("$TV0R_C$", "不合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_C$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$TV0R_C$", "合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_C$", "合格");
|
||||
}
|
||||
|
||||
// 假如为空则所有的都满足
|
||||
@@ -1134,8 +1217,7 @@ public class ExportModelJBController extends BaseController {
|
||||
strResultDistortion += "从上表中可以看出" + strLineBaseName + tmpstrResultDistortion + "均不满足国标限值要求。";
|
||||
}
|
||||
|
||||
reportmap.put("$ResultVoltageRate$", strResultVoltageRate );
|
||||
reportmap.put("$ResultVoltageRateValue$", strResultVoltageRateValue + strResultDistortionValue);
|
||||
|
||||
reportmap.put("$ResultThdRate$", strResultDistortion);
|
||||
reportmap.put("$ResultThdRateValue$", strResultDistortionValue);
|
||||
|
||||
@@ -1194,26 +1276,32 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
String tmpstrResult = "";
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "A";
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "合格");// 三张大表取值
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "合格");
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "B";
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "合格");// 三张大表取值
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "合格");
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "C";
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "合格");// 三张大表取值
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "合格");
|
||||
}
|
||||
// 判断单个结论是否存在
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResultCurrent += (i + 1) + "次谐波电流幅值95%概率值" + tmpstrResult + ";";
|
||||
@@ -1234,20 +1322,23 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
|
||||
/**************************************************************
|
||||
**** 负序电压
|
||||
**** 负序电流
|
||||
***************************************************************/
|
||||
String ineLimit = judgeNull(this.listIneRate.get(0).getOverLimit());// 获取电压长时闪变的限值
|
||||
// 获取电压长时闪变的限值
|
||||
String ineLimit = judgeNull(this.listIneRate.get(0).getOverLimit());
|
||||
|
||||
String strResultIne = "";
|
||||
String tmpstrResultIne = "";
|
||||
String strResultIneValue = "";
|
||||
ReportValue ine1 = this.listIneRate.get(0).getList().get(0);// 短闪
|
||||
ReportValue ine2 = this.listIneRate.get(0).getList().get(1);// 短闪
|
||||
ReportValue ine3 = this.listIneRate.get(0).getList().get(2);// 短闪
|
||||
// 负序电流
|
||||
ReportValue ine1 = this.listIneRate.get(0).getList().get(0);
|
||||
ReportValue ine2 = this.listIneRate.get(0).getList().get(1);
|
||||
ReportValue ine3 = this.listIneRate.get(0).getList().get(2);
|
||||
try {
|
||||
if (Double.parseDouble(ine1.getFmaxValue().toString()) > Double.parseDouble(ineLimit)) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultIne += ",";
|
||||
}
|
||||
tmpstrResultIne += atype + "最大值为:" + ine1.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "不合格");
|
||||
} else {
|
||||
@@ -1255,8 +1346,9 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (Double.parseDouble(ine2.getFmaxValue().toString()) > Double.parseDouble(ineLimit)) {
|
||||
if (!"".equals(tmpstrResultIne))
|
||||
if (!"".equals(tmpstrResultIne)) {
|
||||
tmpstrResultIne += ",";
|
||||
}
|
||||
tmpstrResultIne += btype + "最大值为:" + ine2.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "不合格");
|
||||
} else {
|
||||
@@ -1264,16 +1356,18 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (Double.parseDouble(ine3.getFmaxValue().toString()) > Double.parseDouble(ineLimit) ) {
|
||||
if (!"".equals(tmpstrResultIne))
|
||||
if (!"".equals(tmpstrResultIne)) {
|
||||
tmpstrResultIne += ",";
|
||||
}
|
||||
tmpstrResultIne += ctype + "最大值为:" + ine3.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "合格");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if ("".equals(strResultIneValue))
|
||||
if ("".equals(strResultIneValue)) {
|
||||
strResultIneValue += "注意:从上表中可以看出" + strLineBaseName + "负序电流数据存在异常(不是数值类型)。";
|
||||
}
|
||||
}
|
||||
reportmap.put("$INETX_A$", judgeNull(ine1.getFmaxValue()));
|
||||
reportmap.put("$INETN_A$", judgeNull(ine1.getMinValue()));
|
||||
@@ -1319,7 +1413,7 @@ public class ExportModelJBController extends BaseController {
|
||||
String strMap = "$IN";
|
||||
String strCurrent = strMap + i + "%";
|
||||
|
||||
// 基波电压含有率
|
||||
// 间谐波电压
|
||||
strCurrentA = judgeNull(this.listInRate.get(i).getList().get(0).getCp95Value());
|
||||
strCurrentB = judgeNull(this.listInRate.get(i).getList().get(1).getCp95Value());
|
||||
strCurrentC = judgeNull(this.listInRate.get(i).getList().get(2).getCp95Value());
|
||||
@@ -1361,26 +1455,32 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
String tmpstrResult = "";
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "A";
|
||||
reportmap.put("$IN" + i + "R_A$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$IN" + i + "R_A$", "合格");// 三张大表取值
|
||||
reportmap.put("$IN" + i + "R_A$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$IN" + i + "R_A$", "合格");
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "B";
|
||||
reportmap.put("$IN" + i + "R_B$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$IN" + i + "R_B$", "合格");// 三张大表取值
|
||||
reportmap.put("$IN" + i + "R_B$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$IN" + i + "R_B$", "合格");
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "C";
|
||||
reportmap.put("$IN" + i + "R_C$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$IN" + i + "R_C$", "合格");// 三张大表取值
|
||||
reportmap.put("$IN" + i + "R_C$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$IN" + i + "R_C$", "合格");
|
||||
}
|
||||
// 判断单个结论是否存在
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResultIn += i + "次间谐波电压含有率95%概率值" + tmpstrResult + ";";
|
||||
@@ -1403,22 +1503,30 @@ public class ExportModelJBController extends BaseController {
|
||||
// 测试结果填写
|
||||
reportmap.put("$ResultTitle$", String.format("通过对(%s——%s)时间段内%s电能质量统计数据分析后得出以下结论:",
|
||||
new String[]{DateUtil.format(startDate, "yyyy年MM月dd日 HH时mm分ss秒"),
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒"), strLineBaseName}));// 结论标题
|
||||
reportmap.put("$Result_VD$", String.format("(1)电压偏差:%s", new String[]{strResultVdeviationdata}));// 电压偏差
|
||||
reportmap.put("$Result_FRE$", String.format("(2)频率偏差:%s", new String[]{strResultFre}));// 频率偏差
|
||||
reportmap.put("$Result_THE$", String.format("(3)三相电压不平衡度:%s", new String[]{strResultThree}));// 三相电压不平衡度
|
||||
reportmap.put("$Result_FIC$", String.format("(4)电压长时闪变:%s", new String[]{strResultFlicker}));// 电压长时闪变
|
||||
reportmap.put("$Result_VOL$", String.format("(5)谐波电压含有率:%s", new String[]{strResultVoltageRate}));// 谐波电压
|
||||
reportmap.put("$Result_U$", String.format("(6)电压总谐波畸变率:%s", new String[]{strResultDistortion}));// 谐波电压
|
||||
reportmap.put("$Result_IN$", String.format("(7)间谐波电压含有率:%s", new String[]{strResultIn}));// 谐波电压
|
||||
reportmap.put("$Result_CUR$", String.format("(8)谐波电流:%s", new String[]{strResultCurrent}));// 谐波电流
|
||||
//todo 负序电流 暂降事件
|
||||
reportmap.put("$Result_CUR$", String.format("(9)负序电流:%s", new String[]{strResultCurrent}));// 负序电流
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒"), strLineBaseName}));
|
||||
// 电压偏差
|
||||
reportmap.put("$Result_VD$", String.format("(1)电压偏差:%s", new String[]{strResultVdeviationdata}));
|
||||
// 频率偏差
|
||||
reportmap.put("$Result_FRE$", String.format("(2)频率偏差:%s", new String[]{strResultFre}));
|
||||
// 三相电压不平衡度
|
||||
reportmap.put("$Result_THE$", String.format("(3)三相电压不平衡度:%s", new String[]{strResultThree}));
|
||||
// 电压长时闪变
|
||||
reportmap.put("$Result_FIC$", String.format("(4)电压长时闪变:%s", new String[]{strResultFlicker}));
|
||||
// 谐波电压
|
||||
reportmap.put("$Result_VOL$", String.format("(5)谐波电压含有率:%s", new String[]{strResultVoltageRate}));
|
||||
// 电压总谐波畸变率
|
||||
reportmap.put("$Result_U$", String.format("(6)电压总谐波畸变率:%s", new String[]{strResultDistortion}));
|
||||
// 间谐波电压含有率
|
||||
reportmap.put("$Result_IN$", String.format("(7)间谐波电压含有率:%s", new String[]{strResultIn}));
|
||||
// 谐波电流
|
||||
reportmap.put("$Result_CUR$", String.format("(8)谐波电流:%s", new String[]{strResultCurrent}));
|
||||
// 负序电流
|
||||
reportmap.put("$Result_CUR$", String.format("(9)负序电流:%s", new String[]{strResultCurrent}));
|
||||
// 分析建议填写
|
||||
if (!"".equals(strAnalysis) || !"".equals(strError)) {
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + "," + strAnalysis + strError);// 分析建议
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + "," + strAnalysis + strError);
|
||||
} else {
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + ",电能质量数据满足国标限值要求。");// 分析建议
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + ",电能质量数据满足国标限值要求。");
|
||||
}
|
||||
|
||||
/************************************
|
||||
@@ -1444,7 +1552,8 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$YF0X$", judgeNull(powerDto4.getFmaxValue()));
|
||||
reportmap.put("$YF0N$", judgeNull(powerDto4.getMinValue()));
|
||||
reportmap.put("$YF0E$", judgeNull(powerDto4.getMeanValue()));
|
||||
formatter = new SimpleDateFormat("yyyyMMddHHmmss");// 报告时分秒格式
|
||||
// 报告时分秒格式
|
||||
formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
/****
|
||||
* 暂态列表
|
||||
@@ -1512,7 +1621,8 @@ public class ExportModelJBController extends BaseController {
|
||||
tableList.add(2,risEList);
|
||||
tableList.add(3,shortList);
|
||||
}
|
||||
reportmap.put("$Result_EVENT$", String.format("(10)监测分析时间段内,发生电压暂升事件%s次,电压暂降事件%s次,电压中断事件%s次,需考虑相应治理措施", new String[]{tableList.get(1).size()+"",tableList.get(2).size()+"",tableList.get(3).size()+""}));// 负序电流
|
||||
// 暂降事件列表
|
||||
reportmap.put("$Result_EVENT$", String.format("(10)监测分析时间段内,发生电压暂升事件%s次,电压暂降事件%s次,电压中断事件%s次,需考虑相应治理措施", new String[]{tableList.get(1).size()+"",tableList.get(2).size()+"",tableList.get(3).size()+""}));
|
||||
String reportFileUrl = "";
|
||||
try {
|
||||
String fileName = name + formatter.format(currentTime) + ".docx";
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
import com.njcn.harmonic.service.SteadyQualifyService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -69,4 +70,14 @@ public class SteadyQualifyController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSteadyQualifyTableData")
|
||||
@ApiOperation("稳态合格率列表(曲靖)")
|
||||
@ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
|
||||
public HttpResult<List<SteadyQualifyDetailVO>> getSteadyQualifyTableData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
|
||||
String methodDescribe = getMethodDescribe("getSteadyQualifyTableData");
|
||||
List<SteadyQualifyDetailVO> list = steadyQualifyService.getSteadyQualifyTableData(steadyParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.harmonic.pojo.THDistortionDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
@@ -48,6 +50,18 @@ public class THDController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTHDistortionTableData")
|
||||
@ApiOperation("谐波总畸变率列表(曲靖)")
|
||||
@ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
|
||||
public HttpResult<List<THDistortionDetailVO>> getTHDistortionTableData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
|
||||
String methodDescribe = getMethodDescribe("getTHDistortionTableData");
|
||||
List<THDistortionDetailVO> list = thDistortionService.getTHDistortionTableData(steadyParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getNodeTHDistortionData")
|
||||
@ApiOperation("谐波总畸变率节点图")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.harmonic.pojo.dto.FpyReportDTO;
|
||||
import com.njcn.harmonic.pojo.param.QualifiedReportParam;
|
||||
import com.njcn.harmonic.pojo.param.report.AreaHarmReportParam;
|
||||
import com.njcn.harmonic.service.majornetwork.QualifiedReportService;
|
||||
import com.njcn.harmonic.service.report.AreaHarmonicService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -23,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -47,12 +50,13 @@ public class AreaHarmonicReportController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/areaHarmonicReport")
|
||||
@ApiOperation("区域稳态报告")
|
||||
public HttpResult<Page<FpyReportDTO>> areaHarmonicReport() {
|
||||
public void areaHarmonicReport(@RequestBody AreaHarmReportParam areaHarmReportParam, HttpServletResponse response) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("areaHarmonicReport");
|
||||
areaHarmonicService.areaHarmonicReport(areaHarmReportParam,response);
|
||||
|
||||
log.info("区域稳态报告执行时长:"+timeInterval.interval());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
//return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.harmonic.service;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -36,4 +37,10 @@ public interface SteadyQualifyService {
|
||||
* @date 2022/03/20 20:34
|
||||
*/
|
||||
List<SteadyQualifyVO> getEnterpriseSteadyQualify(DeviceInfoParam.BusinessParam steadyParam);
|
||||
|
||||
/**
|
||||
* 稳态合格率查询表格数据,注:非树表
|
||||
* @param steadyParam 查询参数
|
||||
*/
|
||||
List<SteadyQualifyDetailVO> getSteadyQualifyTableData(DeviceInfoParam.BusinessParam steadyParam);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.harmonic.service;
|
||||
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.harmonic.pojo.THDistortionDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
@@ -40,4 +41,10 @@ public interface THDistortionService {
|
||||
* @Date: 2022/11/7
|
||||
*/
|
||||
List<RMpVThdVO> getTHDTopTenData(StatisticsBizBaseParam statisticsBizBaseParam, Integer topNum);
|
||||
|
||||
/**
|
||||
* 获取畸变率的数据表格展示
|
||||
* @param steadyParam 查询参数
|
||||
*/
|
||||
List<THDistortionDetailVO> getTHDistortionTableData(DeviceInfoParam.BusinessParam steadyParam);
|
||||
}
|
||||
|
||||
@@ -322,14 +322,14 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
|
||||
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
Map<String,UserLedgerVO> userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId,Function.identity()));
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
for (OverLimitLineDTO vo : overLimitLineList) {
|
||||
MonitorOverLimitVO monitorOverLimitVO = new MonitorOverLimitVO();
|
||||
BeanUtil.copyProperties(vo, monitorOverLimitVO);
|
||||
MonitorOverLimitVO source = monMap.get(vo.getId()).get(0);
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.getOrDefault(vo.getObjId(),null);
|
||||
monitorOverLimitVO.setLineObjectName(Objects.nonNull(userLedgerVO)?userLedgerVO.getProjectName():"/");
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.getOrDefault(vo.getObjId(), null);
|
||||
monitorOverLimitVO.setLineObjectName(Objects.nonNull(userLedgerVO) ? userLedgerVO.getProjectName() : "/");
|
||||
monitorOverLimitVO.setOverDay(source.getOverDay());
|
||||
monitorOverLimitVO.setVolDevOverDay(source.getVolDevOverDay());
|
||||
monitorOverLimitVO.setFreqOverDay(source.getFreqOverDay());
|
||||
@@ -502,14 +502,28 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
@SuppressWarnings("unchecked")
|
||||
public OverAreaLimitVO handleAreaData(List<RStatLimitTargetDPO> list, List<String> line, OverAreaVO param) {
|
||||
int onlineCount = 0, overLineCount = 0, freqCount = 0, voltageCount = 0, ubalanceCount = 0, flickerCount = 0, iNegCount = 0, uharmCount = 0, iharmCount = 0, inuharmCount = 0;
|
||||
int freqOverDay = 0, voltageOverDay = 0, ubalanceOverDay = 0, flickerOverDay = 0, iNegOverDay = 0, uharmOverDay = 0, iharmOverDay = 0, inuharmOverDay = 0;
|
||||
OverAreaLimitVO overAreaLimitVO = new OverAreaLimitVO();
|
||||
|
||||
Set<String> freqList = new HashSet<>();
|
||||
Set<String> voltageMonitorList = new HashSet<>();
|
||||
Set<String> threePhaseVoltageMonitorList = new HashSet<>();
|
||||
Set<String> flickerMonitorList = new HashSet<>();
|
||||
Set<String> harmonicVoltageMonitorList = new HashSet<>();
|
||||
Set<String> harmonicCurrentMonitorList = new HashSet<>();
|
||||
|
||||
int threeV = 0, fiveV = 0, sevenV = 0, elevenV = 0, otherV = 0;
|
||||
Set<String> threeVList = new HashSet<>(), fiveVList = new HashSet<>(), sevenVList = new HashSet<>(), elevenVList = new HashSet<>(), otherVList = new HashSet<>();
|
||||
int threeI = 0, fiveI = 0, sevenI = 0, elevenI = 0,otherI = 0;
|
||||
Set<String> threeIList = new HashSet<>(), fiveIList = new HashSet<>(), sevenIList = new HashSet<>(), elevenIList = new HashSet<>(), otherIList = new HashSet<>();
|
||||
|
||||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<RStatLimitTargetDPO> data = (List<RStatLimitTargetDPO>) getAllData(line, param.getSearchBeginTime(), param.getSearchEndTime(), Param.LIMIT_TARGET);
|
||||
if (!CollectionUtils.isEmpty(data)) {
|
||||
onlineCount = data.size();
|
||||
//在线监测点个数
|
||||
overAreaLimitVO.setOnlineMonitorNumber(onlineCount);
|
||||
|
||||
for (RStatLimitTargetDPO item : data) {
|
||||
if (item.getFreqDevOvertime() > 0 || item.getVoltageDevOvertime() > 0 || item.getUbalanceOvertime() > 0 || item.getFlickerOvertime() > 0 || item.getINegOvertime() > 0 || item.getUharm2Overtime() > 0 || item.getIharm2Overtime() > 0 || item.getInuharm1Overtime() > 0) {
|
||||
overLineCount++;
|
||||
@@ -529,89 +543,382 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
|
||||
if (item.getINegOvertime() > 0) {
|
||||
iNegCount++;
|
||||
}
|
||||
if (item.getUharm2Overtime() > 0) {
|
||||
if (vHarmFlag(item)) {
|
||||
uharmCount++;
|
||||
}
|
||||
if (item.getIharm2Overtime() > 0) {
|
||||
|
||||
if (iHarmFlag(item)) {
|
||||
iharmCount++;
|
||||
}
|
||||
if (item.getInuharm1Overtime() > 0) {
|
||||
if (inHarmFlag(item)) {
|
||||
inuharmCount++;
|
||||
}
|
||||
|
||||
//区域报告
|
||||
if (Objects.nonNull(param.getAreaReportFlag()) && param.getAreaReportFlag() == 1) {
|
||||
if (item.getFreqDevOvertime() > 0) {
|
||||
freqList.add(item.getLineId());
|
||||
}
|
||||
if (item.getVoltageDevOvertime() > 0) {
|
||||
voltageMonitorList.add(item.getLineId());
|
||||
}
|
||||
if (item.getUbalanceOvertime() > 0) {
|
||||
threePhaseVoltageMonitorList.add(item.getLineId());
|
||||
}
|
||||
if (item.getFlickerOvertime() > 0) {
|
||||
flickerMonitorList.add(item.getLineId());
|
||||
}
|
||||
if (vHarmFlag(item)) {
|
||||
harmonicVoltageMonitorList.add(item.getLineId());
|
||||
}
|
||||
|
||||
if (iHarmFlag(item)) {
|
||||
harmonicCurrentMonitorList.add(item.getLineId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (item.getUharm3Overtime() > 0) {
|
||||
threeV++;
|
||||
threeVList.add(item.getLineId());
|
||||
}
|
||||
if (item.getUharm5Overtime() > 0) {
|
||||
fiveV++;
|
||||
fiveVList.add(item.getLineId());
|
||||
}
|
||||
if (item.getUharm7Overtime() > 0) {
|
||||
sevenV++;
|
||||
sevenVList.add(item.getLineId());
|
||||
}
|
||||
if (item.getUharm11Overtime() > 0) {
|
||||
elevenV++;
|
||||
elevenVList.add(item.getLineId());
|
||||
}
|
||||
if (vOtherHarmFlag(item)) {
|
||||
otherV++;
|
||||
otherVList.add(item.getLineId());
|
||||
}
|
||||
|
||||
|
||||
if (item.getIharm3Overtime() > 0) {
|
||||
threeI++;
|
||||
threeIList.add(item.getLineId());
|
||||
}
|
||||
if (item.getIharm5Overtime() > 0) {
|
||||
fiveI++;
|
||||
fiveIList.add(item.getLineId());
|
||||
}
|
||||
if (item.getIharm7Overtime() > 0) {
|
||||
sevenI++;
|
||||
sevenIList.add(item.getLineId());
|
||||
}
|
||||
if (item.getIharm11Overtime() > 0) {
|
||||
elevenI++;
|
||||
elevenIList.add(item.getLineId());
|
||||
}
|
||||
if (iOtherHarmFlag(item)) {
|
||||
otherI++;
|
||||
otherIList.add(item.getLineId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//超标监测点个数
|
||||
overAreaLimitVO.setOverLimitMonitorNumber(overLineCount);
|
||||
//超标监测点数占比
|
||||
overAreaLimitVO.setOverBiLi(BigDecimal.valueOf(overLineCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
//频率偏差
|
||||
overAreaLimitVO.setFrequencyMonitorNumber(freqCount);
|
||||
overAreaLimitVO.setFrequencyBiLi(BigDecimal.valueOf(freqCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setFreqMonitorList(new ArrayList<>(freqList));
|
||||
//电压偏差
|
||||
overAreaLimitVO.setVoltageMonitorNumber(voltageCount);
|
||||
overAreaLimitVO.setVoltageBiLi(BigDecimal.valueOf(voltageCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
//谐波电压
|
||||
overAreaLimitVO.setHarmonicVoltageMonitorNumber(uharmCount);
|
||||
overAreaLimitVO.setHarmonicVoltageBiLi(BigDecimal.valueOf(uharmCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
//谐波电流
|
||||
overAreaLimitVO.setHarmonicCurrentMonitorNumber(iharmCount);
|
||||
overAreaLimitVO.setHarmonicCurrentBiLi(BigDecimal.valueOf(iharmCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setVoltageMonitorList(new ArrayList<>(voltageMonitorList));
|
||||
//三相电压不平衡度
|
||||
overAreaLimitVO.setThreePhaseVoltageMonitorNumber(ubalanceCount);
|
||||
overAreaLimitVO.setThreePhaseVoltageBiLi(BigDecimal.valueOf(ubalanceCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setThreePhaseVoltageMonitorList(new ArrayList<>(threePhaseVoltageMonitorList));
|
||||
//闪变
|
||||
overAreaLimitVO.setFlickerMonitorNumber(flickerCount);
|
||||
overAreaLimitVO.setFlickerBiLi(BigDecimal.valueOf(flickerCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setFlickerMonitorList(new ArrayList<>(flickerMonitorList));
|
||||
//负序电流
|
||||
overAreaLimitVO.setNegativeMonitorNumber(iNegCount);
|
||||
overAreaLimitVO.setNegativeBiLi(BigDecimal.valueOf(iNegCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
//谐波电压
|
||||
overAreaLimitVO.setHarmonicVoltageMonitorNumber(uharmCount);
|
||||
overAreaLimitVO.setHarmonicVoltageBiLi(BigDecimal.valueOf(uharmCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicVoltageMonitorList(new ArrayList<>(harmonicVoltageMonitorList));
|
||||
|
||||
//谐波电流
|
||||
overAreaLimitVO.setHarmonicCurrentMonitorNumber(iharmCount);
|
||||
overAreaLimitVO.setHarmonicCurrentBiLi(BigDecimal.valueOf(iharmCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicCurrentMonitorList(new ArrayList<>(harmonicCurrentMonitorList));
|
||||
//间谐波电压
|
||||
overAreaLimitVO.setInterHarmonicMonitorNumber(inuharmCount);
|
||||
overAreaLimitVO.setInterHarmonicBiLi(BigDecimal.valueOf(inuharmCount * 1.0 / data.size() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
Map<LocalDate, List<RStatLimitTargetDPO>> map = list.stream().collect(Collectors.groupingBy(RStatLimitTargetDPO::getTime));
|
||||
for (LocalDate key : map.keySet()) {
|
||||
List<RStatLimitTargetDPO> l = map.get(key);
|
||||
for (RStatLimitTargetDPO pojo : l) {
|
||||
if (pojo.getFreqDevOvertime() > 0) {
|
||||
freqOverDay++;
|
||||
}
|
||||
if (pojo.getVoltageDevOvertime() > 0) {
|
||||
voltageOverDay++;
|
||||
}
|
||||
if (pojo.getUbalanceOvertime() > 0) {
|
||||
ubalanceOverDay++;
|
||||
}
|
||||
if (pojo.getFlickerOvertime() > 0) {
|
||||
flickerOverDay++;
|
||||
}
|
||||
if (pojo.getINegOvertime() > 0) {
|
||||
iNegOverDay++;
|
||||
}
|
||||
if (pojo.getUharm2Overtime() > 0) {
|
||||
uharmOverDay++;
|
||||
}
|
||||
if (pojo.getIharm2Overtime() > 0) {
|
||||
iharmOverDay++;
|
||||
}
|
||||
if (pojo.getInuharm2Overtime() > 0) {
|
||||
inuharmOverDay++;
|
||||
|
||||
|
||||
int freqOverDay = 0, voltageOverDay = 0, ubalanceOverDay = 0, flickerOverDay = 0, iNegOverDay = 0, uharmOverDay = 0, iharmOverDay = 0, inuharmOverDay = 0;
|
||||
|
||||
int threeOverV = 0, fiveOverV = 0, sevenOverV = 0, elevenOverV = 0, otherOverV = 0;
|
||||
int threeOverI = 0, fiveOverI = 0, sevenOverI = 0, elevenOverI = 0, otherOverI = 0;
|
||||
|
||||
|
||||
Map<LocalDate, List<RStatLimitTargetDPO>> map = list.stream().collect(Collectors.groupingBy(RStatLimitTargetDPO::getTime));
|
||||
|
||||
List<Double> freqOverOneDayList = new ArrayList<>(), voltageOverOneDayList = new ArrayList<>(), ubalanceOverOneDayList = new ArrayList<>(),
|
||||
flickerOverOneDayList = new ArrayList<>(), iNegOverOneDayList = new ArrayList<>(), uharmOverOneDayList = new ArrayList<>(),
|
||||
iharmOverOneDayList = new ArrayList<>(), inuharmOverOneDayList = new ArrayList<>();
|
||||
|
||||
|
||||
List<Double> threeOverOneDayList = new ArrayList<>(), fiveOverOneDayList = new ArrayList<>(), sevenOverOneDayList = new ArrayList<>(), elevenOverOneDayList = new ArrayList<>(), otherOverOneDayList = new ArrayList<>();
|
||||
List<Double> threeOverOneDayIList = new ArrayList<>(), fiveOverOneDayIList = new ArrayList<>(), sevenOverOneDayIList = new ArrayList<>(), elevenOverOneDayIList = new ArrayList<>(), otherOverOneDayIList = new ArrayList<>();
|
||||
|
||||
|
||||
for (LocalDate key : map.keySet()) {
|
||||
int freqOverOneDay = 0, voltageOverOneDay = 0, ubalanceOverOneDay = 0, flickerOverOneDay = 0, iNegOverOneDay = 0, uharmOverOneDay = 0, iharmOverOneDay = 0, inuharmOverOneDay = 0;
|
||||
|
||||
int threeOneV = 0, fiveOneV = 0, sevenOneV = 0, elevenOneV = 0, otherOneV = 0;
|
||||
int threeOneI = 0, fiveOneI = 0, sevenOneI = 0, elevenOneI = 0, otherOneI = 0;
|
||||
|
||||
|
||||
List<RStatLimitTargetDPO> l = map.get(key);
|
||||
for (RStatLimitTargetDPO pojo : l) {
|
||||
if (pojo.getFreqDevOvertime() > 0) {
|
||||
freqOverDay++;
|
||||
freqOverOneDay++;
|
||||
}
|
||||
if (pojo.getVoltageDevOvertime() > 0) {
|
||||
voltageOverDay++;
|
||||
voltageOverOneDay++;
|
||||
}
|
||||
if (pojo.getUbalanceOvertime() > 0) {
|
||||
ubalanceOverDay++;
|
||||
ubalanceOverOneDay++;
|
||||
}
|
||||
if (pojo.getFlickerOvertime() > 0) {
|
||||
flickerOverDay++;
|
||||
flickerOverOneDay++;
|
||||
}
|
||||
if (pojo.getINegOvertime() > 0) {
|
||||
iNegOverDay++;
|
||||
iNegOverOneDay++;
|
||||
}
|
||||
if (vHarmFlag(pojo)) {
|
||||
uharmOverDay++;
|
||||
uharmOverOneDay++;
|
||||
}
|
||||
if (iHarmFlag(pojo)) {
|
||||
iharmOverDay++;
|
||||
iharmOverOneDay++;
|
||||
}
|
||||
if (inHarmFlag(pojo)) {
|
||||
inuharmOverDay++;
|
||||
inuharmOverOneDay++;
|
||||
}
|
||||
|
||||
|
||||
//区域报告
|
||||
if (Objects.nonNull(param.getAreaReportFlag()) && param.getAreaReportFlag() == 1) {
|
||||
if (pojo.getUharm3Overtime() > 0) {
|
||||
threeOverV++;
|
||||
threeOneV++;
|
||||
}
|
||||
if (pojo.getUharm5Overtime() > 0) {
|
||||
fiveOverV++;
|
||||
fiveOneV++;
|
||||
}
|
||||
if (pojo.getUharm7Overtime() > 0) {
|
||||
sevenOverV++;
|
||||
sevenOneV++;
|
||||
}
|
||||
if (pojo.getUharm11Overtime() > 0) {
|
||||
elevenOverV++;
|
||||
elevenOneV++;
|
||||
}
|
||||
|
||||
if (vOtherHarmFlag(pojo)) {
|
||||
otherOverV++;
|
||||
otherOneV++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (pojo.getIharm3Overtime() > 0) {
|
||||
threeOverI++;
|
||||
threeOneI++;
|
||||
}
|
||||
if (pojo.getIharm5Overtime() > 0) {
|
||||
fiveOverI++;
|
||||
fiveOneI++;
|
||||
}
|
||||
if (pojo.getIharm7Overtime() > 0) {
|
||||
sevenOverI++;
|
||||
sevenOneI++;
|
||||
}
|
||||
if (pojo.getIharm11Overtime() > 0) {
|
||||
elevenOverI++;
|
||||
elevenOneI++;
|
||||
}
|
||||
if (iOtherHarmFlag(pojo)) {
|
||||
otherOverI++;
|
||||
otherOneI++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
freqOverOneDayList.add((double) freqOverOneDay / data.size() * 100);
|
||||
voltageOverOneDayList.add((double) voltageOverOneDay / data.size() * 100);
|
||||
ubalanceOverOneDayList.add((double) ubalanceOverOneDay / data.size() * 100);
|
||||
flickerOverOneDayList.add((double) flickerOverOneDay / data.size() * 100);
|
||||
iNegOverOneDayList.add((double) iNegOverOneDay / data.size() * 100);
|
||||
uharmOverOneDayList.add((double) uharmOverOneDay / data.size() * 100);
|
||||
iharmOverOneDayList.add((double) iharmOverOneDay / data.size() * 100);
|
||||
inuharmOverOneDayList.add((double) inuharmOverOneDay / data.size() * 100);
|
||||
|
||||
|
||||
threeOverOneDayList.add((double) threeOneV / data.size() * 100);
|
||||
fiveOverOneDayList.add((double) fiveOneV / data.size() * 100);
|
||||
sevenOverOneDayList.add((double) sevenOneV / data.size() * 100);
|
||||
elevenOverOneDayList.add((double) elevenOneV / data.size() * 100);
|
||||
elevenOverOneDayList.add((double) elevenOneV / data.size() * 100);
|
||||
otherOverOneDayList.add((double) otherOneV / data.size() * 100);
|
||||
|
||||
|
||||
threeOverOneDayIList.add((double) threeOneI / data.size() * 100);
|
||||
fiveOverOneDayIList.add((double) fiveOneI / data.size() * 100);
|
||||
sevenOverOneDayIList.add((double) sevenOneI / data.size() * 100);
|
||||
elevenOverOneDayIList.add((double) elevenOneI / data.size() * 100);
|
||||
otherOverOneDayIList.add((double) otherOneI / data.size() * 100);
|
||||
|
||||
}
|
||||
}
|
||||
if (onlineCount != 0) {
|
||||
overAreaLimitVO.setFrequencyOverDayBiLi(freqCount == 0 ? 0.0 : BigDecimal.valueOf(freqOverDay * 1.0 / freqCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setVoltageOverDayBiLi(voltageCount == 0 ? 0.0 : BigDecimal.valueOf(voltageOverDay * 1.0 / voltageCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setThreePhaseVoltageOverDayBiLi(ubalanceCount == 0 ? 0.0 : BigDecimal.valueOf(ubalanceOverDay * 1.0 / ubalanceCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setFlickerOverDayBiLi(flickerCount == 0 ? 0.0 : BigDecimal.valueOf(flickerOverDay * 1.0 / flickerCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setNegativeOverDayBiLi(iNegCount == 0 ? 0.0 : BigDecimal.valueOf(iNegOverDay * 1.0 / iNegCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicVoltageOverDayBiLi(uharmCount == 0 ? 0.0 : BigDecimal.valueOf(uharmOverDay * 1.0 / uharmCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicCurrentOverDayBiLi(iharmCount == 0 ? 0.0 : BigDecimal.valueOf(iharmOverDay * 1.0 / iharmCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setInterHarmonicOverDayBiLi(inuharmCount == 0 ? 0.0 : BigDecimal.valueOf(inuharmOverDay * 1.0 / inuharmCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
|
||||
if (onlineCount != 0) {
|
||||
overAreaLimitVO.setFrequencyDayAvgBiLi(BigDecimal.valueOf(freqOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setVoltageDayAvgBiLi(BigDecimal.valueOf(voltageOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setThreePhaseVoltageDayAvgBiLi(BigDecimal.valueOf(ubalanceOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setFlickerDayAvgBiLi(BigDecimal.valueOf(flickerOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setNegativeDayAvgBiLi(BigDecimal.valueOf(iNegOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicVoltageDayAvgBiLi(BigDecimal.valueOf(uharmOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicCurrentDayAvgBiLi(BigDecimal.valueOf(iharmOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setInterHarmonicDayAvgBiLi(BigDecimal.valueOf(inuharmOverOneDayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
|
||||
overAreaLimitVO.setFrequencyOverDayBiLi(freqCount == 0 ? 0.0 : BigDecimal.valueOf(freqOverDay * 1.0 / freqCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setVoltageOverDayBiLi(voltageCount == 0 ? 0.0 : BigDecimal.valueOf(voltageOverDay * 1.0 / voltageCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setThreePhaseVoltageOverDayBiLi(ubalanceCount == 0 ? 0.0 : BigDecimal.valueOf(ubalanceOverDay * 1.0 / ubalanceCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setFlickerOverDayBiLi(flickerCount == 0 ? 0.0 : BigDecimal.valueOf(flickerOverDay * 1.0 / flickerCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setNegativeOverDayBiLi(iNegCount == 0 ? 0.0 : BigDecimal.valueOf(iNegOverDay * 1.0 / iNegCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicVoltageOverDayBiLi(uharmCount == 0 ? 0.0 : BigDecimal.valueOf(uharmOverDay * 1.0 / uharmCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setHarmonicCurrentOverDayBiLi(iharmCount == 0 ? 0.0 : BigDecimal.valueOf(iharmOverDay * 1.0 / iharmCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
overAreaLimitVO.setInterHarmonicOverDayBiLi(inuharmCount == 0 ? 0.0 : BigDecimal.valueOf(inuharmOverDay * 1.0 / inuharmCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
|
||||
//以下代码只有再区域报告时候会被调用
|
||||
if (Objects.nonNull(param.getAreaReportFlag()) && param.getAreaReportFlag() == 1) {
|
||||
List<OverAreaLimitVO.InnerHarmV> innerHarmVList = new ArrayList<>();
|
||||
innerHarmVList.add(assLimitVO("3",threeVList,threeV,data.size(),threeOverV,threeOverOneDayList));
|
||||
innerHarmVList.add(assLimitVO("5",fiveVList,fiveV,data.size(),fiveOverV,fiveOverOneDayList));
|
||||
innerHarmVList.add(assLimitVO("7",sevenVList,sevenV,data.size(),sevenOverV,sevenOverOneDayList));
|
||||
innerHarmVList.add(assLimitVO("11",elevenVList,elevenV,data.size(),elevenOverV,elevenOverOneDayList));
|
||||
innerHarmVList.add(assLimitVO("其他",otherVList,otherV,data.size(),otherOverV,otherOverOneDayList));
|
||||
overAreaLimitVO.setInnerHarmVList(innerHarmVList);
|
||||
|
||||
|
||||
|
||||
List<OverAreaLimitVO.InnerHarmV> innerHarmIList = new ArrayList<>();
|
||||
innerHarmIList.add(assLimitVO("3",threeIList,threeI,data.size(),threeOverI,threeOverOneDayIList));
|
||||
innerHarmIList.add(assLimitVO("5",fiveIList,fiveI,data.size(),fiveOverI,fiveOverOneDayIList));
|
||||
innerHarmIList.add(assLimitVO("7",sevenIList,sevenI,data.size(),sevenOverI,sevenOverOneDayIList));
|
||||
innerHarmIList.add(assLimitVO("11",elevenIList,elevenI,data.size(),elevenOverI,elevenOverOneDayIList));
|
||||
innerHarmIList.add(assLimitVO("其他",otherIList,otherI,data.size(),otherOverI,otherOverOneDayIList));
|
||||
overAreaLimitVO.setInnerHarmIList(innerHarmIList);
|
||||
}
|
||||
|
||||
}
|
||||
return overAreaLimitVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应报告表格一行数据
|
||||
* @param name
|
||||
* @param lineIds
|
||||
* @param limitCount
|
||||
* @param onlineNum
|
||||
* @param everydayAllNum
|
||||
* @param dayList 时间范围 日超标占比集合
|
||||
* @return
|
||||
*/
|
||||
private OverAreaLimitVO.InnerHarmV assLimitVO(String name,Set<String> lineIds,int limitCount,int onlineNum,int everydayAllNum,List<Double> dayList){
|
||||
OverAreaLimitVO.InnerHarmV inner = new OverAreaLimitVO.InnerHarmV();
|
||||
inner.setName(name);
|
||||
inner.setLimitIdList(new ArrayList<>(lineIds));
|
||||
inner.setLimitCount(limitCount);
|
||||
inner.setLimitRate(BigDecimal.valueOf(limitCount * 1.0 / onlineNum * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
inner.setDayAvg(BigDecimal.valueOf(dayList.stream().mapToDouble(it -> it).average().orElse(0)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
inner.setDayLimit(limitCount == 0 ? 0.0 : BigDecimal.valueOf(everydayAllNum * 1.0 / limitCount).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
return inner;
|
||||
}
|
||||
|
||||
|
||||
private boolean vHarmFlag(RStatLimitTargetDPO x) {
|
||||
int count = x.getUaberranceOvertime() +
|
||||
x.getUharm2Overtime() + x.getUharm3Overtime() + x.getUharm4Overtime() + x.getUharm5Overtime() +
|
||||
x.getUharm6Overtime() + x.getUharm7Overtime() + x.getUharm8Overtime() + x.getUharm9Overtime() +
|
||||
x.getUharm10Overtime() + x.getUharm11Overtime() + x.getUharm12Overtime() + x.getUharm13Overtime() + x.getUharm14Overtime() +
|
||||
x.getUharm15Overtime() + x.getUharm16Overtime() + x.getUharm17Overtime() + x.getUharm18Overtime() + x.getUharm19Overtime() +
|
||||
x.getUharm20Overtime() + x.getUharm21Overtime() + x.getUharm22Overtime() + x.getUharm23Overtime() + x.getUharm24Overtime() +
|
||||
x.getUharm25Overtime();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private boolean vOtherHarmFlag(RStatLimitTargetDPO x) {
|
||||
int count = x.getUharm2Overtime() + x.getUharm4Overtime() +
|
||||
x.getUharm6Overtime() + x.getUharm8Overtime() + x.getUharm9Overtime() +
|
||||
x.getUharm10Overtime() + x.getUharm12Overtime() + x.getUharm13Overtime() + x.getUharm14Overtime() +
|
||||
x.getUharm15Overtime() + x.getUharm16Overtime() + x.getUharm17Overtime() + x.getUharm18Overtime() + x.getUharm19Overtime() +
|
||||
x.getUharm20Overtime() + x.getUharm21Overtime() + x.getUharm22Overtime() + x.getUharm23Overtime() + x.getUharm24Overtime() +
|
||||
x.getUharm25Overtime();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private boolean iHarmFlag(RStatLimitTargetDPO rStatLimitRateDPO) {
|
||||
int count = rStatLimitRateDPO.getIharm2Overtime() + rStatLimitRateDPO.getIharm3Overtime() + rStatLimitRateDPO.getIharm4Overtime() +
|
||||
rStatLimitRateDPO.getIharm5Overtime() + rStatLimitRateDPO.getIharm6Overtime() + rStatLimitRateDPO.getIharm7Overtime() +
|
||||
rStatLimitRateDPO.getIharm8Overtime() + rStatLimitRateDPO.getIharm9Overtime() + rStatLimitRateDPO.getIharm10Overtime() +
|
||||
rStatLimitRateDPO.getIharm11Overtime() + rStatLimitRateDPO.getIharm12Overtime() + rStatLimitRateDPO.getIharm13Overtime() +
|
||||
rStatLimitRateDPO.getIharm14Overtime() + rStatLimitRateDPO.getIharm15Overtime() + rStatLimitRateDPO.getIharm16Overtime() +
|
||||
rStatLimitRateDPO.getIharm17Overtime() + rStatLimitRateDPO.getIharm18Overtime() + rStatLimitRateDPO.getIharm19Overtime() +
|
||||
rStatLimitRateDPO.getIharm20Overtime() + rStatLimitRateDPO.getIharm21Overtime() + rStatLimitRateDPO.getIharm22Overtime() +
|
||||
rStatLimitRateDPO.getIharm23Overtime() + rStatLimitRateDPO.getIharm24Overtime() + rStatLimitRateDPO.getIharm25Overtime();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private boolean iOtherHarmFlag(RStatLimitTargetDPO rStatLimitRateDPO) {
|
||||
int count = rStatLimitRateDPO.getIharm2Overtime() + rStatLimitRateDPO.getIharm4Overtime() + rStatLimitRateDPO.getIharm6Overtime() +
|
||||
rStatLimitRateDPO.getIharm8Overtime() + rStatLimitRateDPO.getIharm9Overtime() + rStatLimitRateDPO.getIharm10Overtime() +
|
||||
rStatLimitRateDPO.getIharm12Overtime() + rStatLimitRateDPO.getIharm13Overtime() +
|
||||
rStatLimitRateDPO.getIharm14Overtime() + rStatLimitRateDPO.getIharm15Overtime() + rStatLimitRateDPO.getIharm16Overtime() +
|
||||
rStatLimitRateDPO.getIharm17Overtime() + rStatLimitRateDPO.getIharm18Overtime() + rStatLimitRateDPO.getIharm19Overtime() +
|
||||
rStatLimitRateDPO.getIharm20Overtime() + rStatLimitRateDPO.getIharm21Overtime() + rStatLimitRateDPO.getIharm22Overtime() +
|
||||
rStatLimitRateDPO.getIharm23Overtime() + rStatLimitRateDPO.getIharm24Overtime() + rStatLimitRateDPO.getIharm25Overtime();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private boolean inHarmFlag(RStatLimitTargetDPO t) {
|
||||
int count = t.getInuharm1Overtime() + t.getInuharm2Overtime() + t.getInuharm3Overtime() + t.getInuharm4Overtime() + t.getInuharm5Overtime() + t.getInuharm6Overtime() + t.getInuharm7Overtime() + t.getInuharm8Overtime() + t.getInuharm9Overtime() + t.getInuharm10Overtime() + t.getInuharm11Overtime() + t.getInuharm12Overtime() + t.getInuharm13Overtime() + t.getInuharm14Overtime() + t.getInuharm15Overtime() + t.getInuharm16Overtime();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能描述: 处理区域在线监测点数、超标监测点数
|
||||
*
|
||||
|
||||
@@ -8,12 +8,15 @@ import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.harmonic.mapper.SteadyQualifyMapper;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
import com.njcn.harmonic.rstatlimitrate.service.IRStatLimitRateDService;
|
||||
import com.njcn.harmonic.service.SteadyQualifyService;
|
||||
@@ -46,6 +49,8 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
@Override
|
||||
public List<SteadyQualifyVO> getSteadyQualifyData(DeviceInfoParam.BusinessParam steadyParam) {
|
||||
List<SteadyQualifyVO> steadyQualifyList = new ArrayList<>();
|
||||
@@ -190,6 +195,73 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
return steadyQualifyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SteadyQualifyDetailVO> getSteadyQualifyTableData(DeviceInfoParam.BusinessParam steadyParam) {
|
||||
List<SteadyQualifyDetailVO> steadyQualifyDetailVOList = new ArrayList<>();
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyParam).getData();
|
||||
|
||||
//收集所有lineIndexes并去重
|
||||
List<String> lineIdList = deviceDataList.stream()
|
||||
.filter(generalDeviceDTO -> CollectionUtil.isNotEmpty(generalDeviceDTO.getLineIndexes()))
|
||||
.flatMap(generalDeviceDTO -> generalDeviceDTO.getLineIndexes().stream())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(lineIdList)) {
|
||||
return steadyQualifyDetailVOList;
|
||||
}
|
||||
|
||||
//获取稳态合格率数据
|
||||
List<RStatLimitRateDPO> qualifiesRate = getQualifiesRate(lineIdList, steadyParam.getSearchBeginTime(), steadyParam.getSearchEndTime());
|
||||
|
||||
//获取监测点集合
|
||||
List<SteadyQualifyVO> monitorList = steadyQualifyMapper.getSteadyQualifyData(lineIdList);
|
||||
|
||||
//获取所有监测点信息信息
|
||||
List<LineDetailVO.Detail> lineInfoByIds = lineFeignClient.getLineDetailByIds(lineIdList).getData();
|
||||
Map<String, LineDetailVO.Detail> lineDetailMap = lineInfoByIds.stream()
|
||||
.collect(Collectors.toMap(LineDetailVO.Detail::getLineId, Function.identity()));
|
||||
|
||||
//组装列表数据
|
||||
for (SteadyQualifyVO monitor : monitorList) {
|
||||
SteadyQualifyDetailVO detailVO = new SteadyQualifyDetailVO();
|
||||
|
||||
//填充监测点详细信息
|
||||
LineDetailVO.Detail lineDetail = lineDetailMap.get(monitor.getId());
|
||||
if (lineDetail != null) {
|
||||
detailVO.setCity(lineDetail.getDeptName());
|
||||
detailVO.setCompany(lineDetail.getGdName());
|
||||
detailVO.setSubStation(lineDetail.getSubName());
|
||||
detailVO.setDeviceId(lineDetail.getDevId());
|
||||
detailVO.setDeviceName(lineDetail.getDevName());
|
||||
detailVO.setManufacturer(lineDetail.getManufacturer());
|
||||
detailVO.setIp(lineDetail.getIp());
|
||||
detailVO.setLineName(lineDetail.getLineName());
|
||||
}
|
||||
|
||||
//计算单个监测点的合格率
|
||||
SteadyQualifyVO dataSingleMonitorMoreDay = getDataSingleMonitorMoreDay(qualifiesRate, monitor.getId());
|
||||
detailVO.setFlicker(PubUtils.dataLimits(dataSingleMonitorMoreDay.getFlicker()));
|
||||
detailVO.setFreqOffset(PubUtils.dataLimits(dataSingleMonitorMoreDay.getFreqOffset()));
|
||||
detailVO.setVoltageOffset(PubUtils.dataLimits(dataSingleMonitorMoreDay.getVoltageOffset()));
|
||||
detailVO.setVoltageUnbalance(PubUtils.dataLimits(dataSingleMonitorMoreDay.getVoltageUnbalance()));
|
||||
detailVO.setNegativeCurrent(PubUtils.dataLimits(dataSingleMonitorMoreDay.getNegativeCurrent()));
|
||||
detailVO.setHarmonicVoltage(PubUtils.dataLimits(dataSingleMonitorMoreDay.getHarmonicVoltage()));
|
||||
detailVO.setHarmonicCurrent(PubUtils.dataLimits(dataSingleMonitorMoreDay.getHarmonicCurrent()));
|
||||
detailVO.setInterHarmonic(PubUtils.dataLimits(dataSingleMonitorMoreDay.getInterHarmonic()));
|
||||
|
||||
steadyQualifyDetailVOList.add(detailVO);
|
||||
}
|
||||
|
||||
//先按变电站排序,再按地市排序
|
||||
steadyQualifyDetailVOList.sort(Comparator
|
||||
.comparing(SteadyQualifyDetailVO::getSubStation, Comparator.nullsLast(String::compareTo))
|
||||
.thenComparing(SteadyQualifyDetailVO::getCity, Comparator.nullsLast(String::compareTo)));
|
||||
|
||||
return steadyQualifyDetailVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取父级每层数据
|
||||
*/
|
||||
|
||||
@@ -17,10 +17,10 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.harmonic.mapper.RMpVThdMapper;
|
||||
import com.njcn.harmonic.mapper.THDistortionMapper;
|
||||
import com.njcn.harmonic.pojo.THDistortionDetailVO;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpVThd;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
@@ -188,6 +188,69 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
return rMpVThdVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<THDistortionDetailVO> getTHDistortionTableData(DeviceInfoParam.BusinessParam steadyParam) {
|
||||
List<THDistortionDetailVO> thDistortionDetailVOList = new ArrayList<>();
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyParam).getData();
|
||||
|
||||
//收集所有lineIndexes并去重
|
||||
List<String> lineIdList = deviceDataList.stream()
|
||||
.filter(generalDeviceDTO -> CollectionUtil.isNotEmpty(generalDeviceDTO.getLineIndexes()))
|
||||
.flatMap(generalDeviceDTO -> generalDeviceDTO.getLineIndexes().stream())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(lineIdList)) {
|
||||
return thDistortionDetailVOList;
|
||||
}
|
||||
|
||||
//获取畸变率数据
|
||||
List<PublicDTO> distortionData = getCondition(lineIdList, steadyParam.getSearchBeginTime(), steadyParam.getSearchEndTime());
|
||||
Map<String, PublicDTO> distortionMap = distortionData.stream()
|
||||
.collect(Collectors.toMap(PublicDTO::getId, Function.identity()));
|
||||
|
||||
//获取监测点集合
|
||||
List<THDistortionVO> monitorList = thDistortionMapper.getLineData(lineIdList);
|
||||
|
||||
//获取所有监测点信息信息
|
||||
List<LineDetailVO.Detail> lineInfoByIds = lineFeignClient.getLineDetailByIds(lineIdList).getData();
|
||||
Map<String, LineDetailVO.Detail> lineDetailMap = lineInfoByIds.stream()
|
||||
.collect(Collectors.toMap(LineDetailVO.Detail::getLineId, Function.identity()));
|
||||
|
||||
//组装列表数据
|
||||
for (THDistortionVO monitor : monitorList) {
|
||||
THDistortionDetailVO detailVO = new THDistortionDetailVO();
|
||||
|
||||
//填充监测点详细信息
|
||||
LineDetailVO.Detail lineDetail = lineDetailMap.get(monitor.getId());
|
||||
if (lineDetail != null) {
|
||||
detailVO.setCity(lineDetail.getDeptName());
|
||||
detailVO.setCompany(lineDetail.getGdName());
|
||||
detailVO.setSubStation(lineDetail.getSubName());
|
||||
detailVO.setDeviceId(lineDetail.getDevId());
|
||||
detailVO.setDeviceName(lineDetail.getDevName());
|
||||
detailVO.setManufacturer(lineDetail.getManufacturer());
|
||||
detailVO.setIp(lineDetail.getIp());
|
||||
detailVO.setLineName(lineDetail.getLineName());
|
||||
}
|
||||
|
||||
//填充畸变率数据
|
||||
if (distortionMap.containsKey(monitor.getId())) {
|
||||
detailVO.setDistortion(distortionMap.get(monitor.getId()).getData());
|
||||
}
|
||||
|
||||
thDistortionDetailVOList.add(detailVO);
|
||||
}
|
||||
|
||||
//先按变电站排序,再按地市排序
|
||||
thDistortionDetailVOList.sort(Comparator
|
||||
.comparing(THDistortionDetailVO::getSubStation, Comparator.nullsLast(String::compareTo))
|
||||
.thenComparing(THDistortionDetailVO::getCity, Comparator.nullsLast(String::compareTo)));
|
||||
|
||||
return thDistortionDetailVOList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算父级畸变率
|
||||
|
||||
@@ -89,6 +89,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
public List<GridDiagramVO.LineData> getGridDiagramLineData(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<GridDiagramVO.LineData> info = new ArrayList<>();
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
deviceInfoParam.setLineOrDevice(1);
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> list = data.stream().sorted(Comparator.comparing(x -> x.getLineIndexes().size(), Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
//终端总数量
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
package com.njcn.harmonic.service.report;
|
||||
|
||||
import com.njcn.harmonic.pojo.param.report.AreaHarmReportParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public interface AreaHarmonicService {
|
||||
|
||||
|
||||
void areaHarmonicReport(AreaHarmReportParam areaHarmReportParam, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,783 @@
|
||||
package com.njcn.harmonic.service.report.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.harmonic.pojo.dto.report.TableMergeRule;
|
||||
import com.njcn.harmonic.pojo.param.report.AreaHarmReportParam;
|
||||
import com.njcn.harmonic.pojo.vo.OverAreaLimitVO;
|
||||
import com.njcn.harmonic.pojo.vo.OverAreaVO;
|
||||
import com.njcn.harmonic.service.IAnalyzeService;
|
||||
import com.njcn.harmonic.service.report.AreaHarmonicService;
|
||||
import com.njcn.harmonic.utils.WordUtil2;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-04
|
||||
* @Description: 区域报告
|
||||
* @Description: 区域报告 - 优化版本
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AreaHarmonicServiceImpl implements AreaHarmonicService {
|
||||
|
||||
// 常量定义
|
||||
private static final String REPORT_TEMPLATE_PATH = "file/areaReportTemplate.docx";
|
||||
private static final String DEFAULT_PROVIDER_DEPT = "中国电力技术研究院";
|
||||
private static final String NO_DATA_PLACEHOLDER = "无";
|
||||
private static final String UNKNOWN_VALUE = "/";
|
||||
|
||||
// 指标等级阈值
|
||||
private static final double EXCELLENT_MAX_THRESHOLD = 5.0;
|
||||
private static final double GOOD_MAX_THRESHOLD = 10.0;
|
||||
private static final double MEDIUM_MAX_THRESHOLD = 30.0;
|
||||
|
||||
// 谐波次数顺序(保持原有顺序)
|
||||
private static final List<String> HARMONIC_ORDERS = Arrays.asList("3", "5", "7", "11","other");
|
||||
|
||||
// 表格索引(保持原有顺序)
|
||||
private static final int LEDGER_TABLE_INDEX = 1;
|
||||
private static final int VOLTAGE_DEV_TABLE_INDEX = 3;
|
||||
private static final int FREQUENCY_TABLE_INDEX = 4;
|
||||
private static final int VOLTAGE_BALANCE_TABLE_INDEX = 5;
|
||||
private static final int FLICKER_TABLE_INDEX = 6;
|
||||
private static final int VOLTAGE_HARMONIC_TABLE_INDEX = 7;
|
||||
private static final int CURRENT_HARMONIC_TABLE_INDEX = 8;
|
||||
|
||||
private final WordUtil2 wordUtil2;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final IAnalyzeService iAnalyzeService; // 修正变量名
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public void areaHarmonicReport(AreaHarmReportParam areaHarmReportParam, HttpServletResponse response) {
|
||||
try {
|
||||
Assert.notNull(areaHarmReportParam, "报告参数不能为空");
|
||||
|
||||
// 1. 构建报告数据
|
||||
Map<String, Object> reportData = buildReportData(areaHarmReportParam);
|
||||
|
||||
// 2. 构建表格数据
|
||||
List<List<String[]>> tableList = buildTableData(areaHarmReportParam,reportData);
|
||||
|
||||
// 3. 生成Word报告
|
||||
generateWordReport(reportData, tableList, response);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("区域谐波报告生成失败,参数: {}", areaHarmReportParam, e);
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"报告生成失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建报告基础数据
|
||||
*/
|
||||
private Map<String, Object> buildReportData(AreaHarmReportParam param) {
|
||||
Map<String, Object> reportData = new HashMap<>(32);
|
||||
|
||||
// 部门信息
|
||||
Dept dept = getDeptInfo(param.getDeptId());
|
||||
reportData.put("$deptName$", dept.getName());
|
||||
reportData.put("$provideDept$", DEFAULT_PROVIDER_DEPT);
|
||||
reportData.put("$TitleTime$", DateUtil.format(new DateTime(), DatePattern.CHINESE_DATE_PATTERN));
|
||||
|
||||
// 时间范围
|
||||
String timeRange = formatTimeRange(param.getStartTime(), param.getEndTime());
|
||||
reportData.put("$reportRangeTime$", timeRange);
|
||||
|
||||
return reportData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建所有表格数据
|
||||
*/
|
||||
private List<List<String[]>> buildTableData(AreaHarmReportParam param,Map<String, Object> reportData) {
|
||||
List<List<String[]>> tableList = new ArrayList<>();
|
||||
|
||||
// 添加空行(保持原有结构)
|
||||
tableList.add(new ArrayList<>());
|
||||
|
||||
// 1. 台账表格
|
||||
List<String[]> ledgerTable = buildLedgerTable(param.getDeptId());
|
||||
tableList.add(ledgerTable);
|
||||
|
||||
// 添加空行(保持原有结构)
|
||||
tableList.add(new ArrayList<>());
|
||||
|
||||
// 2. 电能质量数据表格
|
||||
List<OverAreaLimitVO> qualityData = getPowerQualityData(param);
|
||||
if (CollUtil.isNotEmpty(qualityData)) {
|
||||
// 构建监控点名称映射
|
||||
Map<String, String> monitorNameMap = buildMonitorNameMap(param.getDeptId());
|
||||
|
||||
// 过滤有效数据(在线监控数>0)
|
||||
List<OverAreaLimitVO> validData = qualityData.stream()
|
||||
.filter(vo -> vo.getOnlineMonitorNumber() != null && vo.getOnlineMonitorNumber() > 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(validData)) {
|
||||
tableList.add(buildVoltageDeviationTable(validData));
|
||||
tableList.add(buildFrequencyTable(validData));
|
||||
tableList.add(buildVoltageBalanceTable(validData));
|
||||
tableList.add(buildFlickerTable(validData));
|
||||
tableList.add(buildVoltageHarmonicTable(validData));
|
||||
tableList.add(buildCurrentHarmonicTable(validData));
|
||||
|
||||
// 计算并设置指标数据到临时存储,稍后合并
|
||||
calculateAndStoreIndicatorData(reportData, validData, monitorNameMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加空行(保持原有结构)
|
||||
tableList.add(new ArrayList<>());
|
||||
|
||||
return tableList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建台账表格
|
||||
*/
|
||||
private List<String[]> buildLedgerTable(String deptId) {
|
||||
List<MonitorCommLedgerInfoDTO> ledgerList = getLedgerInfo(deptId);
|
||||
if (CollUtil.isEmpty(ledgerList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 获取电压等级字典
|
||||
Map<String, String> voltageLevelMap = getVoltageLevelMap();
|
||||
|
||||
return IntStream.range(0, ledgerList.size())
|
||||
.mapToObj(i -> {
|
||||
MonitorCommLedgerInfoDTO ledger = ledgerList.get(i);
|
||||
return new String[]{
|
||||
String.valueOf(i + 1),
|
||||
ledger.getMonitorName(),
|
||||
ledger.getBdName(),
|
||||
ledger.getBusBarName(),
|
||||
voltageLevelMap.getOrDefault(ledger.getVoltageLevel(), ""),
|
||||
ledger.getShortCapacity(),
|
||||
ledger.getDevCapacity(),
|
||||
ledger.getDealCapacity()
|
||||
};
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建电压偏差表格
|
||||
*/
|
||||
private List<String[]> buildVoltageDeviationTable(List<OverAreaLimitVO> dataList) {
|
||||
return dataList.stream()
|
||||
.filter(vo -> vo.getOnlineMonitorNumber() != null && vo.getOnlineMonitorNumber() > 0)
|
||||
.map(vo -> new String[]{
|
||||
vo.getName(),
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
vo.getVoltageMonitorNumber().toString(),
|
||||
vo.getVoltageBiLi().toString(),
|
||||
vo.getVoltageDayAvgBiLi().toString(),
|
||||
vo.getVoltageOverDayBiLi().toString()
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建频率表格
|
||||
*/
|
||||
private List<String[]> buildFrequencyTable(List<OverAreaLimitVO> dataList) {
|
||||
return dataList.stream()
|
||||
.filter(vo -> vo.getOnlineMonitorNumber() != null && vo.getOnlineMonitorNumber() > 0)
|
||||
.map(vo -> new String[]{
|
||||
vo.getName(),
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
vo.getFrequencyMonitorNumber().toString(),
|
||||
vo.getFrequencyBiLi().toString(),
|
||||
vo.getFrequencyDayAvgBiLi().toString(),
|
||||
vo.getFrequencyOverDayBiLi().toString()
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建三相电压不平衡度表格
|
||||
*/
|
||||
private List<String[]> buildVoltageBalanceTable(List<OverAreaLimitVO> dataList) {
|
||||
return dataList.stream()
|
||||
.filter(vo -> vo.getOnlineMonitorNumber() != null && vo.getOnlineMonitorNumber() > 0)
|
||||
.map(vo -> new String[]{
|
||||
vo.getName(),
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
vo.getThreePhaseVoltageMonitorNumber().toString(),
|
||||
vo.getThreePhaseVoltageBiLi().toString(),
|
||||
vo.getThreePhaseVoltageDayAvgBiLi().toString(),
|
||||
vo.getThreePhaseVoltageOverDayBiLi().toString()
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建闪变表格
|
||||
*/
|
||||
private List<String[]> buildFlickerTable(List<OverAreaLimitVO> dataList) {
|
||||
return dataList.stream()
|
||||
.filter(vo -> vo.getOnlineMonitorNumber() != null && vo.getOnlineMonitorNumber() > 0)
|
||||
.map(vo -> new String[]{
|
||||
vo.getName(),
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
vo.getFlickerMonitorNumber().toString(),
|
||||
vo.getFlickerBiLi().toString(),
|
||||
vo.getFlickerDayAvgBiLi().toString(),
|
||||
vo.getFlickerOverDayBiLi().toString()
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建谐波电压表格
|
||||
*/
|
||||
private List<String[]> buildVoltageHarmonicTable(List<OverAreaLimitVO> dataList) {
|
||||
List<String[]> tableData = new ArrayList<>();
|
||||
|
||||
for (OverAreaLimitVO vo : dataList) {
|
||||
if (vo.getOnlineMonitorNumber() == null || vo.getOnlineMonitorNumber() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 添加总行
|
||||
tableData.add(new String[]{
|
||||
vo.getName(),
|
||||
"2~25",
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
vo.getHarmonicVoltageMonitorNumber().toString(),
|
||||
vo.getHarmonicVoltageBiLi().toString(),
|
||||
vo.getHarmonicVoltageDayAvgBiLi().toString(),
|
||||
vo.getHarmonicVoltageOverDayBiLi().toString()
|
||||
});
|
||||
|
||||
// 添加各次谐波行
|
||||
if (CollUtil.isNotEmpty(vo.getInnerHarmVList())) {
|
||||
for (OverAreaLimitVO.InnerHarmV innerHarm : vo.getInnerHarmVList()) {
|
||||
tableData.add(new String[]{
|
||||
"",
|
||||
innerHarm.getName(),
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
innerHarm.getLimitCount().toString(),
|
||||
innerHarm.getLimitRate().toString(),
|
||||
innerHarm.getDayAvg().toString(),
|
||||
innerHarm.getDayLimit().toString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tableData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建谐波电流表格
|
||||
*/
|
||||
private List<String[]> buildCurrentHarmonicTable(List<OverAreaLimitVO> dataList) {
|
||||
List<String[]> tableData = new ArrayList<>();
|
||||
|
||||
for (OverAreaLimitVO vo : dataList) {
|
||||
if (vo.getOnlineMonitorNumber() == null || vo.getOnlineMonitorNumber() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 添加总行
|
||||
tableData.add(new String[]{
|
||||
vo.getName(),
|
||||
"2~25",
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
vo.getHarmonicCurrentMonitorNumber().toString(),
|
||||
vo.getHarmonicCurrentBiLi().toString(),
|
||||
vo.getHarmonicVoltageDayAvgBiLi().toString(), // 注意:这里保持原逻辑,使用谐波电压日均值
|
||||
vo.getHarmonicCurrentOverDayBiLi().toString()
|
||||
});
|
||||
|
||||
// 添加各次谐波行
|
||||
if (CollUtil.isNotEmpty(vo.getInnerHarmIList())) {
|
||||
for (OverAreaLimitVO.InnerHarmV innerHarm : vo.getInnerHarmIList()) {
|
||||
tableData.add(new String[]{
|
||||
"",
|
||||
innerHarm.getName(),
|
||||
vo.getOnlineMonitorNumber().toString(),
|
||||
innerHarm.getLimitCount().toString(),
|
||||
innerHarm.getLimitRate().toString(),
|
||||
innerHarm.getDayAvg().toString(),
|
||||
innerHarm.getDayLimit().toString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tableData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算并存储指标数据
|
||||
*/
|
||||
private void calculateAndStoreIndicatorData(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> validData,
|
||||
Map<String, String> monitorNameMap) {
|
||||
// 电压偏差
|
||||
processVoltageDeviation(reportData, validData, monitorNameMap);
|
||||
|
||||
// 频率偏差
|
||||
processFrequencyDeviation(reportData, validData, monitorNameMap);
|
||||
|
||||
// 三相电压不平衡度
|
||||
processVoltageBalance(reportData, validData, monitorNameMap);
|
||||
|
||||
// 闪变
|
||||
processFlicker(reportData, validData, monitorNameMap);
|
||||
|
||||
// 谐波电压
|
||||
processVoltageHarmonic(reportData, validData, monitorNameMap);
|
||||
|
||||
// 谐波电流
|
||||
processCurrentHarmonic(reportData, validData, monitorNameMap);
|
||||
|
||||
// 生成结论
|
||||
generateConclusion(reportData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理电压偏差
|
||||
*/
|
||||
private void processVoltageDeviation(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> dataList,
|
||||
Map<String, String> monitorNameMap) {
|
||||
double avgRate = calculateAverage(dataList, OverAreaLimitVO::getVoltageBiLi);
|
||||
List<String> monitorList = extractMonitorNames(dataList,
|
||||
vo -> vo.getVoltageMonitorList(), monitorNameMap);
|
||||
|
||||
reportData.put("$voltageDevRate$", formatPercentage(avgRate));
|
||||
reportData.put("$voltageDevMark$", getGrade(avgRate));
|
||||
reportData.put("$voltageDevLine$", formatMonitorList(monitorList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理频率偏差
|
||||
*/
|
||||
private void processFrequencyDeviation(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> dataList,
|
||||
Map<String, String> monitorNameMap) {
|
||||
double avgRate = calculateAverage(dataList, OverAreaLimitVO::getFrequencyBiLi);
|
||||
List<String> monitorList = extractMonitorNames(dataList,
|
||||
vo -> vo.getFreqMonitorList(), monitorNameMap);
|
||||
|
||||
reportData.put("$freqRate$", formatPercentage(avgRate));
|
||||
reportData.put("$freqMark$", getGrade(avgRate));
|
||||
reportData.put("$freqLine$", formatMonitorList(monitorList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理三相电压不平衡度
|
||||
*/
|
||||
private void processVoltageBalance(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> dataList,
|
||||
Map<String, String> monitorNameMap) {
|
||||
double avgRate = calculateAverage(dataList, OverAreaLimitVO::getThreePhaseVoltageBiLi);
|
||||
List<String> monitorList = extractMonitorNames(dataList,
|
||||
vo -> vo.getThreePhaseVoltageMonitorList(), monitorNameMap);
|
||||
|
||||
reportData.put("$balanceRate$", formatPercentage(avgRate));
|
||||
reportData.put("$balanceMark$", getGrade(avgRate));
|
||||
reportData.put("$balanceLine$", formatMonitorList(monitorList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理闪变
|
||||
*/
|
||||
private void processFlicker(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> dataList,
|
||||
Map<String, String> monitorNameMap) {
|
||||
double avgRate = calculateAverage(dataList, OverAreaLimitVO::getFlickerBiLi);
|
||||
List<String> monitorList = extractMonitorNames(dataList,
|
||||
vo -> vo.getFlickerMonitorList(), monitorNameMap);
|
||||
|
||||
reportData.put("$flickerRate$", formatPercentage(avgRate));
|
||||
reportData.put("$flickerMark$", getGrade(avgRate));
|
||||
reportData.put("$flickerLine$", formatMonitorList(monitorList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理谐波电压
|
||||
*/
|
||||
private void processVoltageHarmonic(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> dataList,
|
||||
Map<String, String> monitorNameMap) {
|
||||
// 总谐波电压
|
||||
double avgAll = calculateAverage(dataList, OverAreaLimitVO::getHarmonicVoltageBiLi);
|
||||
List<String> monitorAllList = extractMonitorNames(dataList,
|
||||
vo -> vo.getHarmonicVoltageMonitorList(), monitorNameMap);
|
||||
|
||||
reportData.put("$v_all_Rate$", formatPercentage(avgAll));
|
||||
reportData.put("$v_all_Mark$", getGrade(avgAll));
|
||||
reportData.put("$v_all_Line$", formatMonitorList(monitorAllList));
|
||||
|
||||
// 各次谐波电压(保持原有顺序)
|
||||
for (int i = 0; i < HARMONIC_ORDERS.size(); i++) {
|
||||
final int index = i;
|
||||
double avgHarmonic = calculateAverageFromInnerList(dataList,
|
||||
vo -> vo.getInnerHarmVList().get(index).getLimitRate());
|
||||
List<String> monitorHarmonicList = extractMonitorNamesFromInnerList(dataList,
|
||||
vo -> vo.getInnerHarmVList().get(index).getLimitIdList(), monitorNameMap);
|
||||
|
||||
String harmonicKey = HARMONIC_ORDERS.get(i);
|
||||
reportData.put("$v_" + harmonicKey + "_Rate$", formatPercentage(avgHarmonic));
|
||||
reportData.put("$v_" + harmonicKey + "_Mark$", getGrade(avgHarmonic));
|
||||
reportData.put("$v_" + harmonicKey + "_Line$", formatMonitorList(monitorHarmonicList));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理谐波电流
|
||||
*/
|
||||
private void processCurrentHarmonic(Map<String, Object> reportData,
|
||||
List<OverAreaLimitVO> dataList,
|
||||
Map<String, String> monitorNameMap) {
|
||||
// 总谐波电流
|
||||
double avgAll = calculateAverage(dataList, OverAreaLimitVO::getHarmonicCurrentBiLi);
|
||||
List<String> monitorAllList = extractMonitorNames(dataList,
|
||||
vo -> vo.getHarmonicCurrentMonitorList(), monitorNameMap);
|
||||
|
||||
reportData.put("$i_all_Rate$", formatPercentage(avgAll));
|
||||
reportData.put("$i_all_Mark$", getGrade(avgAll));
|
||||
reportData.put("$i_all_Line$", formatMonitorList(monitorAllList));
|
||||
|
||||
// 各次谐波电流(保持原有顺序)
|
||||
for (int i = 0; i < HARMONIC_ORDERS.size(); i++) {
|
||||
final int index = i;
|
||||
double avgHarmonic = calculateAverageFromInnerList(dataList,
|
||||
vo -> vo.getInnerHarmIList().get(index).getLimitRate());
|
||||
List<String> monitorHarmonicList = extractMonitorNamesFromInnerList(dataList,
|
||||
vo -> vo.getInnerHarmIList().get(index).getLimitIdList(), monitorNameMap);
|
||||
|
||||
String harmonicKey = HARMONIC_ORDERS.get(i);
|
||||
reportData.put("$i_" + harmonicKey + "_Rate$", formatPercentage(avgHarmonic));
|
||||
reportData.put("$i_" + harmonicKey + "_Mark$", getGrade(avgHarmonic));
|
||||
reportData.put("$i_" + harmonicKey + "_Line$", formatMonitorList(monitorHarmonicList));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成结论
|
||||
*/
|
||||
private void generateConclusion(Map<String, Object> reportData) {
|
||||
Map<String, String> indicatorScores = new LinkedHashMap<>();
|
||||
indicatorScores.put("供电电压偏差", reportData.get("$voltageDevMark$").toString());
|
||||
indicatorScores.put("频率偏差", reportData.get("$freqMark$").toString());
|
||||
indicatorScores.put("三相电压不平衡度", reportData.get("$balanceMark$").toString());
|
||||
indicatorScores.put("闪变", reportData.get("$flickerMark$").toString());
|
||||
indicatorScores.put("谐波电压", reportData.get("$v_all_Mark$").toString());
|
||||
indicatorScores.put("谐波电流", reportData.get("$i_all_Mark$").toString());
|
||||
|
||||
// 按等级分类指标
|
||||
Map<String, List<String>> categorizedIndicators = categorizeIndicators(indicatorScores);
|
||||
|
||||
// 构建结论文本
|
||||
String conclusion = buildConclusionText(categorizedIndicators);
|
||||
reportData.put("$conclusion$", conclusion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按等级分类指标
|
||||
*/
|
||||
private Map<String, List<String>> categorizeIndicators(Map<String, String> indicatorScores) {
|
||||
Map<String, List<String>> categorized = new LinkedHashMap<>();
|
||||
categorized.put("优秀", new ArrayList<>());
|
||||
categorized.put("良", new ArrayList<>());
|
||||
categorized.put("中", new ArrayList<>());
|
||||
categorized.put("差", new ArrayList<>());
|
||||
|
||||
indicatorScores.forEach((indicator, grade) -> {
|
||||
if (categorized.containsKey(grade)) {
|
||||
categorized.get(grade).add(indicator);
|
||||
}
|
||||
});
|
||||
|
||||
return categorized;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建结论文本
|
||||
*/
|
||||
private String buildConclusionText(Map<String, List<String>> categorizedIndicators) {
|
||||
StringBuilder conclusion = new StringBuilder();
|
||||
List<String> badIndicators = categorizedIndicators.get("差");
|
||||
|
||||
// 按顺序构建结论
|
||||
List<Map.Entry<String, List<String>>> entries = new ArrayList<>(categorizedIndicators.entrySet());
|
||||
for (Map.Entry<String, List<String>> entry : entries) {
|
||||
List<String> indicators = entry.getValue();
|
||||
if (CollUtil.isNotEmpty(indicators)) {
|
||||
if (conclusion.length() > 0) {
|
||||
conclusion.append(",");
|
||||
}
|
||||
conclusion.append(String.join("、", indicators))
|
||||
.append("等指标评分为").append(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
// 添加重点关注提示
|
||||
if (CollUtil.isNotEmpty(badIndicators)) {
|
||||
conclusion.append(",需要重点关注该区域")
|
||||
.append(String.join("、", badIndicators))
|
||||
.append("等指标情况");
|
||||
}
|
||||
|
||||
return conclusion.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成Word报告
|
||||
*/
|
||||
private void generateWordReport(Map<String, Object> reportData,
|
||||
List<List<String[]>> tableList,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
// 构建表格合并规则
|
||||
List<TableMergeRule> mergeRules = buildTableMergeRules();
|
||||
|
||||
// 生成文件名
|
||||
String fileName = generateFileName();
|
||||
|
||||
// 调用Word工具生成报告
|
||||
wordUtil2.getWord(REPORT_TEMPLATE_PATH, reportData, fileName,
|
||||
tableList, mergeRules, response);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Word报告生成失败", e);
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"Word报告生成失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建表格合并规则
|
||||
*/
|
||||
private List<TableMergeRule> buildTableMergeRules() {
|
||||
List<TableMergeRule> mergeRules = new ArrayList<>();
|
||||
// 表格7(谐波电压)的第0列,每6行合并一次(对应"单位"列)
|
||||
mergeRules.add(TableMergeRule.build(VOLTAGE_HARMONIC_TABLE_INDEX, 0, 1, 6));
|
||||
// 表格8(谐波电流)的第0列,每6行合并一次(对应"单位"列)
|
||||
mergeRules.add(TableMergeRule.build(CURRENT_HARMONIC_TABLE_INDEX, 0, 1, 6));
|
||||
return mergeRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成文件名
|
||||
*/
|
||||
private String generateFileName() {
|
||||
return "fileName.docx"; // 保持原有文件名逻辑
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:计算平均值
|
||||
*/
|
||||
private double calculateAverage(List<OverAreaLimitVO> dataList,
|
||||
Function<OverAreaLimitVO, Double> valueExtractor) {
|
||||
return dataList.stream()
|
||||
.map(valueExtractor)
|
||||
.filter(value -> value != null && value >= 0)
|
||||
.mapToDouble(Double::doubleValue)
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:从内部列表计算平均值
|
||||
*/
|
||||
private double calculateAverageFromInnerList(List<OverAreaLimitVO> dataList,
|
||||
Function<OverAreaLimitVO, Double> valueExtractor) {
|
||||
return dataList.stream()
|
||||
.map(valueExtractor)
|
||||
.filter(value -> value != null && value >= 0)
|
||||
.mapToDouble(Double::doubleValue)
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:提取监控点名称
|
||||
*/
|
||||
private List<String> extractMonitorNames(List<OverAreaLimitVO> dataList,
|
||||
Function<OverAreaLimitVO, List<String>> idExtractor,
|
||||
Map<String, String> idToNameMap) {
|
||||
return dataList.stream()
|
||||
.flatMap(vo -> {
|
||||
List<String> ids = idExtractor.apply(vo);
|
||||
return ids != null ? ids.stream() : Stream.<String>empty();
|
||||
})
|
||||
.distinct()
|
||||
.map(idToNameMap::get)
|
||||
.filter(name -> name != null && !name.trim().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:从内部列表提取监控点名称
|
||||
*/
|
||||
private List<String> extractMonitorNamesFromInnerList(List<OverAreaLimitVO> dataList,
|
||||
Function<OverAreaLimitVO, List<String>> idExtractor,
|
||||
Map<String, String> idToNameMap) {
|
||||
return dataList.stream()
|
||||
.flatMap(vo -> {
|
||||
List<String> ids = idExtractor.apply(vo);
|
||||
return ids != null ? ids.stream() : Stream.<String>empty();
|
||||
})
|
||||
.distinct()
|
||||
.map(idToNameMap::get)
|
||||
.filter(name -> name != null && !name.trim().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:格式化百分比
|
||||
*/
|
||||
private String formatPercentage(double value) {
|
||||
if (value < 0) {
|
||||
return UNKNOWN_VALUE;
|
||||
}
|
||||
return BigDecimal.valueOf(value)
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.doubleValue() + "%";
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:获取等级
|
||||
*/
|
||||
private String getGrade(double value) {
|
||||
if (value < 0) {
|
||||
return UNKNOWN_VALUE;
|
||||
} else if (value <= EXCELLENT_MAX_THRESHOLD) {
|
||||
return "优秀";
|
||||
} else if (value <= GOOD_MAX_THRESHOLD) {
|
||||
return "良";
|
||||
} else if (value <= MEDIUM_MAX_THRESHOLD) {
|
||||
return "中";
|
||||
} else {
|
||||
return "差";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:格式化时间范围
|
||||
*/
|
||||
private String formatTimeRange(String startTime, String endTime) {
|
||||
try {
|
||||
String start = DateUtil.format(
|
||||
DateUtil.beginOfDay(DateUtil.parse(startTime)),
|
||||
DatePattern.NORM_DATETIME_PATTERN
|
||||
);
|
||||
String end = DateUtil.format(
|
||||
DateUtil.endOfDay(DateUtil.parse(endTime)),
|
||||
DatePattern.NORM_DATETIME_PATTERN
|
||||
);
|
||||
return start + "-" + end;
|
||||
} catch (Exception e) {
|
||||
log.error("格式化时间范围失败", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:格式化监控点列表
|
||||
*/
|
||||
private String formatMonitorList(List<String> monitorList) {
|
||||
if (CollUtil.isEmpty(monitorList)) {
|
||||
return NO_DATA_PLACEHOLDER;
|
||||
}
|
||||
return String.join(",", monitorList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门信息
|
||||
*/
|
||||
private Dept getDeptInfo(String deptId) {
|
||||
return deptFeignClient.getDeptById(deptId).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取台账信息
|
||||
*/
|
||||
private List<MonitorCommLedgerInfoDTO> getLedgerInfo(String deptId) {
|
||||
DeptGetLineParam param = new DeptGetLineParam();
|
||||
param.setDeptId(deptId);
|
||||
return commTerminalGeneralClient.deptGetLineInfo(param).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电压等级字典
|
||||
*/
|
||||
private Map<String, String> getVoltageLevelMap() {
|
||||
List<DictData> dictDataList = dicDataFeignClient
|
||||
.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode())
|
||||
.getData();
|
||||
return dictDataList.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建监控点名称映射
|
||||
*/
|
||||
private Map<String, String> buildMonitorNameMap(String deptId) {
|
||||
List<MonitorCommLedgerInfoDTO> ledgerList = getLedgerInfo(deptId);
|
||||
return ledgerList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
MonitorCommLedgerInfoDTO::getMonitorId,
|
||||
MonitorCommLedgerInfoDTO::getMonitorName
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电能质量数据
|
||||
*/
|
||||
private List<OverAreaLimitVO> getPowerQualityData(AreaHarmReportParam param) {
|
||||
OverAreaVO queryParam = new OverAreaVO();
|
||||
queryParam.setDeptIndex(param.getDeptId());
|
||||
queryParam.setPageNum(1);
|
||||
queryParam.setPageSize(1000);
|
||||
queryParam.setSearchBeginTime(param.getStartTime());
|
||||
queryParam.setSearchEndTime(param.getEndTime());
|
||||
queryParam.setStatisticalType(new SimpleDTO());
|
||||
queryParam.setAreaReportFlag(1);
|
||||
|
||||
Page<OverAreaLimitVO> page = iAnalyzeService.getAreaData(queryParam);
|
||||
return page.getRecords();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user