日均水位年报表
parent
4880a89d41
commit
3fdbb55f86
|
|
@ -3,10 +3,7 @@ package com.gunshi.project.xyt.controller;
|
|||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.db.dto.DateRangeSo;
|
||||
import com.gunshi.project.xyt.entity.so.StatisticsQuerySo;
|
||||
import com.gunshi.project.xyt.entity.vo.RjyNbStatVo;
|
||||
import com.gunshi.project.xyt.entity.vo.RjyNbVo;
|
||||
import com.gunshi.project.xyt.entity.vo.SdJyRbVo;
|
||||
import com.gunshi.project.xyt.entity.vo.SdSwRbVo;
|
||||
import com.gunshi.project.xyt.entity.vo.*;
|
||||
import com.gunshi.project.xyt.service.StatisticsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
|
@ -60,7 +57,7 @@ public class StatisticsController{
|
|||
@Operation(summary = "日降雨年报表(上方表格)")
|
||||
@PostMapping("/rjyNb")
|
||||
public R<List<RjyNbVo>> rjyNb(@Validated @RequestBody StatisticsQuerySo statisticsQuerySo) {
|
||||
return R.ok(service.rjyNb(statisticsQuerySo));
|
||||
return R.ok(service.rjyNb(statisticsQuerySo,null));
|
||||
}
|
||||
|
||||
@Operation(summary = "日降雨年报表(下方统计)")
|
||||
|
|
@ -75,4 +72,22 @@ public class StatisticsController{
|
|||
service.rjyNbExport(statisticsQuerySo,response);
|
||||
}
|
||||
|
||||
@Operation(summary = "日均水位年报表(上方表格)")
|
||||
@PostMapping("/rjswNb")
|
||||
public R<List<RjyNbVo>> rjswNb(@Validated @RequestBody StatisticsQuerySo statisticsQuerySo) {
|
||||
return R.ok(service.rjswNb(statisticsQuerySo));
|
||||
}
|
||||
|
||||
@Operation(summary = "日均水位年报表(下方统计)")
|
||||
@PostMapping("/rjswNb/stat")
|
||||
public R<RjswNbStatVo> rjswNbStat(@Validated @RequestBody StatisticsQuerySo statisticsQuerySo) {
|
||||
return R.ok(service.rjswNbStat(statisticsQuerySo));
|
||||
}
|
||||
|
||||
@Operation(summary = "日均水位年报表导出")
|
||||
@PostMapping("/rjswNb/export")
|
||||
public void rjswNbExport(@Validated @RequestBody StatisticsQuerySo statisticsQuerySo, HttpServletResponse response) {
|
||||
service.rjswNbExport(statisticsQuerySo,response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NbStatVo {
|
||||
|
||||
@Schema(description="月份")
|
||||
private String month;
|
||||
|
||||
@Schema(description="最高")
|
||||
private String max;
|
||||
|
||||
@Schema(description="最高日期")
|
||||
private String maxDate;
|
||||
|
||||
@Schema(description="最低")
|
||||
private String min;
|
||||
|
||||
@Schema(description="最低日期")
|
||||
private String minDate;
|
||||
|
||||
@Schema(description="平均")
|
||||
private String avg;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RjswNbStatVo {
|
||||
|
||||
@Schema(description="最高水位")
|
||||
private BigDecimal max;
|
||||
|
||||
@Schema(description="最低水位")
|
||||
private BigDecimal min;
|
||||
|
||||
@Schema(description="平均水位")
|
||||
private BigDecimal avg;
|
||||
|
||||
@Schema(description = "统计数据")
|
||||
private List<RjswNbVo> list;
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RjswNbVo{
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","日期"})
|
||||
@ColumnWidth(15)
|
||||
private String theme;
|
||||
|
||||
@ExcelProperty({"${title}","日期"})
|
||||
@ColumnWidth(15)
|
||||
private String date;
|
||||
|
||||
@ExcelProperty({"${title}","一月"})
|
||||
private String drpM1;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","二月"})
|
||||
private String drpM2;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","三月"})
|
||||
private String drpM3;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","四月"})
|
||||
private String drpM4;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","五月"})
|
||||
private String drpM5;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","六月"})
|
||||
private String drpM6;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","七月"})
|
||||
private String drpM7;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","八月"})
|
||||
private String drpM8;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","九月"})
|
||||
private String drpM9;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","十月"})
|
||||
private String drpM10;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","十一月"})
|
||||
private String drpM11;
|
||||
|
||||
|
||||
@ExcelProperty({"${title}","十二月"})
|
||||
private String drpM12;
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -8,7 +7,6 @@ import java.math.BigDecimal;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RjyNbStatVo {
|
||||
|
||||
@Schema(description="降水量")
|
||||
|
|
|
|||
|
|
@ -26,4 +26,6 @@ public interface StPptnRHMapper extends BaseMapper<StPptnRH> {
|
|||
List<StPptnRH> reorganizePptnRHData(@Param("stcd") String stcd, @Param("maxData") StPptnRH maxData);
|
||||
|
||||
StPptnRH getMaxData(String stcd);
|
||||
|
||||
List<StPptnRD> queryDayRz(@Param("year") String year);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ import com.gunshi.project.xyt.model.StPptnRD;
|
|||
import com.gunshi.project.xyt.model.StPptnRH;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import com.gunshi.project.xyt.util.ExcelUtil;
|
||||
import com.gunshi.project.xyt.util.MyBeanUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -280,10 +282,15 @@ public class StatisticsService {
|
|||
ExcelUtil.exportExcel(list, fileName, SdSwRbVo.class, response, fileName);
|
||||
}
|
||||
|
||||
public List<RjyNbVo> rjyNb(StatisticsQuerySo statisticsQuerySo) {
|
||||
public List<RjyNbVo> rjyNb(StatisticsQuerySo statisticsQuerySo,Integer type) {
|
||||
List<RjyNbVo> res = new ArrayList<>();
|
||||
Integer year = statisticsQuerySo.getYear();
|
||||
List<StPptnRD> list = stPptnRHMapper.queryDayDrp(year);
|
||||
List<StPptnRD> list = new ArrayList<>();
|
||||
if(type != null){
|
||||
list = stPptnRHMapper.queryDayRz(year.toString());
|
||||
}else{
|
||||
list = stPptnRHMapper.queryDayDrp(year);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return res;
|
||||
}
|
||||
|
|
@ -300,7 +307,7 @@ public class StatisticsService {
|
|||
for (int j = 0; j < rds.size(); j++) {
|
||||
StPptnRD rd = rds.get(j);
|
||||
if (rd.getDrp() != null) {
|
||||
vo = setDayDrp(vo, rd.getMonth(), rd.getDrp());
|
||||
vo = setDayDrp(vo, rd.getMonth(), rd.getDrp().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -309,43 +316,43 @@ public class StatisticsService {
|
|||
return res;
|
||||
}
|
||||
|
||||
private RjyNbVo setDayDrp(RjyNbVo vo, String month, BigDecimal drp) {
|
||||
private RjyNbVo setDayDrp(RjyNbVo vo, String month, String drp) {
|
||||
switch (month) {
|
||||
case "01":
|
||||
vo.setDrpM1(drp.toString());
|
||||
vo.setDrpM1(drp);
|
||||
break;
|
||||
case "02":
|
||||
vo.setDrpM2(drp.toString());
|
||||
vo.setDrpM2(drp);
|
||||
break;
|
||||
case "03":
|
||||
vo.setDrpM3(drp.toString());
|
||||
vo.setDrpM3(drp);
|
||||
break;
|
||||
case "04":
|
||||
vo.setDrpM4(drp.toString());
|
||||
vo.setDrpM4(drp);
|
||||
break;
|
||||
case "05":
|
||||
vo.setDrpM5(drp.toString());
|
||||
vo.setDrpM5(drp);
|
||||
break;
|
||||
case "06":
|
||||
vo.setDrpM6(drp.toString());
|
||||
vo.setDrpM6(drp);
|
||||
break;
|
||||
case "07":
|
||||
vo.setDrpM7(drp.toString());
|
||||
vo.setDrpM7(drp);
|
||||
break;
|
||||
case "08":
|
||||
vo.setDrpM8(drp.toString());
|
||||
vo.setDrpM8(drp);
|
||||
break;
|
||||
case "09":
|
||||
vo.setDrpM9(drp.toString());
|
||||
vo.setDrpM9(drp);
|
||||
break;
|
||||
case "10":
|
||||
vo.setDrpM10(drp.toString());
|
||||
vo.setDrpM10(drp);
|
||||
break;
|
||||
case "11":
|
||||
vo.setDrpM11(drp.toString());
|
||||
vo.setDrpM11(drp);
|
||||
break;
|
||||
case "12":
|
||||
vo.setDrpM12(drp.toString());
|
||||
vo.setDrpM12(drp);
|
||||
break;
|
||||
}
|
||||
return vo;
|
||||
|
|
@ -394,7 +401,7 @@ public class StatisticsService {
|
|||
List<StPptnRD> list = map.get(s);
|
||||
if(CollectionUtils.isNotEmpty(list)) {
|
||||
BigDecimal maxDrp = list.stream().max(Comparator.comparing(StPptnRD::getDrp)).get().getDrp();
|
||||
setDayDrp(rjyNbVo, s, maxDrp);
|
||||
setDayDrp(rjyNbVo, s, maxDrp.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -409,7 +416,7 @@ public class StatisticsService {
|
|||
List<StPptnRD> list = map.get(s);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
BigDecimal drpSum = list.stream().map(StPptnRD::getDrp).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
setDayDrp(rjyNbVo,s,drpSum);
|
||||
setDayDrp(rjyNbVo,s,drpSum.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -423,14 +430,14 @@ public class StatisticsService {
|
|||
List<StPptnRD> list = map.get(s);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
Long count = list.stream().filter(o -> o.getDrp().compareTo(new BigDecimal(0)) > 0).collect(Collectors.counting());
|
||||
setDayDrp(rjyNbVo,s,new BigDecimal(count));
|
||||
setDayDrp(rjyNbVo,s,new BigDecimal(count).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rjyNbExport(StatisticsQuerySo statisticsQuerySo, HttpServletResponse response) {
|
||||
//上方数据
|
||||
List<RjyNbVo> rjyNb = rjyNb(statisticsQuerySo);
|
||||
List<RjyNbVo> rjyNb = rjyNb(statisticsQuerySo,null);
|
||||
//下方统计数据
|
||||
RjyNbStatVo vo = rjyNbStat(statisticsQuerySo);
|
||||
List<RjyNbVo> list = vo.getList();
|
||||
|
|
@ -453,7 +460,146 @@ public class StatisticsService {
|
|||
rjyNb.add(rjyNbVo);
|
||||
|
||||
String fileName = "小玉潭水库" + statisticsQuerySo.getYear() + "年日降雨年报表";
|
||||
ExcelUtil.exportExcel(rjyNb, fileName, RjyNbVo.class, response, fileName,true);
|
||||
ExcelUtil.exportExcel(rjyNb, fileName, RjyNbVo.class, response, fileName,1);
|
||||
}
|
||||
|
||||
public List<RjyNbVo> rjswNb(StatisticsQuerySo statisticsQuerySo) {
|
||||
return rjyNb(statisticsQuerySo,1);
|
||||
}
|
||||
|
||||
public RjswNbStatVo rjswNbStat(StatisticsQuerySo statisticsQuerySo) {
|
||||
RjswNbStatVo vo = new RjswNbStatVo();
|
||||
Integer year = statisticsQuerySo.getYear();
|
||||
List<StPptnRD> list = stPptnRHMapper.queryDayRz(year.toString());
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return vo;
|
||||
}
|
||||
BigDecimal max = list.stream().max(Comparator.comparing(StPptnRD::getDrp)).get().getDrp();
|
||||
vo.setMax(max);
|
||||
BigDecimal min = list.stream().min(Comparator.comparing(StPptnRD::getDrp)).get().getDrp();
|
||||
vo.setMin(min);
|
||||
BigDecimal sum = list.stream().map(StPptnRD::getDrp).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||
Long count = list.stream().filter(o -> o.getDrp().compareTo(new BigDecimal(0)) > 0).collect(Collectors.counting());
|
||||
vo.setAvg(sum.divide(new BigDecimal(count),2,RoundingMode.HALF_UP));
|
||||
//按月份分组
|
||||
Map<String, List<StPptnRD>> map = list.stream().collect(Collectors.groupingBy(StPptnRD::getMonth));
|
||||
List<NbStatVo> statVos = statData(map);
|
||||
|
||||
List<RjswNbVo> childList = new ArrayList<>();
|
||||
|
||||
RjswNbVo rjswNbVo = new RjswNbVo();
|
||||
Map<String, String> avgMap = statVos.stream().collect(Collectors.toMap(NbStatVo::getMonth, NbStatVo::getAvg));
|
||||
RjyNbVo rjyNbVo = setDayRz(avgMap);
|
||||
BeanUtils.copyProperties(rjyNbVo,rjswNbVo);
|
||||
rjswNbVo.setTheme("月统计");
|
||||
rjswNbVo.setDate("平均");
|
||||
childList.add(rjswNbVo);
|
||||
|
||||
RjswNbVo rjswNbVoMax = new RjswNbVo();
|
||||
Map<String, String> maxMap = statVos.stream().collect(Collectors.toMap(NbStatVo::getMonth, NbStatVo::getMax));
|
||||
RjyNbVo rjyNbVoMax = setDayRz(maxMap);
|
||||
BeanUtils.copyProperties(rjyNbVoMax,rjswNbVoMax);
|
||||
rjswNbVoMax.setTheme("月统计");
|
||||
rjswNbVoMax.setDate("最高");
|
||||
childList.add(rjswNbVoMax);
|
||||
|
||||
RjswNbVo rjMaxDate = new RjswNbVo();
|
||||
Map<String, String> maxDateMap = statVos.stream().collect(Collectors.toMap(NbStatVo::getMonth, NbStatVo::getMaxDate));
|
||||
RjyNbVo rjyNbVoMaxDate = setDayRz(maxDateMap);
|
||||
BeanUtils.copyProperties(rjyNbVoMaxDate,rjMaxDate);
|
||||
rjMaxDate.setTheme("月统计");
|
||||
rjMaxDate.setDate("日期");
|
||||
childList.add(rjMaxDate);
|
||||
|
||||
RjswNbVo rjswNbVoMin = new RjswNbVo();
|
||||
Map<String, String> minMap = statVos.stream().collect(Collectors.toMap(NbStatVo::getMonth, NbStatVo::getMin));
|
||||
RjyNbVo rjyNbVoMin = setDayRz(minMap);
|
||||
BeanUtils.copyProperties(rjyNbVoMin,rjswNbVoMin);
|
||||
rjswNbVoMin.setTheme("月统计");
|
||||
rjswNbVoMin.setDate("最低");
|
||||
childList.add(rjswNbVoMin);
|
||||
|
||||
RjswNbVo rjMinDate = new RjswNbVo();
|
||||
Map<String, String> minDateMap = statVos.stream().collect(Collectors.toMap(NbStatVo::getMonth, NbStatVo::getMinDate));
|
||||
RjyNbVo rjyNbVoMinDate = setDayRz(minDateMap);
|
||||
BeanUtils.copyProperties(rjyNbVoMinDate,rjMinDate);
|
||||
rjMinDate.setTheme("月统计");
|
||||
rjMinDate.setDate("日期");
|
||||
childList.add(rjMinDate);
|
||||
|
||||
vo.setList(childList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private RjyNbVo setDayRz(Map<String, String> map) {
|
||||
RjyNbVo rjyNbVo = new RjyNbVo();
|
||||
map.entrySet().forEach(entry->{
|
||||
String month = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
setDayDrp(rjyNbVo,month,value);
|
||||
});
|
||||
return rjyNbVo;
|
||||
}
|
||||
|
||||
|
||||
private List<NbStatVo> statData(Map<String, List<StPptnRD>> map) {
|
||||
List<NbStatVo> statVos = new ArrayList<>();
|
||||
for(int i = 1;i< 13;i++){
|
||||
String s = String.valueOf(i);
|
||||
if(i < 10){
|
||||
s = "0" + i;
|
||||
}
|
||||
List<StPptnRD> list = map.get(s);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
NbStatVo vo = new NbStatVo();
|
||||
vo.setMonth(s);
|
||||
StPptnRD max = list.stream().max(Comparator.comparing(StPptnRD::getDrp)).get();
|
||||
vo.setMax(max.getDrp().toString());
|
||||
vo.setMaxDate(max.getDay()+"日");
|
||||
|
||||
StPptnRD min = list.stream().min(Comparator.comparing(StPptnRD::getDrp)).get();
|
||||
vo.setMin(min.getDrp().toString());
|
||||
vo.setMinDate(min.getDay()+"日");
|
||||
|
||||
BigDecimal sum = list.stream().map(StPptnRD::getDrp).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
Long count = list.stream().filter(o -> o.getDrp().compareTo(new BigDecimal(0)) > 0).collect(Collectors.counting());
|
||||
vo.setAvg(sum.divide(new BigDecimal(count),2,RoundingMode.HALF_UP).toString());
|
||||
statVos.add(vo);
|
||||
}
|
||||
}
|
||||
return statVos;
|
||||
}
|
||||
|
||||
public void rjswNbExport(StatisticsQuerySo statisticsQuerySo, HttpServletResponse response) {
|
||||
//上方数据
|
||||
List<RjyNbVo> rjyNbVos = this.rjswNb(statisticsQuerySo);
|
||||
List<RjswNbVo> rjswNbVos = MyBeanUtil.collectionCopy(rjyNbVos, RjswNbVo.class);
|
||||
rjswNbVos.stream().forEach(o->o.setTheme(o.getDate()));
|
||||
//下方统计数据
|
||||
RjswNbStatVo statVo = this.rjswNbStat(statisticsQuerySo);
|
||||
List<RjswNbVo> list = statVo.getList();
|
||||
rjswNbVos.addAll(list);
|
||||
|
||||
//最下方拼接一条数据
|
||||
RjswNbVo rjswNbVo = new RjswNbVo();
|
||||
rjswNbVo.setTheme("年统计");
|
||||
rjswNbVo.setDate("年统计");
|
||||
rjswNbVo.setDrpM1("最高水位");
|
||||
rjswNbVo.setDrpM2(statVo.getMax().toString());
|
||||
rjswNbVo.setDrpM3(statVo.getMax().toString());
|
||||
rjswNbVo.setDrpM4(statVo.getMax().toString());
|
||||
rjswNbVo.setDrpM5("最低水位");
|
||||
rjswNbVo.setDrpM6(statVo.getMin().toString());
|
||||
rjswNbVo.setDrpM7(statVo.getMin().toString());
|
||||
rjswNbVo.setDrpM8(statVo.getMin().toString());
|
||||
rjswNbVo.setDrpM9("平均水位");
|
||||
rjswNbVo.setDrpM10(statVo.getAvg().toString());
|
||||
rjswNbVo.setDrpM11(statVo.getAvg().toString());
|
||||
rjswNbVo.setDrpM12(statVo.getAvg().toString());
|
||||
rjswNbVos.add(rjswNbVo);
|
||||
|
||||
String fileName = "小玉潭水库" + statisticsQuerySo.getYear() + "年日平均水位年报表";
|
||||
ExcelUtil.exportExcel(rjswNbVos, fileName, RjswNbVo.class, response, fileName,2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.alibaba.excel.EasyExcel;
|
|||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
|
||||
import com.alibaba.excel.write.merge.LoopMergeStrategy;
|
||||
import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.gunshi.project.xyt.util.excel.ExcelFillCellMergeStrategy;
|
||||
|
|
@ -63,25 +64,45 @@ public class ExcelUtil {
|
|||
* @param clazz 实体类
|
||||
* @param response 响应体
|
||||
*/
|
||||
public static <T> void exportExcel(List<T> list, String filename, Class<T> clazz, HttpServletResponse response,String sheetName,Boolean isMerge) {
|
||||
public static <T> void exportExcel(List<T> list, String filename, Class<T> clazz, HttpServletResponse response,String sheetName,Integer type) {
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = getOutputStream(filename,response);
|
||||
OnceAbsoluteMergeStrategy strategy = new OnceAbsoluteMergeStrategy(36,36,1,2);
|
||||
OnceAbsoluteMergeStrategy strategy1 = new OnceAbsoluteMergeStrategy(36,36,3,6);
|
||||
OnceAbsoluteMergeStrategy strategy2 = new OnceAbsoluteMergeStrategy(36,36,7,8);
|
||||
OnceAbsoluteMergeStrategy strategy3 = new OnceAbsoluteMergeStrategy(36,36,9,12);
|
||||
ExcelWriterSheetBuilder builder = EasyExcel.write(out, clazz)
|
||||
//是否自动关闭流
|
||||
.autoCloseStream(Boolean.FALSE)
|
||||
//自动列宽(不太精确)
|
||||
.registerWriteHandler(new VoteTitleHandler(filename))
|
||||
.registerWriteHandler(strategy)
|
||||
.registerWriteHandler(strategy1)
|
||||
.registerWriteHandler(strategy2)
|
||||
.registerWriteHandler(strategy3)
|
||||
.sheet(sheetName);
|
||||
builder.doWrite(list);
|
||||
if(type == 1){
|
||||
OnceAbsoluteMergeStrategy strategy = new OnceAbsoluteMergeStrategy(36,36,1,2);
|
||||
OnceAbsoluteMergeStrategy strategy1 = new OnceAbsoluteMergeStrategy(36,36,3,6);
|
||||
OnceAbsoluteMergeStrategy strategy2 = new OnceAbsoluteMergeStrategy(36,36,7,8);
|
||||
OnceAbsoluteMergeStrategy strategy3 = new OnceAbsoluteMergeStrategy(36,36,9,12);
|
||||
ExcelWriterSheetBuilder builder = EasyExcel.write(out, clazz)
|
||||
//是否自动关闭流
|
||||
.autoCloseStream(Boolean.FALSE)
|
||||
//自动列宽(不太精确)
|
||||
.registerWriteHandler(new VoteTitleHandler(filename))
|
||||
.registerWriteHandler(strategy)
|
||||
.registerWriteHandler(strategy1)
|
||||
.registerWriteHandler(strategy2)
|
||||
.registerWriteHandler(strategy3)
|
||||
.sheet(sheetName);
|
||||
builder.doWrite(list);
|
||||
}else{
|
||||
LoopMergeStrategy loopMergeStrategy = new LoopMergeStrategy(1,2,0);
|
||||
OnceAbsoluteMergeStrategy strategy1 = new OnceAbsoluteMergeStrategy(33,37,0,0);
|
||||
OnceAbsoluteMergeStrategy strategy2 = new OnceAbsoluteMergeStrategy(38,38,0,1);
|
||||
OnceAbsoluteMergeStrategy strategy3 = new OnceAbsoluteMergeStrategy(38,38,3,5);
|
||||
OnceAbsoluteMergeStrategy strategy4 = new OnceAbsoluteMergeStrategy(38,38,7,9);
|
||||
OnceAbsoluteMergeStrategy strategy5 = new OnceAbsoluteMergeStrategy(38,38,11,13);
|
||||
ExcelWriterSheetBuilder builder = EasyExcel.write(out, clazz)
|
||||
//是否自动关闭流
|
||||
.autoCloseStream(Boolean.FALSE)
|
||||
.registerWriteHandler(loopMergeStrategy)
|
||||
.registerWriteHandler(strategy1)
|
||||
.registerWriteHandler(strategy2)
|
||||
.registerWriteHandler(strategy3)
|
||||
.registerWriteHandler(strategy4)
|
||||
.registerWriteHandler(strategy5)
|
||||
.sheet(sheetName);
|
||||
builder.doWrite(list);
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (out != null){
|
||||
|
|
|
|||
|
|
@ -40,4 +40,11 @@
|
|||
<select id="getMaxData" resultType="com.gunshi.project.xyt.model.StPptnRH">
|
||||
SELECT #{stcd} stcd, COALESCE(max(tm), '2021-01-01 00:00:00') tm FROM st_pptn_r_h
|
||||
</select>
|
||||
|
||||
<select id="queryDayRz" resultType="com.gunshi.project.xyt.model.StPptnRD">
|
||||
select tm,rz as drp,TO_CHAR(tm, 'DD') as day,TO_CHAR(tm, 'MM') as month from public.st_rsvr_r where TO_CHAR(tm, 'YYYY') = #{year}
|
||||
and TRIM(TO_CHAR(tm, 'HH24:MI')) = '08:00'
|
||||
and stcd = (select stcd from public.att_res_base where res_code = '42120250085')
|
||||
order by tm asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue