package org.jeecg.modules.elasticsearch.utils;

import cn.hutool.core.util.StrUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.jeecg.modules.elasticsearch.entity.TenderDetailsVo;
import org.jeecg.modules.elasticsearch.enums.CommonConstant;

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

public class TenderDetailsVoUtils {
    public static TenderDetailsVo isNull(TenderDetailsVo tenderDetailsVo){


        String sourceDataKey = tenderDetailsVo.getSourceDataKey();
        tenderDetailsVo.setSourceDataKey(StrUtil.nullToEmpty(sourceDataKey));

        String projectCode = tenderDetailsVo.getProjectCode();
        tenderDetailsVo.setProjectCode(StrUtil.nullToEmpty(projectCode));

        String projectName = tenderDetailsVo.getProjectName();
        tenderDetailsVo.setProjectName(StrUtil.nullToEmpty(projectName));

        String tenderProjectCode = tenderDetailsVo.getTenderProjectCode();
        tenderDetailsVo.setTenderProjectCode(StrUtil.nullToEmpty(tenderProjectCode));

        String noticeNature = tenderDetailsVo.getNoticeNature();
        tenderDetailsVo.setNoticeNature(StrUtil.nullToEmpty(noticeNature));

        String noticeNatureName = tenderDetailsVo.getNoticeNatureName();
        tenderDetailsVo.setNoticeNatureName(StrUtil.nullToEmpty(noticeNatureName));

        String noticeName = tenderDetailsVo.getNoticeName();
        tenderDetailsVo.setNoticeName(StrUtil.nullToEmpty(noticeName));

        String noticeContent = tenderDetailsVo.getNoticeContent();
        tenderDetailsVo.setNoticeContent(StrUtil.nullToEmpty(noticeContent));

        String noticeSendTime = tenderDetailsVo.getNoticeSendTime();
        tenderDetailsVo.setNoticeSendTime(noticeSendTime);

        String regionCode = tenderDetailsVo.getRegionCode();
        tenderDetailsVo.setRegionCode(StrUtil.nullToEmpty(regionCode));

        String regionName = tenderDetailsVo.getRegionName();
        tenderDetailsVo.setRegionName(StrUtil.nullToEmpty(regionName));

        String industriesTypeCode = tenderDetailsVo.getIndustriesTypeCode();
        tenderDetailsVo.setIndustriesTypeCode(StrUtil.nullToEmpty(industriesTypeCode));

        String industriesTypeName = tenderDetailsVo.getIndustriesTypeName();
        tenderDetailsVo.setIndustriesTypeName(StrUtil.nullToEmpty(industriesTypeName));

        String platformCode = tenderDetailsVo.getPlatformCode();
        tenderDetailsVo.setPlatformCode(StrUtil.nullToEmpty(platformCode));

        String platformName = tenderDetailsVo.getPlatformName();
        tenderDetailsVo.setPlatformName(StrUtil.nullToEmpty(platformName));

        String noticeTypeCode = tenderDetailsVo.getNoticeTypeCode();
        tenderDetailsVo.setNoticeTypeCode(StrUtil.nullToEmpty(noticeTypeCode));

        String noticeTypeName = tenderDetailsVo.getNoticeTypeName();
        tenderDetailsVo.setNoticeTypeName(StrUtil.nullToEmpty(noticeTypeName));

        String transactionTypeCode = tenderDetailsVo.getTransactionTypeCode();
        tenderDetailsVo.setTransactionTypeCode(StrUtil.nullToEmpty(transactionTypeCode));

        String transactionTypeName = tenderDetailsVo.getTransactionTypeName();
        tenderDetailsVo.setTransactionTypeName(StrUtil.nullToEmpty(transactionTypeName));

        String bulletinTypeCode = tenderDetailsVo.getBulletinTypeCode();
        tenderDetailsVo.setBulletinTypeCode(StrUtil.nullToEmpty(bulletinTypeCode));

        String bulletinTypeName = tenderDetailsVo.getBulletinTypeName();
        tenderDetailsVo.setBulletinTypeName(StrUtil.nullToEmpty(bulletinTypeName));

        String bulletinDuty = tenderDetailsVo.getBulletinDuty();
        tenderDetailsVo.setBulletinDuty(StrUtil.nullToEmpty(bulletinDuty));

        String dataSourceCode = tenderDetailsVo.getDataSourceCode();
        tenderDetailsVo.setDataSourceCode(StrUtil.nullToEmpty(dataSourceCode));

        String dataSourceName = tenderDetailsVo.getDataSourceName();
        tenderDetailsVo.setDataSourceName(StrUtil.nullToEmpty(dataSourceName));

        String noticeBidNum = tenderDetailsVo.getNoticeBidNum();
        tenderDetailsVo.setNoticeBidNum(StrUtil.nullToEmpty(noticeBidNum));

        String bidSectionCodes = tenderDetailsVo.getBidSectionCodes();
        tenderDetailsVo.setBidSectionCodes(StrUtil.nullToEmpty(bidSectionCodes));

        String docGetStartTime = tenderDetailsVo.getDocGetStartTime();
        if(ObjectUtils.isEmpty(docGetStartTime)){
            docGetStartTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setDocGetStartTime(docGetStartTime);
        String docGetEndTime = tenderDetailsVo.getDocGetEndTime();
        if(ObjectUtils.isEmpty(docGetEndTime)){
            docGetEndTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setDocGetEndTime(docGetEndTime);
        String bidDocReferEndTime = tenderDetailsVo.getBidDocReferEndTime();
        if(ObjectUtils.isEmpty(bidDocReferEndTime)){
            bidDocReferEndTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setBidDocReferEndTime(bidDocReferEndTime);
        String bidOpenTime = tenderDetailsVo.getBidOpenTime();
        if(ObjectUtils.isEmpty(bidOpenTime)){
            bidOpenTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setBidOpenTime(bidOpenTime);
        String validPeriod = tenderDetailsVo.getValidPeriod();
        tenderDetailsVo.setValidPeriod(StrUtil.nullToEmpty(validPeriod));
        String clarifyTime = tenderDetailsVo.getClarifyTime();
        if(ObjectUtils.isEmpty(clarifyTime)){
            clarifyTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setClarifyTime(clarifyTime);
        String submitTime = tenderDetailsVo.getSubmitTime();
        if(ObjectUtils.isEmpty(submitTime)){
            submitTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setSubmitTime(submitTime);
        String bidOpeningAddress = tenderDetailsVo.getBidOpeningAddress();
        tenderDetailsVo.setBidOpeningAddress(StrUtil.nullToEmpty(bidOpeningAddress));
        String bidOpeningTime = tenderDetailsVo.getBidOpeningTime();
        if(ObjectUtils.isEmpty(bidOpeningTime)){
            bidOpeningTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setBidOpeningTime(bidOpeningTime);

        String bidFinishTime = tenderDetailsVo.getBidFinishTime();
        if(ObjectUtils.isEmpty(bidFinishTime)){
            bidFinishTime = CommonConstant.SET_TIME;
        }
        tenderDetailsVo.setBidFinishTime(bidFinishTime);
        String file = tenderDetailsVo.getFile();
        tenderDetailsVo.setFile(StrUtil.nullToEmpty(file));
        return tenderDetailsVo;
    }


}
