1.灿能云代码调整
This commit is contained in:
@@ -148,7 +148,7 @@ public class EventDetailController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点集合获取短时终端,电压暂升,电压暂降
|
||||
* 根据暂态id集合获取暂降列表
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -161,12 +161,12 @@ public class EventDetailController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点集合获取短时终端,电压暂升,电压暂降
|
||||
* 根据监测点id集合,统计时间范围内暂态超标次数(灿能云)
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventDetailByLineCount")
|
||||
@ApiOperation("根据暂态id集合获取暂降列表")
|
||||
@ApiOperation("根据监测点id集合,统计时间范围内暂态超标次数")
|
||||
public HttpResult<Integer> getEventDetailByLineCount(@RequestBody EventCountParam param) {
|
||||
String methodDescribe = getMethodDescribe("getEventDetailByLineCount");
|
||||
int count = eventDetailService.count(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
@@ -176,4 +176,22 @@ public class EventDetailController extends BaseController {
|
||||
);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@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)
|
||||
@PostMapping("/getLineExport")
|
||||
@ApiOperation("监测点报告导出")
|
||||
|
||||
@@ -68,9 +68,10 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
|
||||
@Override
|
||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType) {
|
||||
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)))
|
||||
.le(StrUtil.isNotBlank(endTime), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
|
||||
.orderByDesc(RmpEventDetailPO::getStartTime)
|
||||
);
|
||||
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.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.FileUtil;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
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.ReportService;
|
||||
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.system.api.DicDataFeignClient;
|
||||
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.util.Units;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
@@ -118,6 +123,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
private final EventDetailMapper eventDetailMapper;
|
||||
private final ReportMapper reportMapper;
|
||||
private final DrawPicUtil drawPicUtil;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam, String id) {
|
||||
List<EventDetail> info = new ArrayList<>();
|
||||
@@ -637,6 +643,18 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
@Override
|
||||
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);
|
||||
//电压暂态统计数据
|
||||
@@ -859,7 +877,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
drawingPatriarch.createPicture(anchor1, addPicture(str2, sheets));
|
||||
drawingPatriarch.createPicture(anchor2, addPicture(str3, sheets));
|
||||
drawingPatriarch.createPicture(anchor3, addPicture(str4, sheets));
|
||||
PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response);
|
||||
return sheets;
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
|
||||
@@ -64,4 +64,13 @@ public interface ReportService {
|
||||
* @param response
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user