diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/GetAboutCameraChannelEventListener.java b/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/GetAboutCameraChannelEventListener.java index 780f8c72..4de37e12 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/GetAboutCameraChannelEventListener.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/GetAboutCameraChannelEventListener.java @@ -48,7 +48,7 @@ public class GetAboutCameraChannelEventListener { //保存cache表信息到正式表 monitorService.insertChannelCacheToCameraChannel(); - //跟新t_region的channelcount + //更新t_region的channelcount cameraOrgenMapper.updateRegionChannelCount(); //更新武伟达的标签表 diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java index b22ae395..32ecc0d6 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java @@ -39,8 +39,8 @@ public interface CameraOrgenizationMapper extends BaseDao { @Select(" SELECT name FROM t_camera_organization where substring(id,5) = #{idPart} and left(id,3) = '006'") String getNameByidPart(@Param("idPart")String idPart); - @Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}") - void updateOrganizationCount(@Param("id") String id); +// @Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}") +// void updateOrganizationCount(@Param("id") String id); void batchSaveCameraChannel(List list); diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java index cd487065..1505ed4a 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java @@ -1140,7 +1140,7 @@ public class MonitorService { return Result.success(maps); } - //以此作为获取视频资源的开始,获取地区和部门信息 + //以此作为获取视频资源的开始,获取地区和组织信息 public void getAndSaveOrgenization(){ List orgenizationByPage = this.getOrgenization(new ArrayList(10000)); if(orgenizationByPage != null && orgenizationByPage.size() > 0){ @@ -1166,7 +1166,6 @@ public class MonitorService { publisher.publishEvent(new SaveOrgenizationEndEvent(this,true)); } } - publisher.publishEvent(new SaveOrgenizationEndEvent(this,true)); } public List getOrgenization(List list) { @@ -1186,14 +1185,10 @@ public class MonitorService { getOrgenizationByParent(list,a.getString("id"),template); } }); -// if(list != null && list.size() > 0){ -// cameraOrgenMapper.truncate("t_camera_organization"); -// } flag = false; return list; }catch (Exception e){ - System.out.println("第"+String.valueOf(count)+"次获取,错误是:"); - System.out.println(e.getMessage()); + log.error("第{}次获取视频通道组织信息失败,错误是:{}",count,e.getMessage()); if(count >= 10){ log.error("获取视频通道组织信息失败,失败原因:{}",e.getMessage()); return new ArrayList(); @@ -1246,7 +1241,11 @@ public class MonitorService { list.addAll(jsonObjects); jsonObjects.forEach(js->{ if(js.getBooleanValue("isParent")){ - getOrgenizationByParent(list,js.getString("id"),restTemplate); + try { + getOrgenizationByParent(list, js.getString("id"), restTemplate); + }catch (Exception e){ + log.error("根据父id:{}获取下级组织信息失败",js.getString("id")); + } } }); } @@ -1319,7 +1318,7 @@ public class MonitorService { if(re.getJSONArray("results") != null){ results = re.getJSONArray("results").toJavaList(Map.class); }else{ - log.info("根据地区id:{}获取摄像头信息失败,失败原因:{}",orgenId,re.toJSONString()); + log.info("根据组织id:{}获取摄像头信息失败,失败原因:{}",orgenId,re.toJSONString()); } return results; } @@ -1368,10 +1367,10 @@ public class MonitorService { cameraChannels = getChannelInfo(m.get("id").toString(),restTemplate); }catch (Exception e){ - log.info("根据地区id:{}查询视频通道失败,这是第{}次重试",m.get("id").toString(),tryCount); + log.info("根据组织id:{}查询视频通道失败,这是第{}次重试",m.get("id").toString(),tryCount); if(tryCount >= 10){ faulseCount.incrementAndGet(); - log.error("根据地区id:{},查询视频通道失败,超出重试次数",m.get("id").toString()); + log.error("根据组织id:{},查询视频通道失败,超出重试次数,将去正式表中查询",m.get("id").toString()); //去t_camera_channel查询相关信息并保存 cameraChannels = cameraChannelMapper.selectCameraChannelByPid(m.get("id").toString()); if(cameraChannels.size() > 0){ @@ -1379,6 +1378,8 @@ public class MonitorService { for(List ll:channelList){ cameraChannelMapper.batchSaveCameraChannel(ll); } + } else { + log.error("根据组织id:{},从正式表中查询视频通道失败,不存在该部门数据",m.get("id").toString()); } } continue; @@ -1465,9 +1466,6 @@ public class MonitorService { } } } -// else{//更新count字段 -// cameraOrgenMapper.updateOrganizationCount(parentId); -// } //修改nodeName needSave.forEach(map->setNodeName(map,map.get("parentId").toString())); @@ -1477,13 +1475,12 @@ public class MonitorService { partition.forEach(l->{ cameraOrgenMapper.batchSaveCameraChannel(l); }); - //cameraOrgenMapper.updateOrganizationCount(parentId); } } - //更新完通道信息后,查询地区下通道的数量并更新到地区表中 + //更新完通道信息后,查询组织下通道的数量并更新到组织表中 public void editChannelCount() throws Exception{ - //1-更新地区表中的每个地区下channelCount + //更新地区表中的每个地区下channelCount List maps = cameraOrgenMapper.selectAllSubOrganizationMap(); if(maps.size() > 0){ for(int i=0;i< maps.size();i++){ @@ -1493,8 +1490,6 @@ public class MonitorService { cameraOrgenMapper.editChannelCount(count,orgaid); }; } - //2-更新市区表t_region表中的channelCount - //cameraOrgenMapper.updateRegionChannelCount(); } public List listChildOrgenIds(String id){