Commit 6fdc25b4285c61aaff7db9e2d4c3e137f1e28b26
1 parent
2ad30a03
通过URL传参访问车辆和通道信息
Showing
5 changed files
with
36 additions
and
37 deletions
src/main/java/com/bsth/controller/video/VideoController.java
| ... | ... | @@ -59,7 +59,7 @@ public class VideoController { |
| 59 | 59 | |
| 60 | 60 | @GetMapping("/tree/carNo/{parentId}") |
| 61 | 61 | public List<VideoTree> layTreeNodeCarNo(@PathVariable("parentId") String parentId) { |
| 62 | - return videoService.combinationTreeOfCar(parentId, false); | |
| 62 | + return videoService.combinationTreeOfCar(parentId, false,false); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | @GetMapping("/tree/search") |
| ... | ... | @@ -71,7 +71,7 @@ public class VideoController { |
| 71 | 71 | } |
| 72 | 72 | List<VideoTree> groups = null; |
| 73 | 73 | try { |
| 74 | - groups = videoService.searchTreeDataByCarNo(carNo, Boolean.TRUE); | |
| 74 | + groups = videoService.searchTreeDataByCarNo(carNo, Boolean.TRUE,Boolean.TRUE); | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | setAttributeToPage(result); |
| ... | ... | @@ -151,7 +151,7 @@ public class VideoController { |
| 151 | 151 | public Map<String, Object> queryChannelsTree(@PathVariable String carNo) { |
| 152 | 152 | Map<String, Object> result = new HashMap<>(); |
| 153 | 153 | try { |
| 154 | - List<VideoTree> trees = videoService.queryChannelsTree(carNo, Boolean.TRUE); | |
| 154 | + List<VideoTree> trees = videoService.queryChannelsTree(carNo, Boolean.TRUE,Boolean.FALSE); | |
| 155 | 155 | setAttributeToPage(result); |
| 156 | 156 | result.put("data", trees); |
| 157 | 157 | result.put("status", ResponseCode.SUCCESS); | ... | ... |
src/main/java/com/bsth/entity/video/VideoTree.java
src/main/java/com/bsth/service/impl/videoimpl/VideoServiceImpl.java
| ... | ... | @@ -69,7 +69,7 @@ public class VideoServiceImpl implements VideoService { |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | @Override |
| 72 | - public List<VideoTree> combinationTreeOfCar(String code,boolean spread) { | |
| 72 | + public List<VideoTree> combinationTreeOfCar(String code,boolean spread,boolean asyn) { | |
| 73 | 73 | if (Objects.nonNull(code)) { |
| 74 | 74 | List<VideoTree> trees = new ArrayList<>(); |
| 75 | 75 | Set<String> carNos = groupCarNosByComputeCode(code); |
| ... | ... | @@ -77,14 +77,14 @@ public class VideoServiceImpl implements VideoService { |
| 77 | 77 | Set<Line> lineSet = groupLingByCompany(code); |
| 78 | 78 | if (CollectionUtils.isNotEmpty(lineSet)) { |
| 79 | 79 | for (Line line : lineSet) { |
| 80 | - VideoTree videoTree = combinationOfLine(code, line,spread); | |
| 80 | + VideoTree videoTree = combinationOfLine(code, line,spread,asyn); | |
| 81 | 81 | trees.add(videoTree); |
| 82 | 82 | |
| 83 | 83 | Set<String> carNoSets = groupCarNoByLine(line.getId()); |
| 84 | 84 | if (CollectionUtils.isNotEmpty(carNoSets)) { |
| 85 | 85 | List<VideoTree> children = new ArrayList<>(); |
| 86 | 86 | for (String carNo : carNoSets) { |
| 87 | - VideoTree carTree = combnationOfCar(carNo, line.getId().toString(),spread); | |
| 87 | + VideoTree carTree = combnationOfCar(carNo, line.getId().toString(),spread,asyn); | |
| 88 | 88 | children.add(carTree); |
| 89 | 89 | |
| 90 | 90 | if (CollectionUtils.isNotEmpty(carNos)) { |
| ... | ... | @@ -100,7 +100,7 @@ public class VideoServiceImpl implements VideoService { |
| 100 | 100 | |
| 101 | 101 | if (CollectionUtils.isNotEmpty(carNos)) { |
| 102 | 102 | for (String carNo : carNos) { |
| 103 | - VideoTree carTree = combnationOfCar(carNo, code,spread); | |
| 103 | + VideoTree carTree = combnationOfCar(carNo, code,spread,asyn); | |
| 104 | 104 | trees.add(carTree); |
| 105 | 105 | } |
| 106 | 106 | } |
| ... | ... | @@ -109,17 +109,19 @@ public class VideoServiceImpl implements VideoService { |
| 109 | 109 | return null; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - private VideoTree combnationOfCar(String carNo, String line,boolean spread) { | |
| 112 | + private VideoTree combnationOfCar(String carNo, String line,boolean spread,boolean asyn) { | |
| 113 | 113 | String name = Objects.isNull(basicData) || MapUtils.isEmpty(basicData.nbbmCompanyPlateMap) ? null : basicData.nbbmCompanyPlateMap.get(carNo); |
| 114 | - return combinationVideoTree(carNo, carNo, line, carNo, 301, "bus1", carNo,spread); | |
| 114 | + VideoTree tree = combinationVideoTree(carNo, carNo, line, carNo, 301, "bus1", carNo,spread,asyn); | |
| 115 | + tree.setWvpLiveBroadcast(wvpConfig.getWvpLiveBroadcast()); | |
| 116 | + return tree; | |
| 115 | 117 | } |
| 116 | 118 | |
| 117 | - private VideoTree combinationOfLine(String code, Line line,boolean spread) { | |
| 118 | - return combinationVideoTree(line.getId(), line.getName(), code, line.getId(), 201, "line", line.getLineCode(),spread); | |
| 119 | + private VideoTree combinationOfLine(String code, Line line,boolean spread,boolean asyn) { | |
| 120 | + return combinationVideoTree(line.getId(), line.getName(), code, line.getId(), 201, "line", line.getLineCode(),spread,asyn); | |
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | @Override |
| 122 | - public List<VideoTree> searchTreeDataByCarNo(String carNo,boolean spread) throws Exception { | |
| 124 | + public List<VideoTree> searchTreeDataByCarNo(String carNo,boolean spread,boolean asyn) throws Exception { | |
| 123 | 125 | Line line = findLineByCode(carNo); |
| 124 | 126 | |
| 125 | 127 | Iterable<Business> businessIterable = businessService.list(new HashMap<>()); |
| ... | ... | @@ -131,22 +133,22 @@ public class VideoServiceImpl implements VideoService { |
| 131 | 133 | Set<Business> businesses = new LinkedHashSet<>(); |
| 132 | 134 | findBussinessByUpCode(line.getCompany(), businessIterable, businesses); |
| 133 | 135 | if (CollectionUtils.isNotEmpty(businesses)) { |
| 134 | - List<VideoTree> group = combitionBussiness(businesses,spread); | |
| 136 | + List<VideoTree> group = combitionBussiness(businesses,spread,asyn); | |
| 135 | 137 | |
| 136 | 138 | VideoTree sourceTree = findVideoTreeByBusinessCode(line.getCompany(), group); |
| 137 | 139 | if (Objects.isNull(sourceTree.getChildren())) { |
| 138 | 140 | sourceTree.setChildren(new ArrayList<>()); |
| 139 | 141 | } |
| 140 | - VideoTree lineOfTreeNode = combinationOfLine(sourceTree.getId().toString(), line,spread); | |
| 142 | + VideoTree lineOfTreeNode = combinationOfLine(sourceTree.getId().toString(), line,spread,asyn); | |
| 141 | 143 | lineOfTreeNode.setSpread(Boolean.TRUE.toString()); |
| 142 | 144 | lineOfTreeNode.setChildren(new ArrayList<>()); |
| 143 | 145 | sourceTree.getChildren().add(lineOfTreeNode); |
| 144 | 146 | |
| 145 | - VideoTree carOfTreeNode = combnationOfCar(carNo, line.getLineCode(),spread); | |
| 147 | + VideoTree carOfTreeNode = combnationOfCar(carNo, line.getLineCode(),spread,asyn); | |
| 146 | 148 | lineOfTreeNode.getChildren().add(carOfTreeNode); |
| 147 | 149 | carOfTreeNode.setSpread(Boolean.TRUE.toString()); |
| 148 | 150 | |
| 149 | - List<VideoTree> children = queryChannelsTree(carNo,spread); | |
| 151 | + List<VideoTree> children = queryChannelsTree(carNo,spread,asyn); | |
| 150 | 152 | carOfTreeNode.setChildren(children); |
| 151 | 153 | |
| 152 | 154 | |
| ... | ... | @@ -158,17 +160,17 @@ public class VideoServiceImpl implements VideoService { |
| 158 | 160 | if (StringUtils.isNotEmpty(company)) { |
| 159 | 161 | findBussinessByUpCode(company, businessIterable, businesses); |
| 160 | 162 | if (CollectionUtils.isNotEmpty(businesses)) { |
| 161 | - List<VideoTree> group = combitionBussiness(businesses,spread); | |
| 163 | + List<VideoTree> group = combitionBussiness(businesses,spread,asyn); | |
| 162 | 164 | VideoTree sourceTree = findVideoTreeByBusinessCode(company, group); |
| 163 | 165 | if (Objects.nonNull(sourceTree) && Objects.isNull(sourceTree.getChildren())) { |
| 164 | 166 | sourceTree.setChildren(new ArrayList<>()); |
| 165 | 167 | } |
| 166 | - VideoTree carOfTreeNode = combnationOfCar(carNo, company,spread); | |
| 168 | + VideoTree carOfTreeNode = combnationOfCar(carNo, company,spread,asyn); | |
| 167 | 169 | carOfTreeNode.setSpread(Boolean.TRUE.toString()); |
| 168 | 170 | sourceTree.getChildren().add(carOfTreeNode); |
| 169 | 171 | |
| 170 | 172 | sourceTree.setSpread("true"); |
| 171 | - List<VideoTree> children = queryChannelsTree(carNo,spread); | |
| 173 | + List<VideoTree> children = queryChannelsTree(carNo,spread,asyn); | |
| 172 | 174 | carOfTreeNode.setChildren(children); |
| 173 | 175 | |
| 174 | 176 | return group; |
| ... | ... | @@ -181,7 +183,7 @@ public class VideoServiceImpl implements VideoService { |
| 181 | 183 | } |
| 182 | 184 | |
| 183 | 185 | @Override |
| 184 | - public List<VideoTree> queryChannelsTree(String carNo, boolean spread) throws Exception { | |
| 186 | + public List<VideoTree> queryChannelsTree(String carNo, boolean spread,boolean asyn) throws Exception { | |
| 185 | 187 | List<Map<String, Object>> videoChannels = getVideoChannel(carNo); |
| 186 | 188 | List<VideoTree> trees = new ArrayList<>(); |
| 187 | 189 | |
| ... | ... | @@ -196,6 +198,7 @@ public class VideoServiceImpl implements VideoService { |
| 196 | 198 | String name = Objects.isNull(map.get("name")) ? map.get("channelId") + "_" + map.get("deviceId") : map.get("name").toString(); |
| 197 | 199 | tree.setText("<span><img src='/metronic_v4.5.4/layui/icon/video1.ico' class ='imageIcon' /></span><span>"+name+"</span>"); |
| 198 | 200 | tree.setNodePValue(carNo); |
| 201 | + tree.setWvpLiveBroadcast(wvpConfig.getWvpLiveBroadcast()); | |
| 199 | 202 | |
| 200 | 203 | trees.add(tree); |
| 201 | 204 | } |
| ... | ... | @@ -231,16 +234,16 @@ public class VideoServiceImpl implements VideoService { |
| 231 | 234 | return Collections.emptyList(); |
| 232 | 235 | } |
| 233 | 236 | |
| 234 | - return combitionBussiness(businessIterable,false); | |
| 237 | + return combitionBussiness(businessIterable,false,Boolean.FALSE); | |
| 235 | 238 | |
| 236 | 239 | } |
| 237 | 240 | |
| 238 | - private List<VideoTree> combitionBussiness(Iterable<Business> businessIterable,boolean spread) { | |
| 241 | + private List<VideoTree> combitionBussiness(Iterable<Business> businessIterable,boolean spread,boolean asyn) { | |
| 239 | 242 | List<VideoTree> trees = new ArrayList<>(); |
| 240 | 243 | Iterator<Business> iterator = businessIterable.iterator(); |
| 241 | 244 | while (iterator.hasNext()) { |
| 242 | 245 | Business business = iterator.next(); |
| 243 | - VideoTree videoTree = combinationVideoTree(business.getBusinessCode(), business.getBusinessName(), business.getUpCode(), business.getId(), null, "company1", business.getBusinessCode(),spread); | |
| 246 | + VideoTree videoTree = combinationVideoTree(business.getBusinessCode(), business.getBusinessName(), business.getUpCode(), business.getId(), null, "company1", business.getBusinessCode(),spread,asyn); | |
| 244 | 247 | trees.add(videoTree); |
| 245 | 248 | } |
| 246 | 249 | List<VideoTree> groupTree = new ArrayList<>(); |
| ... | ... | @@ -275,7 +278,7 @@ public class VideoServiceImpl implements VideoService { |
| 275 | 278 | * @param icon 图标 |
| 276 | 279 | * @return com.bsth.entity.video.VideoTree |
| 277 | 280 | */ |
| 278 | - private VideoTree combinationVideoTree(Object id, String text, String parent, Object sourceId, Integer type, String icon, Object code,boolean spread) { | |
| 281 | + private VideoTree combinationVideoTree(Object id, String text, String parent, Object sourceId, Integer type, String icon, Object code,boolean spread,boolean asyn) { | |
| 279 | 282 | VideoTree videoTree = new VideoTree(); |
| 280 | 283 | videoTree.setId(id); |
| 281 | 284 | videoTree.setText("<span><img src='/metronic_v4.5.4/layui/icon/"+icon+".png' class ='imageIcon' /></span><span>"+text+"</span>"); |
| ... | ... | @@ -284,6 +287,7 @@ public class VideoServiceImpl implements VideoService { |
| 284 | 287 | videoTree.setType(type); |
| 285 | 288 | videoTree.setIcon(icon); |
| 286 | 289 | videoTree.setCode(code); |
| 290 | + videoTree.setInitChild(asyn); | |
| 287 | 291 | videoTree.setSpread(String.valueOf(spread)); |
| 288 | 292 | return videoTree; |
| 289 | 293 | } | ... | ... |
src/main/java/com/bsth/service/video/VideoService.java
| ... | ... | @@ -18,11 +18,11 @@ public interface VideoService { |
| 18 | 18 | |
| 19 | 19 | List<VideoTree> combinationTree(); |
| 20 | 20 | |
| 21 | - List<VideoTree> combinationTreeOfCar(String code,boolean spread); | |
| 21 | + List<VideoTree> combinationTreeOfCar(String code,boolean spread,boolean asyn); | |
| 22 | 22 | |
| 23 | - List<VideoTree> searchTreeDataByCarNo(String carNo,boolean spread) throws Exception; | |
| 23 | + List<VideoTree> searchTreeDataByCarNo(String carNo,boolean spread,boolean asyn) throws Exception; | |
| 24 | 24 | |
| 25 | - List<VideoTree> queryChannelsTree(String carNo,boolean spread) throws Exception; | |
| 25 | + List<VideoTree> queryChannelsTree(String carNo,boolean spread,boolean asyn) throws Exception; | |
| 26 | 26 | |
| 27 | 27 | List<Map<String, Object>> getVideoChannel(String carNo)throws Exception; |
| 28 | 28 | ... | ... |
src/main/resources/static/other/video/video.js
| ... | ... | @@ -119,6 +119,7 @@ function initTreeOpt(data, tree) { |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | function treeClickFun(node,tree){ |
| 122 | + | |
| 122 | 123 | if(node.data.initChild == true){ |
| 123 | 124 | return; |
| 124 | 125 | } |
| ... | ... | @@ -232,19 +233,9 @@ function layCarNoConcatArr(d, node, data, result) { |
| 232 | 233 | d.spread = true; |
| 233 | 234 | d.initChild= true; |
| 234 | 235 | |
| 235 | - if (result) { | |
| 236 | - $.each(data, function (index, d1) { | |
| 237 | - d1.wvpLiveBroadcast = result.wvpLiveBroadcast; | |
| 238 | - }) | |
| 239 | - } | |
| 240 | 236 | if( data){ |
| 241 | 237 | d.children = data; |
| 242 | 238 | } |
| 243 | - // d.children = []; | |
| 244 | - // d.children = d.children.concat(data); | |
| 245 | - if (result) { | |
| 246 | - d.wvpLiveBroadcast = result.wvpLiveBroadcast; | |
| 247 | - } | |
| 248 | 239 | } else { |
| 249 | 240 | layCarNoChildren(d.children, node, data, result); |
| 250 | 241 | } | ... | ... |