1、代码注释的修改

This commit is contained in:
yitonglei 2022-07-29 12:05:22 +08:00
parent 353485ee04
commit c874e7f9cf
3 changed files with 17 additions and 22 deletions

View File

@ -48,7 +48,7 @@ public class GetAboutCameraChannelEventListener {
//保存cache表信息到正式表 //保存cache表信息到正式表
monitorService.insertChannelCacheToCameraChannel(); monitorService.insertChannelCacheToCameraChannel();
//新t_region的channelcount //新t_region的channelcount
cameraOrgenMapper.updateRegionChannelCount(); cameraOrgenMapper.updateRegionChannelCount();
//更新武伟达的标签表 //更新武伟达的标签表

View File

@ -39,8 +39,8 @@ public interface CameraOrgenizationMapper extends BaseDao<CameraOrganization> {
@Select(" SELECT name FROM t_camera_organization where substring(id,5) = #{idPart} and left(id,3) = '006'") @Select(" SELECT name FROM t_camera_organization where substring(id,5) = #{idPart} and left(id,3) = '006'")
String getNameByidPart(@Param("idPart")String idPart); String getNameByidPart(@Param("idPart")String idPart);
@Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}") // @Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}")
void updateOrganizationCount(@Param("id") String id); // void updateOrganizationCount(@Param("id") String id);
void batchSaveCameraChannel(List<Map> list); void batchSaveCameraChannel(List<Map> list);

View File

@ -1140,7 +1140,7 @@ public class MonitorService {
return Result.success(maps); return Result.success(maps);
} }
//以此作为获取视频资源的开始获取地区和部门信息 //以此作为获取视频资源的开始获取地区和组织信息
public void getAndSaveOrgenization(){ public void getAndSaveOrgenization(){
List<JSONObject> orgenizationByPage = this.getOrgenization(new ArrayList<JSONObject>(10000)); List<JSONObject> orgenizationByPage = this.getOrgenization(new ArrayList<JSONObject>(10000));
if(orgenizationByPage != null && orgenizationByPage.size() > 0){ 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));
} }
} }
publisher.publishEvent(new SaveOrgenizationEndEvent(this,true));
} }
public List<JSONObject> getOrgenization(List<JSONObject> list) { public List<JSONObject> getOrgenization(List<JSONObject> list) {
@ -1186,14 +1185,10 @@ public class MonitorService {
getOrgenizationByParent(list,a.getString("id"),template); getOrgenizationByParent(list,a.getString("id"),template);
} }
}); });
// if(list != null && list.size() > 0){
// cameraOrgenMapper.truncate("t_camera_organization");
// }
flag = false; flag = false;
return list; return list;
}catch (Exception e){ }catch (Exception e){
System.out.println(""+String.valueOf(count)+"次获取,错误是:"); log.error("第{}次获取视频通道组织信息失败,错误是:{}",count,e.getMessage());
System.out.println(e.getMessage());
if(count >= 10){ if(count >= 10){
log.error("获取视频通道组织信息失败,失败原因:{}",e.getMessage()); log.error("获取视频通道组织信息失败,失败原因:{}",e.getMessage());
return new ArrayList<JSONObject>(); return new ArrayList<JSONObject>();
@ -1246,7 +1241,11 @@ public class MonitorService {
list.addAll(jsonObjects); list.addAll(jsonObjects);
jsonObjects.forEach(js->{ jsonObjects.forEach(js->{
if(js.getBooleanValue("isParent")){ 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){ if(re.getJSONArray("results") != null){
results = re.getJSONArray("results").toJavaList(Map.class); results = re.getJSONArray("results").toJavaList(Map.class);
}else{ }else{
log.info("根据地区id:{}获取摄像头信息失败,失败原因:{}",orgenId,re.toJSONString()); log.info("根据组织id:{}获取摄像头信息失败,失败原因:{}",orgenId,re.toJSONString());
} }
return results; return results;
} }
@ -1368,10 +1367,10 @@ public class MonitorService {
cameraChannels = getChannelInfo(m.get("id").toString(),restTemplate); cameraChannels = getChannelInfo(m.get("id").toString(),restTemplate);
}catch (Exception e){ }catch (Exception e){
log.info("根据地区id:{}查询视频通道失败,这是第{}次重试",m.get("id").toString(),tryCount); log.info("根据组织id:{}查询视频通道失败,这是第{}次重试",m.get("id").toString(),tryCount);
if(tryCount >= 10){ if(tryCount >= 10){
faulseCount.incrementAndGet(); faulseCount.incrementAndGet();
log.error("根据地区id:{},查询视频通道失败,超出重试次数",m.get("id").toString()); log.error("根据组织id:{},查询视频通道失败,超出重试次数,将去正式表中查询",m.get("id").toString());
//去t_camera_channel查询相关信息并保存 //去t_camera_channel查询相关信息并保存
cameraChannels = cameraChannelMapper.selectCameraChannelByPid(m.get("id").toString()); cameraChannels = cameraChannelMapper.selectCameraChannelByPid(m.get("id").toString());
if(cameraChannels.size() > 0){ if(cameraChannels.size() > 0){
@ -1379,6 +1378,8 @@ public class MonitorService {
for(List<Map> ll:channelList){ for(List<Map> ll:channelList){
cameraChannelMapper.batchSaveCameraChannel(ll); cameraChannelMapper.batchSaveCameraChannel(ll);
} }
} else {
log.error("根据组织id:{},从正式表中查询视频通道失败,不存在该部门数据",m.get("id").toString());
} }
} }
continue; continue;
@ -1465,9 +1466,6 @@ public class MonitorService {
} }
} }
} }
// else{//更新count字段
// cameraOrgenMapper.updateOrganizationCount(parentId);
// }
//修改nodeName //修改nodeName
needSave.forEach(map->setNodeName(map,map.get("parentId").toString())); needSave.forEach(map->setNodeName(map,map.get("parentId").toString()));
@ -1477,13 +1475,12 @@ public class MonitorService {
partition.forEach(l->{ partition.forEach(l->{
cameraOrgenMapper.batchSaveCameraChannel(l); cameraOrgenMapper.batchSaveCameraChannel(l);
}); });
//cameraOrgenMapper.updateOrganizationCount(parentId);
} }
} }
//更新完通道信息后查询地区下通道的数量并更新到地区表中 //更新完通道信息后查询组织下通道的数量并更新到组织表中
public void editChannelCount() throws Exception{ public void editChannelCount() throws Exception{
//1-更新地区表中的每个地区下channelCount //更新地区表中的每个地区下channelCount
List<Map> maps = cameraOrgenMapper.selectAllSubOrganizationMap(); List<Map> maps = cameraOrgenMapper.selectAllSubOrganizationMap();
if(maps.size() > 0){ if(maps.size() > 0){
for(int i=0;i< maps.size();i++){ for(int i=0;i< maps.size();i++){
@ -1493,8 +1490,6 @@ public class MonitorService {
cameraOrgenMapper.editChannelCount(count,orgaid); cameraOrgenMapper.editChannelCount(count,orgaid);
}; };
} }
//2-更新市区表t_region表中的channelCount
//cameraOrgenMapper.updateRegionChannelCount();
} }
public List<Map> listChildOrgenIds(String id){ public List<Map> listChildOrgenIds(String id){