| 
					
				 | 
			
			
				@ -4,6 +4,11 @@ import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.config.YsConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.device.PatientDeviceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.label.WlyyPatientLabelDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.device.DevicePatientDevice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.ResponseContant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.http.HttpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.encode.Base64; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -20,10 +25,11 @@ import org.springframework.util.MultiValueMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.crypto.Cipher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.crypto.spec.SecretKeySpec; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.swing.plaf.basic.BasicScrollPaneUI; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.xml.crypto.Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.security.Security; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.MessageFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.concurrent.TimeUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -33,12 +39,13 @@ import java.util.concurrent.TimeUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private static Logger logger = LoggerFactory.getLogger(YsDeviceService.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private Map<String,String> msgType = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private StringRedisTemplate redisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HttpClientUtil httpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientDeviceDao patientDeviceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取萤石设备assesToken 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -119,6 +126,7 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject surveillanceWay(String deviceSerial,Integer channelNo,Integer isTrust,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("deviceSerial",deviceSerial); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -126,7 +134,15 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("isTrust",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.surveillanceWay,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (responseBody.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,responseBody.getJSONObject("data")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,responseBody.getString("msg")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/os58z7#p9Tfd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -176,14 +192,66 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取视频地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getDeviceLiveAddress(String deviceSerial,Integer channelNo,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getDeviceLiveAddress(String patient,String deviceSerial,Integer channelNo,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(deviceSerial)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(patient,"12"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (devices.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deviceSerial = devices.get(0).getDeviceSn(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MultiValueMap<String, String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("accessToken",getIotAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("deviceSerial",deviceSerial); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("channelNo",channelNo+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.getDeviceLiveAddress,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (responseBody.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject tmp = responseBody.getJSONObject("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer exception = tmp.getInteger("exception"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            switch (exception){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,200); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 1: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"设备不在线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 2: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"设备开启视频加密,请联系管理员先进行解密"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 3: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"设备删除"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 4: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"失效"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 5: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"未绑定"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 6: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"账户下流量已超出"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                case 7: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result.put(ResponseContant.resultMsg,"设备接入限制"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,responseBody.getString("msg")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://open.ys7.com/doc/zh/book/index/address.html#address-api2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -201,7 +269,7 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "flvAddress":"https://flvopen.ys7.com:9188/openlive/99c146f11ab042849fd4b49f7b0d86cf.flv",    FLV流畅直播地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "hdFlvAddress":"https://flvopen.ys7.com:9188/openlive/99c146f11ab042849fd4b49f7b0d86cf.hd.flv", FLV高清直播地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "status":1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "exception":0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "exception":0,0-正常,1-设备不在线,2-设备开启视频加密,3-设备删除,4-失效,5-未绑定,6-账户下流量已超出,7-设备接入限制,0/1/2/6状态返回地址,其他不返回 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "beginTime":1622615659000, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *         "endTime":1622615659000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -209,6 +277,31 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deviceFailConfig(String deviceSerial,Integer type,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url =MessageFormat.format(YsConfig.deviceFailConfig, deviceSerial,"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null==type){//查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            url += "?accessToken="+getIotAccessToken()+"&key=Alarm_DetectHumanCar"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            MultiValueMap<String, String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.GET); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            MultiValueMap<String, String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("accessToken",getIotAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("key","Alarm_DetectHumanCar"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("value","{\"type\":"+type+"}"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.PUT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/os58z7#YYazO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 云台控制开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param deviceSerial 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -254,104 +347,273 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取上传录像授权信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 设置循环覆盖 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param is_vod_cover 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param request 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getVideoKey(HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject coverVideoSwitch(String is_vod_cover ,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject param  = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoKey,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("is_vod_cover",is_vod_cover); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.coverVideoSwitch,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/nu22ks#Kj5dG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://open.ys7.com/doc/zh/book/index/device_ptz.html#device_ptz-api2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 录像列表(无法区分用户) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取设备录像存储信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param deviceSerial 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param channelNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param recType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param request 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject videoList(String name,String type,Integer page,Integer count) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.put("name",name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.put("type",type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deviceVideoTimeList(String patient,String deviceSerial,Integer channelNo,String startTime,String endTime,Integer recType,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(deviceSerial)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(patient,"12"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (devices.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deviceSerial = devices.get(0).getDeviceSn(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("page",page); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("count",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MultiValueMap<String,String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("accessToken",getIotAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("deviceSerial",deviceSerial); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("channelNo",channelNo+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoList,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date tmp = DateUtil.dateTimeParse(startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            long timeStemp = tmp.getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("startTime",timeStemp+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date tmp = DateUtil.dateTimeParse(startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            long timeStemp = tmp.getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("endTime",timeStemp+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null != recType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("recType",recType+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.deviceVideoTimeList,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/nu22ks#kF97n 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (responseBody.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray tmp = responseBody.getJSONArray("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.sort(Comparator.comparing(obj -> Long.parseLong(((LinkedHashMap) obj).get("startTime").toString()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i=0;i<tmp.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                LinkedHashMap mapTmp = tmp.getObject(i,LinkedHashMap.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long startTimeStr =  Long.parseLong(mapTmp.get("startTime").toString()) ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long endTimeStr = Long.parseLong(mapTmp.get("endTime").toString()) ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Date date = new Date(startTimeStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mapTmp.put("startTimeDate",DateUtil.dateToStrLong(date)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                date = new Date(endTimeStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mapTmp.put("endTimeDate",DateUtil.dateToStrLong(date)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,"查询失败,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://open.ys7.com/doc/zh/book/index/device_select.html#device_select-api9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 批量获取录像详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param vod_ids 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 根据时间获取录像地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param deviceSerial 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param channelNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param protocol 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param stopTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param request 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject videoDetailList(String[] vod_ids) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray arr = JSONArray.parseArray(JSON.toJSONString(vod_ids)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("vod_ids",arr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetailList,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deviceVideoUrlByTime(String deviceSerial,Integer channelNo,String protocol,String type,String startTime,String stopTime,Integer expireTime,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MultiValueMap<String,String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("accessToken",getIotAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("deviceSerial",deviceSerial); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("channelNo",channelNo+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(protocol)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("protocol",protocol); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("startTime",startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(stopTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("stopTime",stopTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("type",type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null != expireTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.deviceVideoUrlByTime,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/nu22ks#60Fjf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (responseBody.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,responseBody.getJSONObject("data")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,"查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://open.ys7.com/doc/zh/uikit/wechat_miniapp.html?h=%E5%BD%95%E5%83%8F 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * 获取上传录像授权信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @param request 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public JSONObject getVideoKey(HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoKey,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //https://www.yuque.com/u1400669/kb/nu22ks#Kj5dG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * 录像列表(无法区分用户) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public JSONObject videoList(String name,String type,Integer page,Integer count) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        if (StringUtils.isNotBlank(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            param.put("name",name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        if (StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            param.put("type",type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("page",page); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("count",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoList,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //https://www.yuque.com/u1400669/kb/nu22ks#kF97n 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * 批量获取录像详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @param vod_ids 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public JSONObject videoDetailList(String[] vod_ids) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONArray arr = JSONArray.parseArray(JSON.toJSONString(vod_ids)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("vod_ids",arr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetailList,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //https://www.yuque.com/u1400669/kb/nu22ks#60Fjf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * 获取录像详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public JSONObject videoDetail(String vod_id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        param.put("vod_id",vod_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetail,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //https://www.yuque.com/u1400669/kb/nu22ks#xQCVK 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public JSONObject videoUpload(HttpServletRequest request){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //https://www.yuque.com/u1400669/kb/nu22ks#nQXzO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取录像详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject videoDetail(String vod_id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject param = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("accessToken",getAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("vod_id",vod_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.assesTokenPostHttp(YsConfig.videoDetail,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/nu22ks#xQCVK 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deviceFailConfig(String deviceSerial,Integer type,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url =MessageFormat.format(YsConfig.deviceFailConfig, deviceSerial,"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null==type){//查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            url += "?accessToken="+getIotAccessToken()+"&key=Alarm_DetectHumanCar"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            MultiValueMap<String, String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.GET); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject videoList2(String patient,String deviceSerial,Integer channelNo,String code,Integer expireTime,Integer protocol, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 Integer quality,String startTime,String stopTime,String type,Integer supportH265, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 String gbchannel,HttpServletRequest request) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MultiValueMap<String,String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.add("accessToken",getIotAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(deviceSerial)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(patient,"12"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (devices.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deviceSerial = devices.get(0).getDeviceSn(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            MultiValueMap<String, String> param = new LinkedMultiValueMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("accessToken",getIotAccessToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("key","Alarm_DetectHumanCar"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("value","{\"type\":"+type+"}"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(url,param,HttpMethod.PUT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(deviceSerial)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("deviceSerial",deviceSerial); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return responseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/os58z7#YYazO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject videoUpload(HttpServletRequest request){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://www.yuque.com/u1400669/kb/nu22ks#nQXzO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=channelNo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("channelNo",channelNo+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(code)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("code",code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null !=expireTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("expireTime",expireTime+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null !=protocol){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("protocol",protocol+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null !=quality){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("quality",quality+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("startTime",startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(stopTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("stopTime",stopTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("type",type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=supportH265){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("supportH265",supportH265+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(gbchannel)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            param.add("gbchannel",gbchannel+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpEntity<JSONObject> response = httpClientUtil.iotAssesTokenPostHttp(YsConfig.videoList2,param,HttpMethod.POST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject responseBody = response.getBody(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (responseBody.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,responseBody.getJSONObject("data")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,"查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //https://open.ys7.com/doc/zh/book/index/address_v2.html?h=api%2Flapp%2Fv2%2Flive%2Faddress%2Fget 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -386,23 +648,6 @@ public class YsDeviceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        System.out.println("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10001","离岗检测消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10002","身份识别消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10003","回头客消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10004","门禁事件消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10005","设备报警消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10006","设备上线离线消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10007","门禁权限同步消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10008","消防设备消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10009","企业数据变更消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10010","智能联动消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10011","海康设备透传消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10012","通道关联状态上报消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10013","智能控制设备状态消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10014","托管设备增删消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        msgType.put("10016","门铃消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |