| | |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO; |
| | | import com.doumee.dao.web.response.platformReport.CarmeraListVO; |
| | | import com.doumee.service.business.VisitsService; |
| | | import com.doumee.service.business.impl.JkCabinetGridServiceImpl; |
| | | import com.doumee.service.business.impl.PlatformWarnEventServiceImpl; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | warningEvent.setEventId(request.getEventId()); |
| | | warningEvent.setEventType(request.getEventType().toString()); |
| | | warningEvent.setHappenTime(request.getHappenTime()); |
| | | if(Objects.nonNull(request.getData())){ |
| | | warningEvent.setJsonContent(request.getData().toJSONString()); |
| | | } |
| | | warningEvent.setSrcIndex(request.getSrcIndex()); |
| | | warningEvent.setSrcType(request.getSrcType()); |
| | | warningEvent.setSrcName(request.getSrcName()); |
| | | warningEvent.setWarningId(warning.getId()); |
| | | warningEvent.setDeviceId(request.getSrcIndex()); |
| | | warningEvent.setRegion(this.getRegionsName(warningEvent.getSrcIndex(),warning.getType())); |
| | | warningEventMapper.insert(warningEvent); |
| | | |
| | | if(Objects.nonNull(warningConfig)){ |
| | |
| | | warningPush.setContent(content); |
| | | warningPush.setStatus(Constants.ZERO); |
| | | warningPush.setPushType(Constants.ZERO); |
| | | //TODO 根据具体数据对比获取 |
| | | warningPush.setRegion( "未知位置"); |
| | | warningPush.setRegion( warningEvent.getRegion()); |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(memberList)) { |
| | | warningPush.setMemberIds( |
| | | StringUtils.join(memberList.stream().map(i -> i.getId()).collect(Collectors.toList()), ",") |
| | |
| | | } |
| | | saveInterfaceLog(param,"/business/hksync/push/notice",result,true); |
| | | return null; |
| | | |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String,Object> stringRedisTemplate; |
| | | |
| | | public String getRegionsName(String srcIndex,Integer warningType){ |
| | | log.error("【匹配设备与区域关系信息】========开始=======:"+srcIndex); |
| | | String regionName = "未知区域"; |
| | | if(StringUtils.isBlank(srcIndex)){ |
| | | return regionName; |
| | | } |
| | | try{ |
| | | if(Constants.equalsInteger(warningType,Constants.ZERO)){ |
| | | List<CarmeraListVO> carmeraListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_CAMERAS);//所有监控点数据 |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(carmeraListVOList)){ |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(carmeraListVOList)){ |
| | | for (CarmeraListVO c:carmeraListVOList) { |
| | | if(c.getIndexCode().equals(srcIndex)){ |
| | | log.error("【监控区域匹配结果】===============:"+c.getRegionName()); |
| | | return c.getRegionName(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | List<CarmeraListVO> fireDeviceListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_FIRE_DEVICE);//所有消防设备数据 |
| | | List<CarmeraListVO> sensorListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_SENSOR);//所有传感器 |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(fireDeviceListVOList)){ |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(fireDeviceListVOList)){ |
| | | for (CarmeraListVO c:fireDeviceListVOList) { |
| | | if(c.getIndexCode().equals(srcIndex)){ |
| | | log.error("【消防区域匹配结果】===============:"+c.getRegionName()); |
| | | return c.getRegionName(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(sensorListVOList)){ |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(sensorListVOList)){ |
| | | for (CarmeraListVO c:sensorListVOList) { |
| | | if(c.getIndexCode().equals(srcIndex)){ |
| | | log.error("【传感器区域匹配结果】==============:"+c.getRegionName()); |
| | | return c.getRegionName(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | log.error("【匹配设备与区域关系信息】========结束=======:"+srcIndex); |
| | | return regionName; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 海康访客事件推送 |
| | | * @param param |