parent
4ca29aa6f1
commit
accdfb627a
|
|
@ -64,4 +64,26 @@ public class StFlowR {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private LocalDateTime crtime;
|
private LocalDateTime crtime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近24h平均流量
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal avg24Q;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近24h变幅
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal change24Q;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近24小时累计水量
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal total24V;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String stnm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.gunshi;
|
||||||
import com.gunshi.project.ss.common.model.vo.OsmoticPressDetailVo;
|
import com.gunshi.project.ss.common.model.vo.OsmoticPressDetailVo;
|
||||||
import com.gunshi.project.ss.model.RegressionEquation;
|
import com.gunshi.project.ss.model.RegressionEquation;
|
||||||
import com.gunshi.project.ss.util.RegressionAnalysis;
|
import com.gunshi.project.ss.util.RegressionAnalysis;
|
||||||
|
import org.springframework.data.elasticsearch.client.elc.NativeQueryBuilder;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
|
@ -17,45 +18,17 @@ public class Tests extends Thread {
|
||||||
public static DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
public static DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
List<OsmoticPressDetailVo> res = new ArrayList<>();
|
|
||||||
OsmoticPressDetailVo o1 = new OsmoticPressDetailVo();
|
|
||||||
o1.setRz(new BigDecimal("119.19"));
|
|
||||||
o1.setValue(new BigDecimal("99.65"));
|
|
||||||
|
|
||||||
OsmoticPressDetailVo o2 = new OsmoticPressDetailVo();
|
}
|
||||||
o2.setRz(new BigDecimal("119.19"));
|
|
||||||
o2.setValue(new BigDecimal("99.655"));
|
|
||||||
|
|
||||||
OsmoticPressDetailVo o3 = new OsmoticPressDetailVo();
|
class Myclass implements Cloneable{
|
||||||
o3.setRz(new BigDecimal("119.2"));
|
private String name;
|
||||||
o3.setValue(new BigDecimal("99.665"));
|
|
||||||
|
|
||||||
OsmoticPressDetailVo o4 = new OsmoticPressDetailVo();
|
@Override
|
||||||
o4.setRz(new BigDecimal("119.22"));
|
public Object clone() throws CloneNotSupportedException {
|
||||||
o4.setValue(new BigDecimal("99.675"));
|
Myclass clone = (Myclass) super.clone();
|
||||||
|
return clone;
|
||||||
OsmoticPressDetailVo o5 = new OsmoticPressDetailVo();
|
}
|
||||||
o5.setRz(new BigDecimal("119.23"));
|
|
||||||
o5.setValue(new BigDecimal("99.645"));
|
|
||||||
res.add(o1);
|
|
||||||
res.add(o2);
|
|
||||||
res.add(o5);
|
|
||||||
res.add(o3);
|
|
||||||
res.add(o4);
|
|
||||||
RegressionEquation first = RegressionAnalysis.calculateLinear(res);
|
|
||||||
System.out.println(first.toString());
|
|
||||||
BigDecimal decimal = calculateRegressionValue(first.toString(), new BigDecimal("119.19"));
|
|
||||||
System.out.println(decimal.toString());
|
|
||||||
RegressionEquation second = RegressionAnalysis.calculateQuadratic(res);
|
|
||||||
BigDecimal decimal1 = calculateRegressionValue(second.toString(), new BigDecimal("119.19"));
|
|
||||||
System.out.println(decimal1.toString());
|
|
||||||
System.out.println(second.toString());
|
|
||||||
RegressionEquation three = RegressionAnalysis.calculateCubic(res);
|
|
||||||
System.out.println(calculateRegressionValue(three.toString(), new BigDecimal("119.19")));
|
|
||||||
System.out.println(three.toString());
|
|
||||||
RegressionEquation four = RegressionAnalysis.calculateQuartic(res);
|
|
||||||
// System.out.println(calculateRegressionValue(four.toString(), new BigDecimal("119.19")));
|
|
||||||
System.out.println(four.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public class AttCctvBaseController {
|
||||||
if (ObjectUtils.isNotNull(page.getType())) {
|
if (ObjectUtils.isNotNull(page.getType())) {
|
||||||
query.eq(AttCctvBase::getType, Integer.valueOf(page.getType()));
|
query.eq(AttCctvBase::getType, Integer.valueOf(page.getType()));
|
||||||
}
|
}
|
||||||
query.orderByDesc(AttCctvBase::getCreateTime);
|
query.orderByDesc(AttCctvBase::getOrder);
|
||||||
Page<AttCctvBase> basePage = service.page(page.getPageSo().toPage(), query);
|
Page<AttCctvBase> basePage = service.page(page.getPageSo().toPage(), query);
|
||||||
List<AttCctvBase> records = basePage.getRecords();
|
List<AttCctvBase> records = basePage.getRecords();
|
||||||
if (CollectionUtils.isNotEmpty(records)){
|
if (CollectionUtils.isNotEmpty(records)){
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.ss.entity.so.AttDamProfilePageSo;
|
||||||
import com.gunshi.project.ss.entity.so.GeneralDataPage;
|
import com.gunshi.project.ss.entity.so.GeneralDataPage;
|
||||||
import com.gunshi.project.ss.entity.vo.ProfilePressTreeVo;
|
import com.gunshi.project.ss.entity.vo.ProfilePressTreeVo;
|
||||||
import com.gunshi.project.ss.model.AttDamProfile;
|
import com.gunshi.project.ss.model.AttDamProfile;
|
||||||
|
|
@ -94,11 +95,11 @@ public class AttDamProfileController extends AbstractCommonFileController{
|
||||||
|
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public R<Page<AttDamProfile>> page(@RequestBody @Validated GeneralDataPage page) {
|
public R<Page<AttDamProfile>> page(@RequestBody @Validated AttDamProfilePageSo page) {
|
||||||
LambdaQueryWrapper<AttDamProfile> query = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<AttDamProfile> query = Wrappers.lambdaQuery();
|
||||||
|
|
||||||
if (ObjectUtils.isNotNull(page.getName())) {
|
if (ObjectUtils.isNotNull(page.getProfileName())) {
|
||||||
query.like(AttDamProfile::getProfileName, page.getName());
|
query.like(AttDamProfile::getProfileName, page.getProfileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<AttDamProfile> data = service.page(page.getPageSo().toPage(), query);
|
Page<AttDamProfile> data = service.page(page.getPageSo().toPage(), query);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
@Tag(name = "安全管理-降等报废台账")
|
@Tag(name = "安全管理-降等报废台账")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value="/degradeScrapLedger")
|
@RequestMapping(value="/safety/degradeScrapLedger")
|
||||||
public class DegradeScrapLedgerController extends AbstractCommonFileController {
|
public class DegradeScrapLedgerController extends AbstractCommonFileController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package com.gunshi.project.ss.controller;
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.file.model.FileDescriptor;
|
import com.gunshi.file.model.FileDescriptor;
|
||||||
|
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
|
||||||
import com.gunshi.project.ss.entity.vo.HomeIaCBsnssinfoVo;
|
import com.gunshi.project.ss.entity.vo.HomeIaCBsnssinfoVo;
|
||||||
import com.gunshi.project.ss.model.FileAssociations;
|
import com.gunshi.project.ss.model.FileAssociations;
|
||||||
import com.gunshi.project.ss.model.IaCBsnssinfo;
|
import com.gunshi.project.ss.model.IaCBsnssinfo;
|
||||||
|
|
@ -94,10 +96,15 @@ public class IaCBsnssinfoController extends AbstractCommonFileController{
|
||||||
return R.ok(service.lambdaQuery().list());
|
return R.ok(service.lambdaQuery().list());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
// @PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public R<List<IaCBsnssinfo>> page() {
|
public R<Page<IaCBsnssinfo>> page(@RequestBody IaCFlrvvlgPageSo pageSo) {
|
||||||
return R.ok(service.page(null,null));
|
Page<IaCBsnssinfo> page = service.pageInfo(pageSo);
|
||||||
|
for (IaCBsnssinfo record : page.getRecords()) {
|
||||||
|
List<FileAssociations> files = fileService.getFiles(getGroupId(), record.getEicd());
|
||||||
|
record.setFiles(files);
|
||||||
|
}
|
||||||
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "详情和行政区划数据查询")
|
@Operation(summary = "详情和行政区划数据查询")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.gunshi.project.ss.controller;
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
|
||||||
import com.gunshi.project.ss.entity.vo.HomeIaCDanadVo;
|
import com.gunshi.project.ss.entity.vo.HomeIaCDanadVo;
|
||||||
import com.gunshi.project.ss.model.IaCDanad;
|
import com.gunshi.project.ss.model.IaCDanad;
|
||||||
import com.gunshi.project.ss.service.IaCDanadService;
|
import com.gunshi.project.ss.service.IaCDanadService;
|
||||||
|
|
@ -61,10 +63,11 @@ public class IaCDanadController {
|
||||||
return R.ok(service.lambdaQuery().list());
|
return R.ok(service.lambdaQuery().list());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
// @PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public R<List<IaCDanad>> page() {
|
public R<Page<IaCDanad>> page(@RequestBody IaCFlrvvlgPageSo pageSo) {
|
||||||
return R.ok(service.page(null,null));
|
Page<IaCDanad> page = service.pageInfo(pageSo);
|
||||||
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package com.gunshi.project.ss.controller;
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.file.model.FileDescriptor;
|
import com.gunshi.file.model.FileDescriptor;
|
||||||
|
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
|
||||||
import com.gunshi.project.ss.entity.vo.HomeIaCFlrvvlgVo;
|
import com.gunshi.project.ss.entity.vo.HomeIaCFlrvvlgVo;
|
||||||
import com.gunshi.project.ss.model.FileAssociations;
|
import com.gunshi.project.ss.model.FileAssociations;
|
||||||
import com.gunshi.project.ss.model.IaCFlrvvlg;
|
import com.gunshi.project.ss.model.IaCFlrvvlg;
|
||||||
|
|
@ -82,10 +84,11 @@ public class IaCFlrvvlgController extends AbstractCommonFileController{
|
||||||
return R.ok(service.lambdaQuery().list());
|
return R.ok(service.lambdaQuery().list());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
// @PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public R<List<IaCFlrvvlg>> page() {
|
public R<Page<IaCFlrvvlg>> page(@RequestBody IaCFlrvvlgPageSo pageSo) {
|
||||||
return R.ok(service.page(null,null));
|
Page<IaCFlrvvlg> page = service.pageInfo(pageSo);
|
||||||
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.ss.model.FileAssociations;
|
||||||
|
import com.gunshi.project.ss.model.RegistrationInfo;
|
||||||
|
import com.gunshi.project.ss.service.FileAssociationsService;
|
||||||
|
import com.gunshi.project.ss.service.RegistrationInfoSerivce;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/registrationInfo")
|
||||||
|
@Tag(name = "注册登记信息/责任人信息")
|
||||||
|
public class RegistrationInfoController extends AbstractCommonFileController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RegistrationInfoSerivce registrationInfoSerivce;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileAssociationsService fileService;
|
||||||
|
|
||||||
|
@PostMapping("/addOrEdit")
|
||||||
|
@Schema(description = "更新/新增")
|
||||||
|
public R<RegistrationInfo> addOrEdit(@RequestBody RegistrationInfo registrationInfo){
|
||||||
|
RegistrationInfo res = registrationInfoSerivce.addOrEdit(registrationInfo);
|
||||||
|
if(res!=null){
|
||||||
|
fileService.saveFile(res.getFiles(),getGroupId(),res.getId().toString());
|
||||||
|
}
|
||||||
|
return R.ok(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Schema(description = "获取")
|
||||||
|
public R<RegistrationInfo> get(){
|
||||||
|
RegistrationInfo one = registrationInfoSerivce.lambdaQuery().one();
|
||||||
|
if(one != null){
|
||||||
|
List<FileAssociations> files = fileService.getFiles(getGroupId(), one.getId().toString());
|
||||||
|
one.setFiles(files);
|
||||||
|
}
|
||||||
|
return R.ok(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGroupId() {
|
||||||
|
return "registrationInfo";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
package com.gunshi.project.ss.controller;
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.ss.common.model.StFlowR;
|
||||||
|
import com.gunshi.project.ss.entity.dto.StFlowDataCheckDto;
|
||||||
|
import com.gunshi.project.ss.entity.vo.StFlowLowerDataCheckVo;
|
||||||
|
import com.gunshi.project.ss.entity.vo.StFlowRListVo;
|
||||||
|
import com.gunshi.project.ss.service.StFlowRService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "流量表")
|
@Tag(name = "流量表")
|
||||||
|
|
@ -10,4 +20,45 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@RequestMapping(value="/stFlowR")
|
@RequestMapping(value="/stFlowR")
|
||||||
public class StFlowRController {
|
public class StFlowRController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StFlowRService service;
|
||||||
|
|
||||||
|
@Operation(description = "根据stcd查询历史数据")
|
||||||
|
@PostMapping("/getByStcd")
|
||||||
|
public R<List<StFlowR>> getByStcd(@RequestBody StFlowDataCheckDto dto) {
|
||||||
|
List<StFlowR> res = service.getByStcd(dto);
|
||||||
|
return R.ok(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(description = "查询最新数据")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<StFlowRListVo>> list(){
|
||||||
|
List<StFlowRListVo> res = service.listLatestData();
|
||||||
|
return R.ok(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(description = "数据查询,上方表格")
|
||||||
|
@PostMapping("/upperDataCheck")
|
||||||
|
public R<List<StFlowRListVo>> upperDataCheck(@RequestBody StFlowDataCheckDto dto){
|
||||||
|
List<StFlowRListVo> res = service.upperDataCheck(dto);
|
||||||
|
return R.ok(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(description = "数据查询,下方表格")
|
||||||
|
@PostMapping("/lowerDataCheck")
|
||||||
|
public R<StFlowLowerDataCheckVo> lowerDataCheckVoR(@RequestBody StFlowDataCheckDto dto){
|
||||||
|
StFlowLowerDataCheckVo res = service.lowerDataCheckVoR(dto);
|
||||||
|
return R.ok(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(description = "excel导出")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(@RequestBody StFlowDataCheckDto dto, HttpServletResponse response){
|
||||||
|
service.export(dto,response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.gunshi.project.ss.entity.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StFlowDataCheckDto {
|
||||||
|
|
||||||
|
|
||||||
|
private DateTimeRangeSo dateTimeRangeSo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点编码
|
||||||
|
*/
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0小时 1日
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Document(indexName="ss_object")
|
//@Document(indexName="ss_object")
|
||||||
public class EsObjectDocument {
|
public class EsObjectDocument {
|
||||||
@Id // 必须添加这个注解
|
@Id // 必须添加这个注解
|
||||||
private String id; // 字段名可以是id或自定义
|
private String id; // 字段名可以是id或自定义
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.gunshi.project.ss.entity.so;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AttDamProfilePageSo {
|
||||||
|
|
||||||
|
@Schema(description = "分页参数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private PageSo pageSo;
|
||||||
|
|
||||||
|
|
||||||
|
private String profileName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.gunshi.project.ss.entity.so;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IaCFlrvvlgPageSo {
|
||||||
|
|
||||||
|
@Schema(description = "分页参数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private PageSo pageSo;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
}
|
||||||
|
|
@ -28,4 +28,8 @@ public class ResCodeSo {
|
||||||
*/
|
*/
|
||||||
@Schema(description="类型(1防汛预案 2调度规程)")
|
@Schema(description="类型(1防汛预案 2调度规程)")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "是否有效 0无效 1有效")
|
||||||
|
private Integer isAvailable;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.gunshi.project.ss.entity.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StFlowLowerDataCheckVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大1小时流量
|
||||||
|
*/
|
||||||
|
private BigDecimal max1hoursQ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大6小时流量
|
||||||
|
*/
|
||||||
|
private BigDecimal max6hoursQ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大1小时时间
|
||||||
|
*/
|
||||||
|
private String max1hoursTm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大6小时时间
|
||||||
|
*/
|
||||||
|
private String max6hoursTm;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.gunshi.project.ss.entity.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StFlowRListVo {
|
||||||
|
|
||||||
|
|
||||||
|
private String stnm;
|
||||||
|
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瞬时流量,单位m³/s
|
||||||
|
*/
|
||||||
|
private BigDecimal q;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime tm;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近24h平均流量
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal avg24Q;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近24h变幅
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal change24Q;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近24小时累计水量单位万m³
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal total24V;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.gunshi.project.ss.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gunshi.project.ss.model.RegistrationInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RegistrationInfoMapper extends BaseMapper<RegistrationInfo> {
|
||||||
|
}
|
||||||
|
|
@ -140,5 +140,8 @@ public class AttCctvBase implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@TableField(value = "_order")
|
||||||
|
private Integer order;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -639,4 +639,19 @@ public class AttResBase implements Serializable {
|
||||||
@TableField("management_housing")
|
@TableField("management_housing")
|
||||||
@Schema(description = "管理用房")
|
@Schema(description = "管理用房")
|
||||||
private String managementHousing;
|
private String managementHousing;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField("local_government_person")
|
||||||
|
@Schema(description = "地方政府责任人")
|
||||||
|
private String localGovernmentPerson;
|
||||||
|
|
||||||
|
@TableField("governing_authority_person")
|
||||||
|
@Schema(description = "主管部门责任人")
|
||||||
|
private String governingAuthorityPerson;
|
||||||
|
|
||||||
|
@TableField("management_unit_person")
|
||||||
|
@Schema(description = "管理单位责任人")
|
||||||
|
private String managementUnitPerson;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.gunshi.project.ss.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "注册登记信息")
|
||||||
|
@Data
|
||||||
|
@TableName("public.registration_info")
|
||||||
|
public class RegistrationInfo {
|
||||||
|
|
||||||
|
|
||||||
|
@TableId(value = "id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<FileAssociations> files;
|
||||||
|
}
|
||||||
|
|
@ -119,6 +119,11 @@ public class ResPlanB implements Serializable {
|
||||||
private Date moditime;
|
private Date moditime;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(value = "is_available")
|
||||||
|
@Schema(description = "是否有效 0 无效 1有效")
|
||||||
|
private Integer isAvailable;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "文件集合")
|
@Schema(description = "文件集合")
|
||||||
private List<FileAssociations> files;
|
private List<FileAssociations> files;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -118,6 +119,12 @@ public class SafetyIdentify implements Serializable {
|
||||||
@Size(max = 500,message = "安全鉴定结论最大长度要小于 500")
|
@Size(max = 500,message = "安全鉴定结论最大长度要小于 500")
|
||||||
private String identifyResult;
|
private String identifyResult;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(value = "next_verify_date")
|
||||||
|
@Schema(description = "下次鉴定时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate nextVerifyDate;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "文件集合")
|
@Schema(description = "文件集合")
|
||||||
private List<FileAssociations> files;
|
private List<FileAssociations> files;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
package com.gunshi.project.ss.service;
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
|
||||||
import com.gunshi.project.ss.entity.vo.HomeIaCBsnssinfoVo;
|
import com.gunshi.project.ss.entity.vo.HomeIaCBsnssinfoVo;
|
||||||
import com.gunshi.project.ss.mapper.IaCBsnssinfoMapper;
|
import com.gunshi.project.ss.mapper.IaCBsnssinfoMapper;
|
||||||
import com.gunshi.project.ss.model.IaCBsnssinfo;
|
import com.gunshi.project.ss.model.IaCBsnssinfo;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -24,6 +28,14 @@ public class IaCBsnssinfoService extends ServiceImpl<IaCBsnssinfoMapper, IaCBsns
|
||||||
public List<HomeIaCBsnssinfoVo> getDetailsAndMonitoringDataLis() {
|
public List<HomeIaCBsnssinfoVo> getDetailsAndMonitoringDataLis() {
|
||||||
return baseMapper.getDetailsAndMonitoringDataLis();
|
return baseMapper.getDetailsAndMonitoringDataLis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page<IaCBsnssinfo> pageInfo(IaCFlrvvlgPageSo pageSo) {
|
||||||
|
LambdaQueryWrapper<IaCBsnssinfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if(!StringUtils.isEmpty(pageSo.getName())){
|
||||||
|
queryWrapper.like(IaCBsnssinfo::getName, pageSo.getName());
|
||||||
|
}
|
||||||
|
return this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
package com.gunshi.project.ss.service;
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
|
||||||
import com.gunshi.project.ss.entity.vo.HomeIaCDanadVo;
|
import com.gunshi.project.ss.entity.vo.HomeIaCDanadVo;
|
||||||
import com.gunshi.project.ss.mapper.IaCDanadMapper;
|
import com.gunshi.project.ss.mapper.IaCDanadMapper;
|
||||||
import com.gunshi.project.ss.model.IaCDanad;
|
import com.gunshi.project.ss.model.IaCDanad;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -28,6 +32,14 @@ public class IaCDanadService extends ServiceImpl<IaCDanadMapper, IaCDanad>
|
||||||
public HomeIaCDanadVo detail(String id) {
|
public HomeIaCDanadVo detail(String id) {
|
||||||
return baseMapper.detail(id);
|
return baseMapper.detail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page<IaCDanad> pageInfo(IaCFlrvvlgPageSo pageSo) {
|
||||||
|
LambdaQueryWrapper<IaCDanad> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if(!StringUtils.isBlank(pageSo.getName())){
|
||||||
|
queryWrapper.like(IaCDanad::getName, pageSo.getName());
|
||||||
|
}
|
||||||
|
return this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
package com.gunshi.project.ss.service;
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
|
||||||
import com.gunshi.project.ss.entity.vo.HomeIaCFlrvvlgVo;
|
import com.gunshi.project.ss.entity.vo.HomeIaCFlrvvlgVo;
|
||||||
import com.gunshi.project.ss.mapper.IaCFlrvvlgMapper;
|
import com.gunshi.project.ss.mapper.IaCFlrvvlgMapper;
|
||||||
import com.gunshi.project.ss.model.IaCFlrvvlg;
|
import com.gunshi.project.ss.model.IaCFlrvvlg;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -24,6 +28,18 @@ public class IaCFlrvvlgService extends ServiceImpl<IaCFlrvvlgMapper, IaCFlrvvlg>
|
||||||
public List<HomeIaCFlrvvlgVo> getDetailsAndMonitoringDataLis() {
|
public List<HomeIaCFlrvvlgVo> getDetailsAndMonitoringDataLis() {
|
||||||
return baseMapper.getDetailsAndMonitoringDataLis();
|
return baseMapper.getDetailsAndMonitoringDataLis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page<IaCFlrvvlg> pageInfo(IaCFlrvvlgPageSo pageSo) {
|
||||||
|
LambdaQueryWrapper<IaCFlrvvlg> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if(!StringUtils.isBlank(pageSo.getName())){
|
||||||
|
queryWrapper.like(IaCFlrvvlg::getName, pageSo.getName());
|
||||||
|
}
|
||||||
|
if(!StringUtils.isBlank(pageSo.getPhone())){
|
||||||
|
queryWrapper.like(IaCFlrvvlg::getPhone, pageSo.getPhone());
|
||||||
|
}
|
||||||
|
Page<IaCFlrvvlg> iaCFlrvvlgPage = this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
||||||
|
return iaCFlrvvlgPage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.ss.mapper.PersonnelPlanMapper;
|
||||||
|
import com.gunshi.project.ss.mapper.RegistrationInfoMapper;
|
||||||
|
import com.gunshi.project.ss.model.PersonnelPlan;
|
||||||
|
import com.gunshi.project.ss.model.RegistrationInfo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class RegistrationInfoSerivce extends ServiceImpl<RegistrationInfoMapper, RegistrationInfo> {
|
||||||
|
|
||||||
|
public RegistrationInfo addOrEdit(RegistrationInfo registrationInfo) {
|
||||||
|
|
||||||
|
if(registrationInfo.getId()==null){
|
||||||
|
RegistrationInfo queryOne = this.baseMapper.selectOne(null);
|
||||||
|
if(queryOne==null){
|
||||||
|
RegistrationInfo info = new RegistrationInfo();
|
||||||
|
long id = IdWorker.getId();
|
||||||
|
info.setId(id);
|
||||||
|
save(info);
|
||||||
|
return info;
|
||||||
|
}else{
|
||||||
|
return queryOne;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
RegistrationInfo byId = getById(registrationInfo.getId());
|
||||||
|
return byId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,15 +5,31 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.ss.common.mapper.StFlowRMapper;
|
import com.gunshi.project.ss.common.mapper.StFlowRMapper;
|
||||||
import com.gunshi.project.ss.common.model.StFlowR;
|
import com.gunshi.project.ss.common.model.StFlowR;
|
||||||
|
import com.gunshi.project.ss.common.model.StStbprpB;
|
||||||
|
import com.gunshi.project.ss.entity.dto.StFlowDataCheckDto;
|
||||||
|
import com.gunshi.project.ss.entity.vo.StFlowLowerDataCheckVo;
|
||||||
|
import com.gunshi.project.ss.entity.vo.StFlowRListVo;
|
||||||
import com.gunshi.project.ss.entity.vo.StFlowRVo;
|
import com.gunshi.project.ss.entity.vo.StFlowRVo;
|
||||||
import com.gunshi.project.ss.mapper.StFlowRVoMapper;
|
import com.gunshi.project.ss.mapper.StFlowRVoMapper;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -23,6 +39,9 @@ public class StFlowRService extends ServiceImpl<StFlowRMapper, StFlowR> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private StFlowRVoMapper voMapper;
|
private StFlowRVoMapper voMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StStbprpBService stStbprpBService;
|
||||||
|
|
||||||
public StFlowR getNewDataByStcd(String stcd) {
|
public StFlowR getNewDataByStcd(String stcd) {
|
||||||
LambdaQueryWrapper<StFlowR> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<StFlowR> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(StFlowR::getStcd, stcd);
|
queryWrapper.eq(StFlowR::getStcd, stcd);
|
||||||
|
|
@ -42,4 +61,217 @@ public class StFlowRService extends ServiceImpl<StFlowRMapper, StFlowR> {
|
||||||
public List<StFlowRVo> getDataByStcdAndTm(String stcd, Date tm) {
|
public List<StFlowRVo> getDataByStcdAndTm(String stcd, Date tm) {
|
||||||
return voMapper.getDataByStcdAndTm(stcd, tm);
|
return voMapper.getDataByStcdAndTm(stcd, tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<StFlowRListVo> listLatestData() {
|
||||||
|
List<StFlowRListVo> res = new ArrayList<>();
|
||||||
|
List<StStbprpB> flowStations = stStbprpBService.getFlowStations();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime lastDay = now.minusDays(1);
|
||||||
|
|
||||||
|
for (StStbprpB flowStation : flowStations) {
|
||||||
|
StFlowRListVo stFlowR = new StFlowRListVo();
|
||||||
|
stFlowR.setStcd(flowStation.getStcd());
|
||||||
|
stFlowR.setStnm(flowStation.getStnm());
|
||||||
|
|
||||||
|
// 获取24小时内的所有流量数据
|
||||||
|
List<StFlowR> list = lambdaQuery()
|
||||||
|
.eq(StFlowR::getStcd, flowStation.getStcd())
|
||||||
|
.ge(StFlowR::getTm, lastDay)
|
||||||
|
.le(StFlowR::getTm, now)
|
||||||
|
.orderByAsc(StFlowR::getTm) // 按时间升序排列,方便计算
|
||||||
|
.list();
|
||||||
|
|
||||||
|
if(list.isEmpty()){
|
||||||
|
res.add(stFlowR);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置最新时间点的数据
|
||||||
|
StFlowR latestData = list.get(list.size() - 1);
|
||||||
|
stFlowR.setTm(latestData.getTm());
|
||||||
|
stFlowR.setQ(latestData.getQ());
|
||||||
|
|
||||||
|
// 计算统计值
|
||||||
|
calculateTotalVolume(list, stFlowR);
|
||||||
|
|
||||||
|
res.add(stFlowR);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 替代的累计水量计算方法(使用梯形法,更精确)
|
||||||
|
private void calculateTotalVolume(List<StFlowR> flowList, StFlowRListVo vo) {
|
||||||
|
if (flowList == null || flowList.size() < 2) {
|
||||||
|
vo.setTotal24V(BigDecimal.ZERO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal totalVolume = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for (int i = 0; i < flowList.size() - 1; i++) {
|
||||||
|
StFlowR current = flowList.get(i);
|
||||||
|
StFlowR next = flowList.get(i + 1);
|
||||||
|
|
||||||
|
if (current.getQ() != null && next.getQ() != null &&
|
||||||
|
current.getTm() != null && next.getTm() != null) {
|
||||||
|
|
||||||
|
// 计算时间间隔(秒)
|
||||||
|
long seconds = Duration.between(current.getTm(), next.getTm()).getSeconds();
|
||||||
|
|
||||||
|
// 使用梯形法计算水量:(当前流量 + 下一流量) / 2 × 时间间隔
|
||||||
|
BigDecimal avgQ = current.getQ().add(next.getQ())
|
||||||
|
.divide(BigDecimal.valueOf(2), 4, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
// 水量 = 平均流量(m³/s) × 时间(秒)
|
||||||
|
BigDecimal volume = avgQ.multiply(BigDecimal.valueOf(seconds));
|
||||||
|
|
||||||
|
totalVolume = totalVolume.add(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为万立方米(1万立方米 = 10000立方米)
|
||||||
|
totalVolume = totalVolume.divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_UP);
|
||||||
|
vo.setTotal24V(totalVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StFlowRListVo> upperDataCheck(StFlowDataCheckDto dto) {
|
||||||
|
List<StFlowRListVo> res = new ArrayList<>();
|
||||||
|
List<StFlowR> list = lambdaQuery()
|
||||||
|
.eq(StFlowR::getStcd, dto.getStcd())
|
||||||
|
.ge(StFlowR::getTm, dto.getDateTimeRangeSo().getStart())
|
||||||
|
.le(StFlowR::getTm, dto.getDateTimeRangeSo().getEnd())
|
||||||
|
.orderByDesc(StFlowR::getTm)
|
||||||
|
.list();
|
||||||
|
if(list.isEmpty()){
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
if(dto.getType() == 0){
|
||||||
|
for (StFlowR stFlowR : list) {
|
||||||
|
StFlowRListVo stFlowRListVo = new StFlowRListVo();
|
||||||
|
stFlowRListVo.setStcd(stFlowR.getStcd());
|
||||||
|
stFlowRListVo.setQ(stFlowR.getQ());
|
||||||
|
stFlowRListVo.setTm(stFlowR.getTm());
|
||||||
|
res.add(stFlowRListVo);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 使用Map按日期分组
|
||||||
|
Map<LocalDate, List<StFlowR>> dailyMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
for (StFlowR flow : list) {
|
||||||
|
LocalDate date = flow.getTm().toLocalDate();
|
||||||
|
dailyMap.computeIfAbsent(date, k -> new ArrayList<>()).add(flow);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算每天的平均流量
|
||||||
|
for (Map.Entry<LocalDate, List<StFlowR>> entry : dailyMap.entrySet()) {
|
||||||
|
LocalDate date = entry.getKey();
|
||||||
|
List<StFlowR> dayList = entry.getValue();
|
||||||
|
|
||||||
|
if (!dayList.isEmpty()) {
|
||||||
|
StFlowR sample = dayList.get(0);
|
||||||
|
BigDecimal totalQ = BigDecimal.ZERO;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
// 计算当日流量总和
|
||||||
|
for (StFlowR flow : dayList) {
|
||||||
|
if (flow.getQ() != null) {
|
||||||
|
totalQ = totalQ.add(flow.getQ());
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建结果对象
|
||||||
|
StFlowRListVo vo = new StFlowRListVo();
|
||||||
|
vo.setStcd(sample.getStcd());
|
||||||
|
|
||||||
|
// 计算平均值并保留2位小数
|
||||||
|
if (count > 0) {
|
||||||
|
BigDecimal avgQ = totalQ.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP);
|
||||||
|
vo.setQ(avgQ);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置时间为当天的开始时间(00:00:00)
|
||||||
|
vo.setTm(date.atStartOfDay());
|
||||||
|
res.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StFlowLowerDataCheckVo lowerDataCheckVoR(StFlowDataCheckDto dto) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StFlowR> getByStcd(StFlowDataCheckDto dto) {
|
||||||
|
StStbprpB one = stStbprpBService.lambdaQuery()
|
||||||
|
.eq(StStbprpB::getStcd, dto.getStcd()).one();
|
||||||
|
if(one == null){
|
||||||
|
throw new IllegalArgumentException("对不起,该站点不存在");
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<StFlowR> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(StFlowR::getStcd, dto.getStcd());
|
||||||
|
queryWrapper.ge(StFlowR::getTm, dto.getDateTimeRangeSo().getStart());
|
||||||
|
queryWrapper.le(StFlowR::getTm, dto.getDateTimeRangeSo().getEnd());
|
||||||
|
queryWrapper.orderByDesc(StFlowR::getTm);
|
||||||
|
List<StFlowR> stFlowRS = this.baseMapper.selectList(queryWrapper);
|
||||||
|
stFlowRS.stream().forEach(o -> o.setStnm(one.getStnm()));
|
||||||
|
return stFlowRS;
|
||||||
|
}
|
||||||
|
public void export(StFlowDataCheckDto dto, HttpServletResponse response) {
|
||||||
|
// 1. 获取数据
|
||||||
|
List<StFlowR> dataList = getByStcd(dto);
|
||||||
|
|
||||||
|
// 2. 创建Excel工作簿
|
||||||
|
try (Workbook workbook = new XSSFWorkbook()) {
|
||||||
|
Sheet sheet = workbook.createSheet("流量数据");
|
||||||
|
|
||||||
|
// 3. 创建标题行
|
||||||
|
Row headerRow = sheet.createRow(0);
|
||||||
|
headerRow.createCell(0).setCellValue("站点名称");
|
||||||
|
headerRow.createCell(1).setCellValue("时间");
|
||||||
|
headerRow.createCell(2).setCellValue("瞬时流量(m³/s)");
|
||||||
|
|
||||||
|
// 4. 填充数据
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
for (int i = 0; i < dataList.size(); i++) {
|
||||||
|
StFlowR flowData = dataList.get(i);
|
||||||
|
Row row = sheet.createRow(i + 1);
|
||||||
|
|
||||||
|
// 站点名称
|
||||||
|
row.createCell(0).setCellValue(flowData.getStnm() != null ? flowData.getStnm() : "");
|
||||||
|
|
||||||
|
// 时间
|
||||||
|
String timeStr = "";
|
||||||
|
if (flowData.getTm() != null) {
|
||||||
|
timeStr = flowData.getTm().format(formatter);
|
||||||
|
}
|
||||||
|
row.createCell(1).setCellValue(timeStr);
|
||||||
|
|
||||||
|
// 流量
|
||||||
|
if (flowData.getQ() != null) {
|
||||||
|
row.createCell(2).setCellValue(flowData.getQ().doubleValue());
|
||||||
|
} else {
|
||||||
|
row.createCell(2).setCellValue("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 自动调整列宽
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
sheet.autoSizeColumn(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 设置响应头
|
||||||
|
String fileName = "流量数据_" + System.currentTimeMillis() + ".xlsx";
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||||
|
|
||||||
|
// 7. 写入响应流
|
||||||
|
workbook.write(response.getOutputStream());
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("导出Excel失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -618,7 +618,7 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||||
query.like(StStbprpB::getStnm, pageSo.getStnm());
|
query.like(StStbprpB::getStnm, pageSo.getStnm());
|
||||||
}
|
}
|
||||||
if (ObjectUtils.isNotNull(pageSo.getStatus())) {
|
if (ObjectUtils.isNotNull(pageSo.getStatus())) {
|
||||||
query.like(StStbprpB::getStatus,pageSo.getStatus());
|
query.eq(StStbprpB::getStatus,pageSo.getStatus());
|
||||||
}
|
}
|
||||||
Page<StStbprpB> stStbprpBPage = this.baseMapper.selectPage(pageSo.getPageSo().toPage(), query);
|
Page<StStbprpB> stStbprpBPage = this.baseMapper.selectPage(pageSo.getPageSo().toPage(), query);
|
||||||
for (StStbprpB record : stStbprpBPage.getRecords()) {
|
for (StStbprpB record : stStbprpBPage.getRecords()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue