管控全天候-位移监测

master
yangzhe123 2026-01-23 13:15:41 +08:00
parent dd463a7fff
commit 8301533a10
2 changed files with 104 additions and 0 deletions

View File

@ -118,18 +118,34 @@ public class JcskGnssRController {
return R.ok(service.yearStat(osmoticQuerySo)); return R.ok(service.yearStat(osmoticQuerySo));
} }
@Operation(summary = "时间范围位移统计(表格)")
@PostMapping("/range/stat")
public R<List<OsmoticShiftVo2>> rangeStat(@RequestBody @Validated OsmoticQuerySo osmoticQuerySo) {
return R.ok(service.rangeStat(osmoticQuerySo));
}
@Operation(summary = "年度位移统计(全年度特征值统计)") @Operation(summary = "年度位移统计(全年度特征值统计)")
@PostMapping("/year/stat/value") @PostMapping("/year/stat/value")
public R<List<OsmoticChartVo2>> yearStatValue(@RequestBody @Validated OsmoticQuerySo osmoticQuerySo) { public R<List<OsmoticChartVo2>> yearStatValue(@RequestBody @Validated OsmoticQuerySo osmoticQuerySo) {
return R.ok(service.yearStatValue(osmoticQuerySo)); return R.ok(service.yearStatValue(osmoticQuerySo));
} }
@Operation(summary = "范围位移统计(范围特征值统计)")
@PostMapping("/range/stat/value")
public R<List<OsmoticChartVo2>> rangeStatValue(@RequestBody @Validated OsmoticQuerySo osmoticQuerySo) {
return R.ok(service.rangeStatValue(osmoticQuerySo));
}
@Operation(summary = "年度位移统计导出") @Operation(summary = "年度位移统计导出")
@PostMapping( "/year/stat/export") @PostMapping( "/year/stat/export")
public void yearStatExport(@RequestBody @Validated OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) { public void yearStatExport(@RequestBody @Validated OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) {
service.yearStatExport(osmoticQuerySo,response); service.yearStatExport(osmoticQuerySo,response);
} }
@Operation(summary = "布置图-位移监测") @Operation(summary = "布置图-位移监测")
@GetMapping("/list/value") @GetMapping("/list/value")
public R<List<JcskGnessListVo>> listValue() { public R<List<JcskGnessListVo>> listValue() {

View File

@ -135,6 +135,36 @@ public class JcskGnssRService extends ServiceImpl<JcskGnssRMapper, JcskGnssR> {
return resList; return resList;
} }
public List<OsmoticShiftVo2> rangeStat(OsmoticQuerySo osmoticQuerySo) {
List<OsmoticShiftVo2> resList = new ArrayList<>();
//查询位移监测记录
List<OsmoticShiftValueVo2> valueList = baseMapper.queryReorganizeValue(osmoticQuerySo);
List<String> dateList = DateUtil.getDatesBetween(osmoticQuerySo.getDateTimeRangeSo().getStart(), osmoticQuerySo.getDateTimeRangeSo().getEnd(), false);
//数据处理
for(String str : dateList){
OsmoticShiftVo2 vo = new OsmoticShiftVo2();
vo.setTm(str);
// 筛选出该日期8点的数据
List<OsmoticShiftValueVo2> collect = valueList.stream()
.filter(o -> {
if (o.getTm() != null && o.getTm().startsWith(str)) {
// 提取时间部分检查是否为08:00:00
String timePart = o.getTm().substring(11, 13); // 获取 HH:mm:ss 部分
return "08".equals(timePart);
}
return false;
})
.peek(o->o.setTm(str))
.collect(Collectors.toList());
vo.setList(collect);
resList.add(vo);
}
return resList;
}
// 新增:生成指定年份的所有日期(确保只包含当年日期) // 新增:生成指定年份的所有日期(确保只包含当年日期)
private List<String> generateYearDates(Integer year) { private List<String> generateYearDates(Integer year) {
List<String> dates = new ArrayList<>(); List<String> dates = new ArrayList<>();
@ -222,6 +252,61 @@ public class JcskGnssRService extends ServiceImpl<JcskGnssRMapper, JcskGnssR> {
return resList; return resList;
} }
public List<OsmoticChartVo2> rangeStatValue(OsmoticQuerySo osmoticQuerySo) {
// 定义时间格式化器
List<OsmoticChartVo2> resList = new ArrayList<>();
try {
//查询位移监测记录
List<OsmoticShiftValueVo2> valueList = baseMapper.queryValue(osmoticQuerySo);
//按测站分组
Map<String, List<OsmoticShiftValueVo2>> map = valueList.stream().collect(Collectors.groupingBy(OsmoticShiftValueVo2::getCd));
map.entrySet().forEach(o->{
String key = o.getKey();
List<OsmoticShiftValueVo2> value = o.getValue();
OsmoticChartVo2 xVo = new OsmoticChartVo2();
OsmoticShiftValueVo2 xMax = value.stream().max(Comparator.comparing(OsmoticShiftValueVo2::getDe)).get();
OsmoticShiftValueVo2 xMin = value.stream().min(Comparator.comparing(OsmoticShiftValueVo2::getDe)).get();
xVo.setCd(key + X_PREFIX);
xVo.setMaxValue(xMax.getDe());
xVo.setMaxTm(xMax.getTm());
xVo.setMinValue(xMin.getDe());
xVo.setMinTm(xMin.getTm());
xVo.setDiff(xMax.getDe().subtract(xMin.getDe()));
resList.add(xVo);
OsmoticChartVo2 yVo = new OsmoticChartVo2();
OsmoticShiftValueVo2 yMax = value.stream().max(Comparator.comparing(OsmoticShiftValueVo2::getDn)).get();
OsmoticShiftValueVo2 yMin = value.stream().min(Comparator.comparing(OsmoticShiftValueVo2::getDn)).get();
yVo.setCd(key + Y_PREFIX);
yVo.setMaxValue(yMax.getDn());
yVo.setMaxTm(yMax.getTm());
yVo.setMinValue(yMin.getDn());
yVo.setMinTm(yMin.getTm());
yVo.setDiff(yMax.getDn().subtract(yMin.getDn()));
resList.add(yVo);
OsmoticChartVo2 hVo = new OsmoticChartVo2();
OsmoticShiftValueVo2 hMax = value.stream().max(Comparator.comparing(OsmoticShiftValueVo2::getDu)).get();
OsmoticShiftValueVo2 hMin = value.stream().min(Comparator.comparing(OsmoticShiftValueVo2::getDu)).get();
hVo.setCd(key + H_PREFIX);
hVo.setMaxValue(hMax.getDu());
hVo.setMaxTm(hMax.getTm());
hVo.setMinValue(hMin.getDu());
hVo.setMinTm(hMin.getTm());
hVo.setDiff(hMax.getDu().subtract(hMin.getDu()));
resList.add(hVo);
});
} catch (Exception e) {
log.info("year/state/value报错");
e.printStackTrace();
throw new IllegalArgumentException("报错");
}
return resList;
}
public void yearStatExport(OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) { public void yearStatExport(OsmoticQuerySo osmoticQuerySo, HttpServletResponse response) {
String fileName = "年度位移统计"; String fileName = "年度位移统计";
String sheetName = "年度位移统计"; String sheetName = "年度位移统计";
@ -553,4 +638,7 @@ public class JcskGnssRService extends ServiceImpl<JcskGnssRMapper, JcskGnssR> {
public JcskGnssR queryByCDNM(String stationCode) { public JcskGnssR queryByCDNM(String stationCode) {
return this.baseMapper.queryByCDNM(stationCode); return this.baseMapper.queryByCDNM(stationCode);
} }
} }