大屏变电新增功能

This commit is contained in:
hongchao 2025-01-03 15:09:29 +08:00
parent 531dfdf578
commit 8ae4663fdb
17 changed files with 1171 additions and 21 deletions

View File

@ -141,6 +141,16 @@ public class Constants {
*/
public static final Integer PARTICULATE_KEY = 119;
/**
* 沉降监测类
*/
public static final Integer DROP_KEY = 133;
/**
* 位移监测类
*/
public static final Integer SHIFT_KEY = 134;
/**
* 禁止特殊字符正则表达式
*/

View File

@ -4,10 +4,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.base.basic.config.Constants;
import com.bonus.base.basic.domain.TbWarnConfig;
import com.bonus.base.basic.service.TbWarnConfigService;
import com.bonus.base.basic.vo.ExcavationVo;
import com.bonus.base.basic.vo.InclVo;
import com.bonus.base.basic.vo.TempVo;
import com.bonus.base.basic.vo.TensVo;
import com.bonus.base.basic.vo.*;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
@ -178,6 +175,16 @@ public class TbWarnConfigController extends BaseController {
ExcelUtil<ExcavationVo> util = new ExcelUtil<>(ExcavationVo.class);
util.exportExcel(response, list, "预警配置基坑检测类导出");
}
if (tbWarnConfig.getConfiguType().equals(Constants.DROP_KEY)) {
List<DropVo> list = tbWarnConfigService.queryDropVoByPage(tbWarnConfig);
ExcelUtil<DropVo> util = new ExcelUtil<>(DropVo.class);
util.exportExcel(response, list, "预警配置沉降监测类导出");
}
if (tbWarnConfig.getConfiguType().equals(Constants.SHIFT_KEY)) {
List<ShiftVo> list = tbWarnConfigService.queryShiftVoByPage(tbWarnConfig);
ExcelUtil<ShiftVo> util = new ExcelUtil<>(ShiftVo.class);
util.exportExcel(response, list, "预警配置位移监测类导出");
}
}
}

View File

@ -0,0 +1,60 @@
package com.bonus.base.basic.entity;
import lombok.Data;
/**
* @author : 洪超
* @version : 1.0
* @PackagePath: com.bonus.data.entity
* @CreateTime: 2024-12-30 16:41
* @Description: 沉降监测数据
*/
@Data
public class SettleVo {
private String id;
// 工程id
private String proId;
// 设备编码
private String deviceName;
// 监测值
private String measureValue;
// 变化值
private String changeValue;
private Integer status;
/**
* 累加值
*/
private String accuValue;
/**
* 基础沉降
*/
private String baseValue;
/**
* 平台注册端设备主键
*/
private String deviceId;
/**
* 设备模型
*/
private String model;
/**
* 服务 ID
*/
private String serviceId;
/**
* 数据监测时间
*/
private String dataTime;
private Integer isWarn;
private String remark;
}

View File

@ -0,0 +1,36 @@
package com.bonus.base.basic.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author : 洪超
* @version : 1.0
* @PackagePath: com.bonus.data.entity
* @CreateTime: 2024-12-30 16:41
* @Description: 近电感应参数配置
*/
@Data
public class WarnElectConfigVo {
// 线路属性
private String configElectName;
// 电压等级
private String configLevelName;
// 线路属性值
private Integer configElectValue;
// 电压等级值
private Integer configLevelValue;
private Date updateTime;
private Long updateUser;
}

View File

@ -0,0 +1,61 @@
package com.bonus.base.basic.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author : 洪超
* @version : 1.0
* @PackagePath: com.bonus.data.entity
* @CreateTime: 2024-12-30 16:41
* @Description: 近电感应预警
*/
@Data
public class WarnElectVo {
private Long id;
// 工程id
private String proId;
// 工程名称
private String proName;
// 设备id
private String devId;
// 设备名称
private String devName;
// 预警类型
private String warnType;
// 预警时间
private String warnTime;
// 预警内容
private String warnContent;
@ApiModelProperty(value = "开始日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String startTime;
@ApiModelProperty(value = "结束日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String endTime;
/**
* 设备模型
*/
private String model;
/**
* 服务 ID
*/
private String serviceId;
private Integer isWarn;
private String remark;
}

View File

@ -0,0 +1,34 @@
package com.bonus.base.basic.entity;
import lombok.Data;
/**
* @author : 洪超
* @version : 1.0
* @PackagePath: com.bonus.data.entity
* @CreateTime: 2024-12-30 16:41
* @Description: 预警数据
*/
@Data
public class WarnSettleVo {
private String id;
private String warnTime;
private String warnContent;
private String warnType;
private String deviceType;
private String deviceId;
private String deviceName;
private String proId;
private String proCode;
private String remarks;
}

View File

@ -0,0 +1,30 @@
package com.bonus.base.basic.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author : 洪超
* @version : 1.0
* @PackagePath: com.bonus.data.entity
* @CreateTime: 2024-12-30 16:41
* @Description: 受限空间预警月份
*/
@Data
public class WarnSpaceMonthVo {
private int jan;
private int feb;
private int mar;
private int apr;
private int may;
private int jun;
private int jul;
private int aug;
private int sep;
private int oct;
private int nov;
private int dec;
}

View File

@ -0,0 +1,68 @@
package com.bonus.base.basic.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author : 洪超
* @version : 1.0
* @PackagePath: com.bonus.data.entity
* @CreateTime: 2024-12-30 16:41
* @Description: 受限空间预警
*/
@Data
public class WarnSpaceVo {
private Long id;
// 工程id
private String proId;
// 工程名称
private String proName;
// 设备id
private String devId;
// 设备名称
private String devName;
// 违章类型
private String warnType;
// 预警时间
private String warnTime;
// 年份
private String year;
@ApiModelProperty(value = "开始日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String startTime;
@ApiModelProperty(value = "结束日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String endTime;
//违章照片
private String warnUrl;
/**
* 设备模型
*/
private String model;
/**
* 服务 ID
*/
private String serviceId;
private Integer isWarn;
private String remark;
}

View File

@ -1,10 +1,7 @@
package com.bonus.base.basic.service;
import com.bonus.base.basic.domain.TbWarnConfig;
import com.bonus.base.basic.vo.ExcavationVo;
import com.bonus.base.basic.vo.InclVo;
import com.bonus.base.basic.vo.TempVo;
import com.bonus.base.basic.vo.TensVo;
import com.bonus.base.basic.vo.*;
import com.bonus.common.core.web.domain.AjaxResult;
import java.util.List;
@ -61,4 +58,18 @@ public interface TbWarnConfigService{
*/
List<ExcavationVo> queryExcavationVoByPage(TbWarnConfig tbWarnConfig);
/**
* 查询沉降监测类
* @param tbWarnConfig
* @return
*/
List<DropVo> queryDropVoByPage(TbWarnConfig tbWarnConfig);
/**
* 查询位移监测类
* @param tbWarnConfig
* @return
*/
List<ShiftVo> queryShiftVoByPage(TbWarnConfig tbWarnConfig);
}

View File

@ -5,10 +5,7 @@ import com.bonus.base.basic.domain.TbWarnConfig;
import com.bonus.base.basic.mapper.TbWarnConfigMapper;
import com.bonus.base.basic.service.TbWarnConfigService;
import com.bonus.base.basic.config.ExceptionEnum;
import com.bonus.base.basic.vo.ExcavationVo;
import com.bonus.base.basic.vo.InclVo;
import com.bonus.base.basic.vo.TempVo;
import com.bonus.base.basic.vo.TensVo;
import com.bonus.base.basic.vo.*;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
@ -239,6 +236,56 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
return excavationVos;
}
/**
* 查询沉降预警
* @param record
* @return
*/
@Override
public List<DropVo> queryDropVoByPage(TbWarnConfig record) {
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
ArrayList<DropVo> dropVos = new ArrayList<>();
if (list != null && list.size() > 0) {
for (TbWarnConfig tbWarnConfig : list) {
setConfigStr(tbWarnConfig);
DropVo dropVo = new DropVo();
dropVo.setConfigName(tbWarnConfig.getConfigName());
dropVo.setDevId(tbWarnConfig.getDevId());
dropVo.setMeasureThreshold(tbWarnConfig.getConfigVal1Str());
dropVo.setChangeThreshold(tbWarnConfig.getConfigVal2Str());
dropVo.setAccuThreshold(tbWarnConfig.getConfigVal3Str());
dropVo.setBaseThreshold(tbWarnConfig.getConfigVal4Str());
dropVos.add(dropVo);
}
}
return dropVos;
}
/**
* 查询位移预警
* @param record
* @return
*/
@Override
public List<ShiftVo> queryShiftVoByPage(TbWarnConfig record) {
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
ArrayList<ShiftVo> shiftVos = new ArrayList<>();
if (list != null && list.size() > 0) {
for (TbWarnConfig tbWarnConfig : list) {
setConfigStr(tbWarnConfig);
ShiftVo shiftVo = new ShiftVo();
shiftVo.setConfigName(tbWarnConfig.getConfigName());
shiftVo.setDevId(tbWarnConfig.getDevId());
shiftVo.setMeasureThreshold(tbWarnConfig.getConfigVal1Str());
shiftVo.setChangeThreshold(tbWarnConfig.getConfigVal2Str());
shiftVo.setAccuThreshold(tbWarnConfig.getConfigVal3Str());
shiftVo.setBaseThreshold(tbWarnConfig.getConfigVal4Str());
shiftVos.add(shiftVo);
}
}
return shiftVos;
}
/**
* 设置阈值组合
* @param tbWarnConfig

View File

@ -0,0 +1,31 @@
package com.bonus.base.basic.vo;
import com.bonus.base.basic.domain.TbWarnConfig;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 基坑检测类返回vo
* @Author ma_sh
* @create 2024/11/1 17:14
*/
@Data
public class DropVo extends TbWarnConfig {
@ApiModelProperty(value="测量阈值")
@Excel(name = "测量阈值")
private String measureThreshold;
@ApiModelProperty(value="变化阈值")
@Excel(name = "变化阈值")
private String changeThreshold;
@ApiModelProperty(value="累加阈值")
@Excel(name = "累加阈值")
private String accuThreshold;
@ApiModelProperty(value="基础沉降阈值")
@Excel(name = "基础沉降阈值")
private String baseThreshold;
}

View File

@ -0,0 +1,31 @@
package com.bonus.base.basic.vo;
import com.bonus.base.basic.domain.TbWarnConfig;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 基坑检测类返回vo
* @Author ma_sh
* @create 2024/11/1 17:14
*/
@Data
public class ShiftVo extends TbWarnConfig {
@ApiModelProperty(value="测量阈值")
@Excel(name = "测量阈值")
private String measureThreshold;
@ApiModelProperty(value="变化阈值")
@Excel(name = "变化阈值")
private String changeThreshold;
@ApiModelProperty(value="累加阈值")
@Excel(name = "累加阈值")
private String accuThreshold;
@ApiModelProperty(value="基础沉降阈值")
@Excel(name = "基础沉降阈值")
private String baseThreshold;
}

View File

@ -1,15 +1,23 @@
package com.bonus.base.screen.controller;
import com.bonus.base.basic.domain.TbDevAttribute;
import com.bonus.base.basic.entity.SettleVo;
import com.bonus.base.basic.entity.WarnElectConfigVo;
import com.bonus.base.basic.entity.WarnElectVo;
import com.bonus.base.basic.entity.WarnSpaceVo;
import com.bonus.base.basic.service.TbPeopleService;
import com.bonus.base.screen.service.impl.ProjectDetailsViewServiceImpl;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author : 阮世耀
@ -37,6 +45,64 @@ public class ProjectDetailsViewController extends BaseController {
return AjaxResult.success(projectDetailsViewService.queryDevInfoByProject(proId, powerId, devType));
}
/**
* 根据工程id查询相对应类型下的沉降设备信息
*/
@GetMapping("/queryDevInfoByProjectSettle")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "沉降检测设备信息")
public AjaxResult queryDevInfoByProjectSettle(Integer proId, Integer powerId, String devType) {
return AjaxResult.success(projectDetailsViewService.queryDevInfoByProjectSettle(proId, powerId, devType));
}
/**
* 根据工程id和设备id查询相对应类型下的沉降设备信息
*/
@GetMapping("/queryDevInfoSettle")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "沉降检测设备信息")
public AjaxResult queryDevInfoSettle(Integer proId, Integer deviceId) {
return AjaxResult.success(projectDetailsViewService.queryDevInfoSettle(proId, deviceId));
}
/**
* 根据工程id和设备id查询相对应类型下的位移设备信息
*/
@GetMapping("/queryDevInfoShift")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "位移检测设备信息")
public AjaxResult queryDevInfoShift(Integer proId, Integer deviceId) {
return AjaxResult.success(projectDetailsViewService.queryDevInfoShift(proId, deviceId));
}
/**
* 根据工程id查询相对应类型下的沉降预警信息
*/
@GetMapping("/queryWarnInfoSettle")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public AjaxResult queryWarnInfoSettle(Integer proId,String deviceType) {
return AjaxResult.success(projectDetailsViewService.queryWarnInfoSettle(proId, deviceType));
}
/**
* 根据工程id查询相对应类型下的历史沉降信息
*/
@GetMapping("/queryInfoSettleHistory")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public TableDataInfo queryInfoSettleHistory(SettleVo settleVo) {
startPage();
List<SettleVo> list = projectDetailsViewService.queryInfoSettleHistory(settleVo);
return getDataTable(list);
}
/**
* 根据工程id查询相对应类型下的历史位移信息
*/
@GetMapping("/queryInfoShiftHistory")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public TableDataInfo queryInfoShiftHistory(SettleVo settleVo) {
startPage();
List<SettleVo> list = projectDetailsViewService.queryInfoShiftHistory(settleVo);
return getDataTable(list);
}
/**
* 查询工程人员安全帽定位信息
* @param proId 工程id
@ -135,5 +201,86 @@ public class ProjectDetailsViewController extends BaseController {
return projectDetailsViewService.getTowerDevAttributeRecordByDay(proId);
}
/**
* 根据工程id查询受限空间预警信息
*/
@GetMapping("/queryInfoWarnSpaceList")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public TableDataInfo queryInfoWarnSpaceList(WarnSpaceVo warnSpaceVo) {
startPage();
List<WarnSpaceVo> list = projectDetailsViewService.queryInfoWarnSpaceList(warnSpaceVo);
return getDataTable(list);
}
/**
* 根据工程id查询当年受限空间预警信息
*/
@GetMapping("/queryInfoWarnSpaceMonth")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public AjaxResult queryInfoWarnSpaceMonth(WarnSpaceVo warnSpaceVo) {
return projectDetailsViewService.queryInfoWarnSpaceMonth(warnSpaceVo);
}
/**
* 根据工程id查询当年受限空间违章类型占比
*/
@GetMapping("/queryInfoWarnSpaceType")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public AjaxResult queryInfoWarnSpaceType(WarnSpaceVo warnSpaceVo) {
return projectDetailsViewService.queryInfoWarnSpaceType(warnSpaceVo);
}
/**
* 删除受限空间预警数据
*/
@ApiOperation(value = "删除受限空间预警数据")
@PostMapping("/delWarnSpace")
@SysLog(title = "大屏", businessType = OperaType.DELETE, module = "预警信息")
public AjaxResult delWarnSpace(@RequestBody WarnSpaceVo warnSpaceVo) {
return projectDetailsViewService.delWarnSpace(warnSpaceVo.getId());
}
/**
* 根据工程id查询近电感应预警信息
*/
@GetMapping("/queryInfoWarnElectList")
@SysLog(title = "大屏", businessType = OperaType.QUERY, module = "预警信息")
public TableDataInfo queryInfoWarnElectList(WarnElectVo warnElectVo) {
startPage();
List<WarnElectVo> list = projectDetailsViewService.queryInfoWarnElectList(warnElectVo);
return getDataTable(list);
}
/**
* 删除近电感应预警数据
*/
@ApiOperation(value = "删除近电感应预警数据")
@PostMapping("/delWarnElect")
@SysLog(title = "大屏", businessType = OperaType.DELETE, module = "预警信息")
public AjaxResult delWarnElect(@RequestBody WarnElectVo warnElectVo) {
return projectDetailsViewService.delWarnElect(warnElectVo.getId());
}
/**
* 获取近电感应预警配置数据
*/
@ApiOperation(value = "获取近电感应预警配置数据")
@GetMapping("/getWarnElectConfig")
@SysLog(title = "大屏", businessType = OperaType.DELETE, module = "预警信息")
public AjaxResult getWarnElectConfig(WarnElectVo warnElectVo) {
return projectDetailsViewService.getWarnElectConfig(warnElectVo);
}
/**
* 修改近电感应参数配置数据
*/
@ApiOperation(value = "修改近电感应参数配置数据")
@PostMapping("/editConfig")
@SysLog(title = "大屏", businessType = OperaType.UPDATE, module = "预警信息")
public AjaxResult editConfig(@RequestBody WarnElectConfigVo vo) {
return projectDetailsViewService.editConfig(vo);
}
}

View File

@ -1,7 +1,7 @@
package com.bonus.base.screen.mapper;
import com.bonus.base.basic.domain.TbDevAttribute;
import com.bonus.base.basic.entity.DevAttributeVo;
import com.bonus.base.basic.entity.*;
import com.bonus.base.screen.vo.DeviceWarnRecordVo;
import com.bonus.base.screen.vo.WarnPredictionRecordVo;
import org.apache.ibatis.annotations.Mapper;
@ -28,6 +28,48 @@ public interface TbDeviceDataRecord {
*/
List<Map<String,String>> queryDevInfoByProject(@Param("proId") Integer proId, @Param("powerId") Integer powerId, @Param("devType") Integer devType);
/**
* 查询工程下沉降设备信息
* @param proId 工程id
* @param powerId 杆塔id
* @param devType 设备类型code
*/
List<Map<String,String>> queryDevInfoByProjectSettle(@Param("proId") Integer proId, @Param("powerId") Integer powerId, @Param("devType") String devType);
/**
* 查询工程下和设备下沉降设备信息
* @param proId 工程id
* @param deviceId 设备id
*/
List<Map<String,String>> queryDevInfoSettle(@Param("proId") Integer proId, @Param("deviceId") Integer deviceId);
/**
* 查询工程下和设备下位移设备信息
* @param proId 工程id
* @param deviceId 设备id
*/
List<Map<String,String>> queryDevInfoShift(@Param("proId") Integer proId, @Param("deviceId") Integer deviceId);
/**
* 根据工程id查询相对应类型下的历史沉降信息
*/
List<SettleVo> queryInfoSettleHistory(SettleVo settleVo);
/**
* 根据工程id查询相对应类型下的历史沉降信息
*/
List<SettleVo> queryInfoShiftHistory(SettleVo settleVo);
/**
* 根据工程id查询相对应类型下的预警信息
* @param proId 工程id
* @param deviceType 设备类型
*/
List<Map<String,String>> queryWarnInfoSettle(@Param("proId") Integer proId, @Param("deviceType") String deviceType);
/**
* 安全隐患预测记录信息
* @param record 记录id
@ -103,4 +145,47 @@ public interface TbDeviceDataRecord {
*/
List<DevAttributeVo> getPowerDevAttributeRecordByWarn(@Param("proId") Integer proId);
/**
* 根据工程id查询受限空间预警信息
*/
List<WarnSpaceVo> queryInfoWarnSpaceList(WarnSpaceVo warnSpaceVo);
List<Map<String, Object>> queryInfoWarnSpaceMonth(WarnSpaceVo warnSpaceVo);
List<Map<String, Object>> queryInfoWarnSpaceType(WarnSpaceVo warnSpaceVo);
int delWarnSpace(Long id);
/**
* 根据工程id查近电感应预警信息
*/
List<WarnElectVo> queryInfoWarnElectList(WarnElectVo warnElectVo);
int delWarnElect(Long id);
/**
* 获取近电感应预警配置线路属性数据
*/
List<WarnElectConfigVo> getWarnElectConfig(WarnElectVo warnElectVo);
/**
* 获取近电感应预警配置电压等级数据
*/
List<WarnElectConfigVo> getWarnLevelConfig(WarnElectVo warnElectVo);
/**
* 修改线路属性参数配置
* @param vo
* @return
*/
int editConfig(WarnElectConfigVo vo);
/**
* 修改电压等级参数配置
* @param vo
* @return
*/
int editConfigLevel(WarnElectConfigVo vo);
}

View File

@ -1,16 +1,18 @@
package com.bonus.base.screen.service.impl;
import com.bonus.base.basic.entity.DevAttributeVo;
import com.bonus.base.basic.entity.*;
import com.bonus.base.screen.mapper.TbDeviceDataRecord;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.Arrays.stream;
/**
* @author : 阮世耀
* @version : 1.0
@ -35,6 +37,64 @@ public class ProjectDetailsViewServiceImpl {
return AjaxResult.success(tbDeviceDataRecordMapper.queryDevInfoByProject(proId, powerId, devType));
}
/**
* 根据工程id查询相对应类型下的沉降设备信息
* @param proId
* @param devType
* @return
*/
public AjaxResult queryDevInfoByProjectSettle(Integer proId, Integer powerId, String devType) {
return AjaxResult.success(tbDeviceDataRecordMapper.queryDevInfoByProjectSettle(proId, powerId, devType));
}
/**
* 根据工程id和设备id查询相对应类型下的沉降设备信息
* @param proId
* @param deviceId
* @return
*/
public AjaxResult queryDevInfoSettle(Integer proId, Integer deviceId) {
return AjaxResult.success(tbDeviceDataRecordMapper.queryDevInfoSettle(proId, deviceId));
}
/**
* 根据工程id和设备id查询相对应类型下的位移设备信息
* @param proId
* @param deviceId
* @return
*/
public AjaxResult queryDevInfoShift(Integer proId, Integer deviceId) {
return AjaxResult.success(tbDeviceDataRecordMapper.queryDevInfoShift(proId, deviceId));
}
/**
* 根据工程id查询相对应类型下的历史沉降信息
* @return
*/
public List<SettleVo> queryInfoSettleHistory(SettleVo settleVo) {
List<SettleVo> settleVos = tbDeviceDataRecordMapper.queryInfoSettleHistory(settleVo);
return settleVos;
}
/**
* 根据工程id查询相对应类型下的历史位移信息
* @return
*/
public List<SettleVo> queryInfoShiftHistory(SettleVo settleVo) {
List<SettleVo> settleVos = tbDeviceDataRecordMapper.queryInfoShiftHistory(settleVo);
return settleVos;
}
/**
* 根据工程id查询相对应类型下的沉降预警信息
* @param proId
* @param deviceType
* @return
*/
public AjaxResult queryWarnInfoSettle(Integer proId, String deviceType) {
return AjaxResult.success(tbDeviceDataRecordMapper.queryWarnInfoSettle(proId, deviceType));
}
public AjaxResult getDevAttributeLatestInfoById(Integer proId) {
return AjaxResult.success(tbDeviceDataRecordMapper.getDevAttributeLatestInfoById(proId));
}
@ -157,4 +217,120 @@ public class ProjectDetailsViewServiceImpl {
return AjaxResult.success(tbDeviceDataRecordMapper.getPowerDevAttributeRecordByWarn(proId));
}
/**
* 根据工程id查询受限空间预警信息
*/
public List<WarnSpaceVo> queryInfoWarnSpaceList(WarnSpaceVo warnSpaceVo) {
List<WarnSpaceVo> list = tbDeviceDataRecordMapper.queryInfoWarnSpaceList(warnSpaceVo);
return list;
}
/**
* 根据工程id查询当年受限空间预警信息
* @return
*/
public AjaxResult queryInfoWarnSpaceMonth(WarnSpaceVo warnSpaceVo) {
List<Map<String, Object>> list = tbDeviceDataRecordMapper.queryInfoWarnSpaceMonth(warnSpaceVo);
// 统计每个月份的数量
Map<Integer, Long> monthCounts = new HashMap<>();
if(list!=null){
for (Map<String, Object> map : list) {
Integer month = (Integer) map.get("month");
Long count = (Long) map.get("count");
monthCounts.put(month, count);
}
}
// monthCounts 按照月份进行排序
List<Map.Entry<Integer, Long>> sortedEntries = new ArrayList<>(monthCounts.entrySet());
sortedEntries.sort(Map.Entry.comparingByKey());
WarnSpaceMonthVo vo = new WarnSpaceMonthVo();
for (int month = 1; month <= 12; month++) {
Long count = monthCounts.get(month);
if (count == null) {
count = 0L; // 如果没有该月份的记录返回0
}
switch (month) {
case 1: vo.setJan(Math.toIntExact(count)); break;
case 2: vo.setFeb(Math.toIntExact(count)); break;
case 3: vo.setMar(Math.toIntExact(count)); break;
case 4: vo.setApr(Math.toIntExact(count)); break;
case 5: vo.setMay(Math.toIntExact(count)); break;
case 6: vo.setJun(Math.toIntExact(count)); break;
case 7: vo.setJul(Math.toIntExact(count)); break;
case 8: vo.setAug(Math.toIntExact(count)); break;
case 9: vo.setSep(Math.toIntExact(count)); break;
case 10: vo.setOct(Math.toIntExact(count)); break;
case 11: vo.setNov(Math.toIntExact(count)); break;
case 12: vo.setDec(Math.toIntExact(count)); break;
}
}
return AjaxResult.success(vo);
}
/**
* 根据工程id查询当年受限空间违章类型占比
* @return
*/
public AjaxResult queryInfoWarnSpaceType(WarnSpaceVo warnSpaceVo) {
List<Map<String, Object>> list = tbDeviceDataRecordMapper.queryInfoWarnSpaceType(warnSpaceVo);
return AjaxResult.success(list);
}
/**
* 删除受限空间预警数据
*/
public AjaxResult delWarnSpace(Long id) {
return AjaxResult.success(tbDeviceDataRecordMapper.delWarnSpace(id));
}
/**
* 根据工程id查询近电感应预警信息
*/
public List<WarnElectVo> queryInfoWarnElectList(WarnElectVo warnElectVo) {
List<WarnElectVo> list = tbDeviceDataRecordMapper.queryInfoWarnElectList(warnElectVo);
return list;
}
/**
* 删除近电感应预警数据
*/
public AjaxResult delWarnElect(Long id) {
return AjaxResult.success(tbDeviceDataRecordMapper.delWarnElect(id));
}
/**
* 获取近电感应预警配置数据
*/
public AjaxResult getWarnElectConfig(WarnElectVo warnElectVo) {
List<WarnElectConfigVo> listElect = tbDeviceDataRecordMapper.getWarnElectConfig(warnElectVo);
List<WarnElectConfigVo> listLevel = tbDeviceDataRecordMapper.getWarnLevelConfig(warnElectVo);
WarnElectConfigVo vo = new WarnElectConfigVo();
if(listElect!=null){
vo.setConfigElectName(listElect.get(0).getConfigElectName());
vo.setConfigElectValue(listElect.get(0).getConfigElectValue());
}
if(listLevel!=null){
vo.setConfigLevelName(listLevel.get(0).getConfigLevelName());
vo.setConfigLevelValue(listLevel.get(0).getConfigLevelValue());
}
return AjaxResult.success(vo);
}
public AjaxResult editConfig(WarnElectConfigVo vo) {
try {
vo.setUpdateUser(SecurityUtils.getUserId());
vo.setUpdateTime(new Date());
int num = tbDeviceDataRecordMapper.editConfig(vo);
int numTwo = tbDeviceDataRecordMapper.editConfigLevel(vo);
int numAll = num + numTwo;
if(numAll==2){
return AjaxResult.success();
}
return AjaxResult.error("参数配置修改失败");
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
}
}

View File

@ -255,5 +255,6 @@
<select id="getList" resultType="java.lang.Integer">
select count(1) from tb_team where del_flag = 0 and pro_id = #{id}
</select>
</mapper>

View File

@ -21,6 +21,189 @@
</if>
</select>
<select id="queryDevInfoByProjectSettle" resultType="java.util.Map">
SELECT
device.id as devId,device.dev_name as devName,project.id AS proId,project.pro_name AS proName,
device.dev_type as devType, device.dev_status as devStatus, device.dev_warn as devWarn
FROM
tb_device device
<if test="proId != null ">
LEFT JOIN tb_bd_device_record tbdr ON device.bd_id = tbdr.id and tbdr.pro_id = #{proId}
</if>
LEFT JOIN tb_project project ON project.id = tbdr.pro_id AND project.del_flag = 0
WHERE project.id = #{proId} and device.del_flag = 0
<if test="devType != null">
and device.dev_type = #{devType}
</if>
</select>
<!-- 根据工程id查询相对应类型下的预警信息-->
<select id="queryWarnInfoSettle" resultType="com.bonus.base.basic.entity.WarnSettleVo">
select tw.id as id,tw.dev_id as deviceId,device.dev_name as deviceName,tw.warn_time as warnTime,tw.warn_content as warnContent,tw.warn_type as warnType
from tb_warn tw
left join tb_device device on tw.dev_id = device.id and device.del_flag = 0
left join tb_bd_device_record tbdr ON device.bd_id = tbdr.id
left join tb_project project ON project.id = tbdr.pro_id AND project.del_flag = 0
where project.id = #{proId} and device.dev_type = #{deviceType}
and DATE(tw.warn_time) = CURDATE()
order by tw.warn_time desc
limit 13
</select>
<!-- 查询工程下和设备下沉降设备信息-->
<select id="queryDevInfoSettle" resultType="com.bonus.base.basic.entity.SettleVo">
SELECT
tddr.id as id,
device.id as deviceId,
device.dev_status as status,
device.dev_name as deviceName,
tddr.dev_type as devType,
(CASE WHEN tddr.attribute_name = '累加值' THEN tddr.attribute_val END) as measureValue,
(CASE WHEN tddr.attribute_name = '测量值' THEN tddr.attribute_val END) as changeValue,
(CASE WHEN tddr.attribute_name = '变化值' THEN tddr.attribute_val END) as accuValue,
(CASE WHEN tddr.attribute_name = '基础沉降' THEN tddr.attribute_val END) as baseValue,
tddr.is_warn as isWarn,
tddr.create_time as dataTime
FROM
tb_dev_data_record tddr
LEFT JOIN tb_device device ON tddr.dev_id = device.id AND device.del_flag = 0 and device.dev_type = "settle"
LEFT JOIN tb_bd_device_record tbdr ON device.bd_id = tbdr.id and tbdr.pro_id = #{proId}
LEFT JOIN tb_project project ON project.id = tbdr.pro_id AND project.del_flag = 0
WHERE
project.id = #{proId}
<if test="deviceId != null">
and device.id = #{deviceId}
</if>
and tddr.dev_type = "settle"
and tddr.create_time >= CURDATE()
AND tddr.create_time &lt; CURDATE() + INTERVAL 1 DAY
GROUP BY
tddr.id,
device.id,
device.dev_name,
tddr.dev_type,
tddr.is_warn,
tddr.create_time;
</select>
<!-- 查询工程下和设备下位移设备信息-->
<select id="queryDevInfoShift" resultType="com.bonus.base.basic.entity.SettleVo">
SELECT
tddr.id as id,
device.id as deviceId,
device.dev_status as status,
device.dev_name as deviceName,
tddr.dev_type as devType,
(CASE WHEN tddr.attribute_name = '累加值' THEN tddr.attribute_val END) as measureValue,
(CASE WHEN tddr.attribute_name = '测量值' THEN tddr.attribute_val END) as changeValue,
(CASE WHEN tddr.attribute_name = '变化值' THEN tddr.attribute_val END) as accuValue,
(CASE WHEN tddr.attribute_name = '基础沉降' THEN tddr.attribute_val END) as baseValue,
tddr.is_warn as isWarn,
tddr.create_time as dataTime
FROM
tb_dev_data_record tddr
LEFT JOIN tb_device device ON tddr.dev_id = device.id AND device.del_flag = 0 and device.dev_type = "shift"
LEFT JOIN tb_bd_device_record tbdr ON device.bd_id = tbdr.id and tbdr.pro_id = #{proId}
LEFT JOIN tb_project project ON project.id = tbdr.pro_id AND project.del_flag = 0
WHERE
project.id = #{proId}
<if test="deviceId != null">
and device.id = #{deviceId}
</if>
and tddr.dev_type = "shift"
and tddr.create_time >= CURDATE()
AND tddr.create_time &lt; CURDATE() + INTERVAL 1 DAY
GROUP BY
tddr.id,
device.id,
device.dev_name,
tddr.dev_type,
tddr.is_warn,
tddr.create_time;
</select>
<!-- 根据工程id查询相对应类型下的历史沉降信息-->
<select id="queryInfoSettleHistory" resultType="com.bonus.base.basic.entity.SettleVo">
SELECT
tddr.id as id,
device.id as deviceId,
device.dev_name as deviceName,
device.dev_status as status,
tddr.dev_type as devType,
(CASE WHEN tddr.attribute_name = '累加值' THEN tddr.attribute_val END) as measureValue,
(CASE WHEN tddr.attribute_name = '测量值' THEN tddr.attribute_val END) as changeValue,
(CASE WHEN tddr.attribute_name = '变化值' THEN tddr.attribute_val END) as accuValue,
(CASE WHEN tddr.attribute_name = '基础沉降' THEN tddr.attribute_val END) as baseValue,
tddr.is_warn as isWarn,
tddr.create_time as dataTime
FROM
tb_dev_data_record tddr
LEFT JOIN tb_device device ON tddr.dev_id = device.id AND device.del_flag = 0 and device.dev_type = "settle"
LEFT JOIN tb_bd_device_record tbdr ON device.bd_id = tbdr.id and tbdr.pro_id = #{proId}
LEFT JOIN tb_project project ON project.id = tbdr.pro_id AND project.del_flag = 0
WHERE
project.id = #{proId}
<if test="deviceName != null and deviceName != ''">
and device.dev_name like concat('%',#{deviceName},'%')
</if>
<if test="status != null ">
and device.dev_status = #{status}
</if>
<if test="dataTime != null and dataTime != ''">
and DATE(tddr.create_time) = #{dataTime}
</if>
and tddr.dev_type = "settle"
and tddr.create_time &lt; CURDATE()
GROUP BY
tddr.id,
device.id,
device.dev_name,
tddr.dev_type,
tddr.is_warn,
tddr.create_time
</select>
<!-- 根据工程id查询相对应类型下的历史位移信息-->
<select id="queryInfoShiftHistory" resultType="com.bonus.base.basic.entity.SettleVo">
SELECT
tddr.id as id,
device.id as deviceId,
device.dev_name as deviceName,
device.dev_status as status,
tddr.dev_type as devType,
(CASE WHEN tddr.attribute_name = '累加值' THEN tddr.attribute_val END) as measureValue,
(CASE WHEN tddr.attribute_name = '测量值' THEN tddr.attribute_val END) as changeValue,
(CASE WHEN tddr.attribute_name = '变化值' THEN tddr.attribute_val END) as accuValue,
(CASE WHEN tddr.attribute_name = '基础沉降' THEN tddr.attribute_val END) as baseValue,
tddr.is_warn as isWarn,
tddr.create_time as dataTime
FROM
tb_dev_data_record tddr
LEFT JOIN tb_device device ON tddr.dev_id = device.id AND device.del_flag = 0 and device.dev_type = "shift"
LEFT JOIN tb_bd_device_record tbdr ON device.bd_id = tbdr.id and tbdr.pro_id = #{proId}
LEFT JOIN tb_project project ON project.id = tbdr.pro_id AND project.del_flag = 0
WHERE
project.id = #{proId}
<if test="deviceName != null and deviceName != ''">
and device.dev_name like concat('%',#{deviceName},'%')
</if>
<if test="status != null ">
and device.dev_status = #{status}
</if>
<if test="dataTime != null and dataTime != ''">
and DATE(tddr.create_time) = #{dataTime}
</if>
and tddr.dev_type = "shift"
and tddr.create_time &lt; CURDATE()
GROUP BY
tddr.id,
device.id,
device.dev_name,
tddr.dev_type,
tddr.is_warn,
tddr.create_time
</select>
<select id="getDeviceWarnRecord" resultType="com.bonus.base.screen.vo.DeviceWarnRecordVo">
SELECT
tddr.id,
@ -160,7 +343,7 @@
FROM tb_dev_data_record AS tddr
CROSS JOIN (SELECT @row_number := 0, @current_attribute := '') r
WHERE tddr.dev_id = #{devId}
AND tddr.attribute_name IN ('温度', '湿度', '风速', '噪声', 'pm25', 'pm10')
AND tddr.attribute_name IN ('温度', '湿度', '风速', '噪声', 'pm25', 'pm10','pm1.0')
ORDER BY tddr.attribute_name, tddr.create_time DESC
) tddr
WHERE tddr.row_num &lt;= 10
@ -284,5 +467,137 @@
ORDER BY
tddr.attribute_name, tddr.create_time DESC limit 200;
</select>
<!-- 根据工程id查询受限空间预警信息-->
<select id="queryInfoWarnSpaceList" resultType="com.bonus.base.basic.entity.WarnSpaceVo">
select
tddr.id as id,
project.pro_name as proName,
project.id as proId,
tddr.dev_name as devName,
tddr.create_time as warnTime,
tddr.attribute_name as warnType,
tddr.attribute_val as warnUrl
from tb_dev_data_record tddr
left join tb_device device on tddr.dev_id = device.id and device.del_flag = 0
left join tb_bd_device_record tbdr ON device.bd_id = tbdr.id
left join tb_project project ON project.id = tbdr.pro_id and project.id = #{proId} and project.del_flag = 0
where tddr.is_warn = 1 and tddr.dev_type = 135
<if test="devName != null and devName != ''">
and device.dev_name like concat('%',#{devName},'%')
</if>
<if test="startTime != null and endTime != null">
and DATE(tddr.create_time) between #{startTime} and #{endTime}
</if>
order by tddr.create_time desc
</select>
<!-- 根据工程id查询当年受限空间预警信息-->
<select id="queryInfoWarnSpaceMonth" resultType="java.util.Map">
SELECT
MONTH(tddr.create_time) AS month,
COUNT(*) AS count
FROM
tb_dev_data_record tddr
LEFT JOIN
tb_device device ON tddr.dev_id = device.id AND device.del_flag = 0
LEFT JOIN
tb_bd_device_record tbdr ON device.bd_id = tbdr.id
LEFT JOIN
tb_project project ON project.id = tbdr.pro_id AND project.id = #{proId} AND project.del_flag = 0
WHERE
tddr.is_warn = 1
AND tddr.dev_type = 135
AND YEAR(tddr.create_time) = #{year} -- :year 是前台传来的年份,例如 2025
GROUP BY
MONTH(tddr.create_time)
ORDER BY
month;
</select>
<!-- 根据工程id查询当年受限空间违章类型占比-->
<select id="queryInfoWarnSpaceType" resultType="java.util.Map">
SELECT
tddr.attribute_name as warnType,
COUNT(*) AS count
FROM
tb_dev_data_record tddr
LEFT JOIN
tb_device device ON tddr.dev_id = device.id AND device.del_flag = 0
LEFT JOIN
tb_bd_device_record tbdr ON device.bd_id = tbdr.id
LEFT JOIN
tb_project project ON project.id = tbdr.pro_id AND project.id = 28 AND project.del_flag = 0
WHERE
tddr.is_warn = 1
AND tddr.dev_type = 135
AND YEAR(tddr.create_time) = #{year} -- :year 是前台传来的年份,例如 2025
GROUP BY
tddr.attribute_name
</select>
<delete id="delWarnSpace" parameterType="java.lang.Long">
delete from tb_dev_data_record where id = #{id}
</delete>
<!-- 根据工程id查询近电感应预警信息-->
<select id="queryInfoWarnElectList" resultType="com.bonus.base.basic.entity.WarnElectVo">
select
tddr.id as id,
project.pro_name as proName,
project.id as proId,
tddr.dev_name as devName,
tddr.create_time as warnTime,
tddr.attribute_name as warnType,
tddr.attribute_val as warnContent
from tb_dev_data_record tddr
left join tb_device device on tddr.dev_id = device.id and device.del_flag = 0
left join tb_bd_device_record tbdr ON device.bd_id = tbdr.id
left join tb_project project ON project.id = tbdr.pro_id and project.id = #{proId} and project.del_flag = 0
where tddr.is_warn = 1 and tddr.dev_type = 136
<if test="devName != null and devName != ''">
and device.dev_name like concat('%',#{devName},'%')
</if>
<if test="startTime != null and endTime != null">
and DATE(tddr.create_time) between #{startTime} and #{endTime}
</if>
order by tddr.create_time desc
</select>
<delete id="delWarnElect" parameterType="java.lang.Long">
delete from tb_dev_data_record where id = #{id}
</delete>
<!-- 获取近电感应预警配置线路属性数据-->
<select id="getWarnElectConfig" resultType="com.bonus.base.basic.entity.WarnElectConfigVo">
select
config_name as configElectName,
line_value as configElectValue
from tb_warn_config twc
where twc.configu_type = 136 and config_name='线路属性'
and twc.del_flag = 0
</select>
<!-- 获取近电感应预警配置电压等级数据-->
<select id="getWarnLevelConfig" resultType="com.bonus.base.basic.entity.WarnElectConfigVo">
select
config_name as configLevelName,
line_value as configLevelValue
from tb_warn_config twc
where twc.configu_type = 136 and config_name='电压等级'
and twc.del_flag = 0
</select>
<update id="editConfig">
UPDATE tb_warn_config twc
SET line_value = #{configElectValue},update_time = #{updateTime},update_user = #{updateUser}
where config_name='线路属性' and configu_type = 136 and del_flag = 0
</update>
<update id="editConfigLevel">
UPDATE tb_warn_config twc
SET line_value = #{configLevelValue},update_time = #{updateTime},update_user = #{updateUser}
where config_name='电压等级' and configu_type = 136 and del_flag = 0
</update>
</mapper>