全周期档案;河道水情
parent
dcca6f9352
commit
59fb387388
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.xyt.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.entity.vo.ProjectEventsVo;
|
||||
import com.gunshi.project.xyt.model.ProjectEvents;
|
||||
import com.gunshi.project.xyt.service.ProjectEventsService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
|
|
@ -61,6 +62,12 @@ public class ProjectEventsController extends AbstractCommonFileController{
|
|||
return R.ok(service.pageQuery(page));
|
||||
}
|
||||
|
||||
@Operation(summary = "全周期档案")
|
||||
@PostMapping("/doc/page")
|
||||
public R<Page<ProjectEventsVo>> filePage(@RequestBody @Validated CommonDataPageSo page) {
|
||||
return R.ok(service.filePage(page));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "ProjectEvents";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.gunshi.core.annotation.Get;
|
||||
import com.gunshi.core.annotation.Post;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvBaseVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvMonitorDetailVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvMonitorVo;
|
||||
import com.gunshi.project.xyt.model.StZqrlB;
|
||||
import com.gunshi.project.xyt.service.RiverWaterService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Created by wanyan on 2024/2/21
|
||||
*
|
||||
* @author wanyan
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/river/water")
|
||||
@Tag(name = "河道水情")
|
||||
public class RiverWaterController {
|
||||
|
||||
@Autowired
|
||||
private RiverWaterService riverWaterService;
|
||||
|
||||
@Post(path = "/list", summary = "河道水情列表")
|
||||
public R<List<AttRvBaseVo>> list() {
|
||||
return R.ok(riverWaterService.list());
|
||||
}
|
||||
|
||||
@Get(path = "/zqrl", summary = "水位流量关系")
|
||||
public R<List<StZqrlB>> zqrl(@Schema(name = "stcd") @RequestParam("stcd") String stcd) {
|
||||
return R.ok(riverWaterService.zqrl(stcd));
|
||||
}
|
||||
|
||||
|
||||
@Post(path = "/monitor/data", summary = "监测数据")
|
||||
public R<List<AttRvMonitorVo>> monitorData(@RequestBody @Validated DataQueryCommonSo dataQueryCommonSo) {
|
||||
return R.ok(riverWaterService.monitorData(dataQueryCommonSo));
|
||||
}
|
||||
|
||||
@Get(path = "/detail", summary = "监测详细数据(下方表格)")
|
||||
public R<AttRvMonitorDetailVo> detail(@Schema(name = "stcd") @RequestParam("stcd") String stcd) {
|
||||
return R.ok(riverWaterService.detail(stcd));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import com.gunshi.project.xyt.entity.so.StStbprpBPage;
|
|||
import com.gunshi.project.xyt.entity.so.StStbprpBSo;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeStStbprpBVo;
|
||||
import com.gunshi.project.xyt.entity.vo.StStatusListVo;
|
||||
import com.gunshi.project.xyt.entity.vo.StStatusVo;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.service.StStbprpBService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
|
|
@ -127,4 +128,10 @@ public class StStbprpBController {
|
|||
public R<StStatusListVo> statusList() {
|
||||
return R.ok(service.statusList());
|
||||
}
|
||||
|
||||
@Operation(summary = "雨情站点下拉")
|
||||
@PostMapping("/rain/list")
|
||||
public R<List<StStatusVo>> rainList() {
|
||||
return R.ok(service.rainList());
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Created by wanyan on 2024/3/19
|
||||
|
|
@ -27,4 +29,7 @@ public class CommonDataPageSo {
|
|||
@Schema(description = "时间范围")
|
||||
private DateRangeSo dateSo;
|
||||
|
||||
@Schema(description = "类型(1大事记 2调度指令 3维修养护 4安全鉴定 5除险加固 6白蚁普查)")
|
||||
private List<Integer> types;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,127 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 河道水情
|
||||
* Created by wanyan on 2024/2/20
|
||||
*
|
||||
* @author wanyan
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AttRvBaseVo {
|
||||
|
||||
/**
|
||||
* 测站编码
|
||||
*/
|
||||
@Schema(description = "测站编码")
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
* 测站名称
|
||||
*/
|
||||
@Schema(description = "测站名称")
|
||||
private String stnm;
|
||||
|
||||
/**
|
||||
* 站类
|
||||
*/
|
||||
@Schema(description = "站类(RR水库水文站 ZQ,ZP河道水文站)")
|
||||
private String sttp;
|
||||
|
||||
/**
|
||||
* 来源
|
||||
*/
|
||||
@Schema(description = "来源")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
/**
|
||||
* 行政区划代码
|
||||
*/
|
||||
@Schema(description="行政区划代码")
|
||||
private String adcd;
|
||||
|
||||
/**
|
||||
* 行政区划名称
|
||||
*/
|
||||
@Schema(description="行政区划名称")
|
||||
private String adnm;
|
||||
|
||||
|
||||
/**
|
||||
* 河流名称
|
||||
*/
|
||||
@Schema(description = "河流名称")
|
||||
private String rvnm;
|
||||
|
||||
/**
|
||||
* 流域名称
|
||||
*/
|
||||
@Schema(description="流域名称")
|
||||
private String lyname;
|
||||
|
||||
/**
|
||||
* 站址
|
||||
*/
|
||||
@Schema(description="站址")
|
||||
private String stlc;
|
||||
|
||||
/**
|
||||
* 监测时间
|
||||
*/
|
||||
@Schema(description="监测时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date tm;
|
||||
|
||||
/**
|
||||
* 水位涨跌情况
|
||||
*/
|
||||
@Schema(description="水位涨跌情况(0无变化 1涨 2跌)")
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 监测水位
|
||||
*/
|
||||
@Schema(description="监测水位")
|
||||
private BigDecimal z;
|
||||
|
||||
@Schema(description="警戒水位")
|
||||
private BigDecimal wrz;
|
||||
|
||||
@Schema(description="危险水位")
|
||||
private BigDecimal grz;
|
||||
|
||||
/**
|
||||
* 图片路径
|
||||
*/
|
||||
@Schema(description = "图片路径")
|
||||
private String imgPath;
|
||||
|
||||
@Schema(description="是否超危险水位(0否 1是)")
|
||||
private Integer gstate;
|
||||
|
||||
@Schema(description="是否超警戒水位(0否 1是)")
|
||||
private Integer wstate;
|
||||
|
||||
@Schema(description = "建站日期")
|
||||
private String esstym;
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 河道监测数据
|
||||
* Created by wanyan on 2024/2/20
|
||||
*
|
||||
* @author wanyan
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AttRvMonitorVo {
|
||||
|
||||
/**
|
||||
* 测站编码
|
||||
*/
|
||||
@Schema(description = "测站编码")
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
* 监测时间
|
||||
*/
|
||||
@Schema(description="监测时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date tm;
|
||||
|
||||
/**
|
||||
* 雨量
|
||||
*/
|
||||
@Schema(description="雨量")
|
||||
private BigDecimal drp;
|
||||
|
||||
/**
|
||||
* 监测水位
|
||||
*/
|
||||
@Schema(description="监测水位")
|
||||
private BigDecimal z;
|
||||
|
||||
/**
|
||||
* 实测流量
|
||||
*/
|
||||
@Schema(description="实测流量")
|
||||
private BigDecimal q;
|
||||
|
||||
/**
|
||||
* 转换流量
|
||||
*/
|
||||
@Schema(description="转换流量")
|
||||
private BigDecimal tq;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.model.FileAssociations;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProjectEventsVo {
|
||||
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@Schema(description="发生日期")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
private Date eventsDate;
|
||||
|
||||
@Schema(description="类型(1大事记 2调度指令 3维修养护 4安全鉴定 5除险加固 6白蚁普查)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description="事件内容描述")
|
||||
private String eventsDesc;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "文件集合")
|
||||
private List<FileAssociations> files;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
|||
import com.gunshi.project.xyt.entity.so.PicQuerySo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvBaseVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvMonitorVo;
|
||||
import com.gunshi.project.xyt.model.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -93,13 +95,20 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|||
""")
|
||||
AttResMonitorVo latestRz(@Param("stcd") String stcd);
|
||||
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.rz from public.st_rsvr_r t
|
||||
select
|
||||
<if test="obj.type == 1 ">
|
||||
t.z from public.st_river_r t
|
||||
</if>
|
||||
<if test="obj.type == 2">
|
||||
t.rz from public.st_rsvr_r t
|
||||
</if>
|
||||
where t.stcd = #{stcd} and t.tm = #{dateTime}
|
||||
</script>
|
||||
""")
|
||||
BigDecimal oldRz(@Param("stcd") String stcd,@Param("dateTime") Date dateTime);
|
||||
BigDecimal oldRz(@Param("stcd") String stcd,@Param("type") Integer type, @Param("dateTime") Date dateTime);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
|
|
@ -134,4 +143,59 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|||
</script>
|
||||
""")
|
||||
Page<StImgR> imageInfo(@Param("page") Page<StImgR> page ,@Param("obj") PicQuerySo picQuerySo);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.stcd,t.stnm,COALESCE(t.clgtd,t.lgtd) as lgtd,
|
||||
COALESCE(t.clttd,t.lttd) as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z,s.q,sad.adnm,abb.bas_name as lyname,
|
||||
srb.wrz,srb.grz,srb.invrz,srb.invrztm,case when srb.grz is not null and s.z-srb.grz > 0 then 1 else 0 end as gstate,
|
||||
case when srb.grz is not null and s.z-srb.grz > 0 then 0 when srb.wrz is not null and s.z-srb.wrz > 0 then 1 else 0 end as wstate
|
||||
from public.st_stbprp_b t
|
||||
left join public.st_river_r_real s on t.stcd = s.stcd
|
||||
left join public.st_addvcd_d sad on t.adcd = sad.adcd
|
||||
left join public.att_bas_base abb on t.lyid = abb.bas_code
|
||||
left join public.st_rvfcch_b srb on t.stcd = srb.stcd
|
||||
where t.sttp = 'ZQ'
|
||||
order by gstate desc,wstate desc,s.tm desc nulls last
|
||||
</script>
|
||||
""")
|
||||
List<AttRvBaseVo> queryWaterList();
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.stcd,t.tm,t.drp from public.st_pptn_r t
|
||||
where t.stcd = #{obj.stcd}
|
||||
and t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
|
||||
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
|
||||
order by t.tm desc
|
||||
</script>
|
||||
""")
|
||||
List<AttRvMonitorVo> drp(@Param("obj") DataQueryCommonSo dataQueryCommonSo);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.stcd,t.tm,t.z,t.q from public.st_river_r t
|
||||
where t.stcd = #{obj.stcd}
|
||||
and t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
|
||||
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
|
||||
order by t.tm desc
|
||||
</script>
|
||||
""")
|
||||
List<AttRvMonitorVo> rz(@Param("obj") DataQueryCommonSo dataQueryCommonSo);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.tm,
|
||||
<if test="type == 1">
|
||||
t.z from public.st_river_r_real t
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
t.rz as z from public.st_rsvr_r_real t
|
||||
</if>
|
||||
where t.stcd = #{stcd}
|
||||
order by t.TM desc limit 1
|
||||
</script>
|
||||
""")
|
||||
AttRvMonitorVo latestRz(@Param("stcd") String stcd, @Param("type") Integer type);
|
||||
|
||||
}
|
||||
|
|
@ -56,4 +56,25 @@ public interface FileAssociationsMapper extends BaseMapper<FileAssociations> {
|
|||
</script>
|
||||
""")
|
||||
List<FileAssociations> queryFileList(@Param("businessId") String businessId,@Param("tableName") String tableName,@Param("type") String type);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
SELECT
|
||||
fa.*,
|
||||
fd.file_name,
|
||||
fd.file_size,
|
||||
fd.file_path
|
||||
FROM
|
||||
file_associations fa
|
||||
LEFT JOIN file_descriptor fd ON fa.file_id = fd.file_id
|
||||
WHERE
|
||||
fa.del = '1'
|
||||
AND fa.business_id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
ORDER BY fa.tm desc
|
||||
</script>
|
||||
""")
|
||||
List<FileAssociations> getFilesByIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
|
@ -1,10 +1,95 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.entity.vo.ProjectEventsVo;
|
||||
import com.gunshi.project.xyt.model.ProjectEvents;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProjectEventsMapper extends BaseMapper<ProjectEvents> {
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
|
||||
select t.id,t.events_date,t.events_desc,1 as type from public.project_events t
|
||||
<where>
|
||||
<if test="obj.dateSo != null and obj.dateSo.start != null">
|
||||
t.events_date <![CDATA[>=]]> #{obj.dateSo.start}
|
||||
</if>
|
||||
<if test="obj.dateSo != null and obj.dateSo.end != null">
|
||||
and t.events_date <![CDATA[<=]]> #{obj.dateSo.end}
|
||||
</if>
|
||||
</where>
|
||||
</script>
|
||||
""")
|
||||
List<ProjectEventsVo> eventList(@Param("obj") CommonDataPageSo page);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
|
||||
select t.id,t.report_time as eventsDate,t.maintain_content as eventsDesc,3 as type from public.maintain_service t
|
||||
<where>
|
||||
<if test="obj.dateSo != null and obj.dateSo.start != null">
|
||||
t.report_time <![CDATA[>=]]> #{obj.dateSo.start}
|
||||
</if>
|
||||
<if test="obj.dateSo != null and obj.dateSo.end != null">
|
||||
and t.report_time <![CDATA[<=]]> #{obj.dateSo.end}
|
||||
</if>
|
||||
</where>
|
||||
</script>
|
||||
""")
|
||||
List<ProjectEventsVo> maintainList(@Param("obj") CommonDataPageSo page);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
|
||||
select t.id,t.identify_date as eventsDate,t.main_problem as eventsDesc,4 as type from public.safety_identify t
|
||||
<where>
|
||||
<if test="obj.dateSo != null and obj.dateSo.start != null">
|
||||
t.identify_date <![CDATA[>=]]> #{obj.dateSo.start}
|
||||
</if>
|
||||
<if test="obj.dateSo != null and obj.dateSo.end != null">
|
||||
and t.identify_date <![CDATA[<=]]> #{obj.dateSo.end}
|
||||
</if>
|
||||
</where>
|
||||
</script>
|
||||
""")
|
||||
List<ProjectEventsVo> safetyList(@Param("obj") CommonDataPageSo page);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
|
||||
select t.id,t.start_date as eventsDate,t.construct_content as eventsDesc,5 as type from public.safety_reinforcement t
|
||||
<where>
|
||||
<if test="obj.dateSo != null and obj.dateSo.start != null">
|
||||
t.start_date <![CDATA[>=]]> #{obj.dateSo.start}
|
||||
</if>
|
||||
<if test="obj.dateSo != null and obj.dateSo.end != null">
|
||||
and t.start_date <![CDATA[<=]]> #{obj.dateSo.end}
|
||||
</if>
|
||||
</where>
|
||||
</script>
|
||||
""")
|
||||
List<ProjectEventsVo> reinforceList(@Param("obj") CommonDataPageSo page);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
|
||||
select t.id,t.report_date as eventsDate,6 as type from public.termite_survey t
|
||||
<where>
|
||||
<if test="obj.dateSo != null and obj.dateSo.start != null">
|
||||
and t.report_date <![CDATA[>=]]> #{obj.dateSo.start}
|
||||
</if>
|
||||
<if test="obj.dateSo != null and obj.dateSo.end != null">
|
||||
and t.report_date <![CDATA[<=]]> #{obj.dateSo.end}
|
||||
</if>
|
||||
</where>
|
||||
</script>
|
||||
""")
|
||||
List<ProjectEventsVo> termiteList(@Param("obj") CommonDataPageSo page);
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ package com.gunshi.project.xyt.service;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.FileAssociationsMapper;
|
||||
|
|
@ -15,7 +14,6 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -177,4 +175,7 @@ public class FileAssociationsService extends ServiceImpl<FileAssociationsMapper,
|
|||
return this.remove(new QueryWrapper<FileAssociations>().in("business_id", businessIds));
|
||||
}
|
||||
|
||||
public List<FileAssociations> getFilesByIds(List<String> ids) {
|
||||
return this.baseMapper.getFilesByIds(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,26 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.entity.vo.ProjectEventsVo;
|
||||
import com.gunshi.project.xyt.mapper.ProjectEventsMapper;
|
||||
import com.gunshi.project.xyt.model.FileAssociations;
|
||||
import com.gunshi.project.xyt.model.ProjectEvents;
|
||||
import com.gunshi.project.xyt.util.DataHandleUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: 工程大事记
|
||||
|
|
@ -107,6 +111,50 @@ public class ProjectEventsService extends ServiceImpl<ProjectEventsMapper, Proje
|
|||
fillAttach(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public Page<ProjectEventsVo> filePage(CommonDataPageSo page) {
|
||||
Page<ProjectEventsVo> res = new Page<>();
|
||||
List<ProjectEventsVo> list = new ArrayList<>();
|
||||
List<Integer> types = page.getTypes();
|
||||
if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(1)){
|
||||
List<ProjectEventsVo> projectEventsVos = this.baseMapper.eventList(page);
|
||||
list.addAll(projectEventsVos);
|
||||
}
|
||||
if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(3)){
|
||||
List<ProjectEventsVo> projectEventsVos = this.baseMapper.maintainList(page);
|
||||
list.addAll(projectEventsVos);
|
||||
}
|
||||
if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(4)){
|
||||
List<ProjectEventsVo> projectEventsVos = this.baseMapper.safetyList(page);
|
||||
list.addAll(projectEventsVos);
|
||||
}
|
||||
if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(5)){
|
||||
List<ProjectEventsVo> projectEventsVos = this.baseMapper.reinforceList(page);
|
||||
list.addAll(projectEventsVos);
|
||||
}
|
||||
if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(6)){
|
||||
List<ProjectEventsVo> projectEventsVos = this.baseMapper.termiteList(page);
|
||||
list.addAll(projectEventsVos);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
fillFile(list);
|
||||
list = list.stream().sorted(Comparator.comparing(ProjectEventsVo::getEventsDate).reversed()).collect(Collectors.toList());
|
||||
List<ProjectEventsVo> paginate = DataHandleUtil.paginate(list, page.getPageSo().getPageNumber(), page.getPageSo().getPageSize());
|
||||
res.setRecords(paginate);
|
||||
}
|
||||
res.setCurrent(page.getPageSo().getPageNumber());
|
||||
res.setTotal(list.size());
|
||||
return res;
|
||||
}
|
||||
|
||||
private void fillFile(List<ProjectEventsVo> list) {
|
||||
List<String> ids = list.stream().map(ProjectEventsVo::getId).map(Objects::toString).collect(Collectors.toList());
|
||||
List<FileAssociations> files = fileService.getFilesByIds(ids);
|
||||
Map<String, List<FileAssociations>> map = files.stream().collect(Collectors.groupingBy(FileAssociations::getBusinessId));
|
||||
for (ProjectEventsVo vo : list){
|
||||
vo.setFiles(map.get(vo.getId().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class ReservoirWaterService {
|
|||
//最新水位时间往前推24小时水位
|
||||
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||
LocalDateTime dateTime = now.minusDays(1);
|
||||
BigDecimal oldRz = attResBaseMapper.oldRz(stcd,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
BigDecimal oldRz = attResBaseMapper.oldRz(stcd,1,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
|
||||
if(oldRz == null){
|
||||
return vo;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,165 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvBaseVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvMonitorDetailVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvMonitorVo;
|
||||
import com.gunshi.project.xyt.entity.vo.StPptnDetailsVo;
|
||||
import com.gunshi.project.xyt.mapper.AttResBaseMapper;
|
||||
import com.gunshi.project.xyt.mapper.StZqrlBMapper;
|
||||
import com.gunshi.project.xyt.model.StZqrlB;
|
||||
import com.gunshi.project.xyt.util.DataHandleUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Created by wanyan on 2024/2/21
|
||||
*
|
||||
* @author wanyan
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RiverWaterService {
|
||||
|
||||
@Resource
|
||||
private AttResBaseMapper attRvBaseMapper;
|
||||
|
||||
@Resource
|
||||
private StZqrlBMapper stZqrlBMapper;
|
||||
|
||||
@Resource
|
||||
private RainBasinDivisionService rainBasinDivisionService;
|
||||
|
||||
public List<AttRvBaseVo> list() {
|
||||
List<AttRvBaseVo> attRvBaseVos = attRvBaseMapper.queryWaterList();
|
||||
if(CollectionUtils.isEmpty(attRvBaseVos)){
|
||||
return attRvBaseVos;
|
||||
}
|
||||
return attRvBaseVos;
|
||||
}
|
||||
|
||||
public List<StZqrlB> zqrl(String stcd) {
|
||||
LambdaQueryWrapper<StZqrlB> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(StZqrlB::getStcd, stcd);
|
||||
return stZqrlBMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
public List<AttRvMonitorVo> monitorData(DataQueryCommonSo dataQueryCommonSo) {
|
||||
String stcd = dataQueryCommonSo.getStcd();
|
||||
//雨量数据
|
||||
List<AttRvMonitorVo> drpData = attRvBaseMapper.drp(dataQueryCommonSo);
|
||||
//水位数据
|
||||
List<AttRvMonitorVo> rzData = attRvBaseMapper.rz(dataQueryCommonSo);
|
||||
//获取水位流量关系,算出转换流量
|
||||
List<StZqrlB> zqrl = zqrl(stcd);
|
||||
if(CollectionUtils.isNotEmpty(zqrl)){
|
||||
calcTqData(rzData,zqrl);
|
||||
}
|
||||
//根据监测时间合并雨量和水位数据
|
||||
return bindData(stcd,drpData,rzData);
|
||||
}
|
||||
|
||||
private List<AttRvMonitorVo> bindData(String stcd, List<AttRvMonitorVo> drpData, List<AttRvMonitorVo> rzData) {
|
||||
HashSet<Date> strings = new HashSet<>();
|
||||
drpData.stream().forEach(v1 -> strings.add(v1.getTm()));
|
||||
rzData.stream().forEach(v1 -> strings.add(v1.getTm()));
|
||||
|
||||
ArrayList<AttRvMonitorVo> result = new ArrayList<>();
|
||||
strings.stream().forEach(v1 -> result.add(AttRvMonitorVo.builder().stcd(stcd).tm(v1).build()));
|
||||
|
||||
List<AttRvMonitorVo> list = result.stream().map(v1 -> {
|
||||
drpData.stream().filter(v2 -> v1.getTm().equals(v2.getTm())).forEach(v2 -> {
|
||||
v1.setDrp(v2.getDrp());
|
||||
});
|
||||
|
||||
rzData.stream().filter(v2 -> v1.getTm().equals(v2.getTm())).forEach(v2 -> {
|
||||
v1.setZ(v2.getZ());
|
||||
v1.setQ(v2.getQ());
|
||||
v1.setTq(v2.getTq());
|
||||
});
|
||||
|
||||
return v1;
|
||||
}).collect(Collectors.toList());
|
||||
return list.stream().sorted(Comparator.comparing(AttRvMonitorVo::getTm).reversed()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void calcTqData(List<AttRvMonitorVo> rzData, List<StZqrlB> zqrl) {
|
||||
BigDecimal maxRz = zqrl.stream().max(Comparator.comparing(StZqrlB::getZ)).get().getZ();
|
||||
BigDecimal minRz = zqrl.stream().min(Comparator.comparing(StZqrlB::getZ)).get().getZ();
|
||||
Map<BigDecimal, BigDecimal> map = zqrl.stream().collect(Collectors.toMap(StZqrlB::getZ, StZqrlB::getQ));
|
||||
List<BigDecimal> list = zqrl.stream().map(StZqrlB::getZ).collect(Collectors.toList());
|
||||
for(AttRvMonitorVo vo : rzData){
|
||||
BigDecimal rz = vo.getZ();
|
||||
if(rz.compareTo(minRz) < 0 || rz.compareTo(maxRz) > 0){
|
||||
continue;
|
||||
}
|
||||
vo.setTq(DataHandleUtil.calcData(rz,map,list));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public AttRvMonitorDetailVo detail(String stcd) {
|
||||
AttRvMonitorDetailVo vo = new AttRvMonitorDetailVo();
|
||||
StPptnDetailsVo stPptnDetailsVo = rainBasinDivisionService.queryStPptnDetailsByStcd(stcd);
|
||||
BeanUtils.copyProperties(stPptnDetailsVo,vo,AttRvMonitorDetailVo.class);
|
||||
|
||||
//最新水位
|
||||
AttRvMonitorVo monitorVo = attRvBaseMapper.latestRz(stcd,2);
|
||||
if(monitorVo == null){
|
||||
return vo;
|
||||
}
|
||||
Date tm = monitorVo.getTm();
|
||||
BigDecimal rz = monitorVo.getZ();
|
||||
|
||||
//最新水位时间往前推24小时水位
|
||||
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||
LocalDateTime dateTime = now.minusDays(1);
|
||||
BigDecimal oldRz = attRvBaseMapper.oldRz(stcd,2,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
|
||||
if(oldRz == null){
|
||||
return vo;
|
||||
}
|
||||
vo.setRzDiff(rz.subtract(oldRz));
|
||||
|
||||
//本年最高水位
|
||||
BigDecimal maxYearRz = queryYearRzByStcdAndTime(stcd);
|
||||
vo.setMaxRz(maxYearRz);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private BigDecimal queryYearRzByStcdAndTime(String stcd) {
|
||||
LocalDateTime now = LocalDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault());
|
||||
LocalDateTime startTime;
|
||||
LocalDateTime endTime;
|
||||
if (now.getHour() >= 8 || (now.getHour() < 8 && now.getMonthValue() > 1) || (now.getHour() < 8 && now.getMonthValue() == 1 && now.getDayOfMonth() >= 1)){
|
||||
startTime = LocalDateTime.of(
|
||||
now.getYear(),
|
||||
1,
|
||||
1,
|
||||
8,
|
||||
0,
|
||||
0
|
||||
);
|
||||
endTime = now;
|
||||
return attRvBaseMapper.queryMaxRzByStcdAndTime(stcd,Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()), Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
}
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -109,6 +109,10 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
res.setOffLine(offLineList.stream().sorted(Comparator.comparing(StStatusVo::getTm,Comparator.nullsFirst(String::compareTo)).reversed()).collect(Collectors.toList()));
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<StStatusVo> rainList() {
|
||||
return this.baseMapper.realRainList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,5 +59,24 @@ public class DataHandleUtil {
|
|||
return list2;
|
||||
}
|
||||
|
||||
public static <T> List<T> paginate(List<T> list, int pageNumber, int pageSize) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
|
||||
int totalSize = list.size();
|
||||
int fromIndex = (pageNumber - 1) * pageSize;
|
||||
if (fromIndex >= totalSize || fromIndex < 0) {
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
|
||||
int toIndex = fromIndex + pageSize;
|
||||
if (toIndex > totalSize) {
|
||||
toIndex = totalSize;
|
||||
}
|
||||
|
||||
return list.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue