All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.cirs.model.v202209.device.UpdateDeviceRequest Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.cirs.model.v202209.device;

import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.cirs.constant.CirsConstant;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.exception.BusinessException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.oauth.model.v202010.HttpConfigInfo;
import com.dahuatech.icc.util.StringUtils;

import java.util.List;

/**
 * program:java-sdk
 *
 * @Author: 355079
 * @Date:2022-09-07 09:29
 * @Description:
 */
public class UpdateDeviceRequest extends AbstractIccRequest {
    private Long id;
    private String deviceName;
    private String groupCode;
    private ExtInfo extInfo;
    public class ExtInfo{
        private OnOffStrategy onOffScreenstrategy;
        private OnOffStrategy onOffDevicestrategy;
        public class OnOffStrategy{
            List custom;
            private Boolean customStatus;
            private Listweek;
            private Boolean weekStatus;
            public class Custom{
                private String turnOffTime;
                private String turnOnTime;

                public String getTurnOffTime() {
                    return turnOffTime;
                }

                public void setTurnOffTime(String turnOffTime) {
                    this.turnOffTime = turnOffTime;
                }

                public String getTurnOnTime() {
                    return turnOnTime;
                }

                public void setTurnOnTime(String turnOnTime) {
                    this.turnOnTime = turnOnTime;
                }
            }
            public class Week{
                private String day;
                private String turnOnOffTime;

                public String getDay() {
                    return day;
                }

                public void setDay(String day) {
                    this.day = day;
                }

                public String getTurnOnOffTime() {
                    return turnOnOffTime;
                }

                public void setTurnOnOffTime(String turnOnOffTime) {
                    this.turnOnOffTime = turnOnOffTime;
                }
            }

            public List getCustom() {
                return custom;
            }

            public void setCustom(List custom) {
                this.custom = custom;
            }

            public Boolean getCustomStatus() {
                return customStatus;
            }

            public void setCustomStatus(Boolean customStatus) {
                this.customStatus = customStatus;
            }

            public List getWeek() {
                return week;
            }

            public void setWeek(List week) {
                this.week = week;
            }

            public Boolean getWeekStatus() {
                return weekStatus;
            }

            public void setWeekStatus(Boolean weekStatus) {
                this.weekStatus = weekStatus;
            }
        }

        public OnOffStrategy getOnOffScreenstrategy() {
            return onOffScreenstrategy;
        }

        public void setOnOffScreenstrategy(OnOffStrategy onOffScreenstrategy) {
            this.onOffScreenstrategy = onOffScreenstrategy;
        }

        public OnOffStrategy getOnOffDevicestrategy() {
            return onOffDevicestrategy;
        }

        public void setOnOffDevicestrategy(OnOffStrategy onOffDevicestrategy) {
            this.onOffDevicestrategy = onOffDevicestrategy;
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        putBodyParameter("id",id);
        this.id = id;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        putBodyParameter("deviceName",deviceName);
        this.deviceName = deviceName;
    }

    public String getGroupCode() {
        return groupCode;
    }

    public void setGroupCode(String groupCode) {
        putBodyParameter("groupCode",groupCode);
        this.groupCode = groupCode;
    }

    public ExtInfo getExtInfo() {
        return extInfo;
    }

    public void setExtInfo(ExtInfo extInfo) {
        putBodyParameter("extInfo",extInfo);
        this.extInfo = extInfo;
    }

    public UpdateDeviceRequest() throws ClientException {
        super(CirsConstant.url(CirsConstant.UPDATE_DEVICE), Method.POST);
    }

    public UpdateDeviceRequest(HttpConfigInfo httpConfigInfo, String url, Method method) throws ClientException {
        super(httpConfigInfo.getPrefixUrl() + url, method, Boolean.TRUE);
    }

    @Override
    public Class getResponseClass() {
        return UpdateDeviceResponse.class;
    }

    public void businessValid() {
        if(StringUtils.isEmpty(deviceName)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "deviceName");
        }
        if(id==null){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "id");
        }
        if(StringUtils.isEmpty(groupCode)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "groupCode");
        }
        if(extInfo.getOnOffDevicestrategy()==null){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "onOffDevicestrategy");
        }
        if(extInfo.getOnOffScreenstrategy()==null){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "onOffScreenstrategy");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy