视频播放相关代码
							parent
							
								
									d167cf1234
								
							
						
					
					
						commit
						b59f7dee6d
					
				|  | @ -0,0 +1,57 @@ | |||
| package com.zcloud.controller.gatemachine; | ||||
| 
 | ||||
| import com.zcloud.controller.base.BaseController; | ||||
| import com.zcloud.entity.Page; | ||||
| import com.zcloud.entity.PageData; | ||||
| import com.zcloud.service.gatemachine.GateAreaService; | ||||
| import com.zcloud.util.ReturnMap; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 说明:TODO | ||||
|  * 作者:wangxuan | ||||
|  * 官网:www.zcloudchina.com | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/gateArea") | ||||
| public class GateAreaController extends BaseController { | ||||
| 
 | ||||
|     @Resource | ||||
|     private GateAreaService gateAreaService; | ||||
| 
 | ||||
| 
 | ||||
|     @RequestMapping(value = "/page") | ||||
|     public ReturnMap page(Page page) { | ||||
|         ReturnMap returnMap = new ReturnMap(); | ||||
|         PageData pageData = this.getPageData(); | ||||
|         page.setPd(pageData); | ||||
|         List<PageData> data = gateAreaService.getDatalistpage(page); | ||||
|         returnMap.put("varList", data); | ||||
|         returnMap.put("page", page); | ||||
|         return returnMap; | ||||
|     } | ||||
| 
 | ||||
|     @RequestMapping(value = "/edit") | ||||
|     public ReturnMap edit() { | ||||
|         PageData pd = this.getPageData(); | ||||
|         gateAreaService.edit(pd); | ||||
|         return ReturnMap.ok(); | ||||
|     } | ||||
|     @RequestMapping(value = "/removeByIds") | ||||
|     public ReturnMap removeByIds() { | ||||
|         PageData pageData = this.getPageData(); | ||||
|         gateAreaService.removeByIds(pageData); | ||||
|         return ReturnMap.ok(); | ||||
|     } | ||||
|     @RequestMapping(value = "/add") | ||||
|     public ReturnMap add() { | ||||
|         PageData pageData = this.getPageData(); | ||||
|         gateAreaService.save(pageData); | ||||
|         return ReturnMap.ok(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,59 @@ | |||
| package com.zcloud.controller.gatemachine; | ||||
| 
 | ||||
| import com.zcloud.controller.base.BaseController; | ||||
| import com.zcloud.entity.Page; | ||||
| import com.zcloud.entity.PageData; | ||||
| import com.zcloud.service.gatemachine.GateMachineService; | ||||
| import com.zcloud.util.ReturnMap; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
| /** | ||||
|  * 说明:TODO | ||||
|  * 作者:wangxuan | ||||
|  * 官网:www.zcloudchina.com | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/gateMachine") | ||||
| public class GateMachineController extends BaseController { | ||||
| 
 | ||||
|     @Resource | ||||
|     private GateMachineService gateMachineService; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     @RequestMapping(value = "/page") | ||||
|     public ReturnMap page(Page page) { | ||||
|         PageData pageData = this.getPageData(); | ||||
|         page.setPd(pageData); | ||||
|         ArrayList<PageData> data = gateMachineService.getDatalistpage(page); | ||||
|         ReturnMap returnMap = new ReturnMap(); | ||||
|         returnMap.put("varList", data); | ||||
|         returnMap.put("page", page); | ||||
|         return returnMap; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @RequestMapping(value = "/edit") | ||||
|     public ReturnMap edit() { | ||||
|         PageData pd = this.getPageData(); | ||||
|         gateMachineService.edit(pd); | ||||
|         return ReturnMap.ok(); | ||||
|     } | ||||
|     @RequestMapping(value = "/removeByIds") | ||||
|     public ReturnMap removeByIds() { | ||||
|         PageData pageData = this.getPageData(); | ||||
|         gateMachineService.removeByIds(pageData); | ||||
|         return ReturnMap.ok(); | ||||
|     } | ||||
|     @RequestMapping(value = "/add") | ||||
|     public ReturnMap add() { | ||||
|         PageData pageData = this.getPageData(); | ||||
|         gateMachineService.save(pageData); | ||||
|         return ReturnMap.ok(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,225 @@ | |||
| package com.zcloud.controller.gatemachine; | ||||
| 
 | ||||
| import com.zcloud.controller.base.BaseController; | ||||
| import com.zcloud.entity.Page; | ||||
| import com.zcloud.entity.PageData; | ||||
| import com.zcloud.service.gatemachine.GateVideoService; | ||||
| import com.zcloud.util.DateUtil; | ||||
| import com.zcloud.util.Jurisdiction; | ||||
| import com.zcloud.util.Tools; | ||||
| import com.zcloud.util.hk.HKUtil; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.ResponseBody; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 说明:视频管理 | ||||
|  * 作者:luoxiaobao | ||||
|  * 时间:2021-05-10 | ||||
|  * 官网:www.zcloudchina.com | ||||
|  */ | ||||
| @Controller | ||||
| @RequestMapping("/gateVideo") | ||||
| public class GateVideoController extends BaseController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private GateVideoService gateVideoService; | ||||
| 
 | ||||
| 	/**新增 | ||||
| 	 * @param | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/add") | ||||
| 	@ResponseBody | ||||
| 	public Object add() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		pd.put("GATEVIDEO_ID", this.get32UUID());	//主键
 | ||||
| 		pd.put("OPDATE", DateUtil.date2Str(new Date()));	//操作日期
 | ||||
| 		pd.put("OPUSER", Jurisdiction.getUsername());	//操作人
 | ||||
| 		pd.put("ISDELETE", "0");	//是否删除
 | ||||
| 		gateVideoService.save(pd); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	/**删除 | ||||
| 	 * @param out | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/delete") | ||||
| 	@ResponseBody | ||||
| 	public Object delete() throws Exception{ | ||||
| 		Map<String,String> map = new HashMap<String,String>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		gateVideoService.delete(pd); | ||||
| 		map.put("result", errInfo);				//返回结果
 | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	/**修改 | ||||
| 	 * @param | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/edit") | ||||
| 	@ResponseBody | ||||
| 	public Object edit() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		gateVideoService.edit(pd); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	/**定位 | ||||
| 	 * @param | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/savePosition") | ||||
| 	@ResponseBody | ||||
| 	public Object savePosition() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		gateVideoService.savePosition(pd); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	@RequestMapping(value="/goAllVideo") | ||||
| 	@ResponseBody | ||||
| 	public Object goAllVideo() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 
 | ||||
| 		String DATA_IDS = pd.getString("DATA_IDS"); | ||||
| 		if(Tools.notEmpty(DATA_IDS)){ | ||||
| 			String ArrayDATA_IDS[] = DATA_IDS.split(","); | ||||
| 			pd.put("ArrayDATA_IDS", ArrayDATA_IDS); | ||||
| 		} | ||||
| 		List<PageData>	videoList = gateVideoService.listBo(pd);	//根据ID读取
 | ||||
| 		for (PageData video : videoList) { | ||||
| 			if(video.get("INDEXCODE")!=null && !"".equals(video.getString("INDEXCODE"))){ | ||||
| 				Map<String, Object> data = HKUtil.camerasPreviewURLs(video.getString("INDEXCODE"), "hls"); | ||||
| 				video.put("HLSVIDEOURL", data); | ||||
| 				Map<String, Object> resData = (Map<String, Object>) data.get("data"); | ||||
| 				video.put("GBSVIDEOURL",resData.get("url")); | ||||
| 			} | ||||
| 		} | ||||
| 		map.put("videoList", videoList); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	/**列表 | ||||
| 	 * @param page | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/list") | ||||
| 	@ResponseBody | ||||
| 	public Object list(Page page) throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		String KEYWORDS = pd.getString("KEYWORDS");						//关键词检索条件
 | ||||
| 		if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); | ||||
| 
 | ||||
| 		pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); | ||||
| 		page.setPd(pd); | ||||
| 
 | ||||
| 		List<PageData>	varList = gateVideoService.list(page);	//列出VideoManager列表
 | ||||
| 		map.put("varList", varList); | ||||
| 		map.put("page", page); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	@RequestMapping(value="/listAllForMap") | ||||
| 	@ResponseBody | ||||
| 	public Object listAllForMap() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 
 | ||||
| 		List<PageData>	videoList = gateVideoService.listAllForMap(pd);	//根据ID读取
 | ||||
| 		map.put("videoList", videoList); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	@RequestMapping(value="/editIsShow") | ||||
| 	@ResponseBody | ||||
| 	public Object editIsShow() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		PageData epd = new PageData(); | ||||
| 		epd.put("ISSHOW", '0'); | ||||
| 		epd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); | ||||
| 		gateVideoService.editIsShowBycorpinfoid(epd);	//根据ID读取
 | ||||
| 
 | ||||
| 		pd.put("ISSHOW", '1'); | ||||
| 		gateVideoService.editIsShow(pd);	//根据ID读取
 | ||||
| 		map.put("pd", pd); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 	 /**去修改页面获取数据 | ||||
| 	 * @param | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/goEdit") | ||||
| 	@ResponseBody | ||||
| 	public Object goEdit() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		pd = gateVideoService.findById(pd);	//根据ID读取
 | ||||
| 		map.put("pd", pd); | ||||
| 		map.put("result", errInfo); | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 	 /**批量删除 | ||||
| 	 * @param | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	@RequestMapping(value="/deleteAll") | ||||
| 	@ResponseBody | ||||
| 	public Object deleteAll() throws Exception{ | ||||
| 		Map<String,Object> map = new HashMap<String,Object>(); | ||||
| 		String errInfo = "success"; | ||||
| 		PageData pd = new PageData(); | ||||
| 		pd = this.getPageData(); | ||||
| 		String DATA_IDS = pd.getString("DATA_IDS"); | ||||
| 		if(Tools.notEmpty(DATA_IDS)){ | ||||
| 			String ArrayDATA_IDS[] = DATA_IDS.split(","); | ||||
| 			gateVideoService.deleteAll(ArrayDATA_IDS); | ||||
| 			errInfo = "success"; | ||||
| 		}else{ | ||||
| 			errInfo = "error"; | ||||
| 		} | ||||
| 		map.put("result", errInfo);				//返回结果
 | ||||
| 		return map; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -2,7 +2,9 @@ package com.zcloud.service.gatemachine.impl; | |||
| 
 | ||||
| import com.zcloud.entity.Page; | ||||
| import com.zcloud.entity.PageData; | ||||
| import com.zcloud.mapper.datasource.gatemachine.*; | ||||
| import com.zcloud.mapper.datasource.gatemachine.GateAreaMapper; | ||||
| import com.zcloud.mapper.datasource.gatemachine.GateMachineMapper; | ||||
| import com.zcloud.mapper.datasource.gatemachine.GateVideoMapper; | ||||
| import com.zcloud.service.gatemachine.GateMachineService; | ||||
| import com.zcloud.service.keyProjects.VideoManagerService; | ||||
| import com.zcloud.util.InitPageDataUtil; | ||||
|  |  | |||
|  | @ -49,14 +49,14 @@ public class HKUtil { | |||
|      */ | ||||
|     public static Map<String,Object> camerasPreviewURLs(String id,String type){ | ||||
|         JSONObject jsonBody = new JSONObject(); | ||||
|         jsonBody.put("indexCode", id); | ||||
|         jsonBody.put("cameraIndexCode", id); | ||||
|         jsonBody.put("netZoneCode", "1"); | ||||
|         jsonBody.put("transmode", 1); | ||||
|         jsonBody.put("streamType", 0); | ||||
|         jsonBody.put("protocol",type); | ||||
|         jsonBody.put("expireTime", -1); | ||||
|         jsonBody.put("expand","transcode=1&streamform=rtp"); | ||||
|         Map<String,Object> returnMap=publicHkInterface(jsonBody,"/api/vnsc/mls/v1/preview/openApi/getPreviewParam"); | ||||
|         Map<String,Object> returnMap=publicHkInterface(jsonBody,"/api/video/v1/cameras/previewURLs"); | ||||
|         return returnMap; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue