# AdRequestQuery.java

    package cloud.wconnect.frontoffice.pojo.query.adjustment;

    import cloud.wconnect.frontoffice.pojo.group.General;
    import lombok.Data;
    import org.apache.commons.collections4.CollectionUtils;
    import org.apache.commons.lang3.StringUtils;
    import org.hibernate.validator.constraints.Range;

    import jakarta.validation.constraints.NotNull;
    import java.math.BigDecimal;
    import java.util.List;
    import java.util.Objects;

    /**
     * Adjustment Requests 功能列表搜索对象
     */
    @Data
    public class AdRequestQuery {
        /**
         * 页码
         */
        @NotNull(message = "the page must not be null",groups = {General.class})
        private Integer page;
        /**
         * 每页大小
         */
        @NotNull(message = "the size must not be null",groups = {General.class})
        private Integer size;

        private Integer propertyId;

        /**
         * 单据类型数组 1:Sales 2:Front Desk 3:Accounting 4:Misposting 5:chargeback
         */
        private List<Integer> requestTypeList;

        /**
         * 业务时间开始日期，格式yyyyMMdd
         */
        private String businessDateBegin;
        /**
         * 业务时间结束日期，格式yyyyMMdd
         */
        private String businessDateEnd;
        /**
         * 入住时间开始，格式yyyyMMdd
         */
        private String checkInDateBegin;

        /**
         * 入住时间结束，格式yyyyMMdd
         */
        private String checkInDateEnd;
        /**
         * 数据责任人
         */
        private Integer dutyUser;
        /**
         * 责任人
         */
        private String mistakeBy;
        /**
         * 客人姓名
         */
        private String guestName;
        /**
         * 房间号
         */
        private String roomNumber;
        /**
         * 最小金额
         */
        private BigDecimal minDollar;
        /**
         * 最大金额
         */
        private BigDecimal maxDollar;
        /**
         * 选择原因
         *
         */
        private List<@Range(min = 1, max = 10, message = "The choosedReasonList must between in " +
                "[1:Incorrect Company rate 2:Guest Relation/Complaint 3:Over payment 4:Change Credit Card or other Method of Payment 6:Other 7:Chargeback8：DB Write Off 9:Misposting 10:Fraud]")
                Integer> choosedReasonList;
        /**
         * Conf.Num.
         */
        private String confNumber;
        /**
         * AdjNumber
         */
        private String adjNumber;
        /**
         * 交易代码
         */
        private String trxCode;

        /**
         * Revenue lost (yes / no)
         */
        private Boolean revenueLost;

        /**
         * 审批人ID
         */
        private Integer approvalUser;

        /**
         * 查询状态  1:draft 2:approving 3:approved 4:rejected 5:archived 6:cancel
         */
        private List<@Range(min = 1, max = 6, message = "The queryStatusList must between in [1:draft 2:approving 3:approved 4:rejected 5:archived 6:cancel]") Integer> queryStatusList;

        /**
         * 是否匹配
         */
        private Boolean isMatch;
        /**
         * 创建时间开始日期，格式yyyyMMdd
         */
        private String createTimeBegin;
        /**
         * 创建时间结束日期，格式yyyyMMdd
         */
        private String createTimeEnd;

        /**
         * 判断是否存在非空的查询条件
         *
         * @return java.lang.Boolean true:存在非空查询条件 false:不存在非空查询条件
         * @author lichen
         * @date 2023/12/12
         */
        public static Boolean isExistNotNullCondition(AdRequestQuery query){
            if(CollectionUtils.isNotEmpty(query.getRequestTypeList())) return true;

            if(StringUtils.isNotBlank(query.getBusinessDateBegin()) && StringUtils.isNotBlank(query.getBusinessDateEnd())) return true;

            if(StringUtils.isNotBlank(query.getCheckInDateBegin()) && StringUtils.isNotBlank(query.getCheckInDateEnd())) return true;

            if(Objects.nonNull(query.getDutyUser())) return true;

            if(StringUtils.isNotBlank(query.getMistakeBy())) return true;

            if(StringUtils.isNotBlank(query.getGuestName())) return true;

            if(StringUtils.isNotBlank(query.getRoomNumber())) return true;

            if(Objects.nonNull(query.getMinDollar()) && Objects.nonNull(query.getMaxDollar())) return true;

            if(CollectionUtils.isNotEmpty(query.getChoosedReasonList())) return true;

            if(StringUtils.isNotBlank(query.getConfNumber())) return true;

            if(StringUtils.isNotBlank(query.getAdjNumber())) return true;

            if(StringUtils.isNotBlank(query.getTrxCode())) return true;

            if(Objects.nonNull(query.getRevenueLost())) return true;

            if(Objects.nonNull(query.getApprovalUser())) return true;

            if(CollectionUtils.isNotEmpty(query.getQueryStatusList())) return true;

            if(StringUtils.isNotBlank(query.getCreateTimeBegin()) && StringUtils.isNotBlank(query.getCreateTimeEnd())) return true;

            return Objects.nonNull(query.getIsMatch());
        }

        /**
         * 查询状态
         */
        public static final int QUERY_STATUS_DRAFT = 1;
        public static final int QUERY_STATUS_APPROVING = 2;
        public static final int QUERY_STATUS_APPROVED = 3;
        public static final int QUERY_STATUS_REJECTED = 4;
        public static final int QUERY_STATUS_ARCHIVED = 5;
        public static final int QUERY_STATUS_CANCEL = 6;

    }