diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TunnelBoringMachineStatVo.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TunnelBoringMachineStatVo.java index 80c50db65..c37b8b442 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TunnelBoringMachineStatVo.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TunnelBoringMachineStatVo.java @@ -25,6 +25,9 @@ public class TunnelBoringMachineStatVo { @ApiModelProperty(value = "隧道总里程") private String totalMileage; + @ApiModelProperty(value = "隧道总长度") + private String totalLength; + @ApiModelProperty(value = "最新一条实时数据") private TunnelBoringMachineCurrentDataVo tunnelBoringMachineCurrentDataVo; diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TunnelBoringMachineCurrentDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TunnelBoringMachineCurrentDataServiceImpl.java index 51533b409..3c0137376 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TunnelBoringMachineCurrentDataServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TunnelBoringMachineCurrentDataServiceImpl.java @@ -269,8 +269,8 @@ public class TunnelBoringMachineCurrentDataServiceImpl extends ServiceImpl machineStatList = tunnelBoringMachineStatMapper.selectList(Wrappers.lambdaQuery() .eq(TunnelBoringMachineStat::getProjectSn, projectSn) .eq(TunnelBoringMachineStat::getDevSn, deviceSn) - .ge(TunnelBoringMachineStat::getCreateTime, DateUtil.beginOfMonth(new Date())) - .le(TunnelBoringMachineStat::getCreateTime, DateUtil.endOfMonth(new Date()))); + .ge(TunnelBoringMachineStat::getCreateTime, DateUtil.offsetDay(new Date(), -16)) + .le(TunnelBoringMachineStat::getCreateTime, new Date())); TunnelBoringMachineStatVo tunnelBoringMachineStatVo = new TunnelBoringMachineStatVo(); tunnelBoringMachineStatVo.setTotalMileage(tunnelBoringMachine.getTotalMileage()); tunnelBoringMachineStatVo.setTotalNumber(tunnelBoringMachine.getTotalNumber()); @@ -278,7 +278,7 @@ public class TunnelBoringMachineCurrentDataServiceImpl extends ServiceImpl dayList = DateUtils.getNowFewDaysAgoList(15); List resultList = new ArrayList<>(); for (String s : dayList) { @@ -292,12 +292,13 @@ public class TunnelBoringMachineCurrentDataServiceImpl extends ServiceImpl paramMap) { log.info("uploadTagLowVoltageAlarm:{}", JSON.toJSONString(paramMap)); diff --git a/src/main/java/com/zhgd/xmgl/modules/location/controller/LocationTagLowVoltageAlarmController.java b/src/main/java/com/zhgd/xmgl/modules/location/controller/LocationTagLowVoltageAlarmController.java index 0b0fb4752..18749dd89 100644 --- a/src/main/java/com/zhgd/xmgl/modules/location/controller/LocationTagLowVoltageAlarmController.java +++ b/src/main/java/com/zhgd/xmgl/modules/location/controller/LocationTagLowVoltageAlarmController.java @@ -21,6 +21,7 @@ import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; +import java.util.Map; /** @@ -77,5 +78,13 @@ public class LocationTagLowVoltageAlarmController { return Result.success(locationTagLowVoltageAlarmService.countLocationTagLowVoltageAlarmEveryDay(paramMap)); } - + @ApiOperation(value = "统计每天低电量报警数量", notes = "统计每天低电量报警数量", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "locationTunnelId", value = "定位隧道信息id", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/countLocationTagLowVoltageAlarmEveryDayByType") + public Result>> countLocationTagLowVoltageAlarmEveryDayByType(@ApiIgnore @RequestBody HashMap paramMap) { + return Result.success(locationTagLowVoltageAlarmService.countLocationTagLowVoltageAlarmEveryDayByType(paramMap)); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationData.java b/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationData.java index a91321e89..a4dd88bb6 100644 --- a/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationData.java +++ b/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationData.java @@ -184,6 +184,15 @@ public class LocationData implements Serializable { private String tunnelId; @ApiModelProperty(value = "工作时长(秒)") private Integer workingTime; + @Excel(name = "班组名称 ", width = 15) + @ApiModelProperty(value = "班组名称 ") + private String teamName; + @Excel(name = "设备名称", width = 15) + @ApiModelProperty(value = "设备名称") + private String deviceName; + @Excel(name = "电话号码", width = 15) + @ApiModelProperty(value = "电话号码") + private String phone; @ApiModelProperty(value = "工作时长中文显示") @TableField(exist = false) diff --git a/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTagLowVoltageAlarm.java b/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTagLowVoltageAlarm.java index 946f93668..529e77468 100644 --- a/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTagLowVoltageAlarm.java +++ b/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTagLowVoltageAlarm.java @@ -23,7 +23,7 @@ import java.util.Date; @Data @TableName("location_tag_low_voltage_alarm") @ApiModel(value = "LocationTagLowVoltageAlarm实体类", description = "LocationTagLowVoltageAlarm") -public class LocationTagLowVoltageAlarm implements Serializable { +public class LocationTagLowVoltageAlarm implements Serializable { private static final long serialVersionUID = 1L; /** @@ -92,6 +92,36 @@ public class LocationTagLowVoltageAlarm implements Serializable { @Excel(name = "当前电量 百分比", width = 15) @ApiModelProperty(value = "当前电量 百分比") private java.lang.Integer voltage; + /** + * 所在区域ID + */ + @Excel(name = "所在区域ID", width = 15) + @ApiModelProperty(value = "所在区域ID") + private java.lang.String regionId; + /** + * 所在区域名称 + */ + @Excel(name = "所在区域名称", width = 15) + @ApiModelProperty(value = "所在区域名称") + private java.lang.String regionName; + /** + * 报警位置(米) + */ + @Excel(name = "报警位置(米)", width = 15) + @ApiModelProperty(value = "报警位置(米)") + private java.lang.String nX; + /** + * 位置桩号 + */ + @Excel(name = "位置桩号", width = 15) + @ApiModelProperty(value = "位置桩号") + private java.lang.String pileNo; + /** + * 持续报警时长 单位秒 + */ + @Excel(name = "持续报警时长 单位秒", width = 15) + @ApiModelProperty(value = "持续报警时长 单位秒") + private Integer durationTime; /** * 报警时间 */ diff --git a/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTunnel.java b/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTunnel.java index 67b6470be..7fb888d2e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTunnel.java +++ b/src/main/java/com/zhgd/xmgl/modules/location/entity/LocationTunnel.java @@ -111,4 +111,11 @@ public class LocationTunnel implements Serializable { private Long realtimeId; @ApiModelProperty(value = "矫正人员图标x方向") private Integer correctorIconXDirection; + + + @ApiModelProperty(value = "方向(1:从左到右;2:从右到左)") + private Integer direction; + + @ApiModelProperty(value = "比例尺") + private Integer scale; } diff --git a/src/main/java/com/zhgd/xmgl/modules/location/service/ILocationTagLowVoltageAlarmService.java b/src/main/java/com/zhgd/xmgl/modules/location/service/ILocationTagLowVoltageAlarmService.java index 5a624532d..8822d5b6a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/location/service/ILocationTagLowVoltageAlarmService.java +++ b/src/main/java/com/zhgd/xmgl/modules/location/service/ILocationTagLowVoltageAlarmService.java @@ -7,6 +7,7 @@ import com.zhgd.xmgl.modules.location.entity.dto.JiLianDaRt; import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Description: 定位低电量报警 @@ -28,4 +29,11 @@ public interface ILocationTagLowVoltageAlarmService extends IService countLocationTagLowVoltageAlarmEveryDay(HashMap paramMap); + + /** + *统计每天报警类型数量 + * @param paramMap + * @return + */ + List> countLocationTagLowVoltageAlarmEveryDayByType(HashMap paramMap); } diff --git a/src/main/java/com/zhgd/xmgl/modules/location/service/impl/LocationTagLowVoltageAlarmServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/location/service/impl/LocationTagLowVoltageAlarmServiceImpl.java index da8cda3be..896d0d8a9 100644 --- a/src/main/java/com/zhgd/xmgl/modules/location/service/impl/LocationTagLowVoltageAlarmServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/location/service/impl/LocationTagLowVoltageAlarmServiceImpl.java @@ -1,20 +1,30 @@ package com.zhgd.xmgl.modules.location.service.impl; import cn.hutool.core.codec.Base64; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gexin.fastjson.JSON; import com.gexin.fastjson.TypeReference; import com.zhgd.xmgl.base.entity.vo.TrendOneVo; +import com.zhgd.xmgl.modules.basicdata.entity.SystemUser; +import com.zhgd.xmgl.modules.basicdata.service.INoticeService; +import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService; +import com.zhgd.xmgl.modules.bigdevice.entity.TunnelBoringMachineStat; import com.zhgd.xmgl.modules.location.entity.LocationTagLowVoltageAlarm; import com.zhgd.xmgl.modules.location.entity.dto.JiLianDaRt; import com.zhgd.xmgl.modules.location.mapper.LocationTagLowVoltageAlarmMapper; import com.zhgd.xmgl.modules.location.service.ILocationTagLowVoltageAlarmService; +import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; +import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper; import com.zhgd.xmgl.util.DateUtils; import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.HashMap; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * @Description: 定位低电量报警 @@ -25,6 +35,15 @@ import java.util.List; @Service public class LocationTagLowVoltageAlarmServiceImpl extends ServiceImpl implements ILocationTagLowVoltageAlarmService { + @Autowired + private INoticeService noticeService; + + @Autowired + private ISystemUserService systemUserService; + + @Autowired + private WorkerInfoMapper workerInfoMapper; + @Override public JiLianDaRt uploadTagLowVoltageAlarm(HashMap paramMap) { String data = MapUtils.getString(paramMap, "data"); @@ -32,11 +51,33 @@ public class LocationTagLowVoltageAlarmServiceImpl extends ServiceImpl workerInfoList = workerInfoMapper.selectList(Wrappers.lambdaQuery().eq(WorkerInfo::getLocationCardno, alarm.getCardno())); + if (workerInfoList.size() > 0) { + String msg = ""; + String title = ""; + List systemUserList = systemUserService.list(Wrappers.lambdaQuery().eq(SystemUser::getSn, alarm.getProjectSn()) + .eq(SystemUser::getAccountType, 5)).stream().map(u -> u.getUserId()).collect(Collectors.toList()); + if (alarm.getAlarmType().equals("2140")) { + title = "隧道内低电量报警提醒"; + msg = StrUtil.format("【{}】【{}】标签电量过低,请及时充电保证设备正常工作!", workerInfoList.get(0).getWorkerName(), alarm.getCardno()); + } else if (alarm.getAlarmType().equals("2430")) { + title = "隧道内求救报警提醒"; + msg = StrUtil.format("【{}】【{}】发出一键求救报警消息,管理员需立即组织应急小组进行救援!", workerInfoList.get(0).getWorkerName(), alarm.getCardno()); + } else if (alarm.getAlarmType().equals("2490")) { + title = "隧道内静止报警提醒"; + msg = StrUtil.format("【{}】【{}】长时间处于静止状态,管理员需及时确认人员是否安全", workerInfoList.get(0).getWorkerName(), alarm.getCardno()); + } + noticeService.addUsersNotice(systemUserList, title, msg, "50"); + } baseMapper.insert(alarm); } return JiLianDaRt.success(); } + public static void main(String[] args) { + System.out.println(); + } + @Override public List countLocationTagLowVoltageAlarmEveryDay(HashMap paramMap) { List list = baseMapper.countLocationTagLowVoltageAlarmEveryDay(paramMap); @@ -45,4 +86,27 @@ public class LocationTagLowVoltageAlarmServiceImpl extends ServiceImpl> countLocationTagLowVoltageAlarmEveryDayByType(HashMap paramMap) { + String locationTunnelId = MapUtils.getString(paramMap, "locationTunnelId"); + String projectSn = MapUtils.getString(paramMap, "projectSn"); + List locationTagLowVoltageAlarms = baseMapper.selectList(Wrappers.lambdaQuery() + .eq(LocationTagLowVoltageAlarm::getRegionId, locationTunnelId) + .eq(LocationTagLowVoltageAlarm::getProjectSn, projectSn)); + List dayList = DateUtils.getNowFewDaysAgoList(8); + List> resultList = new ArrayList<>(); + for (String s : dayList) { + if (s.equals(DateUtil.formatDate(new Date()))) { + continue; + } + Map map = new HashMap<>(); + map.put("data", s); + map.put("2140", locationTagLowVoltageAlarms.stream().filter(l -> DateUtil.formatDate(l.getCreateTime()).equals(s) && l.getAlarmType().equals("2140")).count()); + map.put("2430", locationTagLowVoltageAlarms.stream().filter(l -> DateUtil.formatDate(l.getCreateTime()).equals(s) && l.getAlarmType().equals("2430")).count()); + map.put("2490", locationTagLowVoltageAlarms.stream().filter(l -> DateUtil.formatDate(l.getCreateTime()).equals(s) && l.getAlarmType().equals("2490")).count()); + resultList.add(map); + } + return resultList; + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java index fbba257cb..4bf957954 100644 --- a/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java @@ -299,8 +299,15 @@ public class VideoItemServiceImpl extends ServiceImpl result = YsVideoUtil.getVideoUrl(projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret(), videoItem.getSerialNumber(), accessToken); - data.put("videoInfo", result); +// Map result = YsVideoUtil.getVideoUrl(projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret(), videoItem.getSerialNumber(), accessToken); + if (StringUtils.isNotBlank(videoItem.getVideoPassword())) { + data.put("videoInfo", "ezopen://" + videoItem.getVideoPassword() +"@open.ys7.com/" + videoItem.getSerialNumber() + "/" + + videoItem.getVerificationCode() + ".live"); + } else { + data.put("videoInfo", "ezopen://open.ys7.com/" + videoItem.getSerialNumber() + "/" + + videoItem.getVerificationCode() + ".live"); + } +// data.put("videoInfo", result); data.put("accessToken", accessToken); data.put("projectVideoConfig", projectVideoConfig); }