Commit 6fdc25b4285c61aaff7db9e2d4c3e137f1e28b26

Authored by liujun001
1 parent 2ad30a03

通过URL传参访问车辆和通道信息

src/main/java/com/bsth/controller/video/VideoController.java
@@ -59,7 +59,7 @@ public class VideoController { @@ -59,7 +59,7 @@ public class VideoController {
59 59
60 @GetMapping("/tree/carNo/{parentId}") 60 @GetMapping("/tree/carNo/{parentId}")
61 public List<VideoTree> layTreeNodeCarNo(@PathVariable("parentId") String parentId) { 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 @GetMapping("/tree/search") 65 @GetMapping("/tree/search")
@@ -71,7 +71,7 @@ public class VideoController { @@ -71,7 +71,7 @@ public class VideoController {
71 } 71 }
72 List<VideoTree> groups = null; 72 List<VideoTree> groups = null;
73 try { 73 try {
74 - groups = videoService.searchTreeDataByCarNo(carNo, Boolean.TRUE); 74 + groups = videoService.searchTreeDataByCarNo(carNo, Boolean.TRUE,Boolean.TRUE);
75 75
76 76
77 setAttributeToPage(result); 77 setAttributeToPage(result);
@@ -151,7 +151,7 @@ public class VideoController { @@ -151,7 +151,7 @@ public class VideoController {
151 public Map<String, Object> queryChannelsTree(@PathVariable String carNo) { 151 public Map<String, Object> queryChannelsTree(@PathVariable String carNo) {
152 Map<String, Object> result = new HashMap<>(); 152 Map<String, Object> result = new HashMap<>();
153 try { 153 try {
154 - List<VideoTree> trees = videoService.queryChannelsTree(carNo, Boolean.TRUE); 154 + List<VideoTree> trees = videoService.queryChannelsTree(carNo, Boolean.TRUE,Boolean.FALSE);
155 setAttributeToPage(result); 155 setAttributeToPage(result);
156 result.put("data", trees); 156 result.put("data", trees);
157 result.put("status", ResponseCode.SUCCESS); 157 result.put("status", ResponseCode.SUCCESS);
src/main/java/com/bsth/entity/video/VideoTree.java
@@ -64,6 +64,10 @@ public class VideoTree implements Serializable { @@ -64,6 +64,10 @@ public class VideoTree implements Serializable {
64 @Transient 64 @Transient
65 private String spread; 65 private String spread;
66 66
  67 + private boolean initChild=false;
  68 +
  69 + private String wvpLiveBroadcast;
  70 +
67 71
68 public String getTitle() { 72 public String getTitle() {
69 return this.getText(); 73 return this.getText();
src/main/java/com/bsth/service/impl/videoimpl/VideoServiceImpl.java
@@ -69,7 +69,7 @@ public class VideoServiceImpl implements VideoService { @@ -69,7 +69,7 @@ public class VideoServiceImpl implements VideoService {
69 } 69 }
70 70
71 @Override 71 @Override
72 - public List<VideoTree> combinationTreeOfCar(String code,boolean spread) { 72 + public List<VideoTree> combinationTreeOfCar(String code,boolean spread,boolean asyn) {
73 if (Objects.nonNull(code)) { 73 if (Objects.nonNull(code)) {
74 List<VideoTree> trees = new ArrayList<>(); 74 List<VideoTree> trees = new ArrayList<>();
75 Set<String> carNos = groupCarNosByComputeCode(code); 75 Set<String> carNos = groupCarNosByComputeCode(code);
@@ -77,14 +77,14 @@ public class VideoServiceImpl implements VideoService { @@ -77,14 +77,14 @@ public class VideoServiceImpl implements VideoService {
77 Set<Line> lineSet = groupLingByCompany(code); 77 Set<Line> lineSet = groupLingByCompany(code);
78 if (CollectionUtils.isNotEmpty(lineSet)) { 78 if (CollectionUtils.isNotEmpty(lineSet)) {
79 for (Line line : lineSet) { 79 for (Line line : lineSet) {
80 - VideoTree videoTree = combinationOfLine(code, line,spread); 80 + VideoTree videoTree = combinationOfLine(code, line,spread,asyn);
81 trees.add(videoTree); 81 trees.add(videoTree);
82 82
83 Set<String> carNoSets = groupCarNoByLine(line.getId()); 83 Set<String> carNoSets = groupCarNoByLine(line.getId());
84 if (CollectionUtils.isNotEmpty(carNoSets)) { 84 if (CollectionUtils.isNotEmpty(carNoSets)) {
85 List<VideoTree> children = new ArrayList<>(); 85 List<VideoTree> children = new ArrayList<>();
86 for (String carNo : carNoSets) { 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 children.add(carTree); 88 children.add(carTree);
89 89
90 if (CollectionUtils.isNotEmpty(carNos)) { 90 if (CollectionUtils.isNotEmpty(carNos)) {
@@ -100,7 +100,7 @@ public class VideoServiceImpl implements VideoService { @@ -100,7 +100,7 @@ public class VideoServiceImpl implements VideoService {
100 100
101 if (CollectionUtils.isNotEmpty(carNos)) { 101 if (CollectionUtils.isNotEmpty(carNos)) {
102 for (String carNo : carNos) { 102 for (String carNo : carNos) {
103 - VideoTree carTree = combnationOfCar(carNo, code,spread); 103 + VideoTree carTree = combnationOfCar(carNo, code,spread,asyn);
104 trees.add(carTree); 104 trees.add(carTree);
105 } 105 }
106 } 106 }
@@ -109,17 +109,19 @@ public class VideoServiceImpl implements VideoService { @@ -109,17 +109,19 @@ public class VideoServiceImpl implements VideoService {
109 return null; 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 String name = Objects.isNull(basicData) || MapUtils.isEmpty(basicData.nbbmCompanyPlateMap) ? null : basicData.nbbmCompanyPlateMap.get(carNo); 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 @Override 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 Line line = findLineByCode(carNo); 125 Line line = findLineByCode(carNo);
124 126
125 Iterable<Business> businessIterable = businessService.list(new HashMap<>()); 127 Iterable<Business> businessIterable = businessService.list(new HashMap<>());
@@ -131,22 +133,22 @@ public class VideoServiceImpl implements VideoService { @@ -131,22 +133,22 @@ public class VideoServiceImpl implements VideoService {
131 Set<Business> businesses = new LinkedHashSet<>(); 133 Set<Business> businesses = new LinkedHashSet<>();
132 findBussinessByUpCode(line.getCompany(), businessIterable, businesses); 134 findBussinessByUpCode(line.getCompany(), businessIterable, businesses);
133 if (CollectionUtils.isNotEmpty(businesses)) { 135 if (CollectionUtils.isNotEmpty(businesses)) {
134 - List<VideoTree> group = combitionBussiness(businesses,spread); 136 + List<VideoTree> group = combitionBussiness(businesses,spread,asyn);
135 137
136 VideoTree sourceTree = findVideoTreeByBusinessCode(line.getCompany(), group); 138 VideoTree sourceTree = findVideoTreeByBusinessCode(line.getCompany(), group);
137 if (Objects.isNull(sourceTree.getChildren())) { 139 if (Objects.isNull(sourceTree.getChildren())) {
138 sourceTree.setChildren(new ArrayList<>()); 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 lineOfTreeNode.setSpread(Boolean.TRUE.toString()); 143 lineOfTreeNode.setSpread(Boolean.TRUE.toString());
142 lineOfTreeNode.setChildren(new ArrayList<>()); 144 lineOfTreeNode.setChildren(new ArrayList<>());
143 sourceTree.getChildren().add(lineOfTreeNode); 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 lineOfTreeNode.getChildren().add(carOfTreeNode); 148 lineOfTreeNode.getChildren().add(carOfTreeNode);
147 carOfTreeNode.setSpread(Boolean.TRUE.toString()); 149 carOfTreeNode.setSpread(Boolean.TRUE.toString());
148 150
149 - List<VideoTree> children = queryChannelsTree(carNo,spread); 151 + List<VideoTree> children = queryChannelsTree(carNo,spread,asyn);
150 carOfTreeNode.setChildren(children); 152 carOfTreeNode.setChildren(children);
151 153
152 154
@@ -158,17 +160,17 @@ public class VideoServiceImpl implements VideoService { @@ -158,17 +160,17 @@ public class VideoServiceImpl implements VideoService {
158 if (StringUtils.isNotEmpty(company)) { 160 if (StringUtils.isNotEmpty(company)) {
159 findBussinessByUpCode(company, businessIterable, businesses); 161 findBussinessByUpCode(company, businessIterable, businesses);
160 if (CollectionUtils.isNotEmpty(businesses)) { 162 if (CollectionUtils.isNotEmpty(businesses)) {
161 - List<VideoTree> group = combitionBussiness(businesses,spread); 163 + List<VideoTree> group = combitionBussiness(businesses,spread,asyn);
162 VideoTree sourceTree = findVideoTreeByBusinessCode(company, group); 164 VideoTree sourceTree = findVideoTreeByBusinessCode(company, group);
163 if (Objects.nonNull(sourceTree) && Objects.isNull(sourceTree.getChildren())) { 165 if (Objects.nonNull(sourceTree) && Objects.isNull(sourceTree.getChildren())) {
164 sourceTree.setChildren(new ArrayList<>()); 166 sourceTree.setChildren(new ArrayList<>());
165 } 167 }
166 - VideoTree carOfTreeNode = combnationOfCar(carNo, company,spread); 168 + VideoTree carOfTreeNode = combnationOfCar(carNo, company,spread,asyn);
167 carOfTreeNode.setSpread(Boolean.TRUE.toString()); 169 carOfTreeNode.setSpread(Boolean.TRUE.toString());
168 sourceTree.getChildren().add(carOfTreeNode); 170 sourceTree.getChildren().add(carOfTreeNode);
169 171
170 sourceTree.setSpread("true"); 172 sourceTree.setSpread("true");
171 - List<VideoTree> children = queryChannelsTree(carNo,spread); 173 + List<VideoTree> children = queryChannelsTree(carNo,spread,asyn);
172 carOfTreeNode.setChildren(children); 174 carOfTreeNode.setChildren(children);
173 175
174 return group; 176 return group;
@@ -181,7 +183,7 @@ public class VideoServiceImpl implements VideoService { @@ -181,7 +183,7 @@ public class VideoServiceImpl implements VideoService {
181 } 183 }
182 184
183 @Override 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 List<Map<String, Object>> videoChannels = getVideoChannel(carNo); 187 List<Map<String, Object>> videoChannels = getVideoChannel(carNo);
186 List<VideoTree> trees = new ArrayList<>(); 188 List<VideoTree> trees = new ArrayList<>();
187 189
@@ -196,6 +198,7 @@ public class VideoServiceImpl implements VideoService { @@ -196,6 +198,7 @@ public class VideoServiceImpl implements VideoService {
196 String name = Objects.isNull(map.get("name")) ? map.get("channelId") + "_" + map.get("deviceId") : map.get("name").toString(); 198 String name = Objects.isNull(map.get("name")) ? map.get("channelId") + "_" + map.get("deviceId") : map.get("name").toString();
197 tree.setText("<span><img src='/metronic_v4.5.4/layui/icon/video1.ico' class ='imageIcon' /></span><span>"+name+"</span>"); 199 tree.setText("<span><img src='/metronic_v4.5.4/layui/icon/video1.ico' class ='imageIcon' /></span><span>"+name+"</span>");
198 tree.setNodePValue(carNo); 200 tree.setNodePValue(carNo);
  201 + tree.setWvpLiveBroadcast(wvpConfig.getWvpLiveBroadcast());
199 202
200 trees.add(tree); 203 trees.add(tree);
201 } 204 }
@@ -231,16 +234,16 @@ public class VideoServiceImpl implements VideoService { @@ -231,16 +234,16 @@ public class VideoServiceImpl implements VideoService {
231 return Collections.emptyList(); 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 List<VideoTree> trees = new ArrayList<>(); 242 List<VideoTree> trees = new ArrayList<>();
240 Iterator<Business> iterator = businessIterable.iterator(); 243 Iterator<Business> iterator = businessIterable.iterator();
241 while (iterator.hasNext()) { 244 while (iterator.hasNext()) {
242 Business business = iterator.next(); 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 trees.add(videoTree); 247 trees.add(videoTree);
245 } 248 }
246 List<VideoTree> groupTree = new ArrayList<>(); 249 List<VideoTree> groupTree = new ArrayList<>();
@@ -275,7 +278,7 @@ public class VideoServiceImpl implements VideoService { @@ -275,7 +278,7 @@ public class VideoServiceImpl implements VideoService {
275 * @param icon 图标 278 * @param icon 图标
276 * @return com.bsth.entity.video.VideoTree 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 VideoTree videoTree = new VideoTree(); 282 VideoTree videoTree = new VideoTree();
280 videoTree.setId(id); 283 videoTree.setId(id);
281 videoTree.setText("<span><img src='/metronic_v4.5.4/layui/icon/"+icon+".png' class ='imageIcon' /></span><span>"+text+"</span>"); 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,6 +287,7 @@ public class VideoServiceImpl implements VideoService {
284 videoTree.setType(type); 287 videoTree.setType(type);
285 videoTree.setIcon(icon); 288 videoTree.setIcon(icon);
286 videoTree.setCode(code); 289 videoTree.setCode(code);
  290 + videoTree.setInitChild(asyn);
287 videoTree.setSpread(String.valueOf(spread)); 291 videoTree.setSpread(String.valueOf(spread));
288 return videoTree; 292 return videoTree;
289 } 293 }
src/main/java/com/bsth/service/video/VideoService.java
@@ -18,11 +18,11 @@ public interface VideoService { @@ -18,11 +18,11 @@ public interface VideoService {
18 18
19 List<VideoTree> combinationTree(); 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 List<Map<String, Object>> getVideoChannel(String carNo)throws Exception; 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,6 +119,7 @@ function initTreeOpt(data, tree) {
119 } 119 }
120 120
121 function treeClickFun(node,tree){ 121 function treeClickFun(node,tree){
  122 +
122 if(node.data.initChild == true){ 123 if(node.data.initChild == true){
123 return; 124 return;
124 } 125 }
@@ -232,19 +233,9 @@ function layCarNoConcatArr(d, node, data, result) { @@ -232,19 +233,9 @@ function layCarNoConcatArr(d, node, data, result) {
232 d.spread = true; 233 d.spread = true;
233 d.initChild= true; 234 d.initChild= true;
234 235
235 - if (result) {  
236 - $.each(data, function (index, d1) {  
237 - d1.wvpLiveBroadcast = result.wvpLiveBroadcast;  
238 - })  
239 - }  
240 if( data){ 236 if( data){
241 d.children = data; 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 } else { 239 } else {
249 layCarNoChildren(d.children, node, data, result); 240 layCarNoChildren(d.children, node, data, result);
250 } 241 }