package com.xy.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.xy.annotate.DictFormat;
import com.xy.consts.DictConsts;
import com.xy.convert.DictConvert;
import com.xy.utils.DataTime;
import com.xy.utils.PageBean;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Accessors(chain = true)
public class DeviceInfoDto {

    /**
     * 删除线路\点位时时指定 传入 wherePlaceLineId\wherePlaceId
     */
    public final static String DEL = "del";
    /**
     * 更新线\点位时指定 传入 deviceIds、placeLineId\placeId
     */
    public final static String UPDATE = "update";
    /**
     * 解绑线路、点位时指定 传入 deviceIds
     */
    public final static String CLEAR = "clear";

    @Data
    @Accessors(chain = true)
    public static class NfcVol {
        @NotBlank(message = "设备编号不可为空")
        @ApiModelProperty(value = "设备编号", required = true)
        private String deviceId;

        @NotBlank(message = "值不可为空")
        @ApiModelProperty(value = " 音量：0～15 （最小颗粒为1）", required = true)
        private String value;
    }

    @Data
    @Accessors(chain = true)
    public static class NfcVolQuery {
        @NotBlank(message = "设备编号不可为空")
        @ApiModelProperty(value = "设备编号", required = true)
        private String deviceId;

    }


    @Data
    @Accessors(chain = true)
    public static class MercNormalListDto {
        @NotNull(message = "商户ID不能位空")
        @ApiModelProperty(value = "商户Id")
        private Long mercId;
    }

    @Data
    @Accessors(chain = true)
    public static class MercNormalListVo {
        @ApiModelProperty(value = "设备名称")
        private String deviceName;

        @ApiModelProperty(value = "设备id")
        private Long deviceId;
    }

    @Data
    @Accessors(chain = true)
    public static class UpdateLonByPlaceId {
        @NotNull(message = "点位id 不能为空")
        @ApiModelProperty("点位id")
        private Long placeId;

        @ApiModelProperty("经度")
        private String lon;

        @ApiModelProperty("纬度")
        private String lat;

    }

    @Data
    @Accessors(chain = true)
    public static class SimpleDeviceSearchPageDto {
        @NotNull(message = "分页对象不能为空")
        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @ApiModelProperty("设备名称/设备编号")
        private String searchKey;

        @ApiModelProperty(value = "权限设备id多个", hidden = true)
        private List<Long> myDeviceIds;

        @ApiModelProperty(value = "商户Id", hidden = true)
        private Long mercId;
    }

    @Data
    @Accessors(chain = true)
    public static class SimpleDeviceSearchPageVo {
        @ApiModelProperty(value = "设备名称")
        private String deviceName;

        @ApiModelProperty(value = "设备id")
        private Long deviceId;
    }

    @Data
    @Accessors(chain = true)
    public static class Count {

        @NotNull(message = "mercId不能为空")
        @ApiModelProperty(value = "商户ID", required = true)
        private Long mercId;
    }

    @Data
    @Accessors(chain = true)
    public static class PageByMercDto {
        @NotNull(message = "分页信息不能为空")
        @ApiModelProperty(value = "商户ID", required = true)
        private PageBean page;

        @ApiModelProperty("设备类型")
        private Integer deviceType;


        @ApiModelProperty("是否已选择")
        private Boolean choosed;


        @ApiModelProperty("设备id多个")
        private List<Long> deviceIds;

        @ApiModelProperty("权限设备id多个")
        private List<Long> myDeviceIds;

        @ApiModelProperty("设备搜索")
        private String deviceSearch;

        @ApiModelProperty(value = "商户ID", required = true)
        private Long mercId;

    }

    @Data
    @Accessors(chain = true)
    public static class PageByAdminNameDto extends GroupByAdminNameDto {
        @NotNull(message = "分页信息不能为空")
        @ApiModelProperty(value = "商户ID", required = true)
        private PageBean page;

        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty("点位id")
        private Long placeId;

        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("区域名称")
        private String regionName;
    }

    @Data
    @Accessors(chain = true)
    public static class GroupByAdmin {
        @ApiModelProperty(value = "商户ID", required = true)
        private Long mercId;
    }


    @Data
    @Accessors(chain = true)
    public static class GroupByAdminNameDto {
        @ApiModelProperty(value = "商户ID", required = true)
        private Long mercId;

        @ApiModelProperty("设备id集合")
        private List<Long> deviceIdList;

        @ApiModelProperty(value = "设备名/设备ID/管理员名")
        private String searchKey;

        @ApiModelProperty("算法ID")
        private Long algorithmId;

        @ApiModelProperty("是否QA模式")
        private Boolean isQaMode;

    }


    @Data
    @Accessors(chain = true)
    public static class GroupByAdminNameVo {
        @ApiModelProperty(value = "管理员名称")
        private String adminName;

        @ApiModelProperty(value = "adminId 对应权限用户表ID")
        private String adminId;

        @ApiModelProperty(value = "设备数")
        private Integer deviceNum;

        @ApiModelProperty(value = "列表设备信息")
        private List<ListByAdminName> deviceInfos;
    }

    @Data
    @Accessors(chain = true)
    public static class ListByAdminName {
        @ApiModelProperty("设备ID")
        private Long deviceId;


        @ApiModelProperty("设备名称")
        private String deviceName;

        @ApiModelProperty("管理员姓名")
        private String adminName;


        @ApiModelProperty("管理员ID")
        private String adminId;

        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty("设备类型名称")
        private String deviceTypeName;

        @ApiModelProperty("区域名称")
        private String regionName;

        @ApiModelProperty("点位名称")
        private String placeName;

        @ApiModelProperty("商户名称")
        private String mercName;

        @ApiModelProperty("商户编号")
        private String mercCode;

        @ApiModelProperty("算法ID")
        private Long algorithmId;

        @ApiModelProperty("货道数量")
        private Integer aisleNum;

    }


    @Data
    @Accessors(chain = true)
    public static class TyDeviceDTO {
        @NotNull(message = "分页对象不能空")
        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @ApiModelProperty(value = "设备ID或名称搜索")
        private String searchKey;

        /**
         * 第三方设备登记状态
         */
        @ApiModelProperty(value = "第三方设备登记状态1待审核，2已审核")
        private Integer thirdStatus;


    }

    @Data
    @Accessors(chain = true)
    public static class MyDeviceDTO {
        @NotNull(message = "分页对象不能空")
        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @ApiModelProperty(value = "商户ID", hidden = true)
        private Long mercId;


        @ApiModelProperty(value = "搜索关键词")
        private String searchKey;

        @ApiModelProperty(value = "策略ID")
        private Long strategyId;

        @ApiModelProperty(value = "穿梭框类型：1左侧、2右侧")
        private Integer type;


    }


    @Data
    @Accessors(chain = true)
    public static class EventList {

        @NotNull(message = "分页对象不能空")
        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @NotBlank(message = "code不能为空")
        @ApiModelProperty(value = "事件编码", required = true)
        private String code;

        @NotNull(message = "size不能空")
        @ApiModelProperty(value = "大于等于次数", required = true)
        private Integer size;

        @ApiModelProperty(value = "开始时间", required = true)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime beginTime;

        @ApiModelProperty(value = "结束时间", required = true)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime endTime;
    }

    @Data
    @Accessors(chain = true)
    public static class AlgorithmCharging {

        @NotNull(message = "分页对象不能空")
        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @ApiModelProperty(value = "商户ID", hidden = true)
        private Long mercId;

        @ApiModelProperty(value = "设备ID")
        private List<Long> deviceIds;
    }

    @Data
    @Accessors(chain = true)
    public static class NetStateCount {
        @ApiModelProperty("商户ID")
        private Long mercId;

        @ApiModelProperty("网络状态")
        private String netState;

        @ApiModelProperty("数量")
        private Integer count;
    }

    @Data
    @Accessors(chain = true)
    public static class NetStateCountDto {
        @ApiModelProperty("商户ID")
        private List<Long> mercIdList;
    }

    @Data
    @Accessors(chain = true)
    public static class NetStateCountVo {
        @ApiModelProperty("商户ID")
        private Long mercId;
        @ApiModelProperty("总数")
        private Integer count = 0;
        @ApiModelProperty("在线数")
        private Integer onLineCount = 0;
        @ApiModelProperty("离线数")
        private Integer offLineCount = 0;
    }

    @Data
    @Accessors(chain = true)
    public static class Obj {

        @ApiModelProperty("商户ID")
        private Long mercId;

        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("门id 0=1号门 1=2号门")
        private Integer door;

        @ApiModelProperty("是否需要系统信息")
        private Boolean isSysinfo = false;

        @ApiModelProperty("是否需要状态信息")
        private Boolean isStatus = false;

        @ApiModelProperty("是否需要注册信息")
        private Boolean isRegister = false;
    }

    @Data
    @Accessors(chain = true)
    public static class ListDto {
        @ApiModelProperty(value = "设备id批量查")
        private List<Long> deviceIds;

        @ApiModelProperty(value = "商户id")
        private Long mercId;

        @ApiModelProperty("冻结状态")
        private Integer freezeStatus;
    }

    @Data
    @Accessors(chain = true)
    public static class ListCommon {
        @ApiModelProperty("设备信息VO")
        Vo vo;
//        @ApiModelProperty("线路id多个")
//        private List<Long> placeLineIds;

        @ApiModelProperty("设备ID")
        private List<Long> deviceIds;
        @ApiModelProperty("商户ID")
        private List<Long> mercIds;


        @ApiModelProperty("指定字段查询")
        private List<String> columnList;

        @ApiModelProperty(value = "根据名称或编码搜索")
        private String deviceSearch;
    }

    @Data
    @Accessors(chain = true)
    public static class UpdateLine {
        @NotNull(message = "更新类型")
        @ApiModelProperty(value = "更新类型", required = true)
        private String type;

        @NotNull(message = "商户id不能为空")
        @ApiModelProperty(value = "商户id", required = true)
        private Long mercId;

        @ApiModelProperty("设备id集合")
        private List<Long> deviceIds;

        @ApiModelProperty(value = "线路ID")
        private Long placeLineId;

        @ApiModelProperty(value = "原线路ID")
        private Long wherePlaceLineId;
    }

    @Data
    @Accessors(chain = true)
    public static class UpdatePlace {
        @NotNull(message = "更新类型")
        @ApiModelProperty(value = "更新类型", required = true)
        private String type;

        @NotNull(message = "商户id不能为空")
        @ApiModelProperty(value = "商户id", required = true)
        private Long mercId;

        @ApiModelProperty("设备id集合")
        private List<Long> deviceIds;

        @ApiModelProperty(value = "点位ID")
        private Long placeId;

        @ApiModelProperty(value = "原点位ID")
        private Long wherePlaceId;
    }

    @Data
    @Accessors(chain = true)
    public static class Update extends Vo {

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty(value = "系统信息", hidden = true)
        private DeviceSysinfoDto.Vo deviceSysinfo;

        @ApiModelProperty(value = "状态信息", hidden = true)
        private DeviceStatusDto.Vo deviceStatus;

        @ApiModelProperty(value = "注册信息", hidden = true)
        private DeviceRegisterDto.Vo deviceRegister;
    }

    @Data
    @Accessors(chain = true)
    public static class ActivationCount {

        @NotNull(message = "mercId不能为空")
        @ApiModelProperty("商户id")
        private Long mercId;

        @ApiModelProperty("不等于设备类型")
        private Integer notDeviceType;

        @ApiModelProperty("开始时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime beginTime;

        @ApiModelProperty("结束时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime endTime;
    }

    @Data
    @Accessors(chain = true)
    public static class PageSingle extends Vo {
        @NotNull(message = "分页对象不能空")
        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;
    }

    @Data
    @Accessors(chain = true)
    public static class Page extends Vo {

        @ApiModelProperty(value = "拥有的设备ID", hidden = true)
        private List<Long> myDeviceIds;

        @ApiModelProperty("缺货状态")
        private Integer stockStatus;

        @ApiModelProperty("搜索词")
        private String keyword;

        /**
         * 设备ID
         */
        private List<Long> deviceIdList;


        @ApiModelProperty("是否查询故障设备")
        private Boolean fault;

        @ApiModelProperty("是否有nfc")
        private Boolean isHaveNfc;

        @ApiModelProperty("是否导出当前页")
        private Boolean exportPage = true;

        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

        @ApiModelProperty("是否绑定商户")
        private Boolean isBindMerc;
        @ApiModelProperty("资产/sn/sim号")
        private String no;
        @ApiModelProperty("商户id/商户号/商户名称")
        private String merc;
        @ApiModelProperty("设备id/设备名称")
        private String deviceIdName;
        @ApiModelProperty("联网状态")
        private Integer netState;
        @ApiModelProperty("上位机版本号")
        private String appUpmVersion;
        @ApiModelProperty("下位机版本号")
        private String appDownmVersion;
        @JsonFormat(pattern = "yyyy-MM-dd")
        @ApiModelProperty(value = "激活时间-起")
        private LocalDate beginActiveTime;
        @JsonFormat(pattern = "yyyy-MM-dd")
        @ApiModelProperty(value = "激活时间-始")
        private LocalDate endActiveTime;
        @ApiModelProperty("附近最大距离，单位：米")
        private Integer nearby;
        @ApiModelProperty(value = "系统信息", hidden = true)
        private DeviceSysinfoDto.Vo deviceSysinfo;
        @ApiModelProperty(value = "状态信息", hidden = true)
        private DeviceStatusDto.Vo deviceStatus;
        @ApiModelProperty(value = "注册信息", hidden = true)
        private DeviceRegisterDto.Vo deviceRegister;
        @ApiModelProperty(value = "限制查询数量", required = false)
        private Integer limitNum;

        /**
         * size -1 不分页
         *
         * @return
         */
        public PageBean getPage() {
            if (!this.exportPage) {
                this.page.setSize(-1L);
            }
            return page;
        }

        public String getBeginActiveTime() {
            return beginActiveTime == null ? null : DataTime.toString(beginActiveTime.atTime(0, 0, 0));
        }

        public String getEndActiveTime() {
            return endActiveTime == null ? null : DataTime.toString(endActiveTime.atTime(23, 59, 59));
        }


    }

    @Data
    @Accessors(chain = true)
    public static class Vo {

        @ApiModelProperty("货道数量")
        private Integer aisleNum;

        @ApiModelProperty("通电状态")
        private Integer sysPower;

        @ApiModelProperty("左门锁机状态名称")
        private String deviceStateLName;

        @ApiModelProperty("右门锁机状态名称")
        private String deviceStateRName;

        @ApiModelProperty("左门锁机状态，字典类型：devcie_lock_status")
        private Integer deviceStateL;


        @ApiModelProperty("右门锁机状态，字典类型：devcie_lock_status")
        private Integer deviceStateR;

        @ApiModelProperty("设备id")
        private Long deviceId;


        @ApiModelProperty("设备名称")
        private String deviceName;

        @DictFormat(DictConsts.DEVICE_TYPE)
        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty("商户设备资产编号")
        private String mercDeviceCode;

        @ApiModelProperty("商户id")
        private Long mercId;

        @ApiModelProperty("商户编码")
        private String mercCode;

        @ApiModelProperty("商户名称")
        private String mercName;

        @ApiModelProperty("算法平台id")
        private Long algorithmId;

        @ApiModelProperty("点位id")
        private Long placeId;

        @ApiModelProperty("点位")
        private String placeName;

        @ApiModelProperty("点位照片")
        private String placeImgs;

        @ApiModelProperty("线路id")
        private Long placeLineId;

        @ApiModelProperty("线路")
        private String placeLineName;

        @ApiModelProperty("区域id")
        private Long districtId;


        @ApiModelProperty("区域")
        private String districtName;

        @DictFormat(DictConsts.DEVICE_ACTIVE_STATUS)
        @ApiModelProperty("激活状态")
        private Integer activeState;
        @JsonDeserialize(using = LocalDateTimeDeserializer.class)
        @JsonSerialize(using = LocalDateTimeSerializer.class)
        @ApiModelProperty("激活时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime activeTime;

        @DictFormat(DictConsts.DEVICE_BUSY_STATUS)
        @ApiModelProperty("运营状态")
        private Integer busyState;

        @ApiModelProperty("显示状态")
        private Boolean showStatus;

        @DictFormat(DictConsts.DEVICE_FREEZE_STATUS)
        @ApiModelProperty("冻结状态")
        private Integer freezeStatus;

        @ApiModelProperty("设备图片")
        private String deviceImg;

        @ApiModelProperty("经度")
        private String lon;

        @ApiModelProperty("纬度")
        private String lat;

        @DictFormat(DictConsts.DEVICE_FAULT_LEVEL)
        @ApiModelProperty("故障等级")
        private Integer faultLevel;
        @JsonDeserialize(using = LocalDateTimeDeserializer.class)
        @JsonSerialize(using = LocalDateTimeSerializer.class)
        @ApiModelProperty("创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createTime;
        @JsonDeserialize(using = LocalDateTimeDeserializer.class)
        @JsonSerialize(using = LocalDateTimeSerializer.class)
        @ApiModelProperty("更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updateTime;

        @ApiModelProperty("系统信息")
        private DeviceSysinfoDto.Vo deviceSysinfo;


        @ApiModelProperty("状态信息")
        private DeviceStatusDto.Vo deviceStatus;

        @ApiModelProperty("注册信息")
        private DeviceRegisterDto.Vo deviceRegister;

        @ApiModelProperty("联网状态名称")
        private String netStateName;

        @ApiModelProperty("温度设置信息")
        private TempSetInfo tempSetInfo;

        @ApiModelProperty("工作温度设置值")
        private Integer jobTempSetValue;

        @ApiModelProperty("管理员名字")
        private String adminName;

        /**
         * 第三方设备登记状态
         */
        @ApiModelProperty("第三方设备登记状态")
        private String thirdStatus;

        /**
         * 第三方设备审核结果
         */
        @ApiModelProperty("第三方设备审核结果")
        private String thirdResult;

        @ApiModelProperty("设备配置")
        private DeviceConfigDto.Vo deviceConfig;

    }

    @Data
    @Accessors(chain = true)
    public static class AlgorithmChargingVo extends Vo {

        @ApiModelProperty(value = "剩余个数")
        private Integer unusedCount;

        @ApiModelProperty(value = "剩余条数")
        private Integer unusedSize;

        @ApiModelProperty(value = "已用条数")
        private Integer makeSize;

        @ApiModelProperty(value = "欠费金额")
        private Integer arrearageBalance;
    }

    @Data
    @Accessors(chain = true)
    public static class TempSetInfo {

        @ApiModelProperty(value = "设备id")
        private Long deviceId;

        @ApiModelProperty(value = "最大温度告警值")
        private Integer tempMax;

        @ApiModelProperty(value = "最小温度告警值")
        private Integer tempMin;

    }

    @Data
    @Accessors(chain = true)
    public static class PageCount {
        @ApiModelProperty(value = "总设备数")
        private Integer total;

        @ApiModelProperty(value = "在线设备数量")
        private Integer onlineNum;

        @ApiModelProperty(value = "离线设备数量")
        private Integer offLineNum;

        @ApiModelProperty(value = "激活设备数量")
        private Integer activeNum;

        @ApiModelProperty(value = "未激活设备数量")
        private Integer noActiveNum;


    }
    @Data
    @Accessors(chain = true)
    public static class Vo2 extends Vo {

        @ApiModelProperty("商户名称")
        private String mercName;

        @ApiModelProperty("距离")
        private Integer m;

        @ApiModelProperty("点位名称")
        private String placeName;

        @ApiModelProperty("线路名称")
        private String placeLineName;

        @ApiModelProperty("区域名称")
        private String districtName;

        @ApiModelProperty("今日订单数")
        private Integer dayOrderNum;

        @ApiModelProperty("今日销售额")
        private Integer daySalesPrice;

        @ApiModelProperty("流量卡运营商")
        private String simIsp;

        @ApiModelProperty("流量卡号")
        private String simIccid;

        @ApiModelProperty("配件集合")
        private List<DevicePartDto.Vo> deviceParts;
    }

    @Data
    @Accessors(chain = true)
    public static class MerHomeSearchVO {


        @ApiModelProperty("今日订单数")
        private Integer dayOrderNum;

        @ApiModelProperty("今日销售额")
        private Integer daySalesPrice;


        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("设备名称")
        private String deviceName;

        @DictFormat(DictConsts.DEVICE_TYPE)
        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty("商户编码")
        private String mercCode;

        @ApiModelProperty("商户名称")
        private String mercName;


        @DictFormat(DictConsts.DEVICE_BUSY_STATUS)
        @ApiModelProperty("运营状态")
        private Integer busyState;


        @ApiModelProperty("左门锁机状态，字典类型：devcie_lock_status")
        private Integer deviceStateL;


        @ApiModelProperty("右门锁机状态，字典类型：devcie_lock_status")
        private Integer deviceStateR;


        @ApiModelProperty("左门锁机状态名称")
        private String deviceStateLName;

        @ApiModelProperty("右门锁机状态名称")
        private String deviceStateRName;


        @DictFormat(DictConsts.DEVICE_FAULT_LEVEL)
        @ApiModelProperty("故障等级")
        private Integer faultLevel;


        @ApiModelProperty("更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updateTime;


        @ApiModelProperty("上位机版本号=软件版本号")
        private String appUpmVersion;


        @ApiModelProperty("联网信号强度")
        private Integer netDbm;

        @ApiModelProperty("温度值")
        private Integer tempValue;


    }


    @Data
    @Accessors(chain = true)
    public static class DeviceExcelVO {

        @ExcelProperty("所属商户")
        @ApiModelProperty("商户名称")
        private String mercName;


        @ExcelProperty("点位")
        @ApiModelProperty("点位名称")
        private String placeName;

        @ExcelProperty("线路")
        @ApiModelProperty("线路名称")
        private String placeLineName;
        @ExcelProperty("区域")
        @ApiModelProperty("区域名称")
        private String districtName;


        @ExcelProperty("设备编号")
        @ApiModelProperty("设备id")
        private Long deviceId;

        @ExcelProperty("设备名称")
        @ApiModelProperty("设备名称")
        private String deviceName;

        @ExcelProperty(value = "设备类型", converter = DictConvert.class)
        @DictFormat(DictConsts.DEVICE_TYPE)
        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ExcelProperty("商户设备资产编号")
        @ApiModelProperty("商户设备资产编号")
        private String mercDeviceCode;


        @ExcelProperty(value = "商户编码")
        @ApiModelProperty("商户编码")
        private String mercCode;


        @ExcelProperty(value = "激活状态", converter = DictConvert.class)
        @DictFormat(DictConsts.DEVICE_ACTIVE_STATUS)
        @ApiModelProperty("激活状态")
        private Integer activeState;


        @ExcelProperty(value = "运营状态", converter = DictConvert.class)
        @DictFormat(DictConsts.DEVICE_BUSY_STATUS)
        @ApiModelProperty("运营状态")
        private Integer busyState;


        @ExcelProperty(value = "冻结状态", converter = DictConvert.class)
        @DictFormat(DictConsts.DEVICE_FREEZE_STATUS)
        @ApiModelProperty("冻结状态")
        private Integer freezeStatus;


        @ExcelProperty(value = "故障等级", converter = DictConvert.class)
        @DictFormat(DictConsts.DEVICE_FAULT_LEVEL)
        @ApiModelProperty("故障等级")
        private Integer faultLevel;

        @ExcelProperty("流量卡运营商")
        private String simIsp;

        @ExcelProperty("流量卡号")
        private String simIccid;

    }


    /**
     * 商户设备授权
     *
     * @author 谭斌
     * @date 2023/02/09
     */
    @Data
    @Accessors(chain = true)
    public static class MercDeviceAuthDto {
        @ApiModelProperty(value = "是否商户操作", required = false)
        private Boolean mercOperate;


        @ApiModelProperty(value = "对应商户的全量设备ID(传空则取消商户所有机器)", required = false)
        private List<Long> deviceIds;

        @ApiModelProperty(value = "商户ID", required = false)
        private Long mercId;

        @ApiModelProperty(value = "父商户ID")
        private Long parentId;

        @ApiModelProperty(value = "商户名称", required = false)
        private String mercName;


        @NotBlank(message = "商户编码不可为空")
        @ApiModelProperty(value = "商户编码", required = true)
        private String mercCode;

        @ApiModelProperty(value = "算法ID", required = false)
        private Long algorithmId;
    }

    @Data
    @Accessors(chain = true)
    public static class MercDeviceUnBindDto {
        @NotEmpty(message = "请选择设备！")
        @ApiModelProperty(value = "设备ID", required = false)
        private List<Long> deviceIds;

        @ApiModelProperty(value = "商户ID")
        private String mercName;

        @ApiModelProperty(value = "商户编码")
        private String mercCode;

        @ApiModelProperty(value = "商户ID")
        private Long mercId;

    }


    @Data
    @Accessors(chain = true)
    public static class MercAlgorithmIdListDto {
        @ApiModelProperty(value = "商户ID")
        private Long mercId;
    }


    /**
     * 商户设备首页统计
     *
     * @author 谭斌
     * @date 2023/02/28
     */
    @Data
    @Accessors(chain = true)
    public static class MercHomeStatisticalVO {
        @ApiModelProperty(value = "在线设备数")
        private Integer onlineNum;

        @ApiModelProperty(value = "离线设备数")
        private Integer offlineNum;

        @ApiModelProperty(value = "锁机设备数")
        private Integer operatingNum;

        @ApiModelProperty(value = "未锁机设备数")
        private Integer closedNum;

        @ApiModelProperty(value = "待补货设备数")
        private Integer needToFillNum;
    }

    @Data
    @Accessors(chain = true)
    public static class MercHomeQueryDTO {
        @ApiModelProperty(value = "拥有的设备ID", hidden = true)
        private List<Long> myDeviceIds;
        @ApiModelProperty(value = "商户id")
        private Long mercId;

        @ApiModelProperty(value = "设备名称")
        private String deviceName;

        @ApiModelProperty(value = "搜索关键词")
        private String searchKey;


        @ApiModelProperty("设备编号")
        private Long deviceId;

        @ApiModelProperty("激活状态")
        private String activeState;

        @ApiModelProperty("在线状态-字典类型：device_online_status(1-在线，2-离线)")
        private Integer onlineStatus;

        @ApiModelProperty("运营状态-字典类型：device_busy_status（1-运营中，2-已停运）")
        private Integer busyStatus;

        @ApiModelProperty("设备类型-字典类型：device_type")
        private Integer deviceType;

        @ApiModelProperty(value = "设备ID", hidden = true)
        private List<Long> deviceIdList;

        @ApiModelProperty("管理员名字")
        private String adminName;

        @ApiModelProperty("是否QA模式")
        private Boolean isQaMode;

    }


    @Data
    @Accessors(chain = true)
    public static class MercHomeListVO {
        @ApiModelProperty(value = "管理员名称")
        private String adminName;

        @ApiModelProperty(value = "区域ID")
        private Long districtId;

        @ApiModelProperty(value = "设备数")
        private Integer deviceNum;

        @ApiModelProperty(value = "列表设备信息")
        private List<MercHomeDeviceVo> deviceInfos;

        @ApiModelProperty(value = "线路名称")
        private String placeLineName;

        @ApiModelProperty(value = "线路ID")
        private Long placeLineId;
    }


    @Data
    @Accessors(chain = true)
    public static class MercHomeCountVO {


        @ApiModelProperty(value = "区域ID")
        private Long districtId;

        @ApiModelProperty(value = "设备数")
        private Integer deviceNum;


    }


    @Data
    @Accessors(chain = true)
    public static class MercHomeDeviceVo {

        /**
         * 是否有温控仪
         */
        @ApiModelProperty("是否有温控仪")
        private Boolean isHaveTemp;

        @ApiModelProperty("温度值")
        private Integer tempValue;

        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("设备名称")
        private String deviceName;

        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty(value = "算法平台ID")
        private Long algorithmId;

        @ApiModelProperty(value = "算法类型别名")
        private String algorithmAlias;


        @ApiModelProperty("设备类型名称")
        private String deviceTypeName;

        @ApiModelProperty("商户设备资产编号")
        private String mercDeviceCode;


        @ApiModelProperty("运营状态")
        private Integer busyState;

        @ApiModelProperty("联网状态")
        private Integer netState;

        @ApiModelProperty("联网状态名称")
        private String netStateName;

        @ApiModelProperty("运营状态名称")
        private String busyStateName;


        @ApiModelProperty("今日订单数")
        private Integer dayOrderNum;

        @ApiModelProperty("今日销售额")
        private Integer daySalesPrice;


        @ApiModelProperty("在售商品数")
        private Integer onSaleNum;

        @ApiModelProperty("补货数")
        private Integer fillNum;

        @ApiModelProperty(value = "单机容量")
        private Integer capacity;


        @ApiModelProperty("左门锁机状态名称")
        private String deviceStateLName;

        @ApiModelProperty("右门锁机状态名称")
        private String deviceStateRName;

        @ApiModelProperty("左门锁机状态，字典类型：devcie_lock_status")
        private Integer deviceStateL;


        @ApiModelProperty("右门锁机状态，字典类型：devcie_lock_status")
        private Integer deviceStateR;

        @ApiModelProperty("通电状态")
        private Integer sysPower;

        @ApiModelProperty("货道数量")
        private Integer aisleNum;

    }


    @Data
    @Accessors(chain = true)
    public static class CheckOwnerDTO {
        @ApiModelProperty(value = "设备SN", required = false)
        private String deviceSn;

        @ApiModelProperty(value = "设备id", required = false)
        private Long deviceId;
    }

    @Data
    @Accessors(chain = true)
    public static class DeviceDataCountDTO {

        @NotNull(message = "mercId不能为空")
        @ApiModelProperty("商户ID")
        private Long mercId;

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private Long deviceId;

        /**
         * 统计类型（1=经营数据，2=经营图表，3=温度图表，4=信号图表，5=商品管理）
         */
        @ApiModelProperty(value = "统计类型（1=经营数据，2=经营图表，3=温度图表，4=信号图表，5=商品管理）", notes = "统计类型（1=经营数据，2=经营图表，3=温度图表，4=信号图表，5=商品管理）")
        private Integer type;

        @ApiModelProperty("温度、信号图表选择日期yyyy-MM-dd")
        private String choosDate;
    }

    @Data
    @Accessors(chain = true)
    public static class DeviceDataCountVO {
        @ApiModelProperty("(天)经营数据")
        private BusinessData dayBusinessData;

        @ApiModelProperty("(月)经营数据")
        private BusinessData monthBusinessData;

        @ApiModelProperty("商品统计数据")
        private GoodsData goodsData;

        @ApiModelProperty("经营图表")
        private BusinessChart businessChart;

        @ApiModelProperty("温度图表")
        private TemperatureChart temperatureChart;

        @ApiModelProperty("信号图表")
        private SignalChart signalChart;

    }

    /**
     * 信号图表数据
     */
    @Data
    @Accessors(chain = true)
    public static class SignalChart {
        @ApiModelProperty("横坐标:当天到秒的数据")
        private List<String> categories;

        @ApiModelProperty("名称、数据")
        private List<MyChartSeries> series;

    }

    /**
     * 温度图表数据
     */
    @Data
    @Accessors(chain = true)
    public static class TemperatureChart {
        @ApiModelProperty("横坐标:当天到秒的数据")
        private List<String> categories;

        @ApiModelProperty("名称、数据")
        private List<MyChartSeries2> series;

    }

    /**
     * 经营图表数据
     */
    @Data
    @Accessors(chain = true)
    public static class BusinessChart {
        @ApiModelProperty("横坐标:日期最近一个月的")
        private List<String> categories;

        @ApiModelProperty("名称、数据")
        private List<MyChartSeries3> series;

    }

    @Data
    @Accessors(chain = true)
    public static class MyChartSeries {
        @ApiModelProperty("数据")
        private List<Integer> data;

        @ApiModelProperty("名称")
        private String name;

    }

    @Data
    @Accessors(chain = true)
    public static class MyChartSeries2 {
        @ApiModelProperty("数据")
        private List<BigDecimal> data;

        @ApiModelProperty("名称")
        private String name;

    }

    @Data
    @Accessors(chain = true)
    public static class MyChartSeries3 {
        @ApiModelProperty("数据")
        private List<String> data;

        @ApiModelProperty("名称")
        private String name;

    }


    @Data
    @Accessors(chain = true)
    public static class BusinessData {
        @ApiModelProperty(value = "营业额;单位分")
        private Integer salesMoney;

        @ApiModelProperty(value = "销售笔数")
        private Integer salesCount;

        @ApiModelProperty(value = "销售商品数")
        private Integer goodsCount;

        @ApiModelProperty(value = "退款金额;单位分")
        private Integer refundMoney;

        @ApiModelProperty(value = "退款笔数")
        private Integer refundCount;

        @ApiModelProperty(value = "风险订单数")
        private Integer riskCount;

        @ApiModelProperty(value = "0元订单笔数")
        private Integer zeroCount;

        @ApiModelProperty(value = "利润")
        private Integer profit;

        public Integer getProfit() {
            return profit == null ? 0 : profit;
        }
    }

    /**
     * 商品管理统计数据
     */
    @Data
    @Accessors(chain = true)
    public static class GoodsData {

        @ApiModelProperty("在售商品种类")
        private Integer categoryNum;


        /**
         * 设备商品在售库存数
         */
        @ApiModelProperty("可售库存")
        private Integer stock;

        /**
         * 最近一次补货后的库存数
         */
        @ApiModelProperty("上次补货后库存")
        private Integer afterFillStock;


    }

    @Data
    @Accessors(chain = true)
    public static class DeviceIdDto {
        @NotNull(message = "设备id不能为空")
        @ApiModelProperty("设备id")
        private List<Long> deviceId;
    }

    @Data
    @Accessors(chain = true)
    public static class PlaceDeviceNumDto {
        @ApiModelProperty("点位id")
        private Long placeId;

        @ApiModelProperty("点位ID列表")
        private List<Long> placeIdList;
    }

    @Data
    @Accessors(chain = true)
    public static class PlaceDeviceNumVo {
        @ApiModelProperty("点位id")
        private Long placeId;

        @ApiModelProperty("数量")
        private Integer num;
    }

    @Data
    @Accessors(chain = true)
    public static class MyDeviceInfo {
        @ApiModelProperty("商户ID")
        private Long mercId;

        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("设备名称")
        private String deviceName;

        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty("算法类型")
        private Long algorithmId;


    }

    @Data
    @Accessors(chain = true)
    public static class EventListVo extends Vo {

        @ApiModelProperty("事件发生次数")
        private Integer size;

    }
}
