package com.trs.ggzyexchange.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.trs.ggzyexchange.entity.GcPubContract;
import com.trs.ggzyexchange.entity.TenderDetailsVo;
import com.trs.ggzyexchange.mapper.GcPubContractMapper;
import com.trs.ggzyexchange.service.GcPubContractService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 合同签订 服务实现类
 * </p>
 *
 * @author trs
 * @since 2023-02-23
 */
@Service
public class GcPubContractServiceImpl extends ServiceImpl<GcPubContractMapper, GcPubContract> implements GcPubContractService {

    @Autowired
    private GcPubContractMapper gcPubContractMapper;

    @Override
    public Integer getTotalNumberTransactions(String platformCode) {
        return gcPubContractMapper.getTotalNumberTransactions(platformCode);
    }

    @Override
    public IPage<TenderDetailsVo> queryGcBidcandidateAllList(Page<GcPubContract> page) {

        return gcPubContractMapper.queryGcBidcandidateAllList(page);
    }

    @Override
    public IPage<TenderDetailsVo> queryGcBidcandidateAllListByTime(Page<GcPubContract> page, Long time) {
        return gcPubContractMapper.queryGcBidcandidateAllListByTime(page,time);
    }

    @Override
    public Long maxDataTimeStamp() {
        Long aLong = gcPubContractMapper.maxDataTimeStamp();
        try{
            if(!ObjectUtils.isEmpty(aLong)){
                if(aLong != 0){
                    String sLong = ((aLong+"").substring(0,8)) + "000000";
                    aLong = Long.parseLong(sLong);
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return aLong;
    }
}
