package com.engine.custom.sl.entity;

import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.general.BaseBean;

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

public class EsbRequestHeader {
    private String service_sn;
    private String system_id;
    private String requester_id;
    private String branch_id;
    private String channel_id;
    private String service_time;
    private String need_request;
    private String SvcCd;
    private String SvcScn;
    private String BnkSrlNo;
    private String FileFlg;
    private String FilePath;

    public EsbRequestHeader() {

    }

//此方法为推送补贴报销单到ESB的消息头,其他类型需自己set属性
    public EsbRequestHeader(int id) {
        BaseBean baseBean = new BaseBean();
        String idStr = String.format("%06d", id);
        String timestamp = generateTimestamp();
        service_sn = timestamp+idStr;
        system_id = baseBean.getPropValue("ESB_Header","system_id");
        requester_id = baseBean.getPropValue("ESB_Header","requester_id");
        branch_id = baseBean.getPropValue("ESB_Header","branch_id");
        channel_id =  baseBean.getPropValue("ESB_Header","channel_id");
        service_time = timestamp;
        need_request = "";
        SvcCd = baseBean.getPropValue("ESB_Header","SvcCd");
        SvcScn = baseBean.getPropValue("ESB_Header","SvcScn");
        BnkSrlNo = requester_id + timestamp + idStr ;
        FileFlg ="0";
    }

    public String getService_sn() {
        return service_sn;
    }

    public void setService_sn(String service_sn) {
        this.service_sn = service_sn;
    }

    public String getSystem_id() {
        return system_id;
    }

    public void setSystem_id(String system_id) {
        this.system_id = system_id;
    }

    public String getRequester_id() {
        return requester_id;
    }

    public void setRequester_id(String requester_id) {
        this.requester_id = requester_id;
    }

    public String getBranch_id() {
        return branch_id;
    }

    public void setBranch_id(String branch_id) {
        this.branch_id = branch_id;
    }

    public String getChannel_id() {
        return channel_id;
    }

    public void setChannel_id(String channel_id) {
        this.channel_id = channel_id;
    }

    public String getService_time() {
        return service_time;
    }

    public void setService_time(String service_time) {
        this.service_time = service_time;
    }

    public String getNeed_request() {
        return need_request;
    }

    public void setNeed_request(String need_request) {
        this.need_request = need_request;
    }

    public String getSvcCd() {
        return SvcCd;
    }

    public void setSvcCd(String svcCd) {
        SvcCd = svcCd;
    }

    public String getSvcScn() {
        return SvcScn;
    }

    public void setSvcScn(String svcScn) {
        SvcScn = svcScn;
    }

    public String getBnkSrlNo() {
        return BnkSrlNo;
    }

    public void setBnkSrlNo(String bnkSrlNo) {
        BnkSrlNo = bnkSrlNo;
    }

    public String getFileFlg() {
        return FileFlg;
    }

    public void setFileFlg(String fileFlg) {
        FileFlg = fileFlg;
    }

    public String getFilePath() {
        return FilePath;
    }

    public void setFilePath(String filePath) {
        FilePath = filePath;
    }
    public static String generateTimestamp() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        Date currentDate = new Date();
        return dateFormat.format(currentDate);
    }
    // public static String getCurrentTime() {
    //     SimpleDateFormat dateFormat = new SimpleDateFormat("YYYYMMDDHHmmss");
    //     Date currentDate = new Date();
    //     return dateFormat.format(currentDate);
    // }


    @Override
    public String toString() {
        return "EsbRequestHeader{" +
                "service_sn='" + service_sn + '\'' +
                ", system_id='" + system_id + '\'' +
                ", requester_id='" + requester_id + '\'' +
                ", branch_id='" + branch_id + '\'' +
                ", channel_id='" + channel_id + '\'' +
                ", service_time='" + service_time + '\'' +
                ", need_request='" + need_request + '\'' +
                ", SvcCd='" + SvcCd + '\'' +
                ", SvcScn='" + SvcScn + '\'' +
                ", BnkSrlNo='" + BnkSrlNo + '\'' +
                ", FileFlg='" + FileFlg + '\'' +
                ", FilePath='" + FilePath + '\'' +
                '}';
    }


}
