部分视频扬尘

This commit is contained in:
guo 2023-09-23 11:56:34 +08:00
parent c2e327d9a0
commit de76ea0333
20 changed files with 142 additions and 206 deletions

View File

@ -1,9 +1,19 @@
package com.zhgd.xmgl.base.entity.vo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.government.entity.Government;
import com.zhgd.xmgl.modules.city.government.mapper.GovernmentMapper;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections.MapUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
@Data
public class CityAndDistrictDeviceCountVo extends Engineering {
@ -49,4 +59,23 @@ public class CityAndDistrictDeviceCountVo extends Engineering {
@ApiModelProperty("超控制")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer overControlCount;
public static CityAndDistrictDeviceCountVo getCity(List<CityAndDistrictDeviceCountVo> list, GovernmentMapper governmentMapper) {
SecurityUser user = SecurityUtil.getUser();
Government government = governmentMapper.selectOne(new LambdaQueryWrapper<Government>().eq(Government::getGovernmentSn, user.getSn()));
CityAndDistrictDeviceCountVo vo = new CityAndDistrictDeviceCountVo();
vo.setGovernmentName(government.getGovernmentName());
vo.setCount(list.stream().mapToInt(e -> e.getCount()).sum());
vo.setOnlineCount(list.stream().mapToInt(e -> e.getOnlineCount()).sum());
vo.setOfflineCount(list.stream().mapToInt(e -> e.getOfflineCount()).sum());
return vo;
}
public static void addCityIf(HashMap<String, Object> map, List<CityAndDistrictDeviceCountVo> list, GovernmentMapper governmentMapper) {
Integer showCity = MapUtils.getInteger(map, "showCity");
if (Objects.equals(showCity, 1)) {
list.add(0, getCity(list, governmentMapper));
}
}
}

View File

@ -97,67 +97,8 @@ public class EntMonitorDevController {
}
/**
* 添加
*
* @param monitorDev
* @return
*/
@OperLog(operModul = "项目视频管理", operType = "新增", operDesc = "添加视频管理表信息")
@ApiOperation(value = " 添加视频管理表信息", notes = "添加视频管理表信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<MonitorDev> add(@RequestBody MonitorDev monitorDev) {
Result<MonitorDev> result = new Result<MonitorDev>();
monitorDevService.saveInfo(monitorDev);
result.success("添加成功!");
return result;
}
/**
* 编辑
*
* @param monitorDev
* @return
*/
@OperLog(operModul = "项目视频管理", operType = "修改", operDesc = "编辑视频管理表信息")
@ApiOperation(value = "编辑视频管理表信息", notes = "编辑视频管理表信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<MonitorDev> edit(@RequestBody MonitorDev monitorDev) {
Result<MonitorDev> result = new Result<MonitorDev>();
MonitorDev monitorDevEntity = monitorDevService.getById(monitorDev.getMonitorId());
if (monitorDevEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = monitorDevService.updateInfo(monitorDev);
if (ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 通过id删除
* @param monitorDevEntity
* @return
*/
@OperLog(operModul = "项目视频管理", operType = "删除", operDesc = "删除视频管理表信息")
@ApiOperation(value = "删除视频管理表信息", notes = "删除视频管理表信息", httpMethod = "POST")
@ApiImplicitParam(name = "monitorId", value = "视频管理表ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<MonitorDev> delete(@ApiIgnore @RequestBody MonitorDev monitorDevEntity) {
Result<MonitorDev> result = new Result<MonitorDev>();
MonitorDev monitorDev = monitorDevService.getById(monitorDevEntity.getMonitorId());
if (monitorDev == null) {
result.error500("未找到对应实体");
} else {
boolean ok = monitorDevService.removeById(monitorDevEntity.getMonitorId());
if (ok) {
result.success("删除成功!");
}
}
return result;
}
/**
* 通过id查询

View File

@ -100,69 +100,6 @@ public class EnvironmentDevController {
return Result.success(list);
}
/**
* 添加
*
* @param environmentDev
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "新增", operDesc = "添加扬尘设备管理信息")
@ApiOperation(value = " 添加扬尘设备管理信息", notes = "添加扬尘设备管理信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<EnvironmentDev> add(@RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
environmentDevService.saveInfo(environmentDev);
result.success("添加成功!");
return result;
}
/**
* 编辑
*
* @param environmentDev
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "修改", operDesc = "编辑扬尘设备管理信息")
@ApiOperation(value = "编辑扬尘设备管理信息", notes = "编辑扬尘设备管理信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<EnvironmentDev> edit(@RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
EnvironmentDev environmentDevEntity = environmentDevService.getById(environmentDev.getId());
if (environmentDevEntity == null) {
result.error500("未找到对应实体");
} else {
SecurityUser user = SecurityUtil.getUser();
environmentDev.setProjectSn(user.getSn());
boolean ok = environmentDevService.updateInfo(environmentDev);
if (ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "删除", operDesc = "删除扬尘设备管理信息")
@ApiOperation(value = "删除扬尘设备管理信息", notes = "删除扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "扬尘设备管理ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<EnvironmentDev> delete(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
EnvironmentDev iEnvironmentDev = environmentDevService.getById(environmentDev.getId());
if (iEnvironmentDev == null) {
result.error500("未找到对应实体");
} else {
boolean ok = environmentDevService.removeById(environmentDev.getId());
if (ok) {
result.success("删除成功!");
}
}
return result;
}
/**
* 列表查询

View File

@ -7,11 +7,13 @@ import lombok.Data;
public class EnvironmentDevCountVo {
@ApiModelProperty("已监管工程数量")
private Integer supervisedEngineeringCount;
@ApiModelProperty("已监管生产单位数量")
private Integer supervisedProductionUnitCount;
//@ApiModelProperty("已监管生产单位数量")
//private Integer supervisedProductionUnitCount;
@ApiModelProperty("扬尘噪声设备数量")
private Integer dustNoiseEquipmentCount;
@ApiModelProperty("扬尘噪声预警数量")
private Integer dustAndNoiseWarningCount;
@ApiModelProperty("扬尘噪声报警数量")
private Integer dustAndNoiseAlarmCount;
@ApiModelProperty("扬尘噪声监测覆盖率")
private Double dustAndNoiseCoverRate;
}

View File

@ -29,7 +29,7 @@ public interface EnvironmentAlarmMapper extends BaseMapper<EnvironmentAlarm> {
Integer statByEngineering();
EnvironmentDevCountVo count();
Integer getCount();
List<EnvironmentAlarmTypeVo.TypeNum > countTodayEnvironmentAlarmGroupByType();
}

View File

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -36,7 +35,4 @@ public interface EnvironmentDevMapper extends BaseMapper<EnvironmentDev> {
List<OnlineGroupByProjectBo> countGroupByProject();
EnvironmentDevCountVo countInstallEngineering();
EnvironmentDevCountVo count();
}

View File

@ -20,8 +20,8 @@
WHERE engineering_sn != ''
</select>
<select id="count" resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo">
select count(*) dustAndNoiseWarningCount
<select id="getCount" resultType="java.lang.Integer">
select count(*)
from environment_alarm
</select>

View File

@ -55,14 +55,5 @@
group by md.engineering_sn
</select>
<select id="countInstallEngineering" resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo">
select count(*) supervisedEngineeringCount
from engineering e
where exists(select * from environment_dev ed where ed.engineering_sn = e.engineering_sn)
</select>
<select id="count" resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo">
select count(*) dustNoiseEquipmentCount
from engineering e
</select>
</mapper>

View File

@ -29,6 +29,7 @@ import com.zhgd.xmgl.modules.city.dust.service.IDustNoiseDataService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentDevService;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.mapper.EngineeringMapper;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import com.zhgd.xmgl.modules.city.project.service.IProjectService;
@ -40,6 +41,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -70,6 +72,8 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
private IEnvironmentAlarmService environmentAlarmService;
@Autowired
private EnvironmentAlarmMapper environmentAlarmMapper;
@Autowired
private EngineeringMapper engineeringMapper;
@Override
public Page<EnvironmentDev> pageList(Page page, Wrapper<EnvironmentDev> wrapper) {
@ -165,11 +169,11 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
public EnvironmentDevStatDto statistics() {
EnvironmentDevStatDto environmentDev = new EnvironmentDevStatDto();
/* if (type == 1) {
int installNum = this.count(Wrappers.<EnvironmentDev>lambdaQuery().isNotNull(EnvironmentDev::getProjectSn));
int installNum = this.getCount(Wrappers.<EnvironmentDev>lambdaQuery().isNotNull(EnvironmentDev::getProjectSn));
Integer projectNum = projectService.list(Wrappers.<Project>lambdaQuery().eq(Project::getState, 1)).size();
environmentDev.setInstallNum(installNum);
environmentDev.setUseRate(projectNum == 0 ? 0 : NumberUtil.round(installNum * 100F / projectNum, 2).floatValue());
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getProjectSn)));
environmentDev.setTotalAlarm(environmentAlarmService.getCount(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getProjectSn)));
} else {*/
int installNum = this.statByEngineering();
Integer engineeringNum = engineeringService.list(Wrappers.<Engineering>lambdaQuery().eq(Engineering::getExamineState, 3)).size();
@ -195,9 +199,13 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
@Override
public EnvironmentDevCountVo countEnvironmentDev() {
EnvironmentDevCountVo vo = baseMapper.countInstallEngineering();
vo.setDustNoiseEquipmentCount(baseMapper.count().getDustNoiseEquipmentCount());
vo.setDustAndNoiseWarningCount(environmentAlarmMapper.count().getDustAndNoiseWarningCount());
HashMap<String, Object> map = new HashMap<>();
EnvironmentDevCountVo vo = new EnvironmentDevCountVo();
vo.setDustNoiseEquipmentCount(baseMapper.statByDevNum());
vo.setDustAndNoiseAlarmCount(environmentAlarmMapper.getCount());
vo.setSupervisedEngineeringCount(baseMapper.statByEngineering());
Integer count = engineeringMapper.getCount(map);
vo.setDustAndNoiseCoverRate(Double.valueOf(NumberUtil.roundStr((double) vo.getSupervisedEngineeringCount() / Double.valueOf(count) * 100, 2)));
return vo;
}

View File

@ -73,10 +73,6 @@ public class Engineering implements Serializable {
@ApiModelProperty(value = "工程类别(1:房屋建筑;2:市政公用工程;3:轨道交通工程;4:公共建设项目;5:其他)")
private Integer engineeringType;
@TableField(exist = false)
@ApiModelProperty(value = "工程类别名称")
private String engineeringTypeName;
/**
* 工程用途(字典数据)
*/
@ -85,9 +81,6 @@ public class Engineering implements Serializable {
@ApiModelProperty(value = "工程用途(字典数据)")
private Integer engineeringUse;
@TableField(exist = false)
@ApiModelProperty(value = "工程用途名称")
private String engineeringUseName;
/**
* 工程造价(万元)
@ -284,12 +277,6 @@ public class Engineering implements Serializable {
*/
@ApiModelProperty(value = "工程状态(1:未开工;2:在建;3:在建.普通停工;4:在建.处罚停工;5:在建.完工;6:待竣工;7:竣工;8:其他)")
private Integer state;
/**
* 工程状态名称
*/
@TableField(exist = false)
@ApiModelProperty(value = "工程状态名称")
private String stateName;
/**
* 驳回原因
*/
@ -302,6 +289,21 @@ public class Engineering implements Serializable {
@ApiModelProperty(value = "工程AI预警信息统计")
private String aiAlarmStat;
@TableField(exist = false)
@ApiModelProperty(value = "工程类别名称")
private String engineeringTypeName;
/**
* 工程状态名称
*/
@TableField(exist = false)
@ApiModelProperty(value = "工程状态名称")
private String stateName;
@TableField(exist = false)
@ApiModelProperty(value = "工程用途名称")
private String engineeringUseName;
/**
* AI预警状态(true预警;false正常)
*/

View File

@ -162,6 +162,9 @@
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
<if test="state != null">
and state = #{state}
</if>
<if test="engineeringCostBegin != null and engineeringCostBegin != ''">
and engineering_cost >= #{engineeringCostBegin}
</if>

View File

@ -16,9 +16,8 @@ import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.basicdata.dto.MonitorTreeDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.MonitorDevVo;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -32,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -140,9 +140,12 @@ public class MonitorDevController {
@OperLog(operModul = "项目视频管理", operType = "统计", operDesc = "统计市级和区级的监控点")
@ApiOperation(value = "统计市级和区级的监控点", notes = "统计市级和区级的监控点", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "showCity", value = "是否查询城市", paramType = "body", required = true, dataType = "Integer"),
})
@PostMapping(value = "/countCityAndDistrictMonitor")
public Result<List<CityAndDistrictDeviceCountVo>> countCityAndDistrictMonitor() {
List<CityAndDistrictDeviceCountVo> countCityAndDistrictMonitors = monitorDevService.countCityAndDistrictMonitor();
public Result<List<CityAndDistrictDeviceCountVo>> countCityAndDistrictMonitor(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
List<CityAndDistrictDeviceCountVo> countCityAndDistrictMonitors = monitorDevService.countCityAndDistrictMonitor(paramMap);
return Result.success(countCityAndDistrictMonitors);
}
@ -161,5 +164,10 @@ public class MonitorDevController {
return Result.success(pageList);
}
@OperLog(operModul = "项目视频管理", operType = "统计", operDesc = "统计监控总体概况")
@ApiOperation(value = "统计监控总体概况", notes = "统计监控总体概况", httpMethod = "POST")
@PostMapping(value = "/countMonitorDev")
public Result<MonitorDevVo> countMonitorDev() {
return Result.success(monitorDevService.countMonitorDev());
}
}

View File

@ -0,0 +1,18 @@
package com.zhgd.xmgl.modules.city.monitor.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MonitorDevVo {
@ApiModelProperty("在监工程(未竣工)数量")
private Integer monitorEngineeringCount;
@ApiModelProperty("已安装视频工程数量")
private Integer installMonitorCount;
@ApiModelProperty("视频监控覆盖率")
private Double monitorCoverRate;
@ApiModelProperty("未安装视频工程数量")
private Integer uninstallMonitorEngineeringCount;
@ApiModelProperty("累计视频抓拍预警数量")
private Integer monitorQuestionWarningCount;
}

View File

@ -16,7 +16,7 @@ import java.util.List;
/**
* @Description: 视频管理表
* @author pds
* @date 2023-02-27
* @date 2023-02-27
* @version V1.0
*/
@Mapper
@ -36,4 +36,6 @@ public interface MonitorDevMapper extends BaseMapper<MonitorDev> {
List<CityAndDistrictDeviceCountVo> countDistrictMonitor();
List<OnlineGroupByProjectBo> countOnlineGroupByProject();
Integer getEngineeringCount();
}

View File

@ -28,4 +28,5 @@ public interface MonitorQuestionMapper extends BaseMapper<MonitorQuestion> {
Integer statByState();
Integer statByEngineering();
Integer getCount();
}

View File

@ -56,4 +56,9 @@
FROM monitor_dev md
group by md.engineering_sn
</select>
<select id="getEngineeringCount" resultType="java.lang.Integer">
SELECT count(distinct engineering_sn)
FROM monitor_dev
</select>
</mapper>

View File

@ -27,4 +27,8 @@
LEFT JOIN engineering e ON q.engineering_sn = e.engineering_sn
WHERE q.id = #{id}
</select>
<select id="getCount" resultType="java.lang.Integer">
select count(*) from monitor_question
</select>
</mapper>

View File

@ -10,8 +10,10 @@ import com.zhgd.xmgl.modules.basicdata.dto.AppIndexDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.MonitorTreeDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.MonitorDevVo;
import com.zhgd.xmgl.modules.city.project.entity.Project;
import java.util.HashMap;
import java.util.List;
/**
@ -36,11 +38,9 @@ public interface IMonitorDevService extends IService<MonitorDev> {
AppIndexDeviceDto statDevNum();
boolean saveInfo(MonitorDev monitorDev);
boolean updateInfo(MonitorDev monitorDev);
List<CityAndDistrictDeviceCountVo> countCityAndDistrictMonitor();
List<CityAndDistrictDeviceCountVo> countCityAndDistrictMonitor(HashMap<String, Object> paramMap);
IPage<CityAndDistrictDeviceCountVo> queryEngineeringAndStatusPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper);
MonitorDevVo countMonitorDev();
}

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.city.monitor.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -11,7 +12,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.base.entity.vo.CityAndDistrictDeviceCountVo;
import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.MonitorTreeDto;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
@ -19,21 +19,20 @@ import com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentDevMapper;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.mapper.EngineeringMapper;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.government.entity.Government;
import com.zhgd.xmgl.modules.city.government.mapper.GovernmentMapper;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.MonitorDevVo;
import com.zhgd.xmgl.modules.city.monitor.mapper.MonitorDevMapper;
import com.zhgd.xmgl.modules.city.monitor.mapper.MonitorQuestionMapper;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.modules.city.project.entity.Project;
import com.zhgd.xmgl.modules.wisdom.mapper.AiMonitorDevMapper;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -62,6 +61,8 @@ public class MonitorDevServiceImpl extends ServiceImpl<MonitorDevMapper, Monitor
private ISystemDictDataService systemDictDataService;
@Autowired
private GovernmentMapper governmentMapper;
@Autowired
private MonitorQuestionMapper monitorQuestionMapper;
@Override
public Page<MonitorDev> pageList(Page page, Wrapper<MonitorDev> wrapper) {
@ -172,39 +173,13 @@ public class MonitorDevServiceImpl extends ServiceImpl<MonitorDevMapper, Monitor
}
@Override
public boolean saveInfo(MonitorDev monitorDev) {
MonitorDev monitorDevEntity = baseMapper.getByCode(monitorDev.getCode(), "ignoreDataScope");
if (monitorDevEntity != null) {
throw new CustomException("监控编码已存在,请重新输入!");
} else {
monitorDev.setCreateTime(new Date());
}
return this.save(monitorDev);
}
@Override
public boolean updateInfo(MonitorDev monitorDev) {
MonitorDev monitorDevEntity = baseMapper.getByCode(monitorDev.getCode(), "ignoreDataScope");
if (monitorDevEntity != null && !monitorDevEntity.getMonitorId().equals(monitorDev.getMonitorId())) {
throw new CustomException("监控编码已存在,请重新输入!");
}
return this.updateById(monitorDev);
}
@Override
public List<CityAndDistrictDeviceCountVo> countCityAndDistrictMonitor() {
SecurityUser user = SecurityUtil.getUser();
public List<CityAndDistrictDeviceCountVo> countCityAndDistrictMonitor(HashMap<String, Object> paramMap) {
List<CityAndDistrictDeviceCountVo> list = baseMapper.countDistrictMonitor();
Government government = governmentMapper.selectOne(new LambdaQueryWrapper<Government>().eq(Government::getGovernmentSn, user.getSn()));
CityAndDistrictDeviceCountVo vo = new CityAndDistrictDeviceCountVo();
vo.setGovernmentName(government.getGovernmentName());
vo.setCount(list.stream().mapToInt(e -> e.getCount()).sum());
vo.setOnlineCount(list.stream().mapToInt(e -> e.getOnlineCount()).sum());
vo.setOfflineCount(list.stream().mapToInt(e -> e.getOfflineCount()).sum());
list.add(0, vo);
CityAndDistrictDeviceCountVo.addCityIf(paramMap, list, governmentMapper);
return list;
}
@Override
public IPage<CityAndDistrictDeviceCountVo> queryEngineeringAndStatusPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper) {
Page<Engineering> pageList = engineeringService.page(page, wrapper);
@ -218,4 +193,18 @@ public class MonitorDevServiceImpl extends ServiceImpl<MonitorDevMapper, Monitor
});
return rtPage;
}
@Override
public MonitorDevVo countMonitorDev() {
HashMap<String, Object> map = new HashMap<>();
MonitorDevVo vo = new MonitorDevVo();
Integer count = engineeringMapper.getCount(map);
map.put("state", 2);
vo.setMonitorEngineeringCount(engineeringMapper.getCount(map));
vo.setInstallMonitorCount(baseMapper.getEngineeringCount());
vo.setMonitorCoverRate(Double.valueOf(NumberUtil.roundStr((double) vo.getInstallMonitorCount() / Double.valueOf(count) * 100, 2)));
vo.setUninstallMonitorEngineeringCount(count - vo.getInstallMonitorCount());
vo.setMonitorQuestionWarningCount(monitorQuestionMapper.getCount());
return vo;
}
}

View File

@ -183,7 +183,7 @@ public class FileDealComp {
.eq(UserFile::getDeleteFlag, 0)
.eq(UserFile::getUserId, sessionUserId)
.groupBy(UserFile::getFilePath, UserFile::getFileName)
.having("count(file_name) >= 2");
.having("getCount(file_name) >= 2");
List<UserFile> repeatList = userFileMapper.selectList(lambdaQueryWrapper);
for (UserFile userFile : repeatList) {