解决文件冲突代码

This commit is contained in:
wr
2023-06-01 20:01:48 +08:00
parent 0d71c056b2
commit 1db8791c6b
5 changed files with 272 additions and 6 deletions

View File

@@ -22,4 +22,5 @@ public interface ReportMapper {
Page<DetailVO> getUpTimes(Page<DetailVO> page, @Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("dictdata") String dictdata);
Page<DetailVO> getSagTimes(Page<DetailVO> page, @Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("dictdata") String dictdata);
List<DetailVO> getListCount( @Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("dictdata") String dictdata);
}

View File

@@ -61,5 +61,24 @@
and rmed.event_type = #{dictdata}
GROUP BY rmed.measurement_point_id
</select>
<select id="getListCount" resultType="com.njcn.event.pojo.vo.DetailVO">
SELECT
rmed.measurement_point_id lineId,
count(*) times
FROM r_mp_event_detail rmed
WHERE
rmed.measurement_point_id IN
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
and date_format(rmed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''">
and date_format(rmed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
and rmed.event_type = #{dictdata}
GROUP BY rmed.measurement_point_id
</select>
</mapper>

View File

@@ -890,6 +890,9 @@ public class ReportServiceImpl implements ReportService {
sheet2(sheets,cellStyle,bodyStyle,businessParam);
sheet3(sheets,cellStyle,bodyStyle,businessParam);
sheet4(sheets,cellStyle,bodyStyle,businessParam);
sheet5(sheets,cellStyle,bodyStyle,businessParam);
sheet6(sheets,cellStyle,bodyStyle,businessParam);
sheet7(sheets,cellStyle,bodyStyle,businessParam);
ArrayList<Integer> online = new ArrayList<>();
@@ -907,7 +910,7 @@ public class ReportServiceImpl implements ReportService {
List<Integer> up2 = new ArrayList<>();
List<Integer> sag2 = new ArrayList<>();
List<Integer> break2 = new ArrayList<>();
/*
for (int i = 0; i < GereralList.size(); i++) {
GeneralVO vo = GereralList.get(i);
@@ -1072,7 +1075,6 @@ public class ReportServiceImpl implements ReportService {
drawingPatriarch.createPicture(anchor1, sheets.addPicture(bytes2, HSSFWorkbook.PICTURE_TYPE_JPEG));
drawingPatriarch.createPicture(anchor2, sheets.addPicture(bytes3, HSSFWorkbook.PICTURE_TYPE_JPEG));
drawingPatriarch.createPicture(anchor3, sheets.addPicture(bytes4, HSSFWorkbook.PICTURE_TYPE_JPEG));
*/
PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response);
}
public void sheet2(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){
@@ -1166,7 +1168,7 @@ public class ReportServiceImpl implements ReportService {
}
}
public void sheet3(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){
public void sheet3(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException {
sheets.createSheet("暂态原因统计");
HSSFSheet sheetAt = sheets.getSheetAt(2);
sheetAt.setColumnWidth(0, 40 * 256);
@@ -1255,7 +1257,21 @@ public class ReportServiceImpl implements ReportService {
cellR1.setCellValue(reasonsVO.getRate());
}
}
//todo 缺少eaches
HSSFPatriarch drawingPatriarch = sheetAt.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 10, 10, 6, (short) 0.5, (short) 6, (short) 6, (short) 36);
List<String> xdata = new ArrayList<>();
for (ReasonsVO reasonsVO : reason) {
xdata.add(reasonsVO.getReason());
}
String tr = getR(xdata, reason, "bar9.ftl");
BASE64Decoder decoder = new BASE64Decoder();
byte[] bytes = decoder.decodeBuffer(tr);
drawingPatriarch.createPicture(anchor, sheets.addPicture(bytes, HSSFWorkbook.PICTURE_TYPE_JPEG));
}
public void sheet4(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){
sheets.createSheet("详细事件列表");
@@ -1351,6 +1367,235 @@ public class ReportServiceImpl implements ReportService {
}
}
public void sheet5(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){
sheets.createSheet("暂降次数统计");
HSSFSheet sheetAt = sheets.getSheetAt(4);
sheetAt.setColumnWidth(0, 9 * 256);
sheetAt.setColumnWidth(1, 24 * 256);
sheetAt.setColumnWidth(2, 24 * 256);
sheetAt.setColumnWidth(3, 24 * 256);
sheetAt.setColumnWidth(4, 24 * 256);
sheetAt.setColumnWidth(5, 24 * 256);
sheetAt.setColumnWidth(6, 24 * 256);
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 6, 6));
HSSFRow row1 = sheetAt.createRow(0);
HSSFCell r1Cell0 = row1.createCell(0);
HSSFCell r1Cell1 = row1.createCell(1);
HSSFCell r1Cell2 = row1.createCell(2);
HSSFCell r1Cell3 = row1.createCell(3);
HSSFCell r1Cell4 = row1.createCell(4);
HSSFCell r1Cell5 = row1.createCell(5);
HSSFCell r1Cell6 = row1.createCell(6);
setCellStyle(r1Cell0, "序号", cellStyle);
setCellStyle(r1Cell1, "监测点", cellStyle);
setCellStyle(r1Cell2, "干扰源类型", cellStyle);
setCellStyle(r1Cell3, "监测点对象名称", cellStyle);
setCellStyle(r1Cell4, "变电站", cellStyle);
setCellStyle(r1Cell5, "供电公司", cellStyle);
setCellStyle(r1Cell6, "暂降次数", cellStyle);
DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
List<DetailVO> severity = sheetList(businessParam,dictdata.getId());
for (int i = 0; i < severity.size(); i++) {
DetailVO vo = severity.get(i);
HSSFRow row = sheetAt.createRow(i + 2);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
HSSFCell cell6 = row.createCell(6);
cell0.setCellStyle(bodyStyle);
cell1.setCellStyle(bodyStyle);
cell2.setCellStyle(bodyStyle);
cell3.setCellStyle(bodyStyle);
cell4.setCellStyle(bodyStyle);
cell5.setCellStyle(bodyStyle);
cell6.setCellStyle(bodyStyle);
cell0.setCellValue(i+1);
cell1.setCellValue(vo.getLineName());
cell2.setCellValue(vo.getLoadType());
cell3.setCellValue(vo.getObjName());
cell4.setCellValue(vo.getSubName());
cell5.setCellValue(vo.getGdName());
cell6.setCellValue(vo.getTimes());
}
}
public void sheet6(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){
sheets.createSheet("暂升次数统计");
HSSFSheet sheetAt = sheets.getSheetAt(5);
sheetAt.setColumnWidth(0, 9 * 256);
sheetAt.setColumnWidth(1, 24 * 256);
sheetAt.setColumnWidth(2, 24 * 256);
sheetAt.setColumnWidth(3, 24 * 256);
sheetAt.setColumnWidth(4, 24 * 256);
sheetAt.setColumnWidth(5, 24 * 256);
sheetAt.setColumnWidth(6, 24 * 256);
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 6, 6));
HSSFRow row1 = sheetAt.createRow(0);
HSSFCell r1Cell0 = row1.createCell(0);
HSSFCell r1Cell1 = row1.createCell(1);
HSSFCell r1Cell2 = row1.createCell(2);
HSSFCell r1Cell3 = row1.createCell(3);
HSSFCell r1Cell4 = row1.createCell(4);
HSSFCell r1Cell5 = row1.createCell(5);
HSSFCell r1Cell6 = row1.createCell(6);
setCellStyle(r1Cell0, "序号", cellStyle);
setCellStyle(r1Cell1, "监测点", cellStyle);
setCellStyle(r1Cell2, "干扰源类型", cellStyle);
setCellStyle(r1Cell3, "监测点对象名称", cellStyle);
setCellStyle(r1Cell4, "变电站", cellStyle);
setCellStyle(r1Cell5, "供电公司", cellStyle);
setCellStyle(r1Cell6, "暂升次数", cellStyle);
DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
List<DetailVO> severity = sheetList(businessParam,dictdata.getId());
for (int i = 0; i < severity.size(); i++) {
DetailVO vo = severity.get(i);
HSSFRow row = sheetAt.createRow(i + 2);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
HSSFCell cell6 = row.createCell(6);
cell0.setCellStyle(bodyStyle);
cell1.setCellStyle(bodyStyle);
cell2.setCellStyle(bodyStyle);
cell3.setCellStyle(bodyStyle);
cell4.setCellStyle(bodyStyle);
cell5.setCellStyle(bodyStyle);
cell6.setCellStyle(bodyStyle);
cell0.setCellValue(i+1);
cell1.setCellValue(vo.getLineName());
cell2.setCellValue(vo.getLoadType());
cell3.setCellValue(vo.getObjName());
cell4.setCellValue(vo.getSubName());
cell5.setCellValue(vo.getGdName());
cell6.setCellValue(vo.getTimes());
}
}
public void sheet7(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){
sheets.createSheet("短时中断次数统计");
HSSFSheet sheetAt = sheets.getSheetAt(6);
sheetAt.setColumnWidth(0, 9 * 256);
sheetAt.setColumnWidth(1, 24 * 256);
sheetAt.setColumnWidth(2, 24 * 256);
sheetAt.setColumnWidth(3, 24 * 256);
sheetAt.setColumnWidth(4, 24 * 256);
sheetAt.setColumnWidth(5, 24 * 256);
sheetAt.setColumnWidth(6, 24 * 256);
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 6, 6));
HSSFRow row1 = sheetAt.createRow(0);
HSSFCell r1Cell0 = row1.createCell(0);
HSSFCell r1Cell1 = row1.createCell(1);
HSSFCell r1Cell2 = row1.createCell(2);
HSSFCell r1Cell3 = row1.createCell(3);
HSSFCell r1Cell4 = row1.createCell(4);
HSSFCell r1Cell5 = row1.createCell(5);
HSSFCell r1Cell6 = row1.createCell(6);
setCellStyle(r1Cell0, "序号", cellStyle);
setCellStyle(r1Cell1, "监测点", cellStyle);
setCellStyle(r1Cell2, "干扰源类型", cellStyle);
setCellStyle(r1Cell3, "监测点对象名称", cellStyle);
setCellStyle(r1Cell4, "变电站", cellStyle);
setCellStyle(r1Cell5, "供电公司", cellStyle);
setCellStyle(r1Cell6, "短时中断次数", cellStyle);
DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
List<DetailVO> severity = sheetList(businessParam,dictdata.getId());
for (int i = 0; i < severity.size(); i++) {
DetailVO vo = severity.get(i);
HSSFRow row = sheetAt.createRow(i + 2);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
HSSFCell cell6 = row.createCell(6);
cell0.setCellStyle(bodyStyle);
cell1.setCellStyle(bodyStyle);
cell2.setCellStyle(bodyStyle);
cell3.setCellStyle(bodyStyle);
cell4.setCellStyle(bodyStyle);
cell5.setCellStyle(bodyStyle);
cell6.setCellStyle(bodyStyle);
cell0.setCellValue(i+1);
cell1.setCellValue(vo.getLineName());
cell2.setCellValue(vo.getLoadType());
cell3.setCellValue(vo.getObjName());
cell4.setCellValue(vo.getSubName());
cell5.setCellValue(vo.getGdName());
cell6.setCellValue(vo.getTimes());
}
}
private List<DetailVO> sheetList(DeviceInfoParam.BusinessParam businessParam,String id){
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
List<String> lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
if (CollectionUtil.isEmpty(lineIds)) {
throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY);
}
List<DetailVO> listCount = reportMapper.getListCount(lineIds, businessParam.getSearchBeginTime(), businessParam.getSearchEndTime(), id);
ArrayList<String> idlist = new ArrayList<>();
for (DetailVO vo : listCount) {
idlist.add(vo.getLineId());
}
if(CollUtil.isNotEmpty(idlist)){
HttpResult<List<AreaLineInfoVO>> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist);
List<AreaLineInfoVO> data = AreaInfo.getData();
for (DetailVO v : listCount) {
for (AreaLineInfoVO vo : data) {
if (vo.getLineId().equals(v.getLineId())) {
BeanUtils.copyProperties(vo, v);
}
}
}
}
return listCount;
}
/**
* sheet 详细数据列表
*/

View File

@@ -19,7 +19,8 @@ radius: '70%',
center: ['50%', '60%'],
label: {
normal: {
show: false
show: true,
formatter: '{d}%'
},
emphasis: {
show: true

View File

@@ -19,7 +19,7 @@ radius: '70%',
center: ['50%', '53%'],
label: {
normal: {
show: false
formatter: '{d}%'
},
emphasis: {
show: true