package com.brilliance.isc.common.transaction.newcheck.bopset.rmbbop;


import com.brilliance.isc.common.rmbbop.entity.Tej;
import com.brilliance.isc.common.transaction.newcheck.AbstractModuleValidator;
import com.brilliance.isc.common.transaction.newcheck.ValidResult;
import com.brilliance.isc.common.transaction.newcheck.Validate;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class TejValidator extends AbstractModuleValidator<Tej> {

    @Validate(path = "rmbbop.rmb2106.recgrp.tej.%s.exchangeenddate")
    public ValidResult checkExchangeenddate(Tej tej) {
        Date exchangedate = tej.getExchangedate();
        Date exchangeenddate = tej.getExchangeenddate();
        if (exchangedate.after(exchangeenddate))
            return ValidResult.build(false, "承兑到期日需大于等于承兑日");
        return null;
    }

}
