liubing 3 yıl önce
ebeveyn
işleme
22e2765c14

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/YsConfig.java

@ -63,8 +63,8 @@ public class YsConfig {
    public static final String videoList2 = iotBaseUrl +"/api/lapp/v2/live/address/get";
    //全天录像
    public static final String fullDayVideo = iotBaseUrl +"/api/lapp/device/fullday/record/switch/set";
    //https://open.ys7.com/api/lapp/device/fullday/record/switch/set
//    //获取录像accessKey、上传录像地址

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

@ -386,4 +386,32 @@ public class YsDeviceController extends BaseController {
        }
    }
    @ApiOperation("全天录像开关")
    @RequestMapping(value = "fullDayVideo", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String fullDayVideo(
            @ApiParam(name="patient")
            @RequestParam(value = "patient",required = false)String patient,
            @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,
            @ApiParam(name="enable",required = false,value="状态:0-关闭,1-开启")
            @RequestParam(value = "enable",required = false,defaultValue = "1") Integer enable,
            HttpServletRequest request
    ){
        try {
            if (StringUtils.isBlank(patient)&&StringUtils.isBlank(deviceSerial)){
                return error(-1,"参数错误");
            }
            JSONObject result = ysDeviceService.fullDayVideo(deviceSerial,channelNo,enable,request);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return error(200,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"查询成功","data",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"error");
        }
    }
}

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

@ -621,6 +621,31 @@ public class YsDeviceService {
        //https://open.ys7.com/doc/zh/book/index/address_v2.html?h=api%2Flapp%2Fv2%2Flive%2Faddress%2Fget
    }
    public JSONObject fullDayVideo(String deviceSerial,Integer channelNo,Integer enable,HttpServletRequest request) throws Exception {
        JSONObject result = new JSONObject();
        MultiValueMap<String,String> param = new LinkedMultiValueMap<>();
        param.add("accessToken",getIotAccessToken());
        if (StringUtils.isNotBlank(deviceSerial)){
            param.add("deviceSerial",deviceSerial);
        }
        if (channelNo!=null){
            param.add("channelNo",channelNo+"");
        }
        if (enable!=null){
            param.add("enable",enable+"");
        }
        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,"操作成功");
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,responseBody.getString("msg"));
        }
        return result;
    }
    /**
     * 消息解密
     * @param sSrc

+ 7 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -323,6 +323,10 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    public JSONObject deleteUser(String patient){
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO==null){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"账号不存在");
        }
        if (StringUtils.isNotBlank(patientDO.getIdcard())){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"账号已完成注册,无法注销");
@ -331,6 +335,9 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            result.put(ResponseContant.resultMsg,"账号已完成注册,无法注销");
        } else {
            patientDao.delete(patient);
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,"操作成功");
        }
        return result;
    }