package com.jiayue.insu.inclientqn.model;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.jiayue.insu.inclientqn.inenum.QNHLEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * @description: 一体化请求VO
 * @author: yuanhao
 * @createDate: 2021/8/24
 * @version: 1.0
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class RequestVo {

    public static RequestVo UPLOAD_STAT(String el,String data,long time) {

        DateTime dateTime =  DateTime.of(time);
        String fileName = el + "_" + dateTime.toString("yyyyMMdd_HHmm") + "_" + QNHLEnum.DATA_STAT_TYPE.getSign() + ".CIME";
        return RequestVo.builder()
                .transferType(QNHLEnum.TRANSFER_TYPE_UPLOAD.getCode())
                .date(dateTime.toString("yyyyMMdd"))
                .dataType(QNHLEnum.DATA_STAT_TYPE.getSign())
                .fileName(fileName)
                .data(data.toString()).build();
    }

    public static RequestVo UPLOAD_FORE(String el,String data,long time) {

        DateTime dateTime =  DateTime.of(time);
        String fileName = el + "_" + dateTime.toString("yyyyMMdd_HHmm") + "_" + QNHLEnum.DATA_FORE_TYPE.getSign() + ".CIME";
        return RequestVo.builder()
                .transferType(QNHLEnum.TRANSFER_TYPE_UPLOAD.getCode())
                .date(dateTime.toString("yyyyMMdd"))
                .dataType(QNHLEnum.DATA_FORE_TYPE.getSign())
                .fileName(fileName)
                .data(data.toString()).build();
    }

    public static RequestVo CORRECT_US(String el,String data,long time) {

        DateTime dateTime =  DateTime.of(time+1800000L);
        String fileName = el + "_" + dateTime.toString("yyyyMMdd_HHmm") + "_" + QNHLEnum.DATA_CORRULTRSHOR_TYPE.getSign() + ".CIME";
        return RequestVo.builder()
                .transferType(QNHLEnum.TRANSFER_TYPE_CORRECT.getCode())
                .date(dateTime.toString("yyyyMMdd"))
                .dataType(QNHLEnum.DATA_CORRULTRSHOR_TYPE.getSign())
                .fileName(fileName)
                .data(data).build();
    }



    public static RequestVo CORRECT_RP(String data,long time) {

        DateTime dateTime =  DateTime.of(time);
        return RequestVo.builder()
                .transferType(QNHLEnum.TRANSFER_TYPE_CORRECT.getCode())
                .date(dateTime.toString("yyyyMMdd"))
                .dataType(QNHLEnum.DATA_REPAPLAN_TYPE.getSign())
                .data(data).build();
    }

    /**
     * 数据传输类型
     */
    private String transferType;

    /**
     * 日期
     */
    private String date;
    /**
     * 数据类型
     */
    private String dataType;

    /**
     * 文件名
     */
    private String fileName;

    /**
     * 数据
     */
    private String data;


}
