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.xmgl.modules.car.entity.CarPassRecord;
|
||||
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.ICarPassRecordService;
|
||||
import com.zhgd.xmgl.util.yunboCarUtils;
|
||||
@ -89,7 +90,7 @@ public class CarPassRecordController {
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
|
||||
})
|
||||
@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));
|
||||
}
|
||||
|
||||
|
||||
@ -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.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
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.Param;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarPassRecord;
|
||||
@ -29,7 +30,7 @@ public interface CarPassRecordMapper extends BaseMapper<CarPassRecord> {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -60,13 +60,14 @@
|
||||
and a.pass_time >= CONCAT(DATE_FORMAT(now(), "%Y-%m-%d"), ' 00:00:00')
|
||||
and b.id is null
|
||||
</select>
|
||||
<select id="selectCarPassRecordInOutCount" resultType="java.util.Map" parameterType="java.util.Map">
|
||||
SELECT DATE_FORMAT(pass_time, "%H") passTime,
|
||||
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
|
||||
<select id="selectCarPassRecordInOutCount" resultType="com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber"
|
||||
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 = 0 THEN 1 ELSE 0 END)), 0) innum
|
||||
FROM car_pass_record
|
||||
WHERE project_sn = #{projectSn}
|
||||
AND pass_time >= CONCAT(DATE_FORMAT(now(), "%Y-%m-%d"), ' 00:00:00')
|
||||
AND pass_time >= CONCAT(DATE_FORMAT(now(), "%Y-%m-%d"), ' 00:00:00')
|
||||
GROUP BY DATE_FORMAT(pass_time, "%H")
|
||||
</select>
|
||||
<select id="selectCarStatistics" resultType="java.util.Map">
|
||||
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
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.TodayOutInNumber;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -23,7 +24,7 @@ public interface ICarPassRecordService extends IService<CarPassRecord> {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -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.CarPassRecord;
|
||||
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.CarInfoMapper;
|
||||
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.mapper.WorkerAttendanceMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.util.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -41,6 +43,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 车辆通行记录
|
||||
@ -349,8 +353,25 @@ public class CarPassRecordServiceImpl extends ServiceImpl<CarPassRecordMapper, C
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectCarPassRecordInOutCount(Map<String, Object> map) {
|
||||
return carPassRecordMapper.selectCarPassRecordInOutCount(map);
|
||||
public List<TodayOutInNumber> selectCarPassRecordInOutCount(Map<String, Object> 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
|
||||
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.environment.controller;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
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.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -35,7 +36,7 @@ import java.util.Map;
|
||||
public class EnvironmentDevController {
|
||||
@Autowired
|
||||
private IEnvironmentDevService environmentDevService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
@ -48,8 +49,8 @@ public class EnvironmentDevController {
|
||||
public Result<List<EnvironmentDev>> selectEnvironmentDevList(@RequestBody Map<String,Object> map) {
|
||||
return Result.success(environmentDevService.selectEnvironmentDevList(map));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param environmentDev
|
||||
* @return
|
||||
@ -61,8 +62,8 @@ public class EnvironmentDevController {
|
||||
environmentDevService.saveEnvironmentDev(environmentDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param environmentDev
|
||||
* @return
|
||||
@ -74,12 +75,12 @@ public class EnvironmentDevController {
|
||||
environmentDevService.editEnvironmentDev(environmentDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "环境监测管理",operType = "删除绿色扬尘设备",operDesc = "删除绿色扬尘设备")
|
||||
@ApiOperation(value = "删除绿色扬尘设备信息", notes = "删除绿色扬尘设备信息" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "id", value = "绿色扬尘设备ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@ -95,8 +96,8 @@ public class EnvironmentDevController {
|
||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -148,14 +149,15 @@ public class EnvironmentDevController {
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 列表查询各绿色扬尘设备报警信息", notes = "列表查询各绿色扬尘设备报警信息", httpMethod="POST")
|
||||
@ApiOperation(value = " 列表查询各绿色扬尘设备报警信息", notes = "列表查询各绿色扬尘设备报警信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@ApiModel(value="EnvironmentDev实体类",description="EnvironmentDev")
|
||||
public class EnvironmentDev implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**绿色设备表*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="绿色设备表")
|
||||
@ -90,13 +90,21 @@ public class EnvironmentDev implements Serializable {
|
||||
@ApiModelProperty(value="是否创建数据,0否,1是")
|
||||
private java.lang.Integer createDataType ;
|
||||
|
||||
/**是否关闭 1为开 2为关*/
|
||||
/**
|
||||
* 是否关闭 1为开 2为关
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="是否在线 1为在线 2为离线")
|
||||
private java.lang.Integer isClosed ;
|
||||
@ApiModelProperty(value = "是否在线 1为在线 2为离线")
|
||||
private java.lang.Integer isClosed;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="视频列表")
|
||||
@ApiModelProperty(value = "视频列表")
|
||||
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<EntityMap> selectProjectEnvironmentDevList(Map<String, Object> map);
|
||||
List<EnvironmentDev> selectProjectEnvironmentDevList(Map<String, Object> map);
|
||||
|
||||
List<Map<String,Object>> selectAllDevCount();
|
||||
|
||||
|
||||
@ -7,22 +7,25 @@
|
||||
</update>
|
||||
|
||||
<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
|
||||
where project_sn=#{projectSn}
|
||||
|
||||
</select>
|
||||
<select id="selectProjectEnvironmentDevList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 0 end) devonline
|
||||
<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
|
||||
from environment_dev
|
||||
where project_sn=#{projectSn}
|
||||
</select>
|
||||
<select id="selectAllDevCount" resultType="java.util.Map">
|
||||
SELECT project_sn projectSn,COUNT(1) devNum,
|
||||
SUM((case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60)<=10 then 1 else 0 end)) devOnline
|
||||
SELECT project_sn projectSn,
|
||||
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
|
||||
GROUP BY project_sn
|
||||
|
||||
</select>
|
||||
<select id="selectCompanyDevCountStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
@ -163,4 +166,4 @@
|
||||
order by totalProjectNum desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.environment.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.environment.entity.vo.EnvironmentDevAlaramCountListVo;
|
||||
|
||||
import java.util.List;
|
||||
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> 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.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.async.AsyncEnvironment;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||
import com.zhgd.xmgl.modules.bigdevice.entity.BigDeviceVideo;
|
||||
import com.zhgd.xmgl.modules.bigdevice.mapper.BigDeviceVideoMapper;
|
||||
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.service.IEnvironmentDevService;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
@ -24,7 +24,7 @@ import java.util.*;
|
||||
/**
|
||||
* @Description: 绿色扬尘设备
|
||||
* @author: pds
|
||||
* @date: 2020-09-27
|
||||
* @date: 2020-09-27
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -51,32 +51,32 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
public void saveEnvironmentDev(EnvironmentDev environmentDev) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
environmentDev.setCreateTime(sdf.format(new Date()));
|
||||
if(StringUtils.isEmpty(environmentDev.getDeviceId())){
|
||||
if (StringUtils.isEmpty(environmentDev.getDeviceId())) {
|
||||
environmentDev.setDeviceId(UUID.randomUUID().toString().replace("-", "").toUpperCase());
|
||||
}else{
|
||||
QueryWrapper<EnvironmentDev> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(EnvironmentDev::getDeviceId,environmentDev.getDeviceId());
|
||||
int count=environmentDevMapper.selectCount(queryWrapper);
|
||||
if(count>0){
|
||||
} else {
|
||||
QueryWrapper<EnvironmentDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(EnvironmentDev::getDeviceId, environmentDev.getDeviceId());
|
||||
int count = environmentDevMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new OpenAlertException(MessageUtil.get("EquipmentNumExistErr"));
|
||||
}
|
||||
}
|
||||
environmentDev.setRealTime(new Date());
|
||||
environmentDevMapper.insert(environmentDev);
|
||||
//设置项目扬尘设备报警阀值
|
||||
QueryWrapper<EnvironmentWarning> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(EnvironmentWarning::getProjectSn,"-1");
|
||||
List<EnvironmentWarning> list=environmentWarningMapper.selectList(queryWrapper);
|
||||
if(list!=null&&list.size()>0){
|
||||
for(EnvironmentWarning environmentWarning:list){
|
||||
QueryWrapper<EnvironmentWarning> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(EnvironmentWarning::getProjectSn, "-1");
|
||||
List<EnvironmentWarning> list = environmentWarningMapper.selectList(queryWrapper);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (EnvironmentWarning environmentWarning : list) {
|
||||
environmentWarning.setId(null);
|
||||
environmentWarning.setDeviceId(environmentDev.getDeviceId());
|
||||
environmentWarning.setProjectSn(environmentDev.getProjectSn());
|
||||
environmentWarningMapper.insert(environmentWarning);
|
||||
}
|
||||
}
|
||||
if(environmentDev.getVideoList()!=null&&environmentDev.getVideoList().size()>0){
|
||||
for (BigDeviceVideo deviceVideo:environmentDev.getVideoList()){
|
||||
if (environmentDev.getVideoList() != null && environmentDev.getVideoList().size() > 0) {
|
||||
for (BigDeviceVideo deviceVideo : environmentDev.getVideoList()) {
|
||||
deviceVideo.setProjectSn(environmentDev.getProjectSn());
|
||||
deviceVideo.setType(5);
|
||||
deviceVideo.setDevSn(environmentDev.getDeviceId());
|
||||
@ -94,13 +94,13 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
//异步向第三方平台转发扬尘设备数据
|
||||
asyncEnvironment.saveEnvironmentDev(environmentDev);
|
||||
|
||||
QueryWrapper<BigDeviceVideo> queryWrapper2=new QueryWrapper<>();
|
||||
queryWrapper2.lambda().eq(BigDeviceVideo::getDevSn,environmentDev.getDeviceId())
|
||||
.eq(BigDeviceVideo::getProjectSn,environmentDev.getProjectSn())
|
||||
.eq(BigDeviceVideo::getType,5);
|
||||
QueryWrapper<BigDeviceVideo> queryWrapper2 = new QueryWrapper<>();
|
||||
queryWrapper2.lambda().eq(BigDeviceVideo::getDevSn, environmentDev.getDeviceId())
|
||||
.eq(BigDeviceVideo::getProjectSn, environmentDev.getProjectSn())
|
||||
.eq(BigDeviceVideo::getType, 5);
|
||||
bigDeviceVideoMapper.delete(queryWrapper2);
|
||||
if(environmentDev.getVideoList()!=null&&environmentDev.getVideoList().size()>0){
|
||||
for (BigDeviceVideo deviceVideo:environmentDev.getVideoList()){
|
||||
if (environmentDev.getVideoList() != null && environmentDev.getVideoList().size() > 0) {
|
||||
for (BigDeviceVideo deviceVideo : environmentDev.getVideoList()) {
|
||||
deviceVideo.setProjectSn(environmentDev.getProjectSn());
|
||||
deviceVideo.setType(5);
|
||||
deviceVideo.setDevSn(environmentDev.getDeviceId());
|
||||
@ -111,10 +111,10 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
|
||||
@Override
|
||||
public List<EnvironmentDev> selectEnvironmentDevList(Map<String, Object> map) {
|
||||
List<EnvironmentDev> list=environmentDevMapper.selectEnvironmentDevList(map);
|
||||
if(list!=null&&list.size()>0){
|
||||
for (EnvironmentDev dev:list){
|
||||
List<BigDeviceVideo> videoList=bigDeviceVideoMapper.selectBigDeviceVideoByTypeList(dev.getDeviceId(),5);
|
||||
List<EnvironmentDev> list = environmentDevMapper.selectEnvironmentDevList(map);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (EnvironmentDev dev : list) {
|
||||
List<BigDeviceVideo> videoList = bigDeviceVideoMapper.selectBigDeviceVideoByTypeList(dev.getDeviceId(), 5);
|
||||
dev.setVideoList(videoList);
|
||||
}
|
||||
}
|
||||
@ -123,48 +123,48 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectEnvironmentDevStatistics(Map<String, Object> param) {
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
Map<String,Object> map=companyService.getCompanyType(param);
|
||||
List<Map<String,Object>> devList=environmentDevMapper.selectCompanyDevCountStatistics(map);
|
||||
Map<String, Object> alarmTotal=environmentAlarmMapper.selectEnvironmentAlarmCountTotal(map);
|
||||
List<Map<String, Object>> alarmList=environmentAlarmMapper.selectCompanyEnvironmentAlarmList(map);
|
||||
data.put("devList",devList);
|
||||
data.put("alarmTotal",alarmTotal);
|
||||
data.put("alarmList",alarmList);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> map = companyService.getCompanyType(param);
|
||||
List<Map<String, Object>> devList = environmentDevMapper.selectCompanyDevCountStatistics(map);
|
||||
Map<String, Object> alarmTotal = environmentAlarmMapper.selectEnvironmentAlarmCountTotal(map);
|
||||
List<Map<String, Object>> alarmList = environmentAlarmMapper.selectCompanyEnvironmentAlarmList(map);
|
||||
data.put("devList", devList);
|
||||
data.put("alarmTotal", alarmTotal);
|
||||
data.put("alarmList", alarmList);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectCurrentDayEnvironmentDevStatistics(Map<String, Object> param) {
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
Map<String,Object> map=companyService.getCompanyType(param);
|
||||
List<Map<String,Object>> devList=environmentDevMapper.selectCompanyDevCountStatistics(map);
|
||||
Map<String, Object> alarmTotal=environmentAlarmMapper.selectCurrentDayEnvironmentAlarmCountTotal(map);
|
||||
data.put("devList",devList);
|
||||
data.put("alarmTotal",alarmTotal);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> map = companyService.getCompanyType(param);
|
||||
List<Map<String, Object>> devList = environmentDevMapper.selectCompanyDevCountStatistics(map);
|
||||
Map<String, Object> alarmTotal = environmentAlarmMapper.selectCurrentDayEnvironmentAlarmCountTotal(map);
|
||||
data.put("devList", devList);
|
||||
data.put("alarmTotal", alarmTotal);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProjectEnvironmentData(String projectSn) {
|
||||
//删除设备
|
||||
QueryWrapper<EnvironmentDev> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(EnvironmentDev::getProjectSn,projectSn);
|
||||
QueryWrapper<EnvironmentDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(EnvironmentDev::getProjectSn, projectSn);
|
||||
environmentDevMapper.delete(queryWrapper);
|
||||
//删除阀值
|
||||
QueryWrapper<EnvironmentWarning> queryWrapper2=new QueryWrapper<>();
|
||||
queryWrapper2.lambda().eq(EnvironmentWarning::getProjectSn,projectSn);
|
||||
QueryWrapper<EnvironmentWarning> queryWrapper2 = new QueryWrapper<>();
|
||||
queryWrapper2.lambda().eq(EnvironmentWarning::getProjectSn, projectSn);
|
||||
environmentWarningMapper.delete(queryWrapper2);
|
||||
//删除报警记录
|
||||
QueryWrapper<EnvironmentAlarm> queryWrapper3=new QueryWrapper<>();
|
||||
queryWrapper3.lambda().eq(EnvironmentAlarm::getProjectSn,projectSn);
|
||||
QueryWrapper<EnvironmentAlarm> queryWrapper3 = new QueryWrapper<>();
|
||||
queryWrapper3.lambda().eq(EnvironmentAlarm::getProjectSn, projectSn);
|
||||
environmentAlarmMapper.delete(queryWrapper3);
|
||||
//删除环境实时数据
|
||||
QueryWrapper<DustNoiseData> queryWrapper4=new QueryWrapper<>();
|
||||
queryWrapper4.lambda().eq(DustNoiseData::getProjectSn,projectSn);
|
||||
QueryWrapper<DustNoiseData> queryWrapper4 = new QueryWrapper<>();
|
||||
queryWrapper4.lambda().eq(DustNoiseData::getProjectSn, projectSn);
|
||||
dustNoiseDataMapper.delete(queryWrapper4);
|
||||
QueryWrapper<DustNoiseHistoryData> queryWrapper5=new QueryWrapper<>();
|
||||
queryWrapper5.lambda().eq(DustNoiseHistoryData::getProjectSn,projectSn);
|
||||
QueryWrapper<DustNoiseHistoryData> queryWrapper5 = new QueryWrapper<>();
|
||||
queryWrapper5.lambda().eq(DustNoiseHistoryData::getProjectSn, projectSn);
|
||||
dustNoiseHistoryDataMapper.delete(queryWrapper5);
|
||||
|
||||
}
|
||||
@ -176,56 +176,57 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectTotalEnvironmentCountStatistics(Map<String, Object> param) {
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
Map<String,Object> map=companyService.getCompanyType(param);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> map = companyService.getCompanyType(param);
|
||||
//统计扬尘设备
|
||||
Map<String,Object> environmentDevCount=environmentDevMapper.selectEnvironmentDevCount(map);
|
||||
param.put("selectType","1");
|
||||
Map<String, Object> alarmTotal=environmentAlarmMapper.selectEnvironmentAlarmCountTotal(map);
|
||||
data.put("devTotal",environmentDevCount);
|
||||
data.put("alarmTotal",alarmTotal);
|
||||
Map<String, Object> environmentDevCount = environmentDevMapper.selectEnvironmentDevCount(map);
|
||||
param.put("selectType", "1");
|
||||
Map<String, Object> alarmTotal = environmentAlarmMapper.selectEnvironmentAlarmCountTotal(map);
|
||||
data.put("devTotal", environmentDevCount);
|
||||
data.put("alarmTotal", alarmTotal);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectProjectEnvironmentDevAndAlarmCount(Map<String, Object> map) {
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
Map<String, Object> devCount=environmentDevMapper.selectProjectEnvironmentDevCount(map);
|
||||
Map<String, Object> alarmCount=environmentAlarmMapper.selectTodayEnvironmentAlarmCount(map);
|
||||
data.put("devTotal",devCount);
|
||||
data.put("alarmTotal",alarmCount);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> devCount = environmentDevMapper.selectProjectEnvironmentDevCount(map);
|
||||
Map<String, Object> alarmCount = environmentAlarmMapper.selectTodayEnvironmentAlarmCount(map);
|
||||
data.put("devTotal", devCount);
|
||||
data.put("alarmTotal", alarmCount);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectEnvironmentDevAlaramCountList(Map<String, Object> map) {
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
List<EntityMap> devList=environmentDevMapper.selectProjectEnvironmentDevList(map);
|
||||
int totalDevOnlineNum=0;
|
||||
int totalAlarmNum=0;
|
||||
if(devList!=null&&devList.size()>0){
|
||||
public EnvironmentDevAlaramCountListVo selectEnvironmentDevAlaramCountList(Map<String, Object> map) {
|
||||
List<EnvironmentDev> devList = environmentDevMapper.selectProjectEnvironmentDevList(map);
|
||||
int totalDevOnlineNum = 0;
|
||||
int totalAlarmNum = 0;
|
||||
if (devList != null && devList.size() > 0) {
|
||||
//查询报警数
|
||||
List<Map<String, Object>> alarmList=environmentAlarmMapper.selectEnvironmentDevTodayAlarmCount(map);
|
||||
for(EntityMap dev:devList){
|
||||
if("1".equals(MapUtils.getString(dev,"devonline"))){
|
||||
List<Map<String, Object>> alarmList = environmentAlarmMapper.selectEnvironmentDevTodayAlarmCount(map);
|
||||
for (EnvironmentDev dev : devList) {
|
||||
if ("1".equals(dev.getDevOnline())) {
|
||||
totalDevOnlineNum++;
|
||||
}
|
||||
//取出报警次数
|
||||
Integer alarmNum=0;
|
||||
if(alarmList!=null&&alarmList.size()>0){
|
||||
for(Map<String, Object> count:alarmList){
|
||||
if(MapUtils.getString(dev,"deviceId").equals(MapUtils.getString(count,"deviceId"))){
|
||||
alarmNum=MapUtils.getInteger(dev,"totalAlarm");
|
||||
Integer alarmNum = 0;
|
||||
if (alarmList != null && alarmList.size() > 0) {
|
||||
for (Map<String, Object> count : alarmList) {
|
||||
if (dev.getDeviceId().equals(MapUtils.getString(count, "deviceId"))) {
|
||||
alarmNum = MapUtils.getInteger(count, "totalAlarm");
|
||||
}
|
||||
}
|
||||
}
|
||||
dev.put("alarm_num",alarmNum);
|
||||
dev.setAlarmNum(alarmNum);
|
||||
}
|
||||
}
|
||||
data.put("totalDevNum",devList.size());
|
||||
data.put("totalDevOnlineNum",totalDevOnlineNum);
|
||||
data.put("totalAlarmNum",totalAlarmNum);
|
||||
data.put("devList",devList);
|
||||
return data;
|
||||
|
||||
EnvironmentDevAlaramCountListVo vo = new EnvironmentDevAlaramCountListVo();
|
||||
vo.setTotalDevOnlineNum(totalDevOnlineNum);
|
||||
vo.setTotalDevNum(devList.size());
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询本月所有天数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"));
|
||||
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