LAPTOP-KB9HII50\70708 %!s(int64=2) %!d(string=hai) anos
pai
achega
86817d86b6

+ 2 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/YsDeviceController.java

@ -1,12 +1,9 @@
package com.yihu.jw.care.endpoint.device;
package com.yihu.jw.care.endpoint.device;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
@ -15,12 +12,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
/**
 * Created by Bing on 2021/6/1.
 * Created by Bing on 2021/6/1.
 */
 */
@ -407,7 +400,7 @@ public class YsDeviceController extends BaseController {
    }
    }
    @ApiOperation("获取播放地址--协议")
    @ApiOperation("获取播放地址--协议")
    @RequestMapping(value = "getDeviceLiveAddress2", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    @GetMapping(value = "getDeviceLiveAddress2", produces = "application/x-www-form-urlencoded;charset=UTF-8")
    public String getDeviceLiveAddress2(
    public String getDeviceLiveAddress2(
            @ApiParam(name="deviceSerial",required = false,value="设备序列号")
            @ApiParam(name="deviceSerial",required = false,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = false) String deviceSerial,
            @RequestParam(value = "deviceSerial",required = false) String deviceSerial,
@ -418,7 +411,7 @@ public class YsDeviceController extends BaseController {
            JSONObject result = ysDeviceService.getDeviceLiveAddress2(deviceSerial,channelNo);
            JSONObject result = ysDeviceService.getDeviceLiveAddress2(deviceSerial,channelNo);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return error(200,result.getString(ResponseContant.resultMsg));
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
            }
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
        }catch (Exception e){

+ 22 - 34
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.device.DeviceManageService;
import com.yihu.jw.care.service.device.DeviceManageService;
import com.yihu.jw.care.service.device.NetworkCardService;
import com.yihu.jw.care.service.device.NetworkCardService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.care.service.statistics.DetectionPlatformService;
import com.yihu.jw.care.service.statistics.DetectionPlatformService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
@ -46,6 +47,8 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
    private DeviceManageService deviceManageService;
    private DeviceManageService deviceManageService;
    @Autowired
    @Autowired
    private PermissionService permissionService;
    private PermissionService permissionService;
    @Autowired
    private YsDeviceService ysDeviceService;
    @ApiOperation("环境信息")
    @ApiOperation("环境信息")
@ -463,38 +466,23 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
//    @PostMapping(value = "testDownloadVideoUrl")
//    @ApiOperation(value = "下载m3u8")
//    public ObjEnvelop downM3u8Video(@RequestParam String url) {
//        try {
//            return platformService.downM3u8Video(url);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return ObjEnvelop.getSuccess("1111","");
//    }
//    public static void main(String[] args) {
//        String originUrlpath = "http://videocdn.renrenjiang.cn/Act-ss-m3u8-sd/1037359_1546064640169/1037359_1546064640169.m3u8";
//        String preUrlPath = originUrlpath.substring(0, originUrlpath.lastIndexOf("/")+1);
//        String rootPath = "E:\\videodir";
//        String fileName = "";
//        HlsDownloader downLoader = new HlsDownloader(originUrlpath, preUrlPath, rootPath);
//        //downLoader.setThreadQuantity(10);
//        try{
//            fileName = downLoader.download(true);
//        }
//        catch (Exception e) {
//            e.printStackTrace();
//        }
//
//        if(StringUtils.isBlank(fileName)){
//            System.out.println("下载失败");
//        }else{
//            System.err.println("下载成功"+fileName);
//            System.out.println("完整路径:"+rootPath+"\\"+fileName);
//        }
//
//    }
    @ApiOperation("获取播放地址--协议")
    @GetMapping(value = "getDeviceLiveAddress2")
    public ObjEnvelop getDeviceLiveAddress2(
            @ApiParam(name="deviceSerial",required = false,value="设备序列号")
            @RequestParam(value = "deviceSerial",required = false) String deviceSerial,
            @ApiParam(name="channelNo",required = false,value="设备通道号,默认为1")
            @RequestParam(value = "channelNo",required = false,defaultValue = "1") Integer channelNo
    ){
        try {
            JSONObject result = ysDeviceService.getDeviceLiveAddress2(deviceSerial,channelNo);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("查询成功",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
}
}

+ 1 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java

@ -1,20 +1,16 @@
package com.yihu.jw.care.service.device;
package com.yihu.jw.care.service.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.YsConfig;
import com.yihu.jw.care.config.YsConfig;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.YsConfigDao;
import com.yihu.jw.care.dao.device.YsConfigDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.util.DeviceUtil;
import com.yihu.jw.care.util.DeviceUtil;
import com.yihu.jw.care.util.HttpClientUtilCare;
import com.yihu.jw.care.util.HttpClientUtilCare;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.YsConfigDo;
import com.yihu.jw.entity.care.device.YsConfigDo;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.encode.Base64;
import com.yihu.jw.utils.encode.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
@ -32,8 +28,6 @@ import org.springframework.util.MultiValueMap;
import javax.crypto.Cipher;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.swing.plaf.basic.BasicScrollPaneUI;
import javax.xml.crypto.Data;
import java.security.Security;
import java.security.Security;
import java.text.MessageFormat;
import java.text.MessageFormat;
import java.util.*;
import java.util.*;
@ -769,7 +763,7 @@ public class YsDeviceService {
            JSONObject tmp = new JSONObject();
            JSONObject tmp = new JSONObject();
            tmp.put("url",responseBody.getJSONObject("data").getString("url"));
            tmp.put("url",responseBody.getJSONObject("data").getString("url"));
            tmp.put("accessToken",accessToken);
            tmp.put("accessToken",accessToken);
            result.put(ResponseContant.resultMsg,tmp.toJSONString());
            result.put(ResponseContant.resultMsg,tmp);
        }else {
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,responseBody.getString("msg"));
            result.put(ResponseContant.resultMsg,responseBody.getString("msg"));