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.GcBidcandidatePost;
import com.trs.ggzyexchange.entity.ZrzyTdCedeNotice;
import com.trs.ggzyexchange.entity.ZrzyTdCedeNoticeVo;
import com.trs.ggzyexchange.mapper.ZrzyTdCedeNoticeMapper;
import com.trs.ggzyexchange.service.ZrzyTdCedeNoticeService;
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 ZrzyTdCedeNoticeServiceImpl extends ServiceImpl<ZrzyTdCedeNoticeMapper, ZrzyTdCedeNotice> implements ZrzyTdCedeNoticeService {


    @Autowired
    private ZrzyTdCedeNoticeMapper zrzyTdCedeNoticeMapper;

    @Override
    public IPage<ZrzyTdCedeNoticeVo> queryZrzyTdCedeNoticeList(Page<ZrzyTdCedeNotice> page, ZrzyTdCedeNotice zrzyTdCedeNotice) {
        return zrzyTdCedeNoticeMapper.queryZrzyTdCedeNoticeList(
                    page,
                    zrzyTdCedeNotice.getAnnouncementCode(),
                    zrzyTdCedeNotice.getAnnouncementTitle(),
                    zrzyTdCedeNotice.getLandDistrict(),
                    zrzyTdCedeNotice.getPublishingTimeStart(),
                    zrzyTdCedeNotice.getPublishingTimeEnd()
        );
    }

    @Override
    public Long maxDataTimeStamp() {
        Long aLong = zrzyTdCedeNoticeMapper.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;
    }
}
