Commit 156f7f3edffc6d0edaa32b7706164ff849b695ad

Authored by liujun001
1 parent 6fdc25b4

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

src/main/java/com/bsth/controller/video/VideoController.java
@@ -5,12 +5,15 @@ import com.alibaba.fastjson.JSON; @@ -5,12 +5,15 @@ import com.alibaba.fastjson.JSON;
5 import com.bsth.common.ResponseCode; 5 import com.bsth.common.ResponseCode;
6 import com.bsth.controller.schedule.basicinfo.legacy.CarsController; 6 import com.bsth.controller.schedule.basicinfo.legacy.CarsController;
7 import com.bsth.entity.Business; 7 import com.bsth.entity.Business;
  8 +import com.bsth.entity.CarDevice;
8 import com.bsth.entity.Cars; 9 import com.bsth.entity.Cars;
9 import com.bsth.entity.Line; 10 import com.bsth.entity.Line;
10 import com.bsth.entity.video.CarsTreeTable; 11 import com.bsth.entity.video.CarsTreeTable;
11 import com.bsth.entity.video.VideoChannel; 12 import com.bsth.entity.video.VideoChannel;
12 import com.bsth.entity.video.VideoTree; 13 import com.bsth.entity.video.VideoTree;
13 import com.bsth.service.BusinessService; 14 import com.bsth.service.BusinessService;
  15 +import com.bsth.service.CarDeviceService;
  16 +import com.bsth.service.CarsService;
14 import com.bsth.service.LineService; 17 import com.bsth.service.LineService;
15 import com.bsth.service.impl.videoimpl.WvpConfig; 18 import com.bsth.service.impl.videoimpl.WvpConfig;
16 import com.bsth.service.video.VideoService; 19 import com.bsth.service.video.VideoService;
@@ -41,6 +44,8 @@ public class VideoController { @@ -41,6 +44,8 @@ public class VideoController {
41 44
42 @Autowired 45 @Autowired
43 private WvpConfig wvpConfig; 46 private WvpConfig wvpConfig;
  47 + @Autowired
  48 + private CarsService carsService;
44 49
45 @GetMapping("/tree") 50 @GetMapping("/tree")
46 public Map<String, Object> combinationTree() { 51 public Map<String, Object> combinationTree() {
@@ -59,9 +64,23 @@ public class VideoController { @@ -59,9 +64,23 @@ public class VideoController {
59 64
60 @GetMapping("/tree/carNo/{parentId}") 65 @GetMapping("/tree/carNo/{parentId}")
61 public List<VideoTree> layTreeNodeCarNo(@PathVariable("parentId") String parentId) { 66 public List<VideoTree> layTreeNodeCarNo(@PathVariable("parentId") String parentId) {
62 - return videoService.combinationTreeOfCar(parentId, false,false); 67 + return videoService.combinationTreeOfCar(parentId, false, false);
  68 + }
  69 +
  70 + @GetMapping("/tree/caNO/sim/{zbh}")
  71 + public Map<String, String> queryZBH(@PathVariable String zbh) {
  72 + Map<String, String> result = new HashMap<>();
  73 +
  74 +
  75 + Cars cars = carsService.queryCarsByInsideCode(zbh);
  76 +
  77 + String sim = Objects.nonNull(cars)?cars.getSimNo():null;
  78 + result.put("sim", sim);
  79 + result.put("status", "1");
  80 + return result;
63 } 81 }
64 82
  83 +
65 @GetMapping("/tree/search") 84 @GetMapping("/tree/search")
66 public Map<String, Object> searchLayTreeNode(HttpServletRequest request) { 85 public Map<String, Object> searchLayTreeNode(HttpServletRequest request) {
67 Map<String, Object> result = new HashMap<>(); 86 Map<String, Object> result = new HashMap<>();
@@ -71,7 +90,7 @@ public class VideoController { @@ -71,7 +90,7 @@ public class VideoController {
71 } 90 }
72 List<VideoTree> groups = null; 91 List<VideoTree> groups = null;
73 try { 92 try {
74 - groups = videoService.searchTreeDataByCarNo(carNo, Boolean.TRUE,Boolean.TRUE); 93 + groups = videoService.searchTreeDataByCarNo(carNo, Boolean.TRUE, Boolean.TRUE);
75 94
76 95
77 setAttributeToPage(result); 96 setAttributeToPage(result);
@@ -151,7 +170,7 @@ public class VideoController { @@ -151,7 +170,7 @@ public class VideoController {
151 public Map<String, Object> queryChannelsTree(@PathVariable String carNo) { 170 public Map<String, Object> queryChannelsTree(@PathVariable String carNo) {
152 Map<String, Object> result = new HashMap<>(); 171 Map<String, Object> result = new HashMap<>();
153 try { 172 try {
154 - List<VideoTree> trees = videoService.queryChannelsTree(carNo, Boolean.TRUE,Boolean.FALSE); 173 + List<VideoTree> trees = videoService.queryChannelsTree(carNo, Boolean.TRUE, Boolean.FALSE);
155 setAttributeToPage(result); 174 setAttributeToPage(result);
156 result.put("data", trees); 175 result.put("data", trees);
157 result.put("status", ResponseCode.SUCCESS); 176 result.put("status", ResponseCode.SUCCESS);
src/main/java/com/bsth/entity/Cars.java
@@ -144,6 +144,8 @@ public class Cars extends BEntity implements Serializable { @@ -144,6 +144,8 @@ public class Cars extends BEntity implements Serializable {
144 private Integer isSwitch; 144 private Integer isSwitch;
145 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */ 145 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */
146 private String xlmc; 146 private String xlmc;
  147 + /**sim 卡号*/
  148 + private String simNo;
147 149
148 public Cars() {} 150 public Cars() {}
149 151
@@ -532,4 +534,12 @@ public class Cars extends BEntity implements Serializable { @@ -532,4 +534,12 @@ public class Cars extends BEntity implements Serializable {
532 public void setHydrogen(Boolean hydrogen) { 534 public void setHydrogen(Boolean hydrogen) {
533 this.hydrogen = hydrogen; 535 this.hydrogen = hydrogen;
534 } 536 }
  537 +
  538 + public String getSimNo() {
  539 + return simNo;
  540 + }
  541 +
  542 + public void setSimNo(String simNo) {
  543 + this.simNo = simNo;
  544 + }
535 } 545 }
src/main/java/com/bsth/entity/video/VideoTree.java
@@ -64,6 +64,9 @@ public class VideoTree implements Serializable { @@ -64,6 +64,9 @@ public class VideoTree implements Serializable {
64 @Transient 64 @Transient
65 private String spread; 65 private String spread;
66 66
  67 + @Transient
  68 + private String name;
  69 +
67 private boolean initChild=false; 70 private boolean initChild=false;
68 71
69 private String wvpLiveBroadcast; 72 private String wvpLiveBroadcast;
src/main/java/com/bsth/filter/BaseFilter.java
@@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter { @@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter {
20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, 20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE,
21 Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, 21 Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL,
22 Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, 22 Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL,
23 - Constants.FILE_AUTH, Constants.I18N_LOGIN}; 23 + Constants.FILE_AUTH, Constants.I18N_LOGIN,"/video/**"};
24 24
25 @Override 25 @Override
26 public void destroy() { 26 public void destroy() {
src/main/java/com/bsth/repository/CarsRepository.java
@@ -18,4 +18,7 @@ public interface CarsRepository extends BaseRepository&lt;Cars, Integer&gt;{ @@ -18,4 +18,7 @@ public interface CarsRepository extends BaseRepository&lt;Cars, Integer&gt;{
18 18
19 @Query(value="select s from Cars s where s.insideCode=?1") 19 @Query(value="select s from Cars s where s.insideCode=?1")
20 List<Cars> findCarsByCode(String insideCode); 20 List<Cars> findCarsByCode(String insideCode);
  21 +
  22 + @Query(value="select s from Cars s where s.insideCode=?1")
  23 + Cars findByInsideCode(String simNo);
21 } 24 }
src/main/java/com/bsth/service/CarDeviceService.java
@@ -6,4 +6,5 @@ import com.bsth.entity.CarDevice; @@ -6,4 +6,5 @@ import com.bsth.entity.CarDevice;
6 * Created by xu on 16/6/15. 6 * Created by xu on 16/6/15.
7 */ 7 */
8 public interface CarDeviceService extends BaseService<CarDevice, Long> { 8 public interface CarDeviceService extends BaseService<CarDevice, Long> {
  9 +
9 } 10 }
src/main/java/com/bsth/service/CarsService.java
@@ -6,4 +6,5 @@ import com.bsth.entity.Cars; @@ -6,4 +6,5 @@ import com.bsth.entity.Cars;
6 * Created by xu on 16/5/31. 6 * Created by xu on 16/5/31.
7 */ 7 */
8 public interface CarsService extends BaseService<Cars, Integer> { 8 public interface CarsService extends BaseService<Cars, Integer> {
  9 + Cars queryCarsByInsideCode(String zbh);
9 } 10 }
src/main/java/com/bsth/service/impl/CarsServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
3 import com.bsth.entity.Cars; 3 import com.bsth.entity.Cars;
  4 +import com.bsth.repository.CarsRepository;
4 import com.bsth.service.CarsService; 5 import com.bsth.service.CarsService;
5 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
6 7
  8 +import javax.annotation.Resource;
  9 +
7 /** 10 /**
8 * Created by xu on 16/5/31. 11 * Created by xu on 16/5/31.
9 */ 12 */
10 @Service 13 @Service
11 public class CarsServiceImpl extends BaseServiceImpl<Cars, Integer> implements CarsService { 14 public class CarsServiceImpl extends BaseServiceImpl<Cars, Integer> implements CarsService {
  15 + @Resource
  16 + private CarsRepository carsRepository;
  17 +
  18 + public Cars queryCarsByInsideCode(String zbh) {
  19 + return carsRepository.findByInsideCode(zbh);
  20 + }
12 } 21 }
src/main/java/com/bsth/service/impl/videoimpl/VideoServiceImpl.java
@@ -289,6 +289,7 @@ public class VideoServiceImpl implements VideoService { @@ -289,6 +289,7 @@ public class VideoServiceImpl implements VideoService {
289 videoTree.setCode(code); 289 videoTree.setCode(code);
290 videoTree.setInitChild(asyn); 290 videoTree.setInitChild(asyn);
291 videoTree.setSpread(String.valueOf(spread)); 291 videoTree.setSpread(String.valueOf(spread));
  292 + videoTree.setName(text);
292 return videoTree; 293 return videoTree;
293 } 294 }
294 295
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
@@ -143,4 +143,5 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars @@ -143,4 +143,5 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars
143 throw new ScheduleException("设备编号重复"); 143 throw new ScheduleException("设备编号重复");
144 } 144 }
145 } 145 }
  146 +
146 } 147 }