package com.dxhy.core.model;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dxhy.common.utils.DateUtils;
import com.github.pagehelper.util.StringUtil;

import lombok.Data;

/**
 * @author user
 */
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
@Data
public class TDxCustomsRecordMDto extends CommonDTO {
    private Long id;
    private List<String> ids;
    private List<String> gfTaxNo;
    /**
     * 缴款书号码
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String customsCode;
    /**
     * 填发日期
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String fillInDateStart;
    private String fillInDateEnd;
    /**
     * 税款金额
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String taxAmount;
    /**
     * 签收状态
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String qsStatus;
    /**
     * 签收日期
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String qsDateStart;
    private String qsDateEnd;
    /**
     * 是否设置不抵扣状态 '0'否 '1'是
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String sfDkStatus;
    private String glzt;
    private String rzhYesorno;
    private String rzlx;
    private String confirmUser;
    private String authStatus;
    /**
     * 认证日期
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param null
     * @return
     */
    private String rzhDateStart;
    private String rzhDateEnd;
    private String rzhBelongDate;
    private String gfsh;

    public void setParam(Page page) throws Exception {

        if (StringUtil.isNotEmpty(rzhBelongDate)) {
            Date date = new SimpleDateFormat("yyyy-MM").parse(rzhBelongDate);
            rzhBelongDate = new SimpleDateFormat("yyyyMM").format(date);
        }

        if (StringUtil.isNotEmpty(fillInDateStart)) {
            fillInDateStart = DateUtils.getMorning(new SimpleDateFormat("yyyy-MM-dd").parse(fillInDateStart));
        }
        if (StringUtil.isNotEmpty(fillInDateEnd)) {
            fillInDateEnd = DateUtils.getNight(new SimpleDateFormat("yyyy-MM-dd").parse(fillInDateEnd));
        }

        if (StringUtil.isNotEmpty(qsDateStart)) {
            qsDateStart = DateUtils.getMorning(new SimpleDateFormat("yyyy-MM-dd").parse(qsDateStart));
        }
        if (StringUtil.isNotEmpty(qsDateEnd)) {
            qsDateEnd = DateUtils.getNight(new SimpleDateFormat("yyyy-MM-dd").parse(qsDateEnd));
        }

        if (StringUtil.isNotEmpty(rzhDateStart)) {
            rzhDateStart = DateUtils.getMorning(new SimpleDateFormat("yyyy-MM-dd").parse(rzhDateStart));
        }
        if (StringUtil.isNotEmpty(rzhDateEnd)) {
            rzhDateEnd = DateUtils.getNight(new SimpleDateFormat("yyyy-MM-dd").parse(rzhDateEnd));
        }

        if (this.getGfTaxNo() != null && this.getGfTaxNo().size() > 0) {
            for (String str : this.getGfTaxNo()) {
                if (this.isAll(str)) {
                    this.gfTaxNo = null;
                    break;
                }
            }
        }
        this.setPage(page);
    }
}
