diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java index 90d3b1a64..9541d51db 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java @@ -6,23 +6,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.xmgl.base.entity.vo.TrendVo; import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionDevAlarmVo; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionVo; import com.zhgd.xmgl.modules.frontier.service.IFrontierProtectionDevAlarmService; import com.zhgd.xmgl.security.entity.UserInfo; import com.zhgd.xmgl.security.util.SecurityUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletRequest; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.util.*; /** @@ -50,7 +52,11 @@ public class FrontierProtectionDevAlarmController { * @return */ @ApiOperation(value = "分页列表查询临边防护-设备告警信息", notes = "分页列表查询临边防护-设备告警信息", httpMethod = "GET") - @GetMapping(value = "/page") + @ApiImplicitParams({ + @ApiImplicitParam(name = "alarmTime_begin", value = "告警时间开始", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "alarmTime_end", value = "告警时间结束", paramType = "body", required = false, dataType = "String"), + }) + @GetMapping(value = "/page") public Result> queryPageList(FrontierProtectionDevAlarm frontierProtectionDevAlarm, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @@ -164,4 +170,25 @@ public class FrontierProtectionDevAlarmController { } return result; } + + @ApiOperation(value = "统计临边防护报警(实时数据)", notes = "统计临边防护报警(实时数据)", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/countFrontierProtectionDevAlarm") + public Result countFrontierProtectionDevAlarm(@ApiIgnore @RequestBody HashMap paramMap) { + return Result.success(frontierProtectionDevAlarmService.countFrontierProtectionDevAlarm(paramMap)); + } + + @ApiOperation(value = "统计临边防护报警趋势(近7日趋势(次))", notes = "统计临边防护报警趋势(近7日趋势(次))", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "type", value = "1近7天", paramType = "body", required = true, dataType = "Integer"), + }) + @PostMapping(value = "/countFrontierProtectionDevAlarmTrend") + public Result> countFrontierProtectionDevAlarmTrend(@ApiIgnore @RequestBody HashMap paramMap) { + return Result.success(frontierProtectionDevAlarmService.countFrontierProtectionDevAlarmTrend(paramMap)); + } + + } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevController.java b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevController.java index 2ad1fd4a7..307346b75 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevController.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevController.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDev; import com.zhgd.xmgl.modules.frontier.entity.qo.FrontierProtectionDevQO; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionVo; import com.zhgd.xmgl.modules.frontier.service.FrontierProtectionDevService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import java.util.HashMap; import java.util.List; /** @@ -111,5 +113,14 @@ public class FrontierProtectionDevController { public Result deleteById(Long id) { return Result.success(frontierProtectionDevService.removeById(id)); } + + @ApiOperation(value = "统计临边防护(报警统计(次))", notes = "统计临边防护(报警统计(次))", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/countFrontierProtectionDev") + public Result countFrontierProtection(@ApiIgnore @RequestBody HashMap paramMap) { + return Result.success(frontierProtectionDevService.countFrontierProtectionDev(paramMap)); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/entity/FrontierProtectionDevAlarm.java b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/FrontierProtectionDevAlarm.java index 6f922078c..4cb22786a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/entity/FrontierProtectionDevAlarm.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/FrontierProtectionDevAlarm.java @@ -109,6 +109,8 @@ public class FrontierProtectionDevAlarm implements Serializable { @Excel(name = "操作人id", width = 15) @ApiModelProperty(value = "操作人id") private java.lang.Long operateId; + @ApiModelProperty(value = "报警类型") + private java.lang.Integer alarmType; /** * 操作时间 diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/entity/vo/CountFrontierProtectionDevAlarmVo.java b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/vo/CountFrontierProtectionDevAlarmVo.java new file mode 100644 index 000000000..dd977d271 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/vo/CountFrontierProtectionDevAlarmVo.java @@ -0,0 +1,18 @@ +package com.zhgd.xmgl.modules.frontier.entity.vo; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CountFrontierProtectionDevAlarmVo { + @ApiModelProperty("今日报警") + private Integer alarmTodayNum; + @ApiModelProperty("电量过低(今日)") + private Integer lowBatteryTodayNum; + @ApiModelProperty("人员靠近(今日)") + private Integer peopleApproachingTodayNum; + @ApiModelProperty("翻越报警(今日)") + private Integer overrideAlarmTodayNum; +} + diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/entity/vo/CountFrontierProtectionVo.java b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/vo/CountFrontierProtectionVo.java new file mode 100644 index 000000000..eff9e1f51 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/vo/CountFrontierProtectionVo.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.frontier.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CountFrontierProtectionVo { + @ApiModelProperty("设备总数") + private Integer deviceNum; + @ApiModelProperty("人员靠近预警设备数(今日)") + private Integer peopleApproachingWarningDevNumToday; + @ApiModelProperty("电量过低设备数(今日)") + private Integer lowBatteryWarningDevNumToday; + @ApiModelProperty("翻越报警预警设备数(今日)") + private Integer overpassWarningDevNumToday; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/enums/AlarmEnum.java b/src/main/java/com/zhgd/xmgl/modules/frontier/enums/AlarmEnum.java index cd08183df..ed4a8bc95 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/enums/AlarmEnum.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/enums/AlarmEnum.java @@ -1,24 +1,27 @@ package com.zhgd.xmgl.modules.frontier.enums; public enum AlarmEnum { - PROXIMITY("人员靠近", 2, "入侵"), - PORT_STATUS1("线锁1", 2, "断开"), - PORT_STATUS2("线锁2", 2, "断开"), - MAG_STATUS1_ALARM("磁锁1", 2, "报警"), - MAG_STATUS1_DISABLED("磁锁1", 3, "失效"), - MAG_STATUS2_ALARM("磁锁2", 2, "报警"), - MAG_STATUS2_DISABLED("磁锁2", 3, "失效"), - ANTI_CROSS_ALARM("防翻越", 2, "报警"), - ANTI_CROSS_DISABLED("防翻越", 3, "失效"), + PROXIMITY("人员靠近", 2, "入侵", 1), + PORT_STATUS1("线锁1", 2, "断开", 2), + PORT_STATUS2("线锁2", 2, "断开", 3), + MAG_STATUS1_ALARM("磁锁1", 2, "报警", 4), + MAG_STATUS1_DISABLED("磁锁1", 3, "失效", 5), + MAG_STATUS2_ALARM("磁锁2", 2, "报警", 6), + MAG_STATUS2_DISABLED("磁锁2", 3, "失效", 7), + ANTI_CROSS_ALARM("防翻越", 2, "报警", 8), + ANTI_CROSS_DISABLED("防翻越", 3, "失效", 9), + LOW_POWER("低电量", 4, "报警", 10), ; - private Integer alarmType; + private Integer lrkAlarmType; private String name; private String alarmName; + private Integer alarmType; - AlarmEnum(String name, Integer alarmType, String alarmName) { - this.alarmType = alarmType; + AlarmEnum(String name, Integer lrkAlarmType, String alarmName, Integer alarmType) { + this.lrkAlarmType = lrkAlarmType; this.name = name; this.alarmName = alarmName; + this.alarmType = alarmType; } public String getAlarmName() { @@ -37,6 +40,14 @@ public enum AlarmEnum { this.name = name; } + public Integer getLrkAlarmType() { + return lrkAlarmType; + } + + public void setLrkAlarmType(Integer lrkAlarmType) { + this.lrkAlarmType = lrkAlarmType; + } + public Integer getAlarmType() { return alarmType; } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/FrontierProtectionDevAlarmMapper.java b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/FrontierProtectionDevAlarmMapper.java index 4f4147d76..52fe85afb 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/FrontierProtectionDevAlarmMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/FrontierProtectionDevAlarmMapper.java @@ -4,11 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.xmgl.base.entity.vo.TrendVo; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionDevAlarmVo; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionVo; import org.apache.ibatis.annotations.Mapper; import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; +import java.util.HashMap; +import java.util.List; + /** * @Description: 临边防护-设备告警 * @author: pds @@ -19,4 +25,10 @@ import org.apache.ibatis.annotations.Param; public interface FrontierProtectionDevAlarmMapper extends BaseMapper { IPage queryPageList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + CountFrontierProtectionVo countFrontierProtectionDev(HashMap paramMap); + + CountFrontierProtectionDevAlarmVo countFrontierProtectionDevAlarm(HashMap paramMap); + + List countFrontierProtectionDevAlarmTrend(HashMap paramMap); } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/FrontierProtectionDevAlarmMapper.xml b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/FrontierProtectionDevAlarmMapper.xml index c531a4c20..b0d73f25a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/FrontierProtectionDevAlarmMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/FrontierProtectionDevAlarmMapper.xml @@ -9,4 +9,37 @@ left join system_user su on su.user_id = fpda.operate_id ${ew.customSqlSegment} + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/service/FrontierProtectionDevService.java b/src/main/java/com/zhgd/xmgl/modules/frontier/service/FrontierProtectionDevService.java index bcc71957f..e8bb288cc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/service/FrontierProtectionDevService.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/service/FrontierProtectionDevService.java @@ -5,6 +5,9 @@ import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDev; import com.zhgd.xmgl.modules.frontier.entity.qo.FrontierProtectionDevQO; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionVo; + +import java.util.HashMap; /** @@ -19,5 +22,7 @@ public interface FrontierProtectionDevService extends IService paramMap); } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/service/IFrontierProtectionDevAlarmService.java b/src/main/java/com/zhgd/xmgl/modules/frontier/service/IFrontierProtectionDevAlarmService.java index 23b09f950..890d4404e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/service/IFrontierProtectionDevAlarmService.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/service/IFrontierProtectionDevAlarmService.java @@ -1,10 +1,14 @@ package com.zhgd.xmgl.modules.frontier.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.xmgl.base.entity.vo.TrendVo; import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm; import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionDevAlarmVo; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; /** * @Description: 临边防护-设备告警 @@ -15,4 +19,8 @@ import javax.servlet.http.HttpServletRequest; public interface IFrontierProtectionDevAlarmService extends IService { IPage queryPageList(FrontierProtectionDevAlarm frontierProtectionDevAlarm, Integer pageNo, Integer pageSize, HttpServletRequest req); + + CountFrontierProtectionDevAlarmVo countFrontierProtectionDevAlarm(HashMap paramMap); + + List countFrontierProtectionDevAlarmTrend(HashMap paramMap); } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevAlarmServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevAlarmServiceImpl.java index 415455350..49febeb8f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevAlarmServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevAlarmServiceImpl.java @@ -6,15 +6,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.xmgl.base.entity.vo.TrendVo; import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm; +import com.zhgd.xmgl.modules.frontier.entity.vo.CountFrontierProtectionDevAlarmVo; import com.zhgd.xmgl.modules.frontier.mapper.FrontierProtectionDevAlarmMapper; import com.zhgd.xmgl.modules.frontier.service.IFrontierProtectionDevAlarmService; +import com.zhgd.xmgl.util.DateUtils; import com.zhgd.xmgl.util.RefUtil; +import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; /** * @Description: 临边防护-设备告警 @@ -39,4 +46,19 @@ public class FrontierProtectionDevAlarmServiceImpl extends ServiceImpl pageList = frontierProtectionDevAlarmMapper.queryPageList(page, queryWrapper); return pageList; } + + @Override + public CountFrontierProtectionDevAlarmVo countFrontierProtectionDevAlarm(HashMap paramMap) { + return baseMapper.countFrontierProtectionDevAlarm(paramMap); + } + + @Override + public List countFrontierProtectionDevAlarmTrend(HashMap paramMap) { + Integer type = MapUtils.getInteger(paramMap, "type"); + if (Objects.equals(type, 1)) { + List list = baseMapper.countFrontierProtectionDevAlarmTrend(paramMap); + return TrendVo.fillTrendVos(list, DateUtils.getDateTimeStrList(60, "yyyy-MM-dd"), "MM-dd"); + } + return null; + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevCurrentDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevCurrentDataServiceImpl.java index a92f8644e..8979f017a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevCurrentDataServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/FrontierProtectionDevCurrentDataServiceImpl.java @@ -21,6 +21,7 @@ import com.zhgd.xmgl.modules.frontier.mapper.FrontierProtectionDevAlarmMapper; import com.zhgd.xmgl.modules.frontier.mapper.FrontierProtectionDevCurrentDataMapper; import com.zhgd.xmgl.modules.frontier.mapper.FrontierProtectionDevMapper; import com.zhgd.xmgl.modules.frontier.service.FrontierProtectionDevCurrentDataService; +import com.zhgd.xmgl.util.NumberUtils; import com.zhgd.xmgl.util.RefUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -123,33 +124,37 @@ public class FrontierProtectionDevCurrentDataServiceImpl extends ServiceImpl implements FrontierProtectionDevService { @Autowired private FrontierProtectionDevMapper frontierProtectionDevMapper; + @Autowired + private FrontierProtectionDevAlarmMapper frontierProtectionDevAlarmMapper; @Override public IPage selectPageInfo(Page page, FrontierProtectionDevQO frontierProtectionDevQo) { @@ -71,5 +78,14 @@ public class FrontierProtectionDevServiceImpl extends ServiceImpl paramMap) { + String projectSn = MapUtils.getString(paramMap, "projectSn"); + CountFrontierProtectionVo vo = frontierProtectionDevAlarmMapper.countFrontierProtectionDev(paramMap); + vo.setDeviceNum(frontierProtectionDevMapper.selectCount(new LambdaQueryWrapper() + .eq(FrontierProtectionDev::getProjectSn, projectSn))); + return vo; + } }