1.灿能云代码调整
This commit is contained in:
@@ -59,8 +59,14 @@ public interface EventDetailFeignClient {
|
|||||||
HttpResult<List<RmpEventDetailPO>> getEventDetailByIdsList(@RequestBody List<String> ids);
|
HttpResult<List<RmpEventDetailPO>> getEventDetailByIdsList(@RequestBody List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据监测点id集合获取暂降列表
|
* 根据监测点id集合,统计时间范围内暂态超标次数
|
||||||
*/
|
*/
|
||||||
@PostMapping("/getEventDetailByLineCount")
|
@PostMapping("/getEventDetailByLineCount")
|
||||||
HttpResult<Integer> getEventDetailByLineCount(@RequestBody EventCountParam param);
|
HttpResult<Integer> getEventDetailByLineCount(@RequestBody EventCountParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getAppEventDetailLtAmplitude")
|
||||||
|
HttpResult<List<RmpEventDetailPO>> getAppEventDetailLtAmplitude(@RequestBody EventCountParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.event.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.event.api.fallback.ReportFeignClientFallbackFactory;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2024/1/3 10:02
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.EVENT, path = "/report", fallbackFactory = ReportFeignClientFallbackFactory.class)
|
||||||
|
public interface ReportFeignClient {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 灿能云获取暂态报告
|
||||||
|
* @param businessParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/appEventExport")
|
||||||
|
HttpResult<String> appEventExport(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam);
|
||||||
|
}
|
||||||
@@ -66,7 +66,13 @@ public class EventDetailFeignClientFallbackFactory implements FallbackFactory<Ev
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<Integer> getEventDetailByLineCount(EventCountParam param) {
|
public HttpResult<Integer> getEventDetailByLineCount(EventCountParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "根据监测点id集合获取暂降列表", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "根据监测点id集合,统计时间范围内暂态超标次数", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<RmpEventDetailPO>> getAppEventDetailLtAmplitude(EventCountParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.njcn.event.api.fallback;
|
||||||
|
|
||||||
|
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.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.event.api.ReportFeignClient;
|
||||||
|
import com.njcn.event.utils.EventlEnumUtil;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2024/1/3 10:02
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class ReportFeignClientFallbackFactory implements FallbackFactory<ReportFeignClient> {
|
||||||
|
@Override
|
||||||
|
public ReportFeignClient create(Throwable throwable) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (throwable.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||||
|
exceptionEnum = EventlEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new ReportFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> appEventExport(DeviceInfoParam.BusinessParam businessParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "暂态报告导出", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -148,7 +148,7 @@ public class EventDetailController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据监测点集合获取短时终端,电压暂升,电压暂降
|
* 根据暂态id集合获取暂降列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -161,12 +161,12 @@ public class EventDetailController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据监测点集合获取短时终端,电压暂升,电压暂降
|
* 根据监测点id集合,统计时间范围内暂态超标次数(灿能云)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getEventDetailByLineCount")
|
@PostMapping("/getEventDetailByLineCount")
|
||||||
@ApiOperation("根据暂态id集合获取暂降列表")
|
@ApiOperation("根据监测点id集合,统计时间范围内暂态超标次数")
|
||||||
public HttpResult<Integer> getEventDetailByLineCount(@RequestBody EventCountParam param) {
|
public HttpResult<Integer> getEventDetailByLineCount(@RequestBody EventCountParam param) {
|
||||||
String methodDescribe = getMethodDescribe("getEventDetailByLineCount");
|
String methodDescribe = getMethodDescribe("getEventDetailByLineCount");
|
||||||
int count = eventDetailService.count(new LambdaQueryWrapper<RmpEventDetailPO>()
|
int count = eventDetailService.count(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||||
@@ -176,4 +176,22 @@ public class EventDetailController extends BaseController {
|
|||||||
);
|
);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, count, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, count, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息(灿能云)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getAppEventDetailLtAmplitude")
|
||||||
|
@ApiOperation("根据监测点id集合,统计时间范围内特征增幅小于0.9的暂态信息")
|
||||||
|
public HttpResult<List<RmpEventDetailPO>> getAppEventDetailLtAmplitude(@RequestBody EventCountParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getAppEventDetailLtAmplitude");
|
||||||
|
List<RmpEventDetailPO> list = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||||
|
.in(CollUtil.isNotEmpty(param.getIds()), RmpEventDetailPO::getLineId, param.getIds())
|
||||||
|
.ge(StrUtil.isNotBlank(param.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||||
|
.le(StrUtil.isNotBlank(param.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||||
|
.lt(RmpEventDetailPO::getFeatureAmplitude,0.9)
|
||||||
|
);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,18 @@ public class ReportController extends BaseController {
|
|||||||
reportService.getExport(businessParam, response);
|
reportService.getExport(businessParam, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/appEventExport")
|
||||||
|
@ApiOperation("灿能云暂态报告导出")
|
||||||
|
@ApiImplicitParam(name = "businessParam", value = "灿能云暂态导出参数", required = true)
|
||||||
|
public HttpResult<String> appEventExport(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException {
|
||||||
|
String methodDescribe = getMethodDescribe("appEventExport");
|
||||||
|
String path = reportService.appEventExport(businessParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, path, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineExport")
|
@PostMapping("/getLineExport")
|
||||||
@ApiOperation("监测点报告导出")
|
@ApiOperation("监测点报告导出")
|
||||||
|
|||||||
@@ -68,9 +68,10 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
|
|||||||
@Override
|
@Override
|
||||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType) {
|
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType) {
|
||||||
List<RmpEventDetailPO> info = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
List<RmpEventDetailPO> info = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||||
.ne(RmpEventDetailPO::getMeasurementPointId, lineIndexes)
|
.in(RmpEventDetailPO::getMeasurementPointId, lineIndexes)
|
||||||
.ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime)))
|
.ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime)))
|
||||||
.le(StrUtil.isNotBlank(endTime), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
|
.le(StrUtil.isNotBlank(endTime), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
|
||||||
|
.orderByDesc(RmpEventDetailPO::getStartTime)
|
||||||
);
|
);
|
||||||
return BeanUtil.copyToList(info, EventDetail.class);
|
return BeanUtil.copyToList(info, EventDetail.class);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.njcn.common.pojo.dto.SimpleDTO;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.FileUtil;
|
||||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||||
import com.njcn.device.pms.api.MonitorClient;
|
import com.njcn.device.pms.api.MonitorClient;
|
||||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||||
@@ -48,6 +49,8 @@ import com.njcn.event.service.majornetwork.EventDetailService;
|
|||||||
import com.njcn.event.service.majornetwork.EventReportService;
|
import com.njcn.event.service.majornetwork.EventReportService;
|
||||||
import com.njcn.event.service.majornetwork.ReportService;
|
import com.njcn.event.service.majornetwork.ReportService;
|
||||||
import com.njcn.event.utils.WordUtils;
|
import com.njcn.event.utils.WordUtils;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
@@ -86,8 +89,10 @@ import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.util.Units;
|
import org.apache.poi.util.Units;
|
||||||
import org.apache.poi.xwpf.usermodel.*;
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.core.io.InputStreamResource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import sun.misc.BASE64Decoder;
|
import sun.misc.BASE64Decoder;
|
||||||
|
|
||||||
@@ -118,6 +123,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
private final EventDetailMapper eventDetailMapper;
|
private final EventDetailMapper eventDetailMapper;
|
||||||
private final ReportMapper reportMapper;
|
private final ReportMapper reportMapper;
|
||||||
private final DrawPicUtil drawPicUtil;
|
private final DrawPicUtil drawPicUtil;
|
||||||
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam, String id) {
|
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam, String id) {
|
||||||
List<EventDetail> info = new ArrayList<>();
|
List<EventDetail> info = new ArrayList<>();
|
||||||
@@ -637,6 +643,18 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getExport(DeviceInfoParam.BusinessParam businessParam, HttpServletResponse response) throws IOException, TemplateException {
|
public void getExport(DeviceInfoParam.BusinessParam businessParam, HttpServletResponse response) throws IOException, TemplateException {
|
||||||
|
HSSFWorkbook sheets = getSheets(businessParam);
|
||||||
|
PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成暂态报告xlsx
|
||||||
|
* @param businessParam
|
||||||
|
* @return
|
||||||
|
* @throws TemplateException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private HSSFWorkbook getSheets(DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException {
|
||||||
//区域暂态统计数据
|
//区域暂态统计数据
|
||||||
List<GeneralVO> GereralList = getGeneralSituation(businessParam);
|
List<GeneralVO> GereralList = getGeneralSituation(businessParam);
|
||||||
//电压暂态统计数据
|
//电压暂态统计数据
|
||||||
@@ -859,7 +877,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
drawingPatriarch.createPicture(anchor1, addPicture(str2, sheets));
|
drawingPatriarch.createPicture(anchor1, addPicture(str2, sheets));
|
||||||
drawingPatriarch.createPicture(anchor2, addPicture(str3, sheets));
|
drawingPatriarch.createPicture(anchor2, addPicture(str3, sheets));
|
||||||
drawingPatriarch.createPicture(anchor3, addPicture(str4, sheets));
|
drawingPatriarch.createPicture(anchor3, addPicture(str4, sheets));
|
||||||
PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response);
|
return sheets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer addPicture(String str, HSSFWorkbook sheets) throws IOException {
|
public Integer addPicture(String str, HSSFWorkbook sheets) throws IOException {
|
||||||
@@ -7977,6 +7995,21 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String appEventExport(DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException {
|
||||||
|
//临时缓冲区
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
HSSFWorkbook workbook = this.getSheets(businessParam);
|
||||||
|
//创建临时文件
|
||||||
|
workbook.write(out);
|
||||||
|
byte[] bookByteAry = out.toByteArray();
|
||||||
|
InputStream in = new ByteArrayInputStream(bookByteAry);
|
||||||
|
String xlsx = fileStorageUtil.uploadStream(in, OssPath.RESPONSIBILITY_APP_REPORT, FileUtil.generateFileName("xlsx"));
|
||||||
|
workbook.close();
|
||||||
|
in.close();
|
||||||
|
return xlsx;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* zbj
|
* zbj
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -64,4 +64,13 @@ public interface ReportService {
|
|||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
void getPmsAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception;
|
void getPmsAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 灿能云暂态报告
|
||||||
|
* @param businessParam
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/1/3 11:46
|
||||||
|
*/
|
||||||
|
String appEventExport(DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.harmonic.controller;
|
package com.njcn.harmonic.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
@@ -109,8 +110,8 @@ public class HistoryResultController extends BaseController {
|
|||||||
List<RStatLimitRateDPO> list = limitRateDService.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
List<RStatLimitRateDPO> list = limitRateDService.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||||
.in(RStatLimitRateDPO::getLineId, param.getIds())
|
.in(RStatLimitRateDPO::getLineId, param.getIds())
|
||||||
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
||||||
.ge(RStatLimitRateDPO::getTime, param.getStartTime())
|
.ge(StrUtil.isNotBlank(param.getStartTime()),RStatLimitRateDPO::getTime, param.getStartTime())
|
||||||
.le(RStatLimitRateDPO::getTime, param.getEndTime())
|
.le(StrUtil.isNotBlank(param.getEndTime()),RStatLimitRateDPO::getTime, param.getEndTime())
|
||||||
|
|
||||||
);
|
);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
|||||||
Reference in New Issue
Block a user