年度渗流统计查询及导出
parent
b2627616ff
commit
81fc1f5d05
|
|
@ -91,19 +91,19 @@ public class OsmoticPressRController {
|
|||
service.export(osmoticQuerySo,response);
|
||||
}
|
||||
|
||||
@Operation(summary = "年度渗压统计(表格)")
|
||||
@Operation(summary = "年度渗压/渗流统计(表格)")
|
||||
@PostMapping("/year/stat")
|
||||
public R<List<OsmoticStationVo>> yearStat(@RequestBody OsmoticQuerySo osmoticQuerySo) {
|
||||
return R.ok(service.yearStat(osmoticQuerySo));
|
||||
}
|
||||
|
||||
@Operation(summary = "年度渗压统计(全年度特征值统计)")
|
||||
@Operation(summary = "年度渗压/渗流统计(全年度特征值统计)")
|
||||
@PostMapping("/year/stat/value")
|
||||
public R<List<OsmoticChartVo>> yearStatValue(@RequestBody OsmoticQuerySo osmoticQuerySo) {
|
||||
return R.ok(service.yearStatValue(osmoticQuerySo));
|
||||
}
|
||||
|
||||
@Operation(summary = "年度渗压统计导出")
|
||||
@Operation(summary = "年度渗压/渗流统计导出")
|
||||
@PostMapping( "/year/stat/export")
|
||||
public void yearStatExport(@RequestBody OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) {
|
||||
service.yearStatExport(osmoticQuerySo,response);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.xyt.entity.so;
|
|||
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -17,6 +18,10 @@ import java.util.List;
|
|||
@Schema(description = "测值查询对象")
|
||||
public class OsmoticQuerySo {
|
||||
|
||||
@Schema(description = "类型(1渗压 2渗流)")
|
||||
@NotNull(message = "类型不可为空")
|
||||
private Integer type = 1;
|
||||
|
||||
@Schema(description = "年度")
|
||||
private Integer year;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,13 @@ public interface OsmoticPressRMapper extends BaseMapper<OsmoticPressR> {
|
|||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD') as tm,t.value
|
||||
from public.osmotic_press_r t
|
||||
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD') as tm,
|
||||
<if test = "obj.type == 1">
|
||||
t.value from public.osmotic_press_r t
|
||||
</if>
|
||||
<if test = "obj.type == 2">
|
||||
t.q as value from public.osmotic_flow_r t
|
||||
</if>
|
||||
where to_char(t.tm, 'HH24:MI:SS') = '08:00:00' and station_code in
|
||||
<foreach collection="obj.stationCodes" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.gunshi.project.xyt.entity.vo.*;
|
|||
import com.gunshi.project.xyt.mapper.OsmoticPressRMapper;
|
||||
import com.gunshi.project.xyt.model.*;
|
||||
import com.gunshi.project.xyt.model.AttDamProfileAutoDao;
|
||||
import com.gunshi.project.xyt.model.OsmoticFlowDeviceAutoDao;
|
||||
import com.gunshi.project.xyt.model.OsmoticPressDeviceAutoDao;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import com.gunshi.project.xyt.util.ExcelUtil;
|
||||
|
|
@ -44,6 +45,9 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
@Resource
|
||||
private OsmoticPressDeviceAutoDao pressDeviceAutoDao;
|
||||
|
||||
@Resource
|
||||
private OsmoticFlowDeviceAutoDao flowDeviceAutoDao;
|
||||
|
||||
public Page<OsmoticPressR> queryPage(OsmoticQueryPageSo osmoticQueryPageSo) {
|
||||
return mapper.queryPage(osmoticQueryPageSo.getPageSo().toPage(),osmoticQueryPageSo);
|
||||
}
|
||||
|
|
@ -67,7 +71,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
//查询库水位
|
||||
List<StRzVo> list = mapper.queryRz(osmoticQuerySo);
|
||||
Map<String, BigDecimal> rzMap = list.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz));
|
||||
//查询测站管水位
|
||||
//查询测站管水位/渗流量
|
||||
List<OsmoticValueVo> valueList = mapper.queryValue(osmoticQuerySo);
|
||||
//数据处理
|
||||
for(String str : dateList){
|
||||
|
|
@ -90,7 +94,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
//查询库水位
|
||||
List<StRzVo> list = mapper.queryRz(osmoticQuerySo);
|
||||
//查询测站降雨量
|
||||
List<StRzVo> drpList = new ArrayList<>();
|
||||
List<StRzVo> drpList;
|
||||
if(year != null){
|
||||
drpList = mapper.queryDrp(year);
|
||||
OsmoticChartVo chartVo = new OsmoticChartVo();
|
||||
|
|
@ -218,6 +222,11 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
return pressList.stream().map(OsmoticPressDevice::getStationCode).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<String> queryFlowList(){
|
||||
List<OsmoticFlowDevice> flowList = flowDeviceAutoDao.list();
|
||||
return flowList.stream().map(OsmoticFlowDevice::getStationCode).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void export(OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) {
|
||||
//通过断面查询渗压设备
|
||||
List<String> stationCodes = queryPressList(osmoticQuerySo.getProfileCode());
|
||||
|
|
@ -241,7 +250,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
for(int i = 0;i < stationCodes.size();i++){
|
||||
String code = stationCodes.get(i);
|
||||
OsmoticValueVo valueVo = vo.getList().stream().filter(o->code.equals(o.getStationCode())).findFirst().orElse(null);
|
||||
test.put(code,valueVo != null ? valueVo.getValue() : "-");
|
||||
test.put(code,valueVo != null ? valueVo.getValue() : "");
|
||||
}
|
||||
test.put("t4", vo.getStatus() == 0 ? "异常":"正常");
|
||||
list.add(test);
|
||||
|
|
@ -254,9 +263,15 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
}
|
||||
|
||||
private OsmoticQuerySo commonQueryHandle(OsmoticQuerySo osmoticQuerySo){
|
||||
List<String> stationCodes;
|
||||
if(osmoticQuerySo.getType() == 2){
|
||||
//查询所有的渗流设备
|
||||
stationCodes = queryFlowList();
|
||||
}else{
|
||||
String profileCode = osmoticQuerySo.getProfileCode();
|
||||
//通过断面查询渗压设备
|
||||
List<String> stationCodes = queryPressList(profileCode);
|
||||
stationCodes = queryPressList(profileCode);
|
||||
}
|
||||
osmoticQuerySo.setStationCodes(stationCodes);
|
||||
Integer year = osmoticQuerySo.getYear();
|
||||
Date start = DateUtil.convertStringToDate(year + "-01-01 00:00:00");
|
||||
|
|
@ -279,12 +294,22 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
}
|
||||
|
||||
public void yearStatExport(OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) {
|
||||
String profileName = "";
|
||||
String headName = "断面测压管水位(m)";
|
||||
String fileName = "断面年度渗压统计";
|
||||
String sheetName = "年度渗压统计";
|
||||
if(osmoticQuerySo.getType() == 1){
|
||||
//断面名称
|
||||
AttDamProfile damProfile = profileAutoDao.getById(osmoticQuerySo.getProfileCode());
|
||||
if(damProfile != null){
|
||||
profileName = damProfile.getProfileName();
|
||||
headName = damProfile.getProfileName() + headName;
|
||||
fileName = damProfile.getProfileName() + fileName;
|
||||
}
|
||||
}else {
|
||||
headName = "渗流量(L/s)";
|
||||
fileName = "年度渗流统计";
|
||||
sheetName = "年度渗流统计";
|
||||
}
|
||||
|
||||
//上方表格数据
|
||||
List<OsmoticStationVo> resList = yearStat(osmoticQuerySo);
|
||||
//下方特征值数据
|
||||
|
|
@ -304,7 +329,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
|
||||
for(String code : stationCodes){
|
||||
List<String> heads = new ArrayList<>();
|
||||
heads.add(profileName + "断面测压管水位(m)");
|
||||
heads.add(headName);
|
||||
heads.add(code);
|
||||
headList.add(heads);
|
||||
}
|
||||
|
|
@ -390,7 +415,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
diff.put("t3", chartList.stream().filter(o->"drp".equals(o.getStationCode())).findFirst().get().getDiff());
|
||||
list.add(diff);
|
||||
|
||||
ExcelUtil.exportExcel(headList,tableData(list),2,new int[]{0},profileName+"断面年度渗压统计",response,"年度渗压统计");
|
||||
ExcelUtil.exportExcel(headList,tableData(list),2,new int[]{0},fileName,response,sheetName);
|
||||
}
|
||||
|
||||
private List<List> tableData( List<Map<String, Object>> list){
|
||||
|
|
|
|||
Loading…
Reference in New Issue