24小时进出时间段统计bug修复
This commit is contained in:
parent
1728d185bd
commit
cf7c1a112c
@ -8,6 +8,7 @@ import com.zhgd.jeecg.common.api.vo.Result;
|
|||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
||||||
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
||||||
|
import com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber;
|
||||||
import com.zhgd.xmgl.modules.car.service.ICarCameraService;
|
import com.zhgd.xmgl.modules.car.service.ICarCameraService;
|
||||||
import com.zhgd.xmgl.modules.car.service.ICarPassRecordService;
|
import com.zhgd.xmgl.modules.car.service.ICarPassRecordService;
|
||||||
import com.zhgd.xmgl.util.yunboCarUtils;
|
import com.zhgd.xmgl.util.yunboCarUtils;
|
||||||
@ -89,7 +90,7 @@ public class CarPassRecordController {
|
|||||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
|
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
|
||||||
})
|
})
|
||||||
@PostMapping(value = "selectCarPassRecordInOutCount")
|
@PostMapping(value = "selectCarPassRecordInOutCount")
|
||||||
public Result<List<Map<String, Object>>> selectCarPassRecordInOutCount(@RequestBody Map<String, Object> map) {
|
public Result<List<TodayOutInNumber>> selectCarPassRecordInOutCount(@RequestBody Map<String, Object> map) {
|
||||||
return Result.success(carPassRecordService.selectCarPassRecordInOutCount(map));
|
return Result.success(carPassRecordService.selectCarPassRecordInOutCount(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.zhgd.xmgl.modules.car.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TodayOutInNumber {
|
||||||
|
|
||||||
|
private String passTime;
|
||||||
|
private Integer outnum;
|
||||||
|
private Integer innum;
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import java.util.Map;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
||||||
|
import com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
||||||
@ -29,7 +30,7 @@ public interface CarPassRecordMapper extends BaseMapper<CarPassRecord> {
|
|||||||
|
|
||||||
int getLsCarNumTotalByCameraId(Map<String, Object> map);
|
int getLsCarNumTotalByCameraId(Map<String, Object> map);
|
||||||
|
|
||||||
List<Map<String, Object>> selectCarPassRecordInOutCount(Map<String, Object> map);
|
List<TodayOutInNumber> selectCarPassRecordInOutCount(Map<String, Object> map);
|
||||||
|
|
||||||
Map<String, Object> selectCarStatistics(Map<String, Object> map);
|
Map<String, Object> selectCarStatistics(Map<String, Object> map);
|
||||||
|
|
||||||
|
|||||||
@ -60,8 +60,9 @@
|
|||||||
and a.pass_time >= CONCAT(DATE_FORMAT(now(), "%Y-%m-%d"), ' 00:00:00')
|
and a.pass_time >= CONCAT(DATE_FORMAT(now(), "%Y-%m-%d"), ' 00:00:00')
|
||||||
and b.id is null
|
and b.id is null
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCarPassRecordInOutCount" resultType="java.util.Map" parameterType="java.util.Map">
|
<select id="selectCarPassRecordInOutCount" resultType="com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber"
|
||||||
SELECT DATE_FORMAT(pass_time, "%H") passTime,
|
parameterType="java.util.Map">
|
||||||
|
SELECT CONCAT(DATE_FORMAT( pass_time, "%H" ),':00') passTime,
|
||||||
IFNULL(SUM((CASE WHEN type = 1 THEN 1 ELSE 0 END)), 0) outnum,
|
IFNULL(SUM((CASE WHEN type = 1 THEN 1 ELSE 0 END)), 0) outnum,
|
||||||
IFNULL(SUM((CASE WHEN type = 0 THEN 1 ELSE 0 END)), 0) innum
|
IFNULL(SUM((CASE WHEN type = 0 THEN 1 ELSE 0 END)), 0) innum
|
||||||
FROM car_pass_record
|
FROM car_pass_record
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
||||||
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
||||||
|
import com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -23,7 +24,7 @@ public interface ICarPassRecordService extends IService<CarPassRecord> {
|
|||||||
|
|
||||||
List<EntityMap> getCarPassRecordList(Map<String, Object> map);
|
List<EntityMap> getCarPassRecordList(Map<String, Object> map);
|
||||||
|
|
||||||
List<Map<String, Object>> selectCarPassRecordInOutCount(Map<String, Object> map);
|
List<TodayOutInNumber> selectCarPassRecordInOutCount(Map<String, Object> map);
|
||||||
|
|
||||||
Map<String, Object> selectCarStatistics(Map<String, Object> map);
|
Map<String, Object> selectCarStatistics(Map<String, Object> map);
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import com.zhgd.xmgl.modules.car.entity.CarCamera;
|
|||||||
import com.zhgd.xmgl.modules.car.entity.CarInfo;
|
import com.zhgd.xmgl.modules.car.entity.CarInfo;
|
||||||
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
||||||
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
import com.zhgd.xmgl.modules.car.entity.vo.EntryAndExitRecordsTodayVo;
|
||||||
|
import com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber;
|
||||||
import com.zhgd.xmgl.modules.car.mapper.CarCameraMapper;
|
import com.zhgd.xmgl.modules.car.mapper.CarCameraMapper;
|
||||||
import com.zhgd.xmgl.modules.car.mapper.CarInfoMapper;
|
import com.zhgd.xmgl.modules.car.mapper.CarInfoMapper;
|
||||||
import com.zhgd.xmgl.modules.car.mapper.CarPassRecordMapper;
|
import com.zhgd.xmgl.modules.car.mapper.CarPassRecordMapper;
|
||||||
@ -31,6 +32,7 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
|
|||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerAttendanceMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.WorkerAttendanceMapper;
|
||||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||||
|
import com.zhgd.xmgl.util.DateUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -41,6 +43,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 车辆通行记录
|
* @Description: 车辆通行记录
|
||||||
@ -349,8 +353,25 @@ public class CarPassRecordServiceImpl extends ServiceImpl<CarPassRecordMapper, C
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> selectCarPassRecordInOutCount(Map<String, Object> map) {
|
public List<TodayOutInNumber> selectCarPassRecordInOutCount(Map<String, Object> map) {
|
||||||
return carPassRecordMapper.selectCarPassRecordInOutCount(map);
|
List<TodayOutInNumber> todayOutInNumbers = carPassRecordMapper.selectCarPassRecordInOutCount(map);
|
||||||
|
fillDataCarPassRecordInOutCount(todayOutInNumbers);
|
||||||
|
return todayOutInNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillDataCarPassRecordInOutCount(List<TodayOutInNumber> todayOutInNumbers) {
|
||||||
|
Map<String, TodayOutInNumber> map = todayOutInNumbers.stream().collect(Collectors.toMap(TodayOutInNumber::getPassTime, Function.identity()));
|
||||||
|
todayOutInNumbers.clear();
|
||||||
|
for (String h : DateUtil.getAllHourInDay()) {
|
||||||
|
TodayOutInNumber toi = map.get(h);
|
||||||
|
if (toi == null) {
|
||||||
|
toi = new TodayOutInNumber();
|
||||||
|
toi.setPassTime(h);
|
||||||
|
toi.setOutnum(0);
|
||||||
|
toi.setInnum(0);
|
||||||
|
}
|
||||||
|
todayOutInNumbers.add(toi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.environment.controller;
|
|||||||
import com.zhgd.annotation.OperLog;
|
import com.zhgd.annotation.OperLog;
|
||||||
import com.zhgd.jeecg.common.api.vo.Result;
|
import com.zhgd.jeecg.common.api.vo.Result;
|
||||||
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
||||||
|
import com.zhgd.xmgl.modules.environment.entity.vo.EnvironmentDevAlaramCountListVo;
|
||||||
import com.zhgd.xmgl.modules.environment.service.IEnvironmentDevService;
|
import com.zhgd.xmgl.modules.environment.service.IEnvironmentDevService;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -148,6 +149,7 @@ public class EnvironmentDevController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = " 列表查询各绿色扬尘设备报警信息", notes = "列表查询各绿色扬尘设备报警信息", httpMethod = "POST")
|
@ApiOperation(value = " 列表查询各绿色扬尘设备报警信息", notes = "列表查询各绿色扬尘设备报警信息", httpMethod = "POST")
|
||||||
@ -155,7 +157,7 @@ public class EnvironmentDevController {
|
|||||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||||
})
|
})
|
||||||
@PostMapping(value = "/selectEnvironmentDevAlaramCountList")
|
@PostMapping(value = "/selectEnvironmentDevAlaramCountList")
|
||||||
public Result<Map<String,Object>> selectEnvironmentDevAlaramCountList(@RequestBody Map<String,Object> map) {
|
public Result<EnvironmentDevAlaramCountListVo> selectEnvironmentDevAlaramCountList(@RequestBody Map<String, Object> map) {
|
||||||
return Result.success(environmentDevService.selectEnvironmentDevAlaramCountList(map));
|
return Result.success(environmentDevService.selectEnvironmentDevAlaramCountList(map));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,9 @@ public class EnvironmentDev implements Serializable {
|
|||||||
@ApiModelProperty(value="是否创建数据,0否,1是")
|
@ApiModelProperty(value="是否创建数据,0否,1是")
|
||||||
private java.lang.Integer createDataType ;
|
private java.lang.Integer createDataType ;
|
||||||
|
|
||||||
/**是否关闭 1为开 2为关*/
|
/**
|
||||||
|
* 是否关闭 1为开 2为关
|
||||||
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "是否在线 1为在线 2为离线")
|
@ApiModelProperty(value = "是否在线 1为在线 2为离线")
|
||||||
private java.lang.Integer isClosed;
|
private java.lang.Integer isClosed;
|
||||||
@ -99,4 +101,10 @@ public class EnvironmentDev implements Serializable {
|
|||||||
@ApiModelProperty(value = "视频列表")
|
@ApiModelProperty(value = "视频列表")
|
||||||
private List<BigDeviceVideo> videoList;
|
private List<BigDeviceVideo> videoList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "设备状态1在线0离线")
|
||||||
|
private java.lang.Integer devOnline;
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "报警数量")
|
||||||
|
private Integer alarmNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.zhgd.xmgl.modules.environment.entity.vo;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EnvironmentDevAlaramCountListVo {
|
||||||
|
|
||||||
|
private Integer totalDevOnlineNum;
|
||||||
|
private Integer totalDevNum;
|
||||||
|
private List<EnvironmentDev> devList;
|
||||||
|
private Integer totalAlarmNum;
|
||||||
|
|
||||||
|
}
|
||||||
@ -20,7 +20,7 @@ public interface EnvironmentDevMapper extends BaseMapper<EnvironmentDev> {
|
|||||||
|
|
||||||
List<EnvironmentDev> selectEnvironmentDevList(Map<String, Object> map);
|
List<EnvironmentDev> selectEnvironmentDevList(Map<String, Object> map);
|
||||||
|
|
||||||
List<EntityMap> selectProjectEnvironmentDevList(Map<String, Object> map);
|
List<EnvironmentDev> selectProjectEnvironmentDevList(Map<String, Object> map);
|
||||||
|
|
||||||
List<Map<String,Object>> selectAllDevCount();
|
List<Map<String,Object>> selectAllDevCount();
|
||||||
|
|
||||||
|
|||||||
@ -7,22 +7,25 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectEnvironmentDevList" resultType="com.zhgd.xmgl.modules.environment.entity.EnvironmentDev">
|
<select id="selectEnvironmentDevList" resultType="com.zhgd.xmgl.modules.environment.entity.EnvironmentDev">
|
||||||
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 2 end) is_closed
|
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 2 end)
|
||||||
|
is_closed
|
||||||
from environment_dev
|
from environment_dev
|
||||||
where project_sn=#{projectSn}
|
where project_sn=#{projectSn}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="selectProjectEnvironmentDevList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
<select id="selectProjectEnvironmentDevList" resultType="com.zhgd.xmgl.modules.environment.entity.EnvironmentDev">
|
||||||
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 0 end) devonline
|
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 0 end)
|
||||||
|
devOnline
|
||||||
from environment_dev
|
from environment_dev
|
||||||
where project_sn=#{projectSn}
|
where project_sn=#{projectSn}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAllDevCount" resultType="java.util.Map">
|
<select id="selectAllDevCount" resultType="java.util.Map">
|
||||||
SELECT project_sn projectSn,COUNT(1) devNum,
|
SELECT project_sn projectSn,
|
||||||
SUM((case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60)<=10 then 1 else 0 end)) devOnline
|
COUNT(1) devNum,
|
||||||
|
SUM((case
|
||||||
|
when round((UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(real_time)) / 60) <= 10 then 1
|
||||||
|
else 0 end)) devOnline
|
||||||
FROM environment_dev
|
FROM environment_dev
|
||||||
GROUP BY project_sn
|
GROUP BY project_sn
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCompanyDevCountStatistics" resultType="java.util.Map">
|
<select id="selectCompanyDevCountStatistics" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.environment.service;
|
|||||||
|
|
||||||
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhgd.xmgl.modules.environment.entity.vo.EnvironmentDevAlaramCountListVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -32,5 +33,5 @@ public interface IEnvironmentDevService extends IService<EnvironmentDev> {
|
|||||||
|
|
||||||
Map<String,Object> selectProjectEnvironmentDevAndAlarmCount(Map<String, Object> map);
|
Map<String,Object> selectProjectEnvironmentDevAndAlarmCount(Map<String, Object> map);
|
||||||
|
|
||||||
Map<String,Object> selectEnvironmentDevAlaramCountList(Map<String, Object> map);
|
EnvironmentDevAlaramCountListVo selectEnvironmentDevAlaramCountList(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,12 @@ package com.zhgd.xmgl.modules.environment.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
|
||||||
import com.zhgd.xmgl.async.AsyncEnvironment;
|
import com.zhgd.xmgl.async.AsyncEnvironment;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||||
import com.zhgd.xmgl.modules.bigdevice.entity.BigDeviceVideo;
|
import com.zhgd.xmgl.modules.bigdevice.entity.BigDeviceVideo;
|
||||||
import com.zhgd.xmgl.modules.bigdevice.mapper.BigDeviceVideoMapper;
|
import com.zhgd.xmgl.modules.bigdevice.mapper.BigDeviceVideoMapper;
|
||||||
import com.zhgd.xmgl.modules.environment.entity.*;
|
import com.zhgd.xmgl.modules.environment.entity.*;
|
||||||
|
import com.zhgd.xmgl.modules.environment.entity.vo.EnvironmentDevAlaramCountListVo;
|
||||||
import com.zhgd.xmgl.modules.environment.mapper.*;
|
import com.zhgd.xmgl.modules.environment.mapper.*;
|
||||||
import com.zhgd.xmgl.modules.environment.service.IEnvironmentDevService;
|
import com.zhgd.xmgl.modules.environment.service.IEnvironmentDevService;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
@ -198,34 +198,35 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> selectEnvironmentDevAlaramCountList(Map<String, Object> map) {
|
public EnvironmentDevAlaramCountListVo selectEnvironmentDevAlaramCountList(Map<String, Object> map) {
|
||||||
Map<String,Object> data=new HashMap<>();
|
List<EnvironmentDev> devList = environmentDevMapper.selectProjectEnvironmentDevList(map);
|
||||||
List<EntityMap> devList=environmentDevMapper.selectProjectEnvironmentDevList(map);
|
|
||||||
int totalDevOnlineNum = 0;
|
int totalDevOnlineNum = 0;
|
||||||
int totalAlarmNum = 0;
|
int totalAlarmNum = 0;
|
||||||
if (devList != null && devList.size() > 0) {
|
if (devList != null && devList.size() > 0) {
|
||||||
//查询报警数
|
//查询报警数
|
||||||
List<Map<String, Object>> alarmList = environmentAlarmMapper.selectEnvironmentDevTodayAlarmCount(map);
|
List<Map<String, Object>> alarmList = environmentAlarmMapper.selectEnvironmentDevTodayAlarmCount(map);
|
||||||
for(EntityMap dev:devList){
|
for (EnvironmentDev dev : devList) {
|
||||||
if("1".equals(MapUtils.getString(dev,"devonline"))){
|
if ("1".equals(dev.getDevOnline())) {
|
||||||
totalDevOnlineNum++;
|
totalDevOnlineNum++;
|
||||||
}
|
}
|
||||||
//取出报警次数
|
//取出报警次数
|
||||||
Integer alarmNum = 0;
|
Integer alarmNum = 0;
|
||||||
if (alarmList != null && alarmList.size() > 0) {
|
if (alarmList != null && alarmList.size() > 0) {
|
||||||
for (Map<String, Object> count : alarmList) {
|
for (Map<String, Object> count : alarmList) {
|
||||||
if(MapUtils.getString(dev,"deviceId").equals(MapUtils.getString(count,"deviceId"))){
|
if (dev.getDeviceId().equals(MapUtils.getString(count, "deviceId"))) {
|
||||||
alarmNum=MapUtils.getInteger(dev,"totalAlarm");
|
alarmNum = MapUtils.getInteger(count, "totalAlarm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dev.put("alarm_num",alarmNum);
|
dev.setAlarmNum(alarmNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.put("totalDevNum",devList.size());
|
|
||||||
data.put("totalDevOnlineNum",totalDevOnlineNum);
|
EnvironmentDevAlaramCountListVo vo = new EnvironmentDevAlaramCountListVo();
|
||||||
data.put("totalAlarmNum",totalAlarmNum);
|
vo.setTotalDevOnlineNum(totalDevOnlineNum);
|
||||||
data.put("devList",devList);
|
vo.setTotalDevNum(devList.size());
|
||||||
return data;
|
vo.setDevList(devList);
|
||||||
|
vo.setTotalAlarmNum(totalAlarmNum);
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,70 +100,6 @@ public class DateUtil extends cn.hutool.core.date.DateUtil {
|
|||||||
return findDates(cal.getTime(), new Date());
|
return findDates(cal.getTime(), new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询本月所有天数Fix,如:2023-06-01到2023-06-30
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getNowMonthAllDayListFix() {
|
|
||||||
ArrayList<String> rtList = new ArrayList<>();
|
|
||||||
Date now = new Date();
|
|
||||||
DateTime beginDate = cn.hutool.core.date.DateUtil.beginOfMonth(now);
|
|
||||||
DateTime endDate = cn.hutool.core.date.DateUtil.endOfMonth(now);
|
|
||||||
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
|
||||||
for (int i = 0; i < offset + 1; i++) {
|
|
||||||
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
|
|
||||||
}
|
|
||||||
return rtList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询一个月前内所有天数,如:2023-06-10到2023-07-10
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getDaysBetweenLastMonth() {
|
|
||||||
ArrayList<String> rtList = new ArrayList<>();
|
|
||||||
DateTime beginDate = cn.hutool.core.date.DateUtil.lastMonth();
|
|
||||||
DateTime endDate = DateTime.now();
|
|
||||||
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
|
||||||
for (int i = 0; i < offset + 1; i++) {
|
|
||||||
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
|
|
||||||
}
|
|
||||||
return rtList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询一个周前内所有天数,如:2023-06-10到2023-06-17
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getDaysBetweenLastWeek() {
|
|
||||||
ArrayList<String> rtList = new ArrayList<>();
|
|
||||||
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
|
|
||||||
DateTime endDate = DateTime.now();
|
|
||||||
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
|
||||||
for (int i = 0; i < offset + 1; i++) {
|
|
||||||
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
|
|
||||||
}
|
|
||||||
return rtList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询一个周前内所有天数,如:06-10到06-17
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getDaysBetweenLastWeekWithoutYear() {
|
|
||||||
ArrayList<String> rtList = new ArrayList<>();
|
|
||||||
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
|
|
||||||
DateTime endDate = DateTime.now();
|
|
||||||
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
|
||||||
for (int i = 0; i < offset + 1; i++) {
|
|
||||||
rtList.add(cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i), "MM-dd"));
|
|
||||||
}
|
|
||||||
return rtList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询现在时间几天前到现在之间的所有日期
|
* 查询现在时间几天前到现在之间的所有日期
|
||||||
@ -500,4 +436,70 @@ public class DateUtil extends cn.hutool.core.date.DateUtil {
|
|||||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
return dateFormat.format(date);
|
return dateFormat.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询本月所有天数Fix,如:2023-06-01到2023-06-30
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> getCurrentMonthAllDayList() {
|
||||||
|
ArrayList<String> rtList = new ArrayList<>();
|
||||||
|
Date now = new Date();
|
||||||
|
DateTime beginDate = cn.hutool.core.date.DateUtil.beginOfMonth(now);
|
||||||
|
DateTime endDate = cn.hutool.core.date.DateUtil.endOfMonth(now);
|
||||||
|
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
||||||
|
for (int i = 0; i < offset + 1; i++) {
|
||||||
|
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
|
||||||
|
}
|
||||||
|
return rtList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询一个月前内所有天数,如:2023-06-10到2023-07-10
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> getDaysBetweenLastMonth() {
|
||||||
|
ArrayList<String> rtList = new ArrayList<>();
|
||||||
|
DateTime beginDate = cn.hutool.core.date.DateUtil.lastMonth();
|
||||||
|
DateTime endDate = DateTime.now();
|
||||||
|
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
||||||
|
for (int i = 0; i < offset + 1; i++) {
|
||||||
|
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
|
||||||
|
}
|
||||||
|
return rtList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询一个周前内所有天数,如:2023-06-10到2023-06-17
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> getDaysBetweenLastWeek() {
|
||||||
|
ArrayList<String> rtList = new ArrayList<>();
|
||||||
|
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
|
||||||
|
DateTime endDate = DateTime.now();
|
||||||
|
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
||||||
|
for (int i = 0; i < offset + 1; i++) {
|
||||||
|
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
|
||||||
|
}
|
||||||
|
return rtList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询一个周前内所有天数,如:06-10到06-17
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> getDaysBetweenLastWeekWithoutYear() {
|
||||||
|
ArrayList<String> rtList = new ArrayList<>();
|
||||||
|
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
|
||||||
|
DateTime endDate = DateTime.now();
|
||||||
|
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
|
||||||
|
for (int i = 0; i < offset + 1; i++) {
|
||||||
|
rtList.add(cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i), "MM-dd"));
|
||||||
|
}
|
||||||
|
return rtList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user