环境监测页面部分接口
This commit is contained in:
parent
fc706aec32
commit
a0dd79aa49
|
|
@ -21,5 +21,11 @@ public class AttrCodeUtils {
|
|||
*/
|
||||
public final static String GZM_ZL="重量";
|
||||
|
||||
/**
|
||||
* 环境 PM2.5
|
||||
*/
|
||||
public final static String HJ_PM25="PM2.5";
|
||||
|
||||
|
||||
public final static int LIMIT=20;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,4 +33,10 @@ public class TypeCodeUtils {
|
|||
public final static String BALL_CODE="ball_0";
|
||||
|
||||
|
||||
/**
|
||||
* 环境监测设备类型id
|
||||
*/
|
||||
public final static String ENVIRONMENT_CODE="174435992023806894663";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.base.screen.controller;
|
||||
|
||||
import com.bonus.base.basic.domain.CollectDevVo;
|
||||
import com.bonus.base.basic.domain.ConstInfoVo;
|
||||
import com.bonus.base.screen.domain.DeviceAlarmVo;
|
||||
import com.bonus.base.screen.service.EnvironmentDetectionService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 环境监测
|
||||
* @author fl
|
||||
* @date 2025/4/18
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/videoDetection")
|
||||
public class EnvironmentDetectionController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private EnvironmentDetectionService service;
|
||||
|
||||
@ApiOperation(value = "环境监测设备列表")
|
||||
@PostMapping("/getCollectDeviceList")
|
||||
public AjaxResult getCollectDeviceList(@RequestBody CollectDevVo bean) {
|
||||
try {
|
||||
List<CollectDevVo> collectDevVoList = service.getCollectDeviceList(bean);
|
||||
return success(collectDevVoList);
|
||||
}catch (Exception e){
|
||||
log.error("查询环境监测设备失败",e.getMessage());
|
||||
return error("查询环境监测设备失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "近7天空气质量详情")
|
||||
@PostMapping("/getSevenDayAirList")
|
||||
public AjaxResult getSevenDayAirList(@RequestBody CollectDevVo bean) {
|
||||
try {
|
||||
return service.getSevenDayAirList(bean);
|
||||
}catch (Exception e){
|
||||
log.error("查询近7天空气质量详情失败",e.getMessage());
|
||||
return error("查询近7天空气质量详情失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "实时环境信息")
|
||||
@PostMapping("/getEnvironmentMsg")
|
||||
public AjaxResult getEnvironmentMsg(@RequestBody CollectDevVo bean) {
|
||||
try {
|
||||
return service.getEnvironmentMsg(bean);
|
||||
}catch (Exception e){
|
||||
log.error("查询实时环境信息失败",e.getMessage());
|
||||
return error("查询实时环境信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "环境报警信息")
|
||||
@PostMapping("/getEnvironmentAlarmList")
|
||||
public AjaxResult getEnvironmentAlarmList(@RequestBody CollectDevVo constInfoVo) {
|
||||
try {
|
||||
List<DeviceAlarmVo> deviceAlarmVoList = service.getEnvironmentAlarmList(constInfoVo);
|
||||
return success(deviceAlarmVoList);
|
||||
}catch (Exception e){
|
||||
log.error("查询塔吊报警信息失败",e.getMessage());
|
||||
return error("查询塔吊报警信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.base.screen.mapper;
|
||||
|
||||
import com.bonus.base.basic.domain.CollectDevVo;
|
||||
import com.bonus.base.basic.domain.ConstInfoVo;
|
||||
import com.bonus.base.screen.domain.BallInfoVo;
|
||||
import com.bonus.base.screen.domain.DeviceAlarmVo;
|
||||
import com.bonus.base.screen.domain.MapValueVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EnvironmentDetectionMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 查询环境设备列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<CollectDevVo> getCollectDeviceList(CollectDevVo bean);
|
||||
|
||||
/**
|
||||
* 近7天空气质量详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MapValueVo> getAttrListByTypeId(CollectDevVo bean);
|
||||
|
||||
/**
|
||||
* 实时环境信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MapValueVo> getEnvironmentMsg(CollectDevVo bean);
|
||||
|
||||
/**
|
||||
* 环境报警信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<DeviceAlarmVo> getEnvironmentAlarmList(CollectDevVo bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.base.screen.service;
|
||||
|
||||
import com.bonus.base.basic.domain.CollectDevVo;
|
||||
import com.bonus.base.basic.domain.ConstInfoVo;
|
||||
import com.bonus.base.screen.domain.BallInfoVo;
|
||||
import com.bonus.base.screen.domain.DeviceAlarmVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EnvironmentDetectionService {
|
||||
|
||||
/**
|
||||
* 查询环境设备列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<CollectDevVo> getCollectDeviceList(CollectDevVo bean);
|
||||
|
||||
/**
|
||||
* 近7天空气质量详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getSevenDayAirList(CollectDevVo bean);
|
||||
|
||||
/**
|
||||
* 实时环境信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getEnvironmentMsg(CollectDevVo bean);
|
||||
|
||||
/**
|
||||
* 环境报警信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<DeviceAlarmVo> getEnvironmentAlarmList(CollectDevVo bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.base.screen.service.impl;
|
||||
|
||||
import com.bonus.base.basic.domain.CollectDevVo;
|
||||
import com.bonus.base.basic.domain.ConstInfoVo;
|
||||
import com.bonus.base.common.utils.TypeCodeUtils;
|
||||
import com.bonus.base.screen.domain.BallInfoVo;
|
||||
import com.bonus.base.screen.domain.DeviceAlarmVo;
|
||||
import com.bonus.base.screen.domain.MapValueVo;
|
||||
import com.bonus.base.screen.mapper.EnvironmentDetectionMapper;
|
||||
import com.bonus.base.screen.mapper.VideoDetectionMapper;
|
||||
import com.bonus.base.screen.service.EnvironmentDetectionService;
|
||||
import com.bonus.base.screen.service.VideoDetectionService;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fl
|
||||
* @date 2025/4/18
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EnvironmentDetectionServiceImpl implements EnvironmentDetectionService {
|
||||
|
||||
@Resource
|
||||
private EnvironmentDetectionMapper mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询环境设备列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CollectDevVo> getCollectDeviceList(CollectDevVo bean) {
|
||||
//设置查询类型
|
||||
bean.setDevType(TypeCodeUtils.ENVIRONMENT_CODE);
|
||||
return mapper.getCollectDeviceList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 近7天空气质量详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getSevenDayAirList(CollectDevVo bean) {
|
||||
// 获取当前日期
|
||||
LocalDate now = LocalDate.now();
|
||||
// 计算七天前的日期
|
||||
LocalDate sevenDaysAgo = now.minusDays(7);
|
||||
// 格式化日期
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
System.out.println("七天前的起始日期: " + sevenDaysAgo.format(formatter));
|
||||
System.out.println("今天的日期: " + now.format(formatter));
|
||||
//TODO sql没写
|
||||
List<MapValueVo> list = mapper.getAttrListByTypeId(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getEnvironmentMsg(CollectDevVo bean) {
|
||||
bean.setDevType(TypeCodeUtils.ENVIRONMENT_CODE);
|
||||
List<MapValueVo> list = mapper.getEnvironmentMsg(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 环境报警信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceAlarmVo> getEnvironmentAlarmList(CollectDevVo bean) {
|
||||
bean.setDevType(TypeCodeUtils.ENVIRONMENT_CODE);
|
||||
return mapper.getEnvironmentAlarmList(bean);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,6 +53,8 @@ public class TowerCraneDetectionServiceImpl implements TowerCraneDetectionServic
|
|||
*/
|
||||
@Override
|
||||
public List<DeviceAlarmVo> getTowerCraneAlarmList(ConstInfoVo constInfoVo) {
|
||||
//设置查询类型
|
||||
constInfoVo.setTypeCode(TypeCodeUtils.TC_CODE);
|
||||
return mapper.getTowerCraneAlarmList(constInfoVo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.base.screen.mapper.EnvironmentDetectionMapper">
|
||||
|
||||
<select id="getCollectDeviceList" resultType="com.bonus.base.basic.domain.CollectDevVo">
|
||||
SELECT
|
||||
tcd.dev_name,
|
||||
tcd.dev_code,
|
||||
tcd.is_online,
|
||||
tcd.dev_location
|
||||
FROM
|
||||
tb_collect_device tcd
|
||||
WHERE
|
||||
tcd.dev_type_id = #{devType}
|
||||
</select>
|
||||
<select id="getAttrListByTypeId" resultType="com.bonus.base.screen.domain.MapValueVo">
|
||||
|
||||
</select>
|
||||
<select id="getEnvironmentMsg" resultType="com.bonus.base.screen.domain.MapValueVo">
|
||||
SELECT
|
||||
tcda.attr_name as `name`,
|
||||
tcda.attr_val as `value`
|
||||
FROM
|
||||
tb_collect_device tcd
|
||||
LEFT JOIN tb_collect_device_attr tcda ON tcda.dev_id = tcd.id
|
||||
WHERE
|
||||
tcd.dev_type_id = #{devType}
|
||||
</select>
|
||||
<select id="getEnvironmentAlarmList" resultType="com.bonus.base.screen.domain.DeviceAlarmVo">
|
||||
SELECT
|
||||
tcdh.create_time AS createTime,
|
||||
tcdh.remark AS remark,
|
||||
tcd.dev_name AS devName
|
||||
FROM
|
||||
tb_collect_device tcd
|
||||
LEFT JOIN tb_collect_device_his tcdh ON tcdh.dev_id = tcd.id
|
||||
WHERE
|
||||
tcd.dev_type_id = #{devType}
|
||||
and tcdh.is_warn = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -50,5 +50,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN tb_collect_device_his tcdh ON tcdh.dev_id = tcd.id
|
||||
WHERE
|
||||
tci.type_code = #{typeCode}
|
||||
and tcdh.is_warn = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue