预警配置导出
This commit is contained in:
parent
af688cde0c
commit
594f6b0a15
|
|
@ -121,4 +121,24 @@ public class Constants {
|
|||
*/
|
||||
public static final String TB_DEV_ATTRIBUTE_REDIS_KEY = "Tb_dev_Attribute";
|
||||
|
||||
/**
|
||||
* 环境监测类
|
||||
*/
|
||||
public static final Integer TEMP_KEY = 116;
|
||||
|
||||
/**
|
||||
* 组塔倾角监测类
|
||||
*/
|
||||
public static final Integer HUM_KEY = 117;
|
||||
|
||||
/**
|
||||
* 组塔拉力监测类
|
||||
*/
|
||||
public static final Integer NOISE_KEY = 118;
|
||||
|
||||
/**
|
||||
* 基坑监测类
|
||||
*/
|
||||
public static final Integer PARTICULATE_KEY = 119;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public class TbTeamController extends BaseController {
|
|||
* @return 查询结果
|
||||
*/
|
||||
@ApiOperation(value = "查询安全帽类型设备列表")
|
||||
@RequiresPermissions("base:team:list")
|
||||
//@RequiresPermissions("base:team:list")
|
||||
@GetMapping("/devList")
|
||||
public AjaxResult queryByPage(TbDeviceVo tbDeviceVo) {
|
||||
return AjaxResult.success(tbTeamService.selectDeviceList(tbDeviceVo));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.config.Constants;
|
||||
import com.bonus.base.domain.TbTeam;
|
||||
import com.bonus.base.domain.TbWarnConfig;
|
||||
import com.bonus.base.service.TbWarnConfigService;
|
||||
import com.bonus.base.vo.ExcavationVo;
|
||||
import com.bonus.base.vo.InclVo;
|
||||
import com.bonus.base.vo.TempVo;
|
||||
import com.bonus.base.vo.TensVo;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
|
|
@ -10,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -99,5 +107,36 @@ public class TbWarnConfigController extends BaseController {
|
|||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return tbWarnConfigService.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param response
|
||||
* @param tbWarnConfig
|
||||
*/
|
||||
@ApiOperation(value = "预警配置导出")
|
||||
@RequiresPermissions("base:warn:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TbWarnConfig tbWarnConfig) {
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.TEMP_KEY)) {
|
||||
List<TempVo> list = tbWarnConfigService.queryTempVoByPage(tbWarnConfig);
|
||||
ExcelUtil<TempVo> util = new ExcelUtil<>(TempVo.class);
|
||||
util.exportExcel(response, list, "预警配置环境检测类导出");
|
||||
}
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.HUM_KEY)) {
|
||||
List<InclVo> list = tbWarnConfigService.queryInclVoByPage(tbWarnConfig);
|
||||
ExcelUtil<InclVo> util = new ExcelUtil<>(InclVo.class);
|
||||
util.exportExcel(response, list, "预警配置组塔倾角检测类导出");
|
||||
}
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.NOISE_KEY)) {
|
||||
List<TensVo> list = tbWarnConfigService.queryTensVoByPage(tbWarnConfig);
|
||||
ExcelUtil<TensVo> util = new ExcelUtil<>(TensVo.class);
|
||||
util.exportExcel(response, list, "预警配置组塔拉力检测类导出");
|
||||
}
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.PARTICULATE_KEY)) {
|
||||
List<ExcavationVo> list = tbWarnConfigService.queryExcavationVoByPage(tbWarnConfig);
|
||||
ExcelUtil<ExcavationVo> util = new ExcelUtil<>(ExcavationVo.class);
|
||||
util.exportExcel(response, list, "预警配置基坑检测类导出");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -50,6 +49,7 @@ public class TbWarnConfig implements Serializable {
|
|||
@ApiModelProperty(value="配置名称")
|
||||
@Size(max = 64,message = "配置名称最大长度要小于 64")
|
||||
@NotBlank(message = "配置名称不能为空")
|
||||
@Excel(name = "配置名称")
|
||||
private String configName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.domain.TbWarnConfig;
|
||||
import com.bonus.base.vo.ExcavationVo;
|
||||
import com.bonus.base.vo.InclVo;
|
||||
import com.bonus.base.vo.TempVo;
|
||||
import com.bonus.base.vo.TensVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -29,4 +33,31 @@ public interface TbWarnConfigService{
|
|||
|
||||
List<TbWarnConfig> getAll(TbWarnConfig record);
|
||||
|
||||
/**
|
||||
* 查询环境监测类
|
||||
* @param tbWarnConfig
|
||||
* @return
|
||||
*/
|
||||
List<TempVo> queryTempVoByPage(TbWarnConfig tbWarnConfig);
|
||||
|
||||
/**
|
||||
* 查询组塔倾角监测类
|
||||
* @param tbWarnConfig
|
||||
* @return
|
||||
*/
|
||||
List<InclVo> queryInclVoByPage(TbWarnConfig tbWarnConfig);
|
||||
|
||||
/**
|
||||
* 查询组塔拉力监测类
|
||||
* @param tbWarnConfig
|
||||
* @return
|
||||
*/
|
||||
List<TensVo> queryTensVoByPage(TbWarnConfig tbWarnConfig);
|
||||
|
||||
/**
|
||||
* 查询基坑监测类
|
||||
* @param tbWarnConfig
|
||||
* @return
|
||||
*/
|
||||
List<ExcavationVo> queryExcavationVoByPage(TbWarnConfig tbWarnConfig);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbWarnConfig;
|
||||
import com.bonus.base.vo.ExcavationVo;
|
||||
import com.bonus.base.vo.InclVo;
|
||||
import com.bonus.base.vo.TempVo;
|
||||
import com.bonus.base.vo.TensVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -108,26 +114,125 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService{
|
|||
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (TbWarnConfig tbWarnConfig : list) {
|
||||
if (tbWarnConfig.getConfigVal1Min() != null && tbWarnConfig.getConfigVal1Max() != null) {
|
||||
tbWarnConfig.setConfigVal1Str(tbWarnConfig.getConfigVal1Min() + "~" + tbWarnConfig.getConfigVal1Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal2Min() != null && tbWarnConfig.getConfigVal2Max() != null) {
|
||||
tbWarnConfig.setConfigVal2Str(tbWarnConfig.getConfigVal2Min() + "~" + tbWarnConfig.getConfigVal2Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal3Min() != null && tbWarnConfig.getConfigVal3Max() != null) {
|
||||
tbWarnConfig.setConfigVal3Str(tbWarnConfig.getConfigVal3Min() + "~" + tbWarnConfig.getConfigVal3Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal4Min() != null && tbWarnConfig.getConfigVal4Max() != null) {
|
||||
tbWarnConfig.setConfigVal4Str(tbWarnConfig.getConfigVal4Min() + "~" + tbWarnConfig.getConfigVal4Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal5Min() != null && tbWarnConfig.getConfigVal5Max() != null) {
|
||||
tbWarnConfig.setConfigVal5Str(tbWarnConfig.getConfigVal5Min() + "~" + tbWarnConfig.getConfigVal5Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal6Min() != null && tbWarnConfig.getConfigVal6Max() != null) {
|
||||
tbWarnConfig.setConfigVal6Str(tbWarnConfig.getConfigVal6Min() + "~" + tbWarnConfig.getConfigVal6Max());
|
||||
}
|
||||
setConfigStr(tbWarnConfig);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出环境检测类
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TempVo> queryTempVoByPage(TbWarnConfig record) {
|
||||
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
|
||||
ArrayList<TempVo> tempVos = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (TbWarnConfig tbWarnConfig : list) {
|
||||
setConfigStr(tbWarnConfig);
|
||||
TempVo tempVo = new TempVo();
|
||||
tempVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
tempVo.setTempThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
tempVo.setHumThreshold(tbWarnConfig.getConfigVal2Str());
|
||||
tempVo.setNoise(tbWarnConfig.getConfigVal3Str());
|
||||
tempVo.setParticulate(tbWarnConfig.getConfigVal4Str());
|
||||
tempVo.setParticulateMatter(tbWarnConfig.getConfigVal5Str());
|
||||
tempVos.add(tempVo);
|
||||
}
|
||||
}
|
||||
return tempVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询倾角预警
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<InclVo> queryInclVoByPage(TbWarnConfig record) {
|
||||
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
|
||||
ArrayList<InclVo> inclVos = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (TbWarnConfig tbWarnConfig : list) {
|
||||
setConfigStr(tbWarnConfig);
|
||||
InclVo inclVo = new InclVo();
|
||||
inclVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
inclVo.setInclThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
inclVos.add(inclVo);
|
||||
}
|
||||
}
|
||||
return inclVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询拉力预警
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TensVo> queryTensVoByPage(TbWarnConfig record) {
|
||||
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
|
||||
ArrayList<TensVo> tensVos = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (TbWarnConfig tbWarnConfig : list) {
|
||||
setConfigStr(tbWarnConfig);
|
||||
TensVo tensVo = new TensVo();
|
||||
tensVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
tensVo.setTensThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
}
|
||||
}
|
||||
return tensVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询基坑预警
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ExcavationVo> queryExcavationVoByPage(TbWarnConfig record) {
|
||||
List<TbWarnConfig> list = tbWarnConfigMapper.getAll(record);
|
||||
ArrayList<ExcavationVo> excavationVos = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (TbWarnConfig tbWarnConfig : list) {
|
||||
setConfigStr(tbWarnConfig);
|
||||
ExcavationVo excavationVo = new ExcavationVo();
|
||||
excavationVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
excavationVo.setOxyThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
excavationVo.setCOThreshold(tbWarnConfig.getConfigVal2Str());
|
||||
excavationVo.setFlamGasThreshold(tbWarnConfig.getConfigVal3Str());
|
||||
excavationVo.setH2SThreshold(tbWarnConfig.getConfigVal4Str());
|
||||
}
|
||||
}
|
||||
return excavationVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置阈值组合
|
||||
* @param tbWarnConfig
|
||||
*/
|
||||
private void setConfigStr(TbWarnConfig tbWarnConfig) {
|
||||
if (tbWarnConfig.getConfigVal1Min() != null && tbWarnConfig.getConfigVal1Max() != null) {
|
||||
tbWarnConfig.setConfigVal1Str(tbWarnConfig.getConfigVal1Min() + "~" + tbWarnConfig.getConfigVal1Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal2Min() != null && tbWarnConfig.getConfigVal2Max() != null) {
|
||||
tbWarnConfig.setConfigVal2Str(tbWarnConfig.getConfigVal2Min() + "~" + tbWarnConfig.getConfigVal2Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal3Min() != null && tbWarnConfig.getConfigVal3Max() != null) {
|
||||
tbWarnConfig.setConfigVal3Str(tbWarnConfig.getConfigVal3Min() + "~" + tbWarnConfig.getConfigVal3Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal4Min() != null && tbWarnConfig.getConfigVal4Max() != null) {
|
||||
tbWarnConfig.setConfigVal4Str(tbWarnConfig.getConfigVal4Min() + "~" + tbWarnConfig.getConfigVal4Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal5Min() != null && tbWarnConfig.getConfigVal5Max() != null) {
|
||||
tbWarnConfig.setConfigVal5Str(tbWarnConfig.getConfigVal5Min() + "~" + tbWarnConfig.getConfigVal5Max());
|
||||
}
|
||||
if (tbWarnConfig.getConfigVal6Min() != null && tbWarnConfig.getConfigVal6Max() != null) {
|
||||
tbWarnConfig.setConfigVal6Str(tbWarnConfig.getConfigVal6Min() + "~" + tbWarnConfig.getConfigVal6Max());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import com.bonus.base.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 ExcavationVo extends TbWarnConfig {
|
||||
|
||||
@ApiModelProperty(value="含氧量阈值")
|
||||
@Excel(name = "含氧量阈值")
|
||||
private String oxyThreshold;
|
||||
|
||||
@ApiModelProperty(value="一氧化碳阈值")
|
||||
@Excel(name = "一氧化碳阈值")
|
||||
private String cOThreshold;
|
||||
|
||||
@ApiModelProperty(value="可燃气体阈值")
|
||||
@Excel(name = "可燃气体阈值")
|
||||
private String flamGasThreshold;
|
||||
|
||||
@ApiModelProperty(value="硫化氢阈值")
|
||||
@Excel(name = "硫化氢阈值")
|
||||
private String h2SThreshold;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import com.bonus.base.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:12
|
||||
*/
|
||||
@Data
|
||||
public class InclVo extends TbWarnConfig {
|
||||
|
||||
@ApiModelProperty(value=" 倾角阈值")
|
||||
@Excel(name = "倾角阈值")
|
||||
private String inclThreshold;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import com.bonus.base.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:10
|
||||
*/
|
||||
@Data
|
||||
public class TempVo extends TbWarnConfig {
|
||||
|
||||
@ApiModelProperty(value="温度阈值")
|
||||
@Excel(name = "温度阈值")
|
||||
private String tempThreshold;
|
||||
|
||||
@ApiModelProperty(value="湿度阈值")
|
||||
@Excel(name = "湿度阈值")
|
||||
private String humThreshold;
|
||||
|
||||
@ApiModelProperty(value="噪声")
|
||||
@Excel(name = "噪声")
|
||||
private String noise;
|
||||
|
||||
@ApiModelProperty(value="pm2.5")
|
||||
@Excel(name = "PM2.5")
|
||||
private String particulate;
|
||||
|
||||
@ApiModelProperty(value="pm10")
|
||||
@Excel(name = "PM10")
|
||||
private String particulateMatter;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import com.bonus.base.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:13
|
||||
*/
|
||||
@Data
|
||||
public class TensVo extends TbWarnConfig {
|
||||
|
||||
@ApiModelProperty(value="拉力阈值")
|
||||
@Excel(name = "拉力阈值")
|
||||
private String tensThreshold;
|
||||
}
|
||||
|
|
@ -76,19 +76,24 @@
|
|||
</select>
|
||||
|
||||
<select id="selectDeviceList" resultType="com.bonus.base.vo.TbDeviceVo">
|
||||
select td.id as devId,
|
||||
td.dev_name as devName,
|
||||
td.dev_type as devType,
|
||||
td.dev_code as devCode
|
||||
from tb_device td
|
||||
where td.del_flag = '0' and td.dev_type = '123'
|
||||
AND NOT EXISTS(SELECT 1 FROM tb_people tp WHERE tp.dev_id = td.id AND tp.del_flag = '0')
|
||||
SELECT td.id AS devId,
|
||||
td.dev_name AS devName,
|
||||
td.dev_type AS devType,
|
||||
td.dev_code AS devCode
|
||||
FROM tb_device td
|
||||
LEFT JOIN tb_dev_attribute tda ON tda.dev_id = td.id AND tda.del_flag = 0
|
||||
WHERE td.del_flag = '0'
|
||||
AND td.dev_type = '123'
|
||||
AND NOT EXISTS (SELECT 1 FROM tb_people tp WHERE tp.dev_id = td.id AND tp.del_flag = '0')
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
td.dev_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR td.dev_code LIKE CONCAT('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY td.id, td.dev_name, td.dev_type, td.dev_code
|
||||
HAVING COUNT(CASE WHEN tda.jc_name = '经度' AND tda.jc_value IS NOT NULL THEN 1 END) > 0
|
||||
AND COUNT(CASE WHEN tda.jc_name = '纬度' AND tda.jc_value IS NOT NULL THEN 1 END) > 0
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultType="com.bonus.base.domain.TbPeople">
|
||||
|
|
|
|||
Loading…
Reference in New Issue