四管-闸门监控
parent
cd2ccf7bb6
commit
51432e49ed
|
|
@ -1,28 +1,42 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.GateHisPageSo;
|
||||
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
|
||||
import com.gunshi.project.xyt.entity.vo.GateValveOplogVo;
|
||||
import com.gunshi.project.xyt.model.GateValveKey;
|
||||
import com.gunshi.project.xyt.model.GateValveOplog;
|
||||
import com.gunshi.project.xyt.model.GateValveReal;
|
||||
import com.gunshi.project.xyt.service.GateValveRealService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import com.ruoyi.web.controller.common.CommonController;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: 闸阀开关表
|
||||
|
|
@ -34,10 +48,12 @@ import java.util.Map;
|
|||
@RequestMapping(value="/gateValveReal")
|
||||
public class GateValveRealController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GateValveRealController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private GateValveRealService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<GateValveReal> insert(@Validated(Insert.class) @RequestBody GateValveReal dto) {
|
||||
|
|
@ -82,6 +98,70 @@ public class GateValveRealController {
|
|||
return R.ok(service.logPage(so));
|
||||
}
|
||||
|
||||
@Operation(summary = "闸阀操作日志-导出")
|
||||
@PostMapping("/log/exp")
|
||||
public void logexp(@RequestBody GateHisPageSo so, HttpServletResponse response) {
|
||||
so.getPageSo().setPageSize(1000000);
|
||||
Page<GateValveOplogVo> gateValveOplogVoPage = service.logPage(so);
|
||||
|
||||
try {
|
||||
// 设置响应
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("闸阀操作日志_" + System.currentTimeMillis(), "UTF-8")
|
||||
.replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
|
||||
// 自定义表头样式
|
||||
WriteCellStyle headStyle = new WriteCellStyle();
|
||||
headStyle.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex());
|
||||
headStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
// 自定义内容样式
|
||||
WriteCellStyle contentStyle = new WriteCellStyle();
|
||||
contentStyle.setWrapped(true); // 自动换行
|
||||
List<List<String>> headlist= Arrays.asList(
|
||||
Arrays.asList("闸阀名称"),
|
||||
Arrays.asList("操作人"),
|
||||
Arrays.asList("操作时间"),
|
||||
Arrays.asList("操作内容"),
|
||||
Arrays.asList("设定开度"),
|
||||
Arrays.asList("操作前开度")
|
||||
);
|
||||
// 构建导出器
|
||||
EasyExcel.write(response.getOutputStream())
|
||||
.head(headlist) // 自定义表头
|
||||
.registerWriteHandler(new HorizontalCellStyleStrategy(headStyle, contentStyle))
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 自动列宽
|
||||
.sheet("闸阀操作日志")
|
||||
.doWrite(gateValveOplogVoPage.getRecords());
|
||||
}catch (Exception e){
|
||||
log.error("导出异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "闸阀操作日志-分页")
|
||||
@PostMapping("/log/loglist")
|
||||
public R<List<GateValveOplogVo>> loglist(@RequestBody GateHisPageSo so) {
|
||||
List<GateStautsVo> gateStautsVos = service.gateStatusList();
|
||||
if(CollectionUtil.isEmpty(gateStautsVos)){
|
||||
return R.ok(null);
|
||||
}
|
||||
List<GateValveOplogVo> collect = gateStautsVos.stream().map(e -> {
|
||||
GateValveOplogVo vo = new GateValveOplogVo();
|
||||
GateValveOplog loginfo = service.loginfo(e.getValveCode());
|
||||
if(Objects.nonNull(loginfo)){
|
||||
BeanUtils.copyProperties(loginfo, vo);
|
||||
}
|
||||
vo.setValveCode(e.getValveCode());
|
||||
vo.setValveName(e.getValveName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return R.ok(collect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "闸阀操作日志-导出")
|
||||
@PostMapping("/log/export")
|
||||
|
|
|
|||
|
|
@ -1,23 +1,25 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.so.PicQuerySo;
|
||||
import com.gunshi.project.xyt.entity.so.RealRainBaseSo;
|
||||
import com.gunshi.project.xyt.entity.so.ReservoirWaterCommonSo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
|
||||
import com.gunshi.project.xyt.entity.vo.AttRvMonitorDetailVo;
|
||||
import com.gunshi.project.xyt.entity.vo.StRsvrVo;
|
||||
import com.gunshi.project.xyt.model.StImgR;
|
||||
import com.gunshi.project.xyt.model.StImgRReal;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.service.ReservoirWaterService;
|
||||
import com.gunshi.project.xyt.entity.vo.*;
|
||||
import com.gunshi.project.xyt.model.*;
|
||||
import com.gunshi.project.xyt.service.*;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
|
@ -25,7 +27,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
|
|
@ -43,6 +53,21 @@ public class ReservoirWaterController {
|
|||
@Autowired
|
||||
private ReservoirWaterService reservoirWaterService;
|
||||
|
||||
@Autowired
|
||||
private RealRainService realRainService;
|
||||
|
||||
@Autowired
|
||||
private StWaterRRealService stWaterRRealService;
|
||||
|
||||
@Autowired
|
||||
private ResMonthEcoFlowService resMonthEcoFlowService;
|
||||
|
||||
@Autowired
|
||||
private StRsvrRService stRsvrRService;
|
||||
|
||||
@Autowired
|
||||
private StPptnRService stPptnRService;
|
||||
|
||||
@Post(path = "/rz", summary = "水库水位")
|
||||
public R<StRsvrVo> rz(@RequestBody ReservoirWaterCommonSo reservoirWaterCommonSo) {
|
||||
return R.ok(reservoirWaterService.rz(reservoirWaterCommonSo));
|
||||
|
|
@ -75,9 +100,45 @@ public class ReservoirWaterController {
|
|||
|
||||
@Post(path = "/data", summary = "闸阀总览-库容曲线")
|
||||
public R<List<AttResMonitorVo>> data(@RequestBody @Validated DataQueryCommonSo dataQueryCommonSo) {
|
||||
dataQueryCommonSo.setStcd("61610700");//檀树岗水库
|
||||
return R.ok(reservoirWaterService.data(dataQueryCommonSo));
|
||||
}
|
||||
|
||||
@Post(path = "/waterInfo", summary = "闸阀总览-库容曲线")
|
||||
public R<AttResMonitorVo> waterInfo(@RequestBody DataQueryCommonSo dataQueryCommonSo) {
|
||||
AttResMonitorVo attResMonitorVo = new AttResMonitorVo();
|
||||
|
||||
LambdaQueryWrapper<StRsvrR> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(StRsvrR::getStcd,"61610700").orderByDesc(StRsvrR::getTm).last(" limit 1");
|
||||
List<StRsvrR> list1 = stRsvrRService.list(qw);
|
||||
if(CollectionUtils.isNotEmpty(list1)){
|
||||
attResMonitorVo.setRz(new BigDecimal(list1.get(0).getRz()));
|
||||
attResMonitorVo.setTm(list1.get(0).getTm());
|
||||
}
|
||||
LambdaQueryWrapper<StPptnR> qw2= new LambdaQueryWrapper<>();
|
||||
qw2.eq(StPptnR::getStcd,"61610700").gt(StPptnR::getDyp,"0").orderByDesc(StPptnR::getTm).last(" limit 1");
|
||||
List<StPptnR> list3 = stPptnRService.list(qw2);
|
||||
if(Objects.nonNull(list3)){
|
||||
attResMonitorVo.setTodayRainNum(new BigDecimal(list3.get(0).getDyp()));
|
||||
attResMonitorVo.setTodayRainNumTm(list3.get(0).getTm());
|
||||
}
|
||||
|
||||
List<StWaterRReal> list2 = stWaterRRealService.listRelated();
|
||||
if(CollectionUtils.isNotEmpty(list2)){
|
||||
// 获取当月核定流量
|
||||
ResMonthEcoFlow resMonthEcoFlow = resMonthEcoFlowService.getOne(new QueryWrapper<ResMonthEcoFlow>().eq("month", Calendar.getInstance().get(Calendar.MONTH) + 1));
|
||||
if(ObjectUtils.isNotEmpty(resMonthEcoFlow)){
|
||||
for(StWaterRReal real : list2){
|
||||
real.setResMonthEcoFlow(resMonthEcoFlow);
|
||||
}
|
||||
}
|
||||
StWaterRReal stWaterRReal = list2.stream().max((o1, o2) -> o1.getTm().compareTo(o2.getTm())).orElse(new StWaterRReal());
|
||||
attResMonitorVo.setOutPowerNum(stWaterRReal.getQ());
|
||||
attResMonitorVo.setOutPowerNumTm(stWaterRReal.getTm());
|
||||
}
|
||||
return R.ok(attResMonitorVo);
|
||||
}
|
||||
|
||||
@Post(path = "/data/page", summary = "分页库容曲线")
|
||||
public R<Page<AttResMonitorVo>> dataPage(@RequestBody @Validated PicQuerySo picQuerySo) {
|
||||
return R.ok(reservoirWaterService.dataPage(picQuerySo));
|
||||
|
|
|
|||
|
|
@ -93,11 +93,18 @@ public class TermiteSurveyController extends AbstractCommonFileController{
|
|||
return R.ok(countMap);
|
||||
}
|
||||
|
||||
//所有点 去除空的
|
||||
long pileNumberCount = records.stream()
|
||||
.map(TermiteSurveyDetail::getPileNumber).filter(e -> StringUtils.isNotEmpty(e))
|
||||
.collect(Collectors.toSet()).stream().count();
|
||||
countMap.put("totalPoint", pileNumberCount);
|
||||
page.getPageSo().setPageSize(1000000);
|
||||
page.setPileNumber(null);
|
||||
page.setSearchDate(null);
|
||||
Page<TermiteSurveyDetail> totalPage = termiteSurveyDetailService.pageQuery(page);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(totalPage.getRecords())){
|
||||
//所有点 去除空的
|
||||
long pileNumberCount = totalPage.getRecords().stream()
|
||||
//.map(TermiteSurveyDetail::getPileNumber).filter(e -> StringUtils.isNotEmpty(e))
|
||||
.collect(Collectors.toSet()).stream().count();
|
||||
countMap.put("totalPoint", pileNumberCount);
|
||||
}
|
||||
|
||||
|
||||
//有危害 && 未处置
|
||||
|
|
|
|||
|
|
@ -55,5 +55,29 @@ public class AttResMonitorVo {
|
|||
@Schema(description="库容")
|
||||
private BigDecimal w;
|
||||
|
||||
/**
|
||||
* 今日雨量
|
||||
*/
|
||||
@Schema(description="今日雨量")
|
||||
private BigDecimal todayRainNum;
|
||||
|
||||
/**
|
||||
* 今日雨量
|
||||
*/
|
||||
@Schema(description="今日雨量")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date todayRainNumTm;
|
||||
|
||||
/**
|
||||
* 灌溉发电流量
|
||||
*/
|
||||
@Schema(description="灌溉发电流量")
|
||||
private BigDecimal outPowerNum;
|
||||
|
||||
/**
|
||||
* 灌溉发电流量
|
||||
*/
|
||||
@Schema(description="灌溉发电流量")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date outPowerNumTm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,12 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|||
<script>
|
||||
select t.stcd,t.tm,t.rz from public.st_rsvr_r t
|
||||
where t.stcd = #{obj.stcd}
|
||||
<if test="obj.stm != null ">
|
||||
and t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
<if test="obj.etm != null ">
|
||||
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
and TRIM(TO_CHAR(t.tm, 'MI:SS')) = '00:00'
|
||||
order by t.tm desc
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ public interface GateValveRealMapper extends BaseMapper<GateValveReal> {
|
|||
case when t.before_status = '100%' then '全开' when t.before_status = '0%' then '关' else t.before_status end as beforeStatus
|
||||
from public.gate_valve_oplog t
|
||||
left join public.att_gate_valve s on t.valve_code = s.valve_code
|
||||
where t.valve_code = #{obj.valveCode}
|
||||
where 1=1
|
||||
<if test="obj.valveCode != null">
|
||||
and t.valve_code = #{obj.valveCode}
|
||||
</if>
|
||||
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ public interface RealRainMapper {
|
|||
t3.res_code,
|
||||
t3.res_name,
|
||||
t1.lgtd,
|
||||
t1.lttd
|
||||
t1.lttd,
|
||||
t1.tm
|
||||
from st_stbprp_b t1
|
||||
left join att_res_base t3 on t3.stcd = t1.stcd
|
||||
left join st_addvcd_d s1 on s1.adcd = t1.adcd
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.gunshi.project.xyt.util.ExcelUtil;
|
|||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -107,6 +108,17 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
|
|||
return baseMapper.logPage(so.getPageSo().toPage(),so);
|
||||
}
|
||||
|
||||
public GateValveOplog loginfo(String code) {
|
||||
if(StringUtils.isBlank(code)){
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<GateValveOplogVo> qw = new LambdaQueryWrapper();
|
||||
qw.eq(GateValveOplogVo::getValveCode,code);
|
||||
qw.orderByDesc(GateValveOplogVo::getTm).last("LIMIT 1");
|
||||
List<GateValveOplog> list = gateValveOplogAutoDao.list();
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
public void logExport(GateHisPageSo so, HttpServletResponse response) {
|
||||
List<GateValveOplogVo> logList = baseMapper.logList(so);
|
||||
ExcelUtil.exportExcel(logList,"闸阀操作日志",GateValveOplogVo.class,response,"闸阀操作日志");
|
||||
|
|
|
|||
Loading…
Reference in New Issue