Merge remote-tracking branch 'origin/master'

This commit is contained in:
xy
2024-08-27 09:36:18 +08:00
58 changed files with 1226 additions and 169 deletions

View File

@@ -84,6 +84,8 @@ public enum CommonResponseEnum {
FILE_EXIST("A0096", "文件已存在"),
FILE_NAME_ERROR("A0096", "文件格式有误"),
FILE_SIZE_ERROR("A0096", "文件过大"),
FILE_XLSX_ERROR("A0096", "请上传excel文件"),

View File

@@ -1,6 +1,7 @@
package com.njcn.common.utils;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
@@ -56,5 +57,90 @@ public class FileUtil {
}
}
/**
* 判断文件是否为word格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsWord(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"doc", "docx"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为pdf格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsPdf(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"pdf"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为excel格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsExcel(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"xls", "xlsx"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 从文件名中提取扩展名
*
* @param fileName 文件名
* @return 扩展名
*/
private static String getFileExtension(String fileName) {
int dotIndex = fileName.lastIndexOf('.');
if (dotIndex == -1) {
return "";
}
return fileName.substring(dotIndex + 1);
}
}

View File

@@ -44,6 +44,9 @@ public enum GWSendEnum {
PARK_AND_STATION("parkAndStation", "/pms-ghq-powerquality-start/powerQuality/park/create"),
REPORT_CREATE("reportCreate", "/pms-ghq-powerquality-start/powerQuality/report/create"),
COMM_POINT("commPoint","/pms-ghq-powerquality-start/powerQuality/publicConnection/pqBusMonitorDataStatisticalCreate")
;

View File

@@ -22,6 +22,10 @@ public class SendParam {
@ApiModelProperty(value = "统计日期")
private String statisticalDate;
private String statisticalType;
private String isAppend;
@ApiModelProperty(value = "上报参数")
private List stats;
}

View File

@@ -35,6 +35,6 @@ public class LineDTO {
@ApiModelProperty(name = "objType",value = "对象类型")
private String objType;
@ApiModelProperty(name = "stationType",value = "新能源场站类型")
private String stationType;
@ApiModelProperty(name = "新能源场站信息ID")
private String newStationId;
}

View File

@@ -1,17 +0,0 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wr
* @since 2023-08-21
*/
public interface PqsDeviceUnitMapper extends BaseMapper<PqsDeviceUnit> {
}

View File

@@ -1,13 +1,14 @@
package com.njcn.device.pms.service.majornetwork.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.mapper.PqsDeviceUnitMapper;
import com.njcn.device.pms.mapper.majornetwork.PqsDeviceUnitMapper;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
@@ -18,7 +19,9 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -44,6 +47,9 @@ public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, P
.eq(PmsTerminal::getStatus, DataStateEnum.ENABLE.getCode())
.eq(StrUtil.isNotBlank(devFlag), PmsTerminal::getTerminalState, devFlag)
);
if(CollUtil.isEmpty(list)){
return pqsDeviceUnitVos;
}
List<String> terminal = list.stream().map(PmsTerminal::getId).collect(Collectors.toList());
//获取所有终端信息
List<PqsDeviceUnit> pqsDeviceUnits = this.listByIds(terminal);
@@ -61,12 +67,13 @@ public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, P
subUnitVo.setId(subKey);
subUnitVo.setName(subValue.get(0).getPowerrName());
Map<String, List<PmsTerminal>> terMap = subValue.stream().collect(Collectors.groupingBy(PmsTerminal::getId));
List<DeviceUnitVo> terUnitVos = new ArrayList<>();
List<DeviceUnitVo.DeviceUnit> terUnitVos = new ArrayList<>();
terMap.forEach((terKey, terValue) -> {
for (PmsTerminal pmsTerminal : terValue) {
DeviceUnitVo terUnitVo = new DeviceUnitVo();
DeviceUnitVo.DeviceUnit terUnitVo = new DeviceUnitVo.DeviceUnit();
terUnitVo.setId(pmsTerminal.getId());
terUnitVo.setName(pmsTerminal.getName());
terUnitVo.setDevFlag(pmsTerminal.getTerminalState());
PqsDeviceUnit pqsDeviceUnit;
if (unitMap.containsKey(terKey)) {
pqsDeviceUnit = unitMap.get(terKey);

View File

@@ -21,7 +21,7 @@ public interface DeptLineFeignClient {
HttpResult<List<String>> getLineByDeptId(@RequestParam("id")String id);
@PostMapping("/getLineByDeptIdAndNewStation")
HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id")String id,@RequestParam("type")String type);
HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id")String id);
@PostMapping("/selectDeptBindLines")
HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids);

View File

@@ -40,7 +40,7 @@ public class DeptLineFeignClientFallbackFactory implements FallbackFactory<DeptL
}
@Override
public HttpResult<List<String>> getLineByDeptIdAndNewStation(String id, String type) {
public HttpResult<List<String>> getLineByDeptIdAndNewStation(String id) {
log.error("{}异常,降级处理,异常为:{}", "根据部门id获取绑定的监测点且再根据NewStation进行过滤", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -30,7 +30,7 @@ public class NewStationClientFallbackFactory implements FallbackFactory<NewStati
return new NewStationClient() {
@Override
public HttpResult<NewStation> selectById(String id) {
log.error("{}异常,降级处理,异常为:{}", "获取终获取告警策略列表", throwable.toString());
log.error("{}异常,降级处理,异常为:{}", "根据ID获取新能源场站高低电压穿越表信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};

View File

@@ -21,4 +21,14 @@ public interface Param {
Integer WEEK = 4;
Integer DAY = 5;
//以下四个固定ID用于某些业务判断
//字典(sys_dict_data):电压暂升的ID
String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0";
//字典(sys_dict_data):电压暂降的ID
String LOWEREVENT = "c37861896dafab0883321e1d508caa51";
//字典(sys_dict_data):光伏电站的ID
String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e";
//字典(sys_dict_data):风电场的ID
String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583";
}

View File

@@ -115,9 +115,9 @@ public class DeptLineController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineByDeptIdAndNewStation")
@ApiOperation("根据部门id获取绑定的监测点且再根据NewStation进行过滤")
public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id") String id,@RequestParam("type")String type) {
public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation");
List<String> list = deptLineService.getLineByDeptIdAndNewStation(id,type);
List<String> list = deptLineService.getLineByDeptIdAndNewStation(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}

View File

@@ -83,5 +83,5 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);
List<String> getLineByDeptIdAndNewStation(@Param("id") String id,@Param("stationType") String stationType);
List<String> getLineByDeptIdAndNewStation(@Param("id") String id);
}

View File

@@ -198,6 +198,7 @@
<select id="getLineByDeptIdAndNewStation" resultType="string">
select pdl.Line_Id from pq_dept_line pdl
inner join pq_line_detail pld on pdl.Line_Id = pld.Id
where pdl.Id = #{id} and pld.New_Station_Id in (select pns.id from pq_new_station pns where pns.station_type = #{stationType} and pns.state = 1)
where pdl.Id = #{id}
and exists (select 1 from pq_new_station pns where pns.id = pld.New_Station_Id and pns.state = 1)
</select>
</mapper>

View File

@@ -1432,7 +1432,7 @@
pqd.Run_Flag as runFlag,
detail.PT_Type AS ptType,
detail.PT_Phase_Type AS ptPhaseType,
detail.New_Station_Id AS stationType
detail.New_Station_Id AS newStationId
FROM
pq_line line,
pq_line_detail detail,

View File

@@ -73,7 +73,7 @@ public interface DeptLineService extends IService<DeptLine> {
* @author guofeihu
* @date 2024/8/19
*/
List<String> getLineByDeptIdAndNewStation(String id,String type);
List<String> getLineByDeptIdAndNewStation(String id);
/**
* @Description: 根据部门id获取所有子集部门所包含的部门信息

View File

@@ -12,7 +12,7 @@ import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.service.DeptLineService;
import com.njcn.event.pojo.constant.Param;
import com.njcn.device.pq.constant.Param;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.pojo.param.DeptLineParam;
@@ -90,10 +90,8 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
}
@Override
public List<String> getLineByDeptIdAndNewStation(String id, String type) {
if("1".equals(type)) type = Param.WINDFARM;
if("2".equals(type)) type = Param.PHOTOVOLTAICPOWER;
return this.baseMapper.getLineByDeptIdAndNewStation(id,type);
public List<String> getLineByDeptIdAndNewStation(String id) {
return this.baseMapper.getLineByDeptIdAndNewStation(id);
}
@Override

View File

@@ -7,12 +7,11 @@ import com.njcn.event.pojo.param.EventCountParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.GeneralVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -76,4 +75,10 @@ public interface EventDetailFeignClient {
*/
@PostMapping("/getEventDetailByEventType")
HttpResult<List<RmpEventDetailPO>> getEventDetailByEventType(@RequestBody EventCountParam param);
/**
* 根据开始时间及结束时间获取暂态事件信息
*/
@PostMapping("/getNewEventDetailByTime")
HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false)LocalDateTime lastTime,@RequestParam("currentTime")LocalDateTime currentTime);
}

View File

@@ -12,7 +12,7 @@ import com.njcn.event.utils.EventlEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -82,6 +82,11 @@ public class EventDetailFeignClientFallbackFactory implements FallbackFactory<Ev
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(LocalDateTime lastTime, LocalDateTime currentTime) {
log.error("{}异常,降级处理,异常为:{}", "根据开始时间及结束时间获取暂态事件信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -27,14 +27,4 @@ public interface Param {
String BEGIN =" 00:00:00";
String END =" 23:59:59";
//以下四个固定ID用于某些业务判断
//字典(sys_dict_data):电压暂升的ID
String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0";
//字典(sys_dict_data):电升暂升的ID
String LOWEREVENT = "c37861896dafab0883321e1d508caa51";
//字典(sys_dict_data):光伏电站的ID
String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e";
//字典(sys_dict_data):风电场的ID
String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583";
}

View File

@@ -36,4 +36,7 @@ public class EventNewStationVo implements Serializable {
@ApiModelProperty(value = "暂降严重度")
private Double severity;
@ApiModelProperty(value = "波形路径")
private String wavePath;
}

View File

@@ -78,6 +78,12 @@
<artifactId>harmonic-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>prepare-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -212,4 +213,22 @@ public class EventDetailController extends BaseController {
);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据开始时间及结束时间获取暂态事件信息
* @return
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getNewEventDetailByTime")
@ApiOperation("根据开始时间及结束时间获取暂态事件信息")
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false) LocalDateTime lastTime, @RequestParam("currentTime")LocalDateTime currentTime) {
String methodDescribe = getMethodDescribe("getNewEventDetailByTime");
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.le(RmpEventDetailPO::getStartTime,currentTime);
if(lastTime != null){
lambdaQueryWrapper.gt(RmpEventDetailPO::getStartTime,lastTime);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailService.list(lambdaQueryWrapper), methodDescribe);
}
}

View File

@@ -1,7 +1,6 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.pq.api.DeptLineFeignClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.api.NewStationClient;
@@ -14,6 +13,8 @@ import com.njcn.event.pojo.vo.EventNewStationVo;
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
import com.njcn.prepare.harmonic.api.event.SpThroughFeignClient;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.pojo.po.Area;
import com.njcn.user.api.DeptFeignClient;
@@ -25,7 +26,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
/**
@@ -46,14 +46,14 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
private final DeptLineFeignClient deptLineFeignClient;
private final CommLineClient commLineClient;
private final LineFeignClient lineFeignClient;
private final EventDetailService eventDetailService;
private final NewStationClient newStationClient;
private final SpThroughFeignClient spThroughFeignClient;
@Override
public List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
List<VoltageRideThroughVo> voltageRideThroughVos = new ArrayList<>();
@@ -70,39 +70,17 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
voltageRideThroughVo.setLat(area.getLat());
voltageRideThroughVo.setLng(area.getLng());
}
voltageRideThroughVo.setHighPressure((int) (Math.random() * 100 + 1)+"");
voltageRideThroughVo.setLowPressure((int) (Math.random() * 100 + 1)+"");
//开始计算每个地区高低压穿越次数
//获取当前部门下所有的监测点(当然也会根据选择的新能源场站类型进行过滤)
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId(),voltageRideThroughQueryParam.getType()).getData();
for(String lineId : lineIds){
//监测点绑定的暂降事件
List<EventDetail> eventDetails = eventDetailService.getEventDetailData(lineId,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END);
//取出事件类型为:暂升
List<EventDetail> upperEventDetails = eventDetails.stream().filter(e -> e.getEventType().equals(Param.UPPEREVENT)).collect(Collectors.toList());
//取出事件类型为:暂降
List<EventDetail> lowerEventDetails = eventDetails.stream().filter(e -> e.getEventType().equals(Param.LOWEREVENT)).collect(Collectors.toList());
//当前监测点为:风电场
if("1".equals(voltageRideThroughQueryParam.getType())){
//计算 风电场 暂升次数
for(EventDetail eventDetail : upperEventDetails){
}
//计算 风电场 暂降次数
for(EventDetail eventDetail : lowerEventDetails){
}
}
//当前监测点为:光伏电站
if("2".equals(voltageRideThroughQueryParam.getType())){
//计算 光伏电站 暂升次数
for(EventDetail eventDetail : upperEventDetails){
}
//计算 光伏电站 暂降次数
for(EventDetail eventDetail : lowerEventDetails){
}
//开始计算当前地区高低压穿越次数
//获取当前部门下所有的已绑定能源站的监测点
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId()).getData();
if(!lineIds.isEmpty()){
//根据已绑定能源站的监测点获取关联的暂态事件
List<EventDetail> eventDetails = eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null);
List<String> eventIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList());
if(!eventIds.isEmpty()){
SpThroughParam spThroughParam = new SpThroughParam(eventIds,voltageRideThroughQueryParam.getType());
//赋值子部门高低电压穿越次数
BeanUtils.copyProperties(spThroughFeignClient.getDataByEventIds(spThroughParam).getData(),voltageRideThroughVo);
}
}
voltageRideThroughVos.add(voltageRideThroughVo);
@@ -114,17 +92,24 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
public List<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
List<EventNewStationVo> eventNewStationVos = new ArrayList<>();
List<String> lineIds = new ArrayList<>();
//获取当前选择的部门下所有的监测点(当然也会根据选择的新能源场站类型进行过滤)
lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(voltageRideThroughQueryParam.getAreaId(),voltageRideThroughQueryParam.getType()).getData());
//获取当前部门下所有的已绑定能源站的监测点
lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(voltageRideThroughQueryParam.getAreaId()).getData());
if(!lineIds.isEmpty()){
//根据监测点获取监测点下所有的事件集合
eventNewStationVos = BeanUtil.copyToList(eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null), EventNewStationVo.class);
//特殊处理事件集合中新能源场站名称
for(EventNewStationVo eventNewStationVo : eventNewStationVos){
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(Arrays.asList(eventNewStationVo.getLineId())).getData();
if(!lineDetailDataVOS.isEmpty()){
NewStation newStation = newStationClient.selectById(lineDetailDataVOS.get(0).getNewStationId()).getData();
eventNewStationVo.setNewStationName(newStation.getName());
if(!eventNewStationVos.isEmpty()){
SpThroughParam spThroughParam = new SpThroughParam(eventNewStationVos.stream().map(EventNewStationVo::getEventId).collect(Collectors.toList()),voltageRideThroughQueryParam.getType());
//eventNewStationVos:事件集合中是包含了所有符合条件的事件,可能有部分事件并没有被高低电压穿越记录定时任务所执行 所以需要过滤下 具体逻辑说请看spThroughFeignClient.formatEventIds
List<String> eventIds = spThroughFeignClient.formatEventIds(spThroughParam).getData();
//过滤掉不符合的事件(eventIds为有效事件ID)
eventNewStationVos = eventNewStationVos.stream().filter(item->eventIds.contains(item.getEventId())).collect(Collectors.toList());
//特殊处理事件集合中新能源场站名称
for(EventNewStationVo eventNewStationVo : eventNewStationVos){
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(Arrays.asList(eventNewStationVo.getLineId())).getData();
if(!lineDetailDataVOS.isEmpty()){
NewStation newStation = newStationClient.selectById(lineDetailDataVOS.get(0).getNewStationId()).getData();
eventNewStationVo.setNewStationName(newStation.getName());
}
}
}
}

View File

@@ -191,6 +191,7 @@ spring:
uri: lb://harmonic-boot
predicates:
- Path=/IndexAnalysis/**
- Path=/pms-tech-powerquality-start/**
#项目日志的配置

View File

@@ -27,4 +27,7 @@ public interface UploadGwDataFeignClient {
@PostMapping("/uploadEvaluationData")
HttpResult<String> uploadEvaluationData(@RequestBody UploadParam param);
@PostMapping("/upGwCommPoint")
HttpResult<String> upGwCommPoint(@RequestBody UploadParam param);
}

View File

@@ -45,6 +45,12 @@ public class UploadGwDataFallbackFactory implements FallbackFactory<UploadGwData
log.error("{}异常,降级处理,异常为:{}", "国网上送-母线基准水平评估数据", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
@Override
public HttpResult<String> upGwCommPoint(UploadParam param) {
log.error("{}异常,降级处理,异常为:{}", "国网上送-公共连接点数据", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
};
}
}

View File

@@ -0,0 +1,31 @@
package com.njcn.harmonic.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.time.LocalDate;
/**
* 有功功率趋势实分页查询类
* @author guofeihu
* @date 2024-08-20
*/
@Data
public class RActivePowerRangeQueryParam extends BaseParam {
@Data
public static class RActivePowerRangeEdit{
@ApiModelProperty("id")
private String id;
@NotBlank(message = "监测点ID不能为空")
@ApiModelProperty("监测点(*)")
private String lineId;
@NotBlank(message = "日期不能为空")
@ApiModelProperty("日期(*)")
private LocalDate timeId;
}
}

View File

@@ -0,0 +1,46 @@
package com.njcn.harmonic.pojo.po.pmsWifi;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author xy
* @since 2024-08-25
*/
@Getter
@Setter
@TableName("pms_real_data")
public class MonitorRealData {
private static final long serialVersionUID = 1L;
@TableField("id")
private String id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@TableField("time_Id")
private LocalDateTime timeId;
@MppMultiId
@TableField("line_id")
private String lineId;
@MppMultiId
@TableField("value_type")
private String valueType;
@TableField("pms_content")
private String pmsContent;
}

View File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@@ -16,8 +18,7 @@ import lombok.Setter;
* @author xy
* @since 2024-08-15
*/
@Getter
@Setter
@TableName("r_upload_comm_point_bus")
public class RUploadCommPointBus implements Serializable {
@@ -162,5 +163,246 @@ public class RUploadCommPointBus implements Serializable {
@TableField(exist = false)
private String cnMonitorId;
private Integer uploadStatus;
public Integer getUploadStatus() {
return uploadStatus;
}
public void setUploadStatus(Integer uploadStatus) {
this.uploadStatus = uploadStatus;
}
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public String getStatisticalType() {
return statisticalType;
}
public void setStatisticalType(String statisticalType) {
this.statisticalType = statisticalType;
}
public String getStatisticalDate() {
return statisticalDate;
}
public void setStatisticalDate(String statisticalDate) {
this.statisticalDate = statisticalDate;
}
public String getBusId() {
return busId;
}
public void setBusId(String busId) {
this.busId = busId;
}
public String getBusName() {
return busName;
}
public void setBusName(String busName) {
this.busName = busName;
}
public String getProvinceOrg() {
return provinceOrg;
}
public void setProvinceOrg(String provinceOrg) {
this.provinceOrg = provinceOrg;
}
public String getProvinceOrgName() {
return provinceOrgName;
}
public void setProvinceOrgName(String provinceOrgName) {
this.provinceOrgName = provinceOrgName;
}
public String getCityOrg() {
return cityOrg;
}
public void setCityOrg(String cityOrg) {
this.cityOrg = cityOrg;
}
public String getCityOrgName() {
return cityOrgName;
}
public void setCityOrgName(String cityOrgName) {
this.cityOrgName = cityOrgName;
}
public String getMaintOrg() {
return maintOrg;
}
public void setMaintOrg(String maintOrg) {
this.maintOrg = maintOrg;
}
public String getMaintOrgName() {
return maintOrgName;
}
public void setMaintOrgName(String maintOrgName) {
this.maintOrgName = maintOrgName;
}
public String getStationType() {
return stationType;
}
public void setStationType(String stationType) {
this.stationType = stationType;
}
public String getStationId() {
return stationId;
}
public void setStationId(String stationId) {
this.stationId = stationId;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getStationVoltageLevel() {
return stationVoltageLevel;
}
public void setStationVoltageLevel(String stationVoltageLevel) {
this.stationVoltageLevel = stationVoltageLevel;
}
public String getBusVoltageLevel() {
return busVoltageLevel;
}
public void setBusVoltageLevel(String busVoltageLevel) {
this.busVoltageLevel = busVoltageLevel;
}
public Integer getOvDays() {
return ovDays;
}
public void setOvDays(Integer ovDays) {
this.ovDays = ovDays;
}
public Double getAvgVrms() {
return avgVrms;
}
public void setAvgVrms(Double avgVrms) {
this.avgVrms = avgVrms;
}
public Double getgVrms() {
return gVrms;
}
public void setgVrms(Double gVrms) {
this.gVrms = gVrms;
}
public Integer getHarmVOvDays() {
return harmVOvDays;
}
public void setHarmVOvDays(Integer harmVOvDays) {
this.harmVOvDays = harmVOvDays;
}
public Integer getHarmVOvDuration() {
return harmVOvDuration;
}
public void setHarmVOvDuration(Integer harmVOvDuration) {
this.harmVOvDuration = harmVOvDuration;
}
public Integer getVunbanOvDays() {
return vunbanOvDays;
}
public void setVunbanOvDays(Integer vunbanOvDays) {
this.vunbanOvDays = vunbanOvDays;
}
public Integer getVunbanOvDuration() {
return vunbanOvDuration;
}
public void setVunbanOvDuration(Integer vunbanOvDuration) {
this.vunbanOvDuration = vunbanOvDuration;
}
public Integer getPltOvDays() {
return pltOvDays;
}
public void setPltOvDays(Integer pltOvDays) {
this.pltOvDays = pltOvDays;
}
public Integer getPltOvDuration() {
return pltOvDuration;
}
public void setPltOvDuration(Integer pltOvDuration) {
this.pltOvDuration = pltOvDuration;
}
public String getMonitorId() {
return monitorId;
}
public void setMonitorId(String monitorId) {
this.monitorId = monitorId;
}
public String getMonitorIds() {
return monitorIds;
}
public void setMonitorIds(String monitorIds) {
this.monitorIds = monitorIds;
}
public String getDataSource() {
return dataSource;
}
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}
public String getCnMonitorId() {
return cnMonitorId;
}
public void setCnMonitorId(String cnMonitorId) {
this.cnMonitorId = cnMonitorId;
}
}

View File

@@ -0,0 +1,51 @@
package com.njcn.harmonic.controller.pmsWifi;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.mapper.pmsWifi.PmsMonitorRealDataMapper;
import com.njcn.harmonic.pojo.po.pmsWifi.MonitorRealData;
import com.njcn.influx.service.IDataVService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 公共连接点母线电能质量统计 前端控制器
* </p>
*
* @author cdf
* @since 2024-08-15
*/
@RestController
@RequestMapping("/pmsWifi")
@RequiredArgsConstructor
public class PmsWifiController extends BaseController {
private final PmsMonitorRealDataMapper pmsMonitorRealDataMapper;
private final IDataVService iDataVService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getPmsInfo")
@ApiOperation("查询最新的一条电能质量数据")
public HttpResult<MonitorRealData> getPmsInfo(@RequestParam String monitorId,@RequestParam String valueType) {
String methodDescribe = getMethodDescribe("getPmsInfo");
LambdaUpdateWrapper<MonitorRealData> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(MonitorRealData::getValueType,valueType).eq(MonitorRealData::getLineId,monitorId);
MonitorRealData monitorRealData = pmsMonitorRealDataMapper.selectOne(lambdaUpdateWrapper);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorRealData, methodDescribe);
}
}

View File

@@ -0,0 +1,25 @@
package com.njcn.harmonic.controller.powerstatistics;
import com.njcn.harmonic.service.activepowerrange.PowerStatisticsService;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
/**
* 有功功率趋势统计 前端控制器
* @author guofeihu
* @since 2024-08-20
*/
@Slf4j
@RestController
@RequestMapping("/powerStatistics")
@Api(tags = "有功功率趋势")
@AllArgsConstructor
public class PowerStatisticsController extends BaseController {
private final PowerStatisticsService powerStatisticsService;
}

View File

@@ -1,6 +1,23 @@
package com.njcn.harmonic.controller.upload;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
import com.njcn.harmonic.pojo.vo.upload.UploadPointStatisticalDataVo;
import com.njcn.harmonic.service.upload.IRUploadCommPointBusService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -11,12 +28,37 @@ import com.njcn.web.controller.BaseController;
* 公共连接点母线电能质量统计 前端控制器
* </p>
*
* @author xy
* @author cdf
* @since 2024-08-15
*/
@RestController
@RequestMapping("/upload/rUploadCommPointBus")
@RequestMapping("/upload")
@RequiredArgsConstructor
public class RUploadCommPointBusController extends BaseController {
private final IRUploadCommPointBusService irUploadCommPointBusService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getCommPointBusPage")
@ApiOperation("分页查询公共连接点")
@ApiImplicitParam(name = "param", value = "实体参数", required = true)
public HttpResult<Page<RUploadCommPointBus>> getCommPointBusPage(@RequestBody @Validated UploadDataParam param) {
String methodDescribe = getMethodDescribe("getCommPointBusPage");
Page<RUploadCommPointBus> page = irUploadCommPointBusService.getCommPointBusPage(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/upGwCommPoint")
@ApiOperation("上送国网")
@ApiImplicitParam(name = "param", value = "实体参数", required = true)
public HttpResult<Boolean> upGwCommPoint(@RequestBody UploadDataParam param) {
String methodDescribe = getMethodDescribe("upGwCommPoint");
irUploadCommPointBusService.upGw(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
}

View File

@@ -0,0 +1,14 @@
package com.njcn.harmonic.mapper.pmsWifi;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.harmonic.pojo.po.pmsWifi.MonitorRealData;
/**
* roma
*
* @author cdf
* @date 2024/8/25
*/
public interface PmsMonitorRealDataMapper extends MppBaseMapper<MonitorRealData> {
}

View File

@@ -0,0 +1,10 @@
package com.njcn.harmonic.service.activepowerrange;
/**
* 有功功率趋势统计 服务类
* @author guofeihu
* @since 2024-08-20
*/
public interface PowerStatisticsService {
}

View File

@@ -0,0 +1,14 @@
package com.njcn.harmonic.service.activepowerrange.impl;
import com.njcn.harmonic.service.activepowerrange.PowerStatisticsService;
import org.springframework.stereotype.Service;
/**
* 有功功率趋势统计 服务实现类
* @author guofeihu
* @since 2024-08-20
*/
@Service
public class PowerStatisticsServiceImpl implements PowerStatisticsService {
}

View File

@@ -1,14 +1,24 @@
package com.njcn.harmonic.service.upload;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
/**
* <p>
* 公共连接点母线电能质量统计 服务类
* </p>
*/
@Service
public interface IRUploadCommPointBusService extends IService<RUploadCommPointBus> {
Page<RUploadCommPointBus> getCommPointBusPage(UploadDataParam param);
Boolean upGw(UploadDataParam param);
}

View File

@@ -1,12 +1,33 @@
package com.njcn.harmonic.service.upload.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 cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.harmonic.mapper.upload.RUploadCommPointBusMapper;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
import com.njcn.harmonic.service.upload.IRUploadCommPointBusService;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.web.enums.GWSendEnum;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.SendParam;
import com.njcn.web.utils.GwSendUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* <p>
* 公共连接点母线电能质量统计 服务实现类
@@ -18,4 +39,80 @@ import org.springframework.stereotype.Service;
@Service
public class RUploadCommPointBusServiceImpl extends ServiceImpl<RUploadCommPointBusMapper, RUploadCommPointBus> implements IRUploadCommPointBusService {
@Override
public Page<RUploadCommPointBus> getCommPointBusPage(UploadDataParam param) {
DateTime dateTime = DateUtil.parse(param.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
if(param.getDataType().equals("02")){
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_MONTH_PATTERN));
}else if(param.getDataType().equals("01")){
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_YEAR_PATTERN));
}
LambdaQueryWrapper<RUploadCommPointBus> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(RUploadCommPointBus::getStatisticalType,param.getDataType())
.eq(RUploadCommPointBus::getStatisticalDate,param.getSearchBeginTime());
return this.page(new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),lambdaQueryWrapper);
}
@Override
public Boolean upGw(UploadDataParam param) {
if(StrUtil.isBlank(param.getSearchBeginTime())){
throw new BusinessException("日期不可为空");
}
LambdaQueryWrapper<RUploadCommPointBus> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isBlank(param.getDataType())){
//类型为空则上送日月年数据
DateTime dateTime = DateUtil.parse(param.getSearchBeginTime(),DatePattern.NORM_DATE_PATTERN);
String month = DateUtil.format(dateTime,DatePattern.NORM_MONTH_PATTERN);
String year = DateUtil.format(dateTime,DatePattern.NORM_YEAR_PATTERN);
lambdaQueryWrapper.in(RUploadCommPointBus::getStatisticalDate, Stream.of(param.getSearchBeginTime(),month,year).collect(Collectors.toList()));
}else {
lambdaQueryWrapper.eq(RUploadCommPointBus::getStatisticalType,param.getDataType())
.eq(RUploadCommPointBus::getStatisticalDate,param.getSearchBeginTime());
}
List<RUploadCommPointBus> rUploadCommPointBusList = this.list(lambdaQueryWrapper);
if(CollUtil.isEmpty(rUploadCommPointBusList)){
throw new BusinessException("查询数据为空");
}
List<List<RUploadCommPointBus>> list = CollUtil.split(rUploadCommPointBusList,100);
for(int i=0;i<list.size();i++){
SendParam sendParam = new SendParam();
if(i==0){
sendParam.setIsAppend("0");
}else if(i==list.size()-1){
sendParam.setIsAppend("2");
}else {
sendParam.setIsAppend("1");
}
if(StrUtil.isNotBlank(param.getDataType())){
DateTime dateTime = DateUtil.parse(param.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
sendParam.setStatisticalType(param.getDataType());
if(param.getDataType().equals(DicDataEnum.STATISTICAL_TYPE_M.getCode())){
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_MONTH_PATTERN));
}else if(param.getDataType().equals(DicDataEnum.STATISTICAL_TYPE_Y.getCode())){
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_YEAR_PATTERN));
}
sendParam.setStatisticalDate(param.getSearchBeginTime());
}
sendParam.setStats(list);
Map<String, String> sendRes = GwSendUtil.send(sendParam, GWSendEnum.COMM_POINT);
List<String> ids = list.get(i).stream().map(RUploadCommPointBus::getObjId).collect(Collectors.toList());
int count = GwSendUtil.returnInfoMsg(ids,sendRes);
System.out.println("上送成功,上送成功返回"+count+"");
if(count == list.get(i).size()){
LambdaUpdateWrapper<RUploadCommPointBus> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.set(RUploadCommPointBus::getUploadStatus,1).in(RUploadCommPointBus::getObjId,ids);
this.update(lambdaUpdateWrapper);
}
}
return true;
}
}

View File

@@ -3,8 +3,13 @@ package com.njcn.prepare.harmonic.api.event;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.event.fallback.SpThroughFeignClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 高低电压穿越Feign客户端
@@ -20,4 +25,10 @@ public interface SpThroughFeignClient {
@PostMapping("/record")
HttpResult<Boolean> record();
@PostMapping("/getDataByEventIds")
HttpResult<SpThroughVO> getDataByEventIds(@RequestBody @Validated SpThroughParam spThroughParam);
@PostMapping("/formatEventIds")
HttpResult<List<String>> formatEventIds(@RequestBody @Validated SpThroughParam spThroughParam);
}

View File

@@ -4,10 +4,13 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.event.SpThroughFeignClient;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
import com.njcn.prepare.harmonic.utils.PrepareEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 高低电压穿越熔断降级
@@ -33,6 +36,18 @@ public class SpThroughFeignClientFallbackFactory implements FallbackFactory<SpTh
log.error("{}异常,降级处理,异常为:{}", "高低电压穿越记录: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<SpThroughVO> getDataByEventIds(SpThroughParam spThroughParam) {
log.error("{}异常,降级处理,异常为:{}", "根据事件ID集合及能源站类型获取高低电压穿越次数: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<String>> formatEventIds(SpThroughParam spThroughParam) {
log.error("{}异常,降级处理,异常为:{}", "根据原有的事件集合进行过滤: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,27 @@
package com.njcn.prepare.harmonic.pojo.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author guofeihu
* @since 2024-08-14
*/
@Data
public class SpThroughParam {
@ApiModelProperty(name = "eventIds",value = "事件ID集合")
private List<String> eventIds;
@ApiModelProperty(name = "lineType",value = "监测点类别(1:风电场、2:光伏电站)")
private String stationType;
public SpThroughParam(List<String> eventIds, String stationType) {
this.eventIds = eventIds;
this.stationType = stationType;
}
public SpThroughParam() {
}
}

View File

@@ -0,0 +1,19 @@
package com.njcn.prepare.harmonic.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author guofeihu
* @since 2024-08-14
*/
@Data
public class SpThroughVO {
@ApiModelProperty("低压次数")
private String lowPressure;
@ApiModelProperty("高压次数")
private String highPressure;
}

View File

@@ -12,6 +12,7 @@ import com.njcn.prepare.harmonic.service.mysql.area.RStatOrgService;
import com.njcn.prepare.harmonic.service.mysql.dim.*;
import com.njcn.prepare.harmonic.service.mysql.line.PollutionService;
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.*;
import com.njcn.prepare.harmonic.service.mysql.upload.IRUploadCommPointBusService;
import com.njcn.prepare.harmonic.service.mysql.upload.IRUploadEvaluationDataDService;
import com.njcn.prepare.harmonic.service.mysql.send.ConverterIndexStatisticsPOService;
import com.njcn.prepare.harmonic.service.mysql.send.PqTypicalSourceCreatePOService;
@@ -50,11 +51,6 @@ public class OrgPointExecutor extends BaseExecutor{
private final RAlarmCountService rAlarmCountService;
private final RDimBusbarHarmnicDPOService rDimBusbarHarmnicDPOService;
private final RDimStationHarmnicDPOService rDimStationHarmnicDPOService;
private final RDimStationTargetDPOService rDimStationTargetDPOService;
private final RDimStationTargetMPOService rDimStationTargetMPOService;
private final RDimStationTargetYPOService rDimStationTargetYPOService;
private final RDimBusTargetDPOService rDimBusTargetDPOService;
private final RDimBusTargetMPOService rDimBusTargetMPOService;
@@ -77,6 +73,8 @@ public class OrgPointExecutor extends BaseExecutor{
private final ConverterIndexStatisticsPOService converterIndexStatisticsPOService;
private final PqTypicalSourceCreatePOService pqTypicalSourceCreatePOService;
private final IRUploadEvaluationDataDService irUploadEvaluationDataDService;
private final IRUploadCommPointBusService irUploadCommPointBusService;
/**
*
* 3.3.2. 单位标数据质量
@@ -714,4 +712,24 @@ public class OrgPointExecutor extends BaseExecutor{
}
}
@LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rUploadCommPoint", nodeType = NodeTypeEnum.COMMON)
public boolean rUploadCommPointAccess(NodeComponent bindCmp) {
return isAccess(bindCmp);
}
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rUploadCommPoint", nodeType = NodeTypeEnum.COMMON)
public void rUploadCommPointProcess(NodeComponent bindCmp) {
String tag = bindCmp.getTag();
CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam = bindCmp.getRequestData();
if (tag.equalsIgnoreCase("r_upload_comm_point_d")) {
//日表
irUploadCommPointBusService.handlerDay(calculatedParam.getDataDate());
} else if (tag.equalsIgnoreCase("r_upload_comm_point_m")) {
//月表
irUploadCommPointBusService.handlerMonth(calculatedParam.getDataDate());
} else if (tag.equalsIgnoreCase("r_upload_comm_point_y")) {
//月表
irUploadCommPointBusService.handlerYear(calculatedParam.getDataDate());
}
}
}

View File

@@ -6,7 +6,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.prepare.harmonic.pojo.po.SpThroughPO;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
import com.njcn.prepare.harmonic.service.mysql.event.SpThroughService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
@@ -45,11 +46,19 @@ public class SpThroughController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
@PostMapping("/getDataByLineIds")
@ApiOperation("根据监测点ID集合获取高低电压穿越信息")
public HttpResult<List<SpThroughPO>> getDataByLineIds(@RequestBody List<String> lineIds) {
String methodDescribe = getMethodDescribe("getDataByLineIds");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, spThroughService.getDataByLineIds(lineIds), methodDescribe);
@PostMapping("/getDataByEventIds")
@ApiOperation("根据事件ID集合及能源站类型获取高低电压穿越次数")
public HttpResult<SpThroughVO> getDataByEventIds(@RequestBody SpThroughParam spThroughParam) {
String methodDescribe = getMethodDescribe("getDataByEventIds");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, spThroughService.getDataByEventIds(spThroughParam), methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
@PostMapping("/formatEventIds")
@ApiOperation("根据原有的事件集合进行过滤")
public HttpResult<List<String>> formatEventIds(@RequestBody SpThroughParam spThroughParam) {
String methodDescribe = getMethodDescribe("formatEventIds");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, spThroughService.formatEventIds(spThroughParam), methodDescribe);
}
}

View File

@@ -24,4 +24,6 @@ public class CommPointController {
}
}

View File

@@ -1,11 +1,25 @@
package com.njcn.prepare.harmonic.service.mysql.Impl.event;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.pq.api.NewStationClient;
import com.njcn.device.pq.constant.Param;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.prepare.harmonic.mapper.mysql.event.SpThroughMapper;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.prepare.harmonic.pojo.po.SpThroughPO;
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
import com.njcn.prepare.harmonic.service.mysql.event.SpThroughService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* 高低电压穿越 服务实现类
@@ -13,15 +27,105 @@ import java.util.List;
* @since 2024-08-22
*/
@Service
@RequiredArgsConstructor
public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThroughPO> implements SpThroughService {
private final EventDetailFeignClient eventDetailFeignClient;
private final CommLineClient commLineClient;
private final NewStationClient newStationClient;
@Override
public void record() {
LocalDateTime currentTime = LocalDateTime.now();
//获取最新的暂态事件信息(截至目前为止)
List<RmpEventDetailPO> evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(getLastTime(),currentTime).getData();
for(RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS){
//获取监测点
LineDTO lineDTO = commLineClient.getLineDetail(rmpEventDetailPO.getMeasurementPointId()).getData();
if(lineDTO != null && lineDTO.getNewStationId() != null){
NewStation newStation = newStationClient.selectById(lineDTO.getNewStationId()).getData();
if(newStation != null){
//暂升事件
if(Param.UPPEREVENT.equals(rmpEventDetailPO.getEventType())){
//风电场
if(Param.WINDFARM.equals(newStation.getStationType())){
}
//光伏电站
if(Param.PHOTOVOLTAICPOWER.equals(newStation.getStationType())){
}
}
//暂降事件
if(Param.LOWEREVENT.equals(rmpEventDetailPO.getEventType())){
//风电场
if(Param.WINDFARM.equals(newStation.getStationType())){
}
//光伏电站
if(Param.PHOTOVOLTAICPOWER.equals(newStation.getStationType())){
}
}
}
}
}
}
//拿到最近一次插入高低电压穿越表信息的时间
private LocalDateTime getLastTime(){
LambdaQueryWrapper<SpThroughPO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.orderByDesc(SpThroughPO::getCreateTime);
Page<SpThroughPO> page = new Page<>(1, 1);
List<SpThroughPO> spThroughPOS = this.baseMapper.selectPage(page,lambdaQueryWrapper).getRecords();
if(!spThroughPOS.isEmpty()){
return spThroughPOS.get(0).getCreateTime();
}
return null;
}
@Override
public List<SpThroughPO> getDataByLineIds(List<String> lineIds) {
return null;
public SpThroughVO getDataByEventIds(SpThroughParam spThroughParam) {
SpThroughVO spThroughVO = new SpThroughVO();
LambdaQueryWrapper<SpThroughPO> upperLambdaQueryWrapper = new LambdaQueryWrapper();
upperLambdaQueryWrapper.in(SpThroughPO::getEventId,spThroughParam.getEventIds())
.eq(SpThroughPO::getIsOrNot,1)
.eq(SpThroughPO::getStationType,spThroughParam.getStationType().equals("1")?Param.WINDFARM:Param.PHOTOVOLTAICPOWER)
.eq(SpThroughPO::getState,1)
.eq(SpThroughPO::getEventType,Param.UPPEREVENT);
Integer upperCount = this.baseMapper.selectCount(upperLambdaQueryWrapper);
spThroughVO.setHighPressure(upperCount == 0?null:upperCount.toString());
LambdaQueryWrapper<SpThroughPO> lowLambdaQueryWrapper = new LambdaQueryWrapper();
lowLambdaQueryWrapper.in(SpThroughPO::getEventId,spThroughParam.getEventIds())
.eq(SpThroughPO::getIsOrNot,1)
.eq(SpThroughPO::getStationType,spThroughParam.getStationType().equals("1")?Param.WINDFARM:Param.PHOTOVOLTAICPOWER)
.eq(SpThroughPO::getState,1)
.eq(SpThroughPO::getEventType,Param.LOWEREVENT);
Integer lowCount = this.baseMapper.selectCount(lowLambdaQueryWrapper);
spThroughVO.setLowPressure(lowCount == 0?null:lowCount.toString());
return spThroughVO;
}
/**
* 说明:
* 此方法是专门提供给event模块-高低压穿越模块中-根据区域获取暂态事件列表使用
* 根据区域获取各个子区域高低电压穿越次数是基于sp_through表中记录来的 那么在根据区域获取暂态事件列表数据也应该基于sp_through表中记录来
* 因为如果不基于sp_through表中记录来 那么根据区域获取暂态事件可能数据非常多且可能一部分的事件数据并没有被定时任务(record方法)所执行
* @param spThroughParam
* @return
*/
@Override
public List<String> formatEventIds(SpThroughParam spThroughParam) {
LambdaQueryWrapper<SpThroughPO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.in(SpThroughPO::getEventId,spThroughParam.getEventIds())
.eq(SpThroughPO::getIsOrNot,1)
.eq(SpThroughPO::getStationType,spThroughParam.getStationType().equals("1")?Param.WINDFARM:Param.PHOTOVOLTAICPOWER)
.eq(SpThroughPO::getState,1);
List<SpThroughPO> spThroughPOS = this.baseMapper.selectList(lambdaQueryWrapper);
return spThroughPOS.stream().map(SpThroughPO::getEventId).collect(Collectors.toList());
}
}

View File

@@ -1,7 +1,9 @@
package com.njcn.prepare.harmonic.service.mysql.event;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
import com.njcn.prepare.harmonic.pojo.po.SpThroughPO;
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
import java.util.List;
/**
@@ -17,8 +19,13 @@ public interface SpThroughService extends IMppService<SpThroughPO> {
void record();
/**
* 根据监测点ID集合获取高低电压穿越信息
* 根据事件ID集合及能源站类型获取高低电压穿越次数
*/
List<SpThroughPO> getDataByLineIds(List<String> lineIds);
SpThroughVO getDataByEventIds(SpThroughParam spThroughParam);
/**
* 根据原有的事件集合进行过滤
*/
List<String> formatEventIds(SpThroughParam spThroughParam);
}

View File

@@ -14,4 +14,10 @@ public interface IRUploadCommPointBusService extends IService<RUploadCommPointBu
void handlerDay(String date);
void handlerMonth(String date);
void handlerYear(String date);
}

View File

@@ -2,6 +2,9 @@ package com.njcn.prepare.harmonic.service.mysql.upload.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 cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -82,7 +85,6 @@ public class RUploadCommPointBusServiceImpl extends MppServiceImpl<RUploadCommPo
@Override
@Async("asyncExecutor")
public void handlerDay(String date){
List<RUploadCommPointBus> poLIst = new ArrayList<>();
@@ -177,6 +179,7 @@ public class RUploadCommPointBusServiceImpl extends MppServiceImpl<RUploadCommPo
rUploadCommPointBus.setMonitorId(point.getMonitorId());
rUploadCommPointBus.setDataSource("01");
rUploadCommPointBus.setCnMonitorId(point.getId());
rUploadCommPointBus.setUploadStatus(DataStateEnum.DELETED.getCode());
poLIst.add(rUploadCommPointBus);
});
@@ -202,7 +205,7 @@ public class RUploadCommPointBusServiceImpl extends MppServiceImpl<RUploadCommPo
}
if(cpMap.containsKey(item.getCnMonitorId())){
RStatDataVDPO rStatDataVDPO = cpMap.get(item.getCnMonitorId());
item.setGVrms(rStatDataVDPO.getRms());
item.setgVrms(rStatDataVDPO.getRms());
}
Integer limitDay = 0;
@@ -254,6 +257,158 @@ public class RUploadCommPointBusServiceImpl extends MppServiceImpl<RUploadCommPo
}
public void handlerMonth(String date){
DateTime begin = DateUtil.beginOfMonth(DateUtil.parse(date, DatePattern.NORM_DATE_PATTERN));
DateTime end = DateUtil.parse(date, DatePattern.NORM_DATE_PATTERN);
String month = DateUtil.format(end,DatePattern.NORM_MONTH_PATTERN);
LambdaQueryWrapper<RUploadCommPointBus> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.between(RUploadCommPointBus::getStatisticalDate,begin,end).eq(RUploadCommPointBus::getStatisticalType,DicDataEnum.STATISTICAL_TYPE_D.getCode());
List<RUploadCommPointBus> rUploadCommPointBusList = this.list(lambdaQueryWrapper);
List<RUploadCommPointBus> poLIst = new ArrayList<>();
Map<String,List<RUploadCommPointBus>> map = rUploadCommPointBusList.stream().collect(Collectors.groupingBy(RUploadCommPointBus::getBusId));
map.forEach((busId,list)->{
RUploadCommPointBus one = list.get(0);
RUploadCommPointBus rUploadCommPointBus = new RUploadCommPointBus();
rUploadCommPointBus.setObjId(IdUtil.simpleUUID());
rUploadCommPointBus.setBusId(busId);
rUploadCommPointBus.setBusName(one.getBusName());
rUploadCommPointBus.setBusVoltageLevel(one.getBusVoltageLevel());
rUploadCommPointBus.setStatisticalType(DicDataEnum.STATISTICAL_TYPE_M.getCode());
rUploadCommPointBus.setStatisticalDate(month);
rUploadCommPointBus.setProvinceOrg(one.getProvinceOrg());
rUploadCommPointBus.setProvinceOrgName(one.getProvinceOrgName());
rUploadCommPointBus.setCityOrg(one.getCityOrg());
rUploadCommPointBus.setCityOrgName(one.getCityOrgName());
rUploadCommPointBus.setMaintOrg(one.getMaintOrg());
rUploadCommPointBus.setMaintOrgName(one.getMaintOrgName());
rUploadCommPointBus.setStationType("zf01");
rUploadCommPointBus.setStationId(one.getStationId());
rUploadCommPointBus.setStationName(one.getStationName());
rUploadCommPointBus.setStationVoltageLevel(one.getStationVoltageLevel());
rUploadCommPointBus.setDataSource("01");
List<String> temList = list.stream().map(RUploadCommPointBus::getMonitorId).collect(Collectors.toList());
String point = findMostFrequentString(temList);
rUploadCommPointBus.setMonitorId(point);
rUploadCommPointBus.setAvgVrms(list.stream().filter(item->Objects.nonNull(item.getAvgVrms())).mapToDouble(RUploadCommPointBus::getAvgVrms).average().orElse(0.0));
rUploadCommPointBus.setgVrms(list.stream().filter(item->Objects.nonNull(item.getgVrms())).mapToDouble(RUploadCommPointBus::getgVrms).average().orElse(0.0));
rUploadCommPointBus.setHarmVOvDuration(list.stream().filter(item->Objects.nonNull(item.getHarmVOvDuration())).mapToInt(RUploadCommPointBus::getHarmVOvDuration).sum());
rUploadCommPointBus.setHarmVOvDays(list.stream().filter(item->Objects.nonNull(item.getHarmVOvDays())).mapToInt(RUploadCommPointBus::getHarmVOvDays).sum());
rUploadCommPointBus.setVunbanOvDuration(list.stream().filter(item->Objects.nonNull(item.getVunbanOvDuration())).mapToInt(RUploadCommPointBus::getVunbanOvDuration).sum());
rUploadCommPointBus.setVunbanOvDays(list.stream().filter(item->Objects.nonNull(item.getVunbanOvDays())).mapToInt(RUploadCommPointBus::getVunbanOvDays).sum());
rUploadCommPointBus.setPltOvDuration(list.stream().filter(item->Objects.nonNull(item.getPltOvDuration())).mapToInt(RUploadCommPointBus::getPltOvDuration).sum());
rUploadCommPointBus.setPltOvDays(list.stream().filter(item->Objects.nonNull(item.getPltOvDays())).mapToInt(RUploadCommPointBus::getPltOvDays).sum());
rUploadCommPointBus.setOvDays(list.stream().filter(item->Objects.nonNull(item.getOvDays())).mapToInt(RUploadCommPointBus::getOvDays).sum());
rUploadCommPointBus.setUploadStatus(DataStateEnum.DELETED.getCode());
poLIst.add(rUploadCommPointBus);
});
if(CollUtil.isNotEmpty(poLIst)){
this.saveOrUpdateBatchByMultiId(poLIst);
}
}
public void handlerYear(String date){
DateTime begin = DateUtil.beginOfYear(DateUtil.parse(date, DatePattern.NORM_DATE_PATTERN));
DateTime end = DateUtil.parse(date, DatePattern.NORM_DATE_PATTERN);
String year = DateUtil.format(end,DatePattern.NORM_YEAR_PATTERN);
LambdaQueryWrapper<RUploadCommPointBus> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.between(RUploadCommPointBus::getStatisticalDate,begin,end).eq(RUploadCommPointBus::getStatisticalType,DicDataEnum.STATISTICAL_TYPE_D.getCode());
List<RUploadCommPointBus> rUploadCommPointBusList = this.list(lambdaQueryWrapper);
List<RUploadCommPointBus> poLIst = new ArrayList<>();
Map<String,List<RUploadCommPointBus>> map = rUploadCommPointBusList.stream().collect(Collectors.groupingBy(RUploadCommPointBus::getBusId));
map.forEach((busId,list)->{
RUploadCommPointBus one = list.get(0);
RUploadCommPointBus rUploadCommPointBus = new RUploadCommPointBus();
rUploadCommPointBus.setStatisticalType(DicDataEnum.STATISTICAL_TYPE_Y.getCode());
rUploadCommPointBus.setStatisticalDate(year);
rUploadCommPointBus.setObjId(IdUtil.simpleUUID());
rUploadCommPointBus.setBusId(busId);
rUploadCommPointBus.setBusName(one.getBusName());
rUploadCommPointBus.setBusVoltageLevel(one.getBusVoltageLevel());
rUploadCommPointBus.setProvinceOrg(one.getProvinceOrg());
rUploadCommPointBus.setProvinceOrgName(one.getProvinceOrgName());
rUploadCommPointBus.setCityOrg(one.getCityOrg());
rUploadCommPointBus.setCityOrgName(one.getCityOrgName());
rUploadCommPointBus.setMaintOrg(one.getMaintOrg());
rUploadCommPointBus.setMaintOrgName(one.getMaintOrgName());
rUploadCommPointBus.setStationType("zf01");
rUploadCommPointBus.setStationId(one.getStationId());
rUploadCommPointBus.setStationName(one.getStationName());
rUploadCommPointBus.setStationVoltageLevel(one.getStationVoltageLevel());
rUploadCommPointBus.setDataSource("01");
List<String> temList = list.stream().map(RUploadCommPointBus::getMonitorId).collect(Collectors.toList());
String point = findMostFrequentString(temList);
rUploadCommPointBus.setMonitorId(point);
rUploadCommPointBus.setAvgVrms(list.stream().filter(item->Objects.nonNull(item.getAvgVrms())).mapToDouble(RUploadCommPointBus::getAvgVrms).average().orElse(0.0));
rUploadCommPointBus.setgVrms(list.stream().filter(item->Objects.nonNull(item.getgVrms())).mapToDouble(RUploadCommPointBus::getgVrms).average().orElse(0.0));
rUploadCommPointBus.setHarmVOvDuration(list.stream().filter(item->Objects.nonNull(item.getHarmVOvDuration())).mapToInt(RUploadCommPointBus::getHarmVOvDuration).sum());
rUploadCommPointBus.setHarmVOvDays(list.stream().filter(item->Objects.nonNull(item.getHarmVOvDays())).mapToInt(RUploadCommPointBus::getHarmVOvDays).sum());
rUploadCommPointBus.setVunbanOvDuration(list.stream().filter(item->Objects.nonNull(item.getVunbanOvDuration())).mapToInt(RUploadCommPointBus::getVunbanOvDuration).sum());
rUploadCommPointBus.setVunbanOvDays(list.stream().filter(item->Objects.nonNull(item.getVunbanOvDays())).mapToInt(RUploadCommPointBus::getVunbanOvDays).sum());
rUploadCommPointBus.setPltOvDuration(list.stream().filter(item->Objects.nonNull(item.getPltOvDuration())).mapToInt(RUploadCommPointBus::getPltOvDuration).sum());
rUploadCommPointBus.setPltOvDays(list.stream().filter(item->Objects.nonNull(item.getPltOvDays())).mapToInt(RUploadCommPointBus::getPltOvDays).sum());
rUploadCommPointBus.setOvDays(list.stream().filter(item->Objects.nonNull(item.getOvDays())).mapToInt(RUploadCommPointBus::getOvDays).sum());
rUploadCommPointBus.setUploadStatus(DataStateEnum.DELETED.getCode());
poLIst.add(rUploadCommPointBus);
});
if(CollUtil.isNotEmpty(poLIst)){
this.saveOrUpdateBatchByMultiId(poLIst);
}
}
public String findMostFrequentString(List<String> strings) {
if (strings == null || strings.isEmpty()) {
throw new IllegalArgumentException("输入的列表不能为空");
}
// 使用HashMap来记录每个字符串及其出现次数
Map<String, Integer> frequencyMap = new HashMap<>();
for (String str : strings) {
frequencyMap.put(str, frequencyMap.getOrDefault(str, 0) + 1);
}
// 初始化最大出现次数和对应的字符串
int maxCount = 0;
String mostFrequent = strings.get(0); // 假设列表不为空,则取第一个字符串作为初始值
// 遍历HashMap找到出现次数最多的字符串
for (Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
if (entry.getValue() > maxCount) {
maxCount = entry.getValue();
mostFrequent = entry.getKey();
}
}
return mostFrequent;
}
/***
* 获取越限最大值
* @param object
@@ -306,13 +461,6 @@ public class RUploadCommPointBusServiceImpl extends MppServiceImpl<RUploadCommPo
return monitorRes;
}
public void handlerMonth(String date){
}
public void handlerYear(String date){
}
}

View File

@@ -124,13 +124,13 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
List<DeptGetChildrenMoreDTO> list = calculatedParam.getIdList();
list.forEach(item -> {
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), item.getDeptLevel())) {
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), item.getDeptLevel())
//县数据
|| Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_4.getCode()),item.getDeptLevel())
|| Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_4.getCode()), item.getDeptLevel())) {
return;
}
if(item.getUnitId().equals("13B9B47F1E4F3324E05338297A0A0595")){
System.out.println("555");
}
BusBarDto busBarDto = allDept.stream().filter(o -> Objects.equals(o.getOrgId(), item.getUnitId())).findFirst().orElse(null);

View File

@@ -9,6 +9,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.FileUtil;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.SupvAlarmParam;
import com.njcn.process.pojo.param.SupvFileParam;
@@ -31,7 +32,7 @@ import java.util.List;
/**
* <p>
* 前端控制器
* 前端控制器
* </p>
*
* @author hongawen
@@ -47,40 +48,45 @@ public class SupvFileController extends BaseController {
@PostMapping("planUpload")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
@ApiOperation("监督计划问题附件上传")
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file,
@RequestParam("planId") String planId,
@RequestParam("type") Integer type,
@RequestParam("uploaderId") String uploaderId,
@RequestParam("uploaderName") String uploaderName,
@RequestParam("attachmentType")String attachmentType,
@RequestParam("uploadTime")String uploadTime
){
@RequestParam("attachmentType") String attachmentType,
@RequestParam("uploadTime") String uploadTime
) {
String methodDescribe = getMethodDescribe("planUpload");
if(!StrUtil.isAllNotBlank(planId,uploaderId,uploaderName,attachmentType,uploadTime)||type==null){
throw new BusinessException("必填字段不能为空");
String originalFilename = file.getOriginalFilename();
if (FileUtil.judgeFileIsWord(originalFilename) || FileUtil.judgeFileIsPdf(originalFilename) || FileUtil.judgeFileIsExcel(originalFilename)) {
if (!StrUtil.isAllNotBlank(planId, uploaderId, uploaderName, attachmentType, uploadTime) || type == null) {
throw new BusinessException("必填字段不能为空");
}
iSupvFileService.planUpload(file, planId, type, uploaderId, uploaderName, attachmentType, uploadTime);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
iSupvFileService.planUpload(file,planId,type,uploaderId,uploaderName,attachmentType,uploadTime);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FILE_NAME_ERROR, null, methodDescribe);
}
@PostMapping("list")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询附件信息集合")
@ApiImplicitParam(name = "param",value = "请求体",required = true)
public HttpResult<List<SupvFile>> pageAlarm(@RequestBody SupvFileParam param){
@ApiImplicitParam(name = "param", value = "请求体", required = true)
public HttpResult<List<SupvFile>> pageAlarm(@RequestBody SupvFileParam param) {
String methodDescribe = getMethodDescribe("pageAlarm");
List<SupvFile> supvFiles = iSupvFileService.listFile(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supvFiles, methodDescribe);
}
@PostMapping("detail")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DOWNLOAD)
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
@ApiOperation("监督计划问题附件下载")
public HttpResult<Object> detail(HttpServletResponse response, @RequestParam("busId") String busId, @RequestParam("type") Integer type,@RequestParam("attachmentType") String attachmentType){
public HttpResult<Object> detail(HttpServletResponse response, @RequestParam("busId") String busId, @RequestParam("type") Integer type, @RequestParam("attachmentType") String attachmentType) {
String methodDescribe = getMethodDescribe("detail");
iSupvFileService.detail(response,busId,type,attachmentType);
iSupvFileService.detail(response, busId, type, attachmentType);
return null;
}
}

View File

@@ -16,8 +16,8 @@ public class SensitiveReportExcel implements Serializable {
/**
* 对应用户名称
*/
@Excel(name = "*工程名称", width = 30)
@NotBlank(message = "工程名称不能为空")
@Excel(name = "*项目名称", width = 30)
@NotBlank(message = "项目名称不能为空")
private String projectName;
@Excel(name = "*用户性质", width = 30, replace = {"新建电网工程_0", "扩建电网工程_1", "新建非线性负荷用户_2", "扩建非线性负荷用户_3", "新建新能源发电站_4", "扩建新能源发电站_5", "_null"})

View File

@@ -15,8 +15,8 @@ public class SensitiveUserSExcel implements Serializable {
/**
* 对应用户名称
*/
@Excel(name = "*工程名称", width = 30)
@NotBlank(message = "工程名称不能为空")
@Excel(name = "*项目名称", width = 30)
@NotBlank(message = "项目名称不能为空")
private String projectName;
@Excel(name = "*所属地市", width = 30)

View File

@@ -265,10 +265,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
if(Objects.nonNull(data)){
name = data.getName();
}
String sign = "监督类型为:".concat(name)
.concat(",由")
.concat(surveyPlanVO.getDeptName())
.concat("负责")
String sign = name.concat("->")
.concat(surveyPlanVO.getPlanName());
bpmInstanceInfo.setInstanceSign(sign);
return bpmInstanceInfo;

View File

@@ -301,8 +301,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
if(Objects.nonNull(data)){
name = data.getName();
}
String sign = "监督类型为:".concat(name)
.concat("")
String sign = name.concat("")
.concat(surveyTestVO.getDeptName())
.concat("负责")
.concat(surveyTestVO.getPlanName())

View File

@@ -111,8 +111,7 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
QueryWrapper<UserLog> queryWrapper = new QueryWrapper<>();
queryWrapper
.between("sys_user_log.create_time", DateUtil.beginOfDay(DateUtil.parse(auditParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(auditParam.getSearchEndTime())))
.ne("sys_user_log.login_name", UNKNOWN_USER);
DateUtil.endOfDay(DateUtil.parse(auditParam.getSearchEndTime())));
if (StrUtil.isNotBlank(auditParam.getLoginName())) {
queryWrapper.eq("sys_user_log.login_name", auditParam.getLoginName());
}

View File

@@ -25,22 +25,13 @@ public class UploadGwTaskSubstationRunner implements TimerTaskRunner {
@Override
public void action(String date) {
UploadParam param = new UploadParam();
/*param.setTime(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
String code = uploadGwDataFeignClient.uploadSubstationStatisticalData(param).getCode();
if(code.equals("A0002")){
throw new BusinessException("失败");
}
*/
param.setTime(DateUtil.yesterday().toString(DatePattern.NORM_MONTH_PATTERN));
String codeM = uploadGwDataFeignClient.uploadSubstationStatisticalData(param).getCode();
if(codeM.equals("A0002")){
throw new BusinessException("失败");
}
uploadGwDataFeignClient.uploadSubstationStatisticalData(param);
//年
param.setTime(DateUtil.yesterday().toString(DatePattern.NORM_YEAR_PATTERN));
String code2 = uploadGwDataFeignClient.uploadSubstationStatisticalData(param).getCode();
if(code2.equals("A0002")){
throw new BusinessException("失败");
}
uploadGwDataFeignClient.uploadSubstationStatisticalData(param);
}
}

View File

@@ -55,10 +55,10 @@ public class PassWordRuleController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("获取密码规则")
@ApiOperation("获取用户策略")
@RequestMapping(value = "/getUserStrategy", method = RequestMethod.POST)
public HttpResult<UserStrategy> getUserStrategy() {
String methodDescribe = getMethodDescribe("getRule");
String methodDescribe = getMethodDescribe("getUserStrategy");
UserStrategy userStrategy = passWordRuleService.getUserStrategy();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userStrategy, methodDescribe);