2024-07-08 17:47:02 +08:00
|
|
|
package com.gunshi.project.xyt.service;
|
|
|
|
|
|
2024-07-09 14:54:21 +08:00
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
2024-07-08 17:47:02 +08:00
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
2024-07-09 14:54:21 +08:00
|
|
|
import com.gunshi.project.xyt.entity.so.WarnPageSo;
|
|
|
|
|
import com.gunshi.project.xyt.entity.so.WarnSo;
|
|
|
|
|
import com.gunshi.project.xyt.entity.vo.OsmoticWarnVo;
|
2024-07-08 17:47:02 +08:00
|
|
|
import com.gunshi.project.xyt.mapper.OsmoticWarnRMapper;
|
|
|
|
|
import com.gunshi.project.xyt.model.OsmoticWarnR;
|
2024-07-09 14:54:21 +08:00
|
|
|
import jakarta.annotation.Resource;
|
2024-07-08 17:47:02 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
2024-07-09 14:54:21 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
2024-07-08 17:47:02 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 描述: 隐患预警记录表
|
|
|
|
|
* author: xusan
|
|
|
|
|
* date: 2024-07-08 17:30:37
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public class OsmoticWarnRService extends ServiceImpl<OsmoticWarnRMapper, OsmoticWarnR>
|
|
|
|
|
{
|
2024-07-09 14:54:21 +08:00
|
|
|
@Resource
|
|
|
|
|
private OsmoticWarnRMapper mapper;
|
2024-07-08 17:47:02 +08:00
|
|
|
|
2024-07-09 14:54:21 +08:00
|
|
|
public Page<OsmoticWarnVo> queryPage(WarnPageSo warnPageSo) {
|
|
|
|
|
return mapper.queryPage(warnPageSo.getPageSo().toPage(),warnPageSo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<Integer, Long> stat(WarnSo warnSo) {
|
|
|
|
|
LambdaQueryWrapper<OsmoticWarnR> wrapper = Wrappers.lambdaQuery();
|
|
|
|
|
if(warnSo.getType() != null){
|
|
|
|
|
wrapper.eq(OsmoticWarnR::getType,warnSo.getType());
|
|
|
|
|
}
|
|
|
|
|
if(warnSo.getLevel() != null){
|
|
|
|
|
wrapper.eq(OsmoticWarnR::getLevel,warnSo.getLevel());
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotEmpty(warnSo.getStationCode())){
|
|
|
|
|
wrapper.like(OsmoticWarnR::getStationCode,warnSo.getStationCode());
|
|
|
|
|
}
|
|
|
|
|
if(warnSo.getDateTimeRangeSo() != null && warnSo.getDateTimeRangeSo().getStart() != null){
|
|
|
|
|
wrapper.ge(OsmoticWarnR::getTm,warnSo.getDateTimeRangeSo().getStart());
|
|
|
|
|
}
|
|
|
|
|
if(warnSo.getDateTimeRangeSo() != null && warnSo.getDateTimeRangeSo().getEnd() != null){
|
|
|
|
|
wrapper.le(OsmoticWarnR::getTm,warnSo.getDateTimeRangeSo().getEnd());
|
|
|
|
|
}
|
|
|
|
|
List<OsmoticWarnR> list = this.list(wrapper);
|
|
|
|
|
return list.stream().collect(Collectors.groupingBy(OsmoticWarnR::getLevel, Collectors.counting()));
|
|
|
|
|
}
|
2024-07-08 17:47:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|