package com.brilliance.isc.common.transaction.newcheck.bopdec;

import com.brilliance.isc.bo.bopdecbo.Dbc;
import com.brilliance.isc.bo.bopdecbo.Dbf;
import com.brilliance.isc.bo.model.CheckItems;
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 com.brilliance.isc.mda.dao.DbcMapper;
import com.brilliance.isc.mda.dao.DbfMapper;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

@Component
public class BoppayValidator extends AbstractModuleValidator<CheckItems> {

    @Autowired
    private BopdecCommon bopdecCommon;

    @Autowired
    private BopdecCommonValidator bopdecCommonValidator;

    @Autowired
    private DbcMapper dbcMapper;

    @Autowired
    private DbfMapper dbfMapper;

    @Override
    @PostConstruct
    public void register() {
        super.register();
    }

    @Override
    public Map<String, String> validate(CheckItems checkItems) {
        return super.validate(checkItems);
    }

    @Validate(path = "boppay.dbcgrp.bas.buscode")
    public ValidResult checkDbcBuscodeN1000(CheckItems checkItems) {
        String szflg = checkItems.getSzflg();
        String buscode = checkItems.getBuscode();
        String dectyp = checkItems.getDectyp();
        if("1".equals(szflg)){
            if (MdaUtils.isEmpty(buscode)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            if (!"V".equals(dectyp)) {
                if (MdaUtils.isEmpty(buscode)) {
                    return ValidResult.build(false, "此字段为必输项！");
                } else {
                    if ("A".equals(dectyp)) {
                        Dbc dbc = dbcMapper.selectByBuscode(buscode);
                        if(!MdaUtils.isEmpty(dbc)){
                            return ValidResult.build(false, "系统已存在该业务编号，请重新指定！");
                        }
                    }
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.buscode")
    public ValidResult checkDbfBuscodeN1000(CheckItems checkItems) {
        String szflg = checkItems.getSzflg();
        String buscode = checkItems.getBuscode();
        String dectyp = checkItems.getDectyp();
        if("2".equals(szflg)) {
            if (MdaUtils.isEmpty(buscode)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            if (!"V".equals(dectyp)) {
                if (MdaUtils.isEmpty(buscode)) {
                    return ValidResult.build(false, "此字段为必输项！");
                } else {
                    if ("A".equals(buscode)) {
                        Dbf dbf = dbfMapper.selectByBuscode(buscode);
                        if(!MdaUtils.isEmpty(dbf)){
                            return ValidResult.build(false, "系统已存在该业务编号，请重新指定！");
                        }
                    }
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.acttyp")
    public ValidResult checkActtypN1000(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String acttyp = checkItems.getActtyp();
        if("1".equals(szflg)){
            if (MdaUtils.isEmpty(acttyp)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.actiontype")
    public ValidResult checkDbcBasActiontypeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String actiontype = checkItems.getBasactiontype();
        if("1".equals(szflg)){
            if (MdaUtils.isEmpty(actiontype)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.actiontype")
    public ValidResult checkDbcDclActiontypeN1000(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            String actiontype = checkItems.getDclactiontype();
            if (MdaUtils.isEmpty(actiontype)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }
    @Validate(path = "boppay.dbcgrp.vrf.actiontype")
    public ValidResult checkDbcVrfActiontypeN1000(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            String actiontype = checkItems.getVrfactiontype();
            if (MdaUtils.isEmpty(actiontype)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.actiontype")
    public ValidResult checkDbfBasActiontypeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String actiontype = checkItems.getBasactiontype();
        if("2".equals(szflg)){
            if (MdaUtils.isEmpty(actiontype)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.actiontype")
    public ValidResult checkDbfVrfActiontypeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String actiontype = checkItems.getVrfactiontype();
            if (MdaUtils.isEmpty(actiontype)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.custcod")
    public ValidResult checkDbcCustcodN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkCustcod(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.custcod")
//    public WarningResult warncheckDbcCustcodN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASCUSTCOD";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckCustcod(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.custcod")
    public ValidResult checkDbfCustcodN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkCustcod(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.custcod")
//    public WarningResult warncheckDbfCustcodN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASCUSTCOD";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckCustcod(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.exrate")
    public ValidResult checkDbcExrateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkExrate(checkItems);
        }
        return null;
    }
    @Validate(path = "boppay.dbfgrp.bas.exrate")
    public ValidResult checkDbfExrateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkExrate(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.fcyacc")
    public ValidResult checkDbcFcyaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkFcyacc(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.fcyacc")
//    public WarningResult warncheckDbcFcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASFCYACC";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckFcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.fcyacc")
    public ValidResult checkDbfFcyaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkFcyacc(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.fcyacc")
//    public WarningResult warncheckDbfFcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASFCYACC";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckFcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.actuccy")
    public ValidResult checkDbcBasActuccyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            String actuccy = checkItems.getActuccy();
            if(MdaUtils.isEmpty(actuccy)){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.actuccy")
    public ValidResult checkDbfBasActuccyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            BigDecimal actuamt = checkItems.getActuamt();
            if(MdaUtils.isEmpty(actuamt)){
                actuamt = BigDecimal.ZERO;
            }
            String actuccy = checkItems.getActuccy();
            BigDecimal zero = BigDecimal.ZERO;
            if(actuamt.compareTo(zero) != 0) {
                if (MdaUtils.isEmpty(actuccy)) {
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.actuamt")
    public ValidResult checkDbcBasActuamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            BigDecimal actuamt = checkItems.getActuamt();
            if(MdaUtils.isEmpty(actuamt)){
                actuamt = BigDecimal.ZERO;
            }
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            BigDecimal zero = BigDecimal.ZERO;
            if (actuamt.compareTo(zero) == 0 && (!bopdecCommon.indexGt(txcode,"-999998-") && !bopdecCommon.indexGt(txcode2,"-999998-"))) {
                return ValidResult.build(false, "实际付款金额必须大于0");
            }
            if (actuamt.compareTo(zero) < 0) {
                return ValidResult.build(false, "此金额不能小于零!");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.actuamt")
    public ValidResult checkDbfBasActuamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            BigDecimal actuamt = checkItems.getActuamt();
            if(MdaUtils.isEmpty(actuamt)){
                actuamt = BigDecimal.ZERO;
            }
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            BigDecimal zero = BigDecimal.ZERO;
            if (actuamt.compareTo(zero) == 0 && (!bopdecCommon.indexGt(txcode,"-999998-") && !bopdecCommon.indexGt(txcode2,"-999998-"))) {
                return ValidResult.build(false, "实际付款金额必须大于0");
            }
            if (actuamt.compareTo(zero) < 0) {
                return ValidResult.build(false, "此金额不能小于零!");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.fcyamt")
    public ValidResult checkDbcFcyamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkFcyamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.fcyamt")
    public ValidResult checkDbfFcyamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkFcyamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.idcode")
    public ValidResult checkDbcIdcodeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkIdcode(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.idcode")
//    public WarningResult warncheckDbcIdcodeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASIDCODE";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckIdcode(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.idcode")
    public ValidResult checkDbfIdcodeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkIdcode(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.idcode")
//    public WarningResult warncheckDbfIdcodeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASIDCODE";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckIdcode(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.lcyacc")
    public ValidResult checkDbcLcyaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkLcyacc(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.lcyacc")
//    public WarningResult warncheckDbcLcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASLCYACC";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckLcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.lcyacc")
    public ValidResult checkDbfLcyaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkLcyacc(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.lcyacc")
//    public WarningResult warncheckDbfLcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASLCYACC";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckLcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.lcyamt")
    public ValidResult checkDbcLcyamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkLcyamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.lcyamt")
    public ValidResult checkDbfLcyamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkLcyamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.oppuser")
    public ValidResult checkDbcOppuserN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkOppuser(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.oppuser")
//    public WarningResult warncheckDbcOppuserN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASOPPUSER";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckOppuser(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.oppuser")
    public ValidResult checkDbfOppuserN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkOppuser(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.oppuser")
//    public WarningResult warncheckDbfOppuserN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASOPPUSER";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckOppuser(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.othacc")
    public ValidResult checkDbcOthaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkOthacc(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.othacc")
//    public WarningResult warncheckDbcOthaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASOTHACC";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckOthacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.othacc")
    public ValidResult checkDbfOthaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkOthacc(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.othacc")
//    public WarningResult warncheckDbfOthaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASOTHACC";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckOthacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.othamt")
    public ValidResult checkDbcOthamtN900(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkOthamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.othamt")
    public ValidResult checkDbfOthamtN900(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkOthamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.txamt")
    public ValidResult checkDbcTxamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkTxamt(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.txamt")
    public ValidResult checkDbfTxamtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkTxamt(checkItems);
        }
        return null;
    }

    /**
     *   source:baspp.@0052.script
     */

    @Validate(path = "boppay.dbcgrp.bas.ownextkey")
    public ValidResult checkDbcOwnextkeyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            String ownextkey = checkItems.getOwnextkey();
            if (MdaUtils.isEmpty(ownextkey)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.ownextkey")
    public ValidResult checkDbfOwnextkeyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            String ownextkey = checkItems.getOwnextkey();
            if (MdaUtils.isEmpty(ownextkey)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }


    @Validate(path = "boppay.dbcgrp.bas.actiondesc")
    public ValidResult checkDbcBasActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkBasActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.actiondesc")
    public ValidResult checkDbcDclActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkDclActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.actiondesc")
    public ValidResult checkDbcVrfActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkVrfActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.actiondesc")
    public ValidResult checkDbfBasActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkBasActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.actiondesc")
    public ValidResult checkDbfVrfActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkVrfActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.issdate")
    public ValidResult checkDbcBasIssdateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            String method = checkItems.getMethod();
            Date issdate = checkItems.getIssdate();
            if (MdaUtils.compareTo(method,"L") == 0 || MdaUtils.compareTo(method,"G") == 0) {
                if(MdaUtils.isEmpty(issdate)) {
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.lcbgno")
    public ValidResult checkDbcBasLcbgnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            String method = checkItems.getMethod();
            String lcbgno = checkItems.getLcbgno();
            Date issdate = checkItems.getIssdate();
            if (method.equals("L") || method.equals("G")){
                if(MdaUtils.isEmpty(lcbgno)){
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
            if(!MdaUtils.isEmpty(lcbgno)) {
                if(MdaUtils.isEmpty(issdate)){
                    return ValidResult.build(false, "开证日期为必输项");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.lcbgno")
    public ValidResult checkDbfBasLcbgnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String basflg = checkItems.getBasflg();
        if(szflg.equals("2") && "X".equals(basflg)) {
            String lcbgno = checkItems.getLcbgno();
            Date issdate = checkItems.getIssdate();
            if(!MdaUtils.isEmpty(lcbgno)) {
                if(MdaUtils.isEmpty(issdate)){
                    return ValidResult.build(false, "开证日期为必输项");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.method")
    public ValidResult checkDbcMethodsN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            String method = checkItems.getMethod();
            if (MdaUtils.isEmpty(method)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.method")
    public ValidResult checkDbfMethodsN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            String method = checkItems.getMethod();
            if (MdaUtils.isEmpty(method)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.outchargeccy")
    public ValidResult checkDbcBasOutchargeccyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            BigDecimal outchargeamt = checkItems.getOutchargeamt();
            if(MdaUtils.isEmpty(outchargeamt)){
                outchargeamt = BigDecimal.ZERO;
            }
            String outchargeccy = checkItems.getOutchargeccy();
            if(!MdaUtils.isBigDecimalEmpty(outchargeamt)){
                if(MdaUtils.isEmpty(outchargeccy)) {
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.outchargeamt")
    public ValidResult checkDbcBasOutchargeamtN950(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            BigDecimal outchargeamtB = checkItems.getOutchargeamt();
            if(MdaUtils.isEmpty(outchargeamtB)){
                outchargeamtB = BigDecimal.ZERO;
            }
            String outchargeccy = checkItems.getOutchargeccy();
            BigDecimal zero = new BigDecimal(0);
            if (outchargeamtB.compareTo(zero) == 0 && !MdaUtils.isEmpty(outchargeccy)) {
                return ValidResult.build(false, "扣费金额必须大于零! ");
            }
            if (outchargeamtB.compareTo(zero) < 0) {
                return ValidResult.build(false, "此金额不能小于零!");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.outchargeccy")
    public ValidResult checkDbfBasOutchargeccyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            BigDecimal outchargeamt = checkItems.getOutchargeamt();
            if(MdaUtils.isEmpty(outchargeamt)){
                outchargeamt = BigDecimal.ZERO;
            }
            String outchargeccy = checkItems.getOutchargeccy();
            if(!MdaUtils.isBigDecimalEmpty(outchargeamt)){
                if(MdaUtils.isEmpty(outchargeccy)) {
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.outchargeamt")
    public ValidResult checkDbfBasOutchargeamtN950(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            BigDecimal outchargeamtB = checkItems.getOutchargeamt();
            if(MdaUtils.isEmpty(outchargeamtB)){
                outchargeamtB = BigDecimal.ZERO;
            }
            String outchargeccy = checkItems.getOutchargeccy();
            BigDecimal zero = new BigDecimal(0);
            if (outchargeamtB.compareTo(zero) == 0 && !MdaUtils.isEmpty(outchargeccy)) {
                return ValidResult.build(false, "扣费金额必须大于零! ");
            }
            if (outchargeamtB.compareTo(zero) < 0) {
                return ValidResult.build(false, "此金额不能小于零!");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.custnm")
    public ValidResult checkDbcCustnmN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkCustnm(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.custnm")
    public ValidResult checkDbfCustnmN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkCustnm(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.custype")
    public ValidResult checkDbcCustypeN80(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            bopdecCommonValidator.checkCustype(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.bas.custype")
//    public WarningResult warncheckDbcCustypeN80(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBCBASCUSTYPE";
//        if("1".equals(szflg)){
//            bopdecCommonValidator.warncheckCustype(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.bas.custype")
    public ValidResult checkDbfCustypeN80(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            bopdecCommonValidator.checkCustype(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.bas.custype")
//    public WarningResult warncheckDbfCustypeN80(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBFBASCUSTYPE";
//        if("2".equals(szflg)){
//            bopdecCommonValidator.warncheckCustype(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }


    /**
     *   source:dclpp.@0002.script
     */

    @Validate(path = "boppay.dbcgrp.dcl.country")
    public ValidResult checkDbcDclCountryN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            String country = checkItems.getCountry();
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            if (MdaUtils.isEmpty(country)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            if (!MdaUtils.isEmpty(country) &&  "CHN".equals(country) && (!bopdecCommon.indexGt(txcode,"-999998-") && !bopdecCommon.indexGt(txcode2,"-999998-"))) {
                return ValidResult.build(false, "不能选择CHN(中国)! ");
            }
            //交易对方国别或地区为“ZZZ”
            if(!MdaUtils.isEmpty(country) && "ZZZ".equals(country)) {
//                return ValidResult.build(false, "第4.2.5.1项检核:交易对方国别或地区为“ZZZ”");
                return null;
            }
            return bopdecCommonValidator.checkCommonCountry(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.country")
//    public WarningResult warncheckDbcDclCountryN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLCOUNTRY";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            String country = checkItems.getCountry();
//            String txcode = checkItems.getTxcode();
//            String txcode2 = checkItems.getTxcode2();
//            if (MdaUtils.isEmpty(country)) {
//                return WarningResult.buildEmpty(subid);
//
//            }
//            if (!MdaUtils.isEmpty(country) &&  "CHN".equals(country) && (!bopdecCommon.indexGt(txcode,"-999998-") && !bopdecCommon.indexGt(txcode2,"-999998-"))) {
//                return WarningResult.buildEmpty(subid);
//
//            }
//            //交易对方国别或地区为“ZZZ”
//            if(!MdaUtils.isEmpty(country) && "ZZZ".equals(country)) {
//                return WarningResult.build(subid, "第4.2.5.1项检核:交易对方国别或地区为“ZZZ”");
//            }
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.vrf.country")
    public ValidResult checkDbfVrfCountryN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String country = checkItems.getCountry();
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            if (MdaUtils.isEmpty(country)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
//            if ( ("999998".equals(txcode) || "999998".equals(txcode2 )) && "CHN".equals(country)) {
//                return ValidResult.build(false, "交易编码为99998时，国家代码不能为CHN-中国");
//            }
            return bopdecCommonValidator.checkCommonCountry(checkItems);
        }
        return null;
    }

    /**
     *   source:dclpp.@0003.script
     */

    @Validate(path = "boppay.dbcgrp.dcl.crtuser")
    public ValidResult checkDbcDclCrtuserN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        String crtuser = checkItems.getDclcrtuser();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkCrtuser(crtuser);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.crtuser")
    public ValidResult checkDbcVrfCrtuserN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        String crtuser = checkItems.getVrfcrtuser();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkCrtuser(crtuser);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.crtuser")
    public ValidResult checkDbfCrtuserN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        String crtuser = checkItems.getVrfcrtuser();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkCrtuser(crtuser);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.inptelc")
    public ValidResult checkDbcDclInptelcN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            String inptelc = checkItems.getDclinptelc();
            if (MdaUtils.isEmpty(inptelc)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.inptelc")
    public ValidResult checkDbcVrfInptelcN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        String vrfflg = checkItems.getVrfflg();

        if("1".equals(szflg) && "X".equals(vrfflg)){
            String vrfinptelc = checkItems.getVrfinptelc();
            if (MdaUtils.isEmpty(vrfinptelc)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            if("X".equals(dclflg)){
                String dclinptelc = checkItems.getDclinptelc();
                if(!MdaUtils.isEmpty(vrfinptelc) && !MdaUtils.isEmpty(dclinptelc)){
                    if(!vrfinptelc.equals(dclinptelc)){
                        return ValidResult.build(false,"电话号码不一致");
                    }
                }
            }
        }
        return null;
    }
//    提示变成error
//    @Warning(path = "boppay.dbcgrp.vrf.inptelc")
//    public WarningResult warncheckDbcVrfInptelcN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String vrfflg = checkItems.getVrfflg();
//        String subid = "BOPDBCVRFINPTELC";
//        if("1".equals(szflg) && "X".equals(vrfflg)){
//            String vrfinptelc = checkItems.getVrfinptelc();
//            if (MdaUtils.isEmpty(vrfinptelc)) {
//                return WarningResult.buildEmpty(subid);
//            }
//            if("X".equals(dclflg)){
//                String dclinptelc = checkItems.getDclinptelc();
//                if(!MdaUtils.isEmpty(vrfinptelc) && !MdaUtils.isEmpty(dclinptelc)){
//                    if(!vrfinptelc.equals(dclinptelc)){
//                        return WarningResult.build(subid,"电话号码不一致");
//                    }
//                }
//            }
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.vrf.inptelc")
    public ValidResult checkDbfVrfInptelcN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String inptelc = checkItems.getVrfinptelc();
            if (MdaUtils.isEmpty(inptelc)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    /**
     *   source:dclpp.@0005.script
     */

    @Validate(path = "boppay.dbcgrp.dcl.isref")
    public ValidResult checkDbcDclIsrefN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            String isref = checkItems.getDclisref();
            if (MdaUtils.isEmpty(isref)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    /**
     *   source:dclpp.@0006.script
     */

    @Validate(path = "boppay.dbcgrp.dcl.paytype")
    public ValidResult checkDbcDclPaytypeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkPaytype(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.paytype")
//    public WarningResult warncheckDbcDclPaytypeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLPAYTYPE";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckPaytype(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.dcl.rptdate")
    public ValidResult checkDbcDclRptdateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkDclRptdate0007(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.rptdate")
    public ValidResult checkDbcVrfRptdateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkVrfRptdate0013(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.rptdate")
    public ValidResult checkDbfVrfRptdateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkVrfRptdate0013(checkItems);
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.tc1amt")
    public ValidResult checkDbcTc1amtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkTc1amt(checkItems);
        }
        return null;
    }

    /**
     *   source:dclpp.@0010.script
     */

    @Validate(path = "boppay.dbcgrp.dcl.tc2amt")
    public ValidResult checkDbcDclTc2amtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            String txcode2 = checkItems.getTxcode2();
            String tx2rem = checkItems.getTx2rem();
            BigDecimal tc2amt = checkItems.getTc2amt();
            if(MdaUtils.isEmpty(tc2amt)){
                tc2amt = BigDecimal.ZERO;
            }
            if ((!MdaUtils.isEmpty(txcode2) || !MdaUtils.isEmpty(tx2rem)) && !bopdecCommon.indexGt(txcode2, "-999998-")) {
                if(MdaUtils.isEmpty(tc2amt) || MdaUtils.isBigDecimalEmpty(tc2amt)) {
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.tx2rem")
    public ValidResult checkDbcDclTx2remN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkTx2rem(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.tx2rem")
//    public WarningResult warncheckDbcDclTx2remN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLTX2REM";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTx2rem(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.dcl.txcode")
    public ValidResult checkDbcDclTxcodeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkTxcode(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.txcode")
//    public WarningResult warncheckDbcDclTxcodeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLTXCODE";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTxcode(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.dcl.txcode2")
    public ValidResult checkDbcDclTxcode2N100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkTxcode2(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.txcode2")
//    public WarningResult warncheckDbcDclTxcode2N100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLTXCODE2";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTxcode2(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.dcl.txrem")
    public ValidResult checkDbcDclTxremN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkTxrem(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.txrem")
//    public WarningResult warncheckDbcDclTxremN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLTXREM";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTxrem(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbcgrp.bas.rptno")
    public ValidResult checkDbcBasRptnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            String rptno = checkItems.getRptno();
            if (MdaUtils.isEmpty(rptno)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.rptno")
    public ValidResult checkDbcDclRptnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            String rptno = checkItems.getRptno();
            if (MdaUtils.isEmpty(rptno)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.rptno")
    public ValidResult checkDbcVrfRptnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            String rptno = checkItems.getRptno();
            if (MdaUtils.isEmpty(rptno)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.rptno")
    public ValidResult checkDbfBasRptnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            String rptno = checkItems.getRptno();
            if (MdaUtils.isEmpty(rptno)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }
    @Validate(path = "boppay.dbfgrp.vrf.rptno")
    public ValidResult checkDbfVrfRptnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String rptno = checkItems.getRptno();
            if (MdaUtils.isEmpty(rptno)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.bas.txccy")
    public ValidResult checkDbcBasTxccyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String txccy = checkItems.getTxccy();
        if("1".equals(szflg)){
            if (MdaUtils.isEmpty(txccy)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.bas.txccy")
    public ValidResult checkDbfBasTxccyN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String txccy = checkItems.getTxccy();
        if("2".equals(szflg)){
            if (MdaUtils.isEmpty(txccy)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.isref")
    public ValidResult checkDbfVrfIsrefN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String isref = checkItems.getVrfisref();
            String custype = checkItems.getCustype();
            String transName = checkItems.getTransName().toLowerCase();
            if (MdaUtils.isEmpty(isref)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
//            if (transName.endsWith("sel")) {
//                if (transName.startsWith("dbd") || transName.startsWith("dbe") || transName.startsWith("dbf")) {
//                    if (bopdecCommon.indexGt(isref, "-Y-") && bopdecCommon.indexGt(custype, "-D-F-")) {
//
//                    }
//                }
//            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.payattr")
    public ValidResult checkDbfVrfPayattrN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String payattr = checkItems.getPayattr();
            if (MdaUtils.isEmpty(payattr)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }


    @Validate(path = "boppay.dbfgrp.vrf.paytype")
    public ValidResult checkDbfVrfPaytypeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String paytype = checkItems.getPaytype();
            if (MdaUtils.isEmpty(paytype)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.dcl.regno")
    public ValidResult checkDbcDclRegnoN950(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkRegno1(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.dcl.regno")
//    public WarningResult warncheckDbcDclRegnoN950(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBCDCLREGNO";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warnCheckRegno1(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.vrf.regno")
    public ValidResult checkDbfVrfRegnoN950(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            return bopdecCommonValidator.checkRegno2(checkItems);
        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.vrf.regno")
//    public WarningResult warncheckDbfVrfRegnoN950(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String vrfflg = checkItems.getVrfflg();
//        String subid = "BOPDBFVRFREGNO";
//        if("2".equals(szflg) && "X".equals(vrfflg)){
//            return bopdecCommonValidator.warncheckRegno2(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.vrf.tc1amt")
    public ValidResult checkDbfVrfTc1amtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            BigDecimal tc1amt = checkItems.getTc1amt();
            if(MdaUtils.isEmpty(tc1amt)){
                tc1amt = BigDecimal.ZERO;
            }
            BigDecimal tc2amt = checkItems.getTc2amt();
            if(MdaUtils.isEmpty(tc2amt)){
                tc2amt = BigDecimal.ZERO;
            }
            BigDecimal basamt = checkItems.getTxamt();
            if(MdaUtils.isEmpty(basamt)){
                basamt = BigDecimal.ZERO;
            }
            if (MdaUtils.isBigDecimalEmpty(tc1amt)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            if (tc1amt.compareTo(tc2amt) < 0) {
                return bopdecCommon.checkErrorText("M");
            }
            BigDecimal dclamt = tc1amt.add(tc2amt);
            if (basamt.compareTo(dclamt) != 0) {
                return bopdecCommon.checkErrorText("H");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.billno")
    public ValidResult checkDbcVrfBillnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            String billno = checkItems.getBillno();
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            if (!MdaUtils.isEmpty(billno)) {
                String str = billno;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 128) {
                    return ValidResult.build(false, "该字段不能超过128个字符！");
                }
            } else {
                /*提示类：当交易编码以1或2开头时，管理信息中“提运单号/仓单号”应有值*/
//                if ((!MdaUtils.isEmpty(txcode) && bopdecCommon.startsWithValue(txcode, "-1-2-")) || (!MdaUtils.isEmpty(txcode2) && bopdecCommon.startsWithValue(txcode2, "-1-2-"))) {
//                    return ValidResult.build(false, "当交易编码以1或2开头时，“提运单号/仓单号”应有值");
//                }
            }
        }
        return null;
    }

//    @Warning(path = "boppay.dbcgrp.vrf.billno")
//    public WarningResult warncheckDbcVrfBillnoN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String vrfflg = checkItems.getVrfflg();
//        String subid = "BOPDBCVRFBILLNO";
//        if("1".equals(szflg) && "X".equals(vrfflg)){
//            String billno = checkItems.getBillno();
//            String txcode = checkItems.getTxcode();
//            String txcode2 = checkItems.getTxcode2();
//            if (!MdaUtils.isEmpty(billno)) {
//                String str = billno;
//                byte[] buff = null;
//                try {
//                    buff = str.getBytes("GB18030");
//                } catch (Exception e) {
//                    return WarningResult.buildEmpty(subid);
//                }
//                int len = buff.length;
//                if (len > 128) {
//                    return WarningResult.buildEmpty(subid);
//                }
//            } else {
//                /*提示类：当交易编码以1或2开头时，管理信息中“提运单号/仓单号”应有值*/
//                if ((!MdaUtils.isEmpty(txcode) && bopdecCommon.startsWithValue(txcode, "-1-2-")) || (!MdaUtils.isEmpty(txcode2) && bopdecCommon.startsWithValue(txcode2, "-1-2-"))) {
//                    return WarningResult.build(subid, "当交易编码以1或2开头时，“提运单号/仓单号”应有值");
//                }
//            }
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.vrf.billno")
    public ValidResult checkDbfVrfBillnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String billno = checkItems.getBillno();
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            String str = billno;
//            if(((!MdaUtils.isEmpty(txcode) && bopdecCommon.startsWithValue(txcode,"-1-2-"))||(!MdaUtils.isEmpty(txcode2) && bopdecCommon.startsWithValue(txcode2,"-1-2-"))) && MdaUtils.isEmpty(str)){
//                return ValidResult.build(false, "当交易编码以1或2开头时，“提运单号/仓单号”应有值");
//            }

            byte[] buff = null;
            try {
                buff = str.getBytes("GB18030");
            } catch (Exception e) {
                return ValidResult.build(false, "getBytes fail...");
            }
            int len = buff.length;
            if (len > 128) {
                return ValidResult.build(false, "该字段不能超过128个字符！");
            }

        }
        return null;
    }

//    @Warning(path = "boppay.dbfgrp.vrf.billno")
//    public WarningResult warncheckDbfVrfBillnoN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String vrfflg = checkItems.getVrfflg();
//        String subid = "BOPDBFVRFBILLNO";
//        if("2".equals(szflg) && "X".equals(vrfflg)){
//            String billno = checkItems.getBillno();
//            String txcode = checkItems.getTxcode();
//            String txcode2 = checkItems.getTxcode2();
//            String str = billno;
//            if(((!MdaUtils.isEmpty(txcode) && bopdecCommon.startsWithValue(txcode,"-1-2-"))||(!MdaUtils.isEmpty(txcode2) && bopdecCommon.startsWithValue(txcode2,"-1-2-"))) && MdaUtils.isEmpty(str)){
//                return WarningResult.build(subid, "当交易编码以1或2开头时，“提运单号/仓单号”应有值");
//            }
//
//            byte[] buff = null;
//            try {
//                buff = str.getBytes("GB18030");
//            } catch (Exception e) {
//                return WarningResult.buildEmpty(subid);
//            }
//            int len = buff.length;
//            if (len > 128) {
//                return WarningResult.buildEmpty(subid);
//            }
//
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boppay.dbfgrp.vrf.tc2amt")
    public ValidResult checkDbfVrfTc2amtN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String txcode2 = checkItems.getTxcode2();
            BigDecimal tc2amt = checkItems.getTc2amt();
            if(MdaUtils.isEmpty(tc2amt)){
                tc2amt = BigDecimal.ZERO;
            }
            BigDecimal zero = BigDecimal.ZERO;
            if ( !MdaUtils.isEmpty(txcode2) && tc2amt.compareTo(zero) == 0){
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.tx2rem")
    public ValidResult checkDbfVrfTx2remN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String txcode2 = checkItems.getTxcode2();
            String tx2rem = checkItems.getTx2rem();
            String txrem = checkItems.getTxrem();
            String zbxmszh = checkItems.getZbxmszh();
            if (!MdaUtils.isEmpty(txcode2) && MdaUtils.isEmpty(tx2rem)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            if(MdaUtils.isEmpty(tx2rem)){
//                return ValidResult.build(false, "此字段为必输项！");
                return null;
            }
            //校验字节数50-》256
            if (!MdaUtils.isEmpty(tx2rem)) {
                String str = tx2rem;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 256) {
                    return ValidResult.build(false, "交易附言不能超过256位");
                }
            }
            if("Y".equals( zbxmszh )) {
                if (!MdaUtils.isEmpty(txcode2)) {
                    if (bopdecCommon.isZbxm(txcode2, "I")) {
                        if (!tx2rem.contains("CADS")) {
                            return ValidResult.build(false, "无资本项目数字化标识，请添加CADS前缀");
                        }
                    }
                }
            }else {
                if (tx2rem.contains("CADS")) {
                    return ValidResult.build(false, "非资本项目数字化请删除CADS字样");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.txcode")
    public ValidResult checkDbfVrfTxcodeN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String txcode = checkItems.getTxcode();
            if (MdaUtils.isEmpty(txcode)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.txcode2")
    public ValidResult checkDbfVrfTxcode2N100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            BigDecimal tc2amt = checkItems.getTc2amt();
            if(MdaUtils.isEmpty(tc2amt)){
                tc2amt = BigDecimal.ZERO;
            }
            String tx2rem = checkItems.getTx2rem();
            String txcode = checkItems.getTxcode();
            String txcode2 = checkItems.getTxcode2();
            if (!MdaUtils.isBigDecimalEmpty(tc2amt) || !MdaUtils.isEmpty(tx2rem)) {
                if(MdaUtils.isEmpty(txcode2)) {
                    return ValidResult.build(false, "此字段为必输项！");
                }
            }
            if (!MdaUtils.isEmpty(txcode)) {
                if (txcode.equals(txcode2) && !MdaUtils.isEmpty(txcode2)) {
                    return bopdecCommon.checkErrorText("C");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.txrem")
    public ValidResult checkDbfVrfTxremN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String txrem = checkItems.getTxrem();
            String txcode = checkItems.getTxcode();
            String zbxmszh = checkItems.getZbxmszh();
            if (MdaUtils.isEmpty(txrem)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
            //校验字节数50-》256
            if (!MdaUtils.isEmpty(txrem)) {
                String str = txrem;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 256) {
                    return ValidResult.build(false, "该字段只能输入256个字符！");
                }
            }
            if("Y".equals( zbxmszh )) {
                if (!MdaUtils.isEmpty(txcode)) {
                    if (bopdecCommon.isZbxm(txcode, "I")) {
                        if (!txrem.contains("CADS")) {
                            return ValidResult.build(false, "无资本项目数字化标识，请添加CADS前缀");
                        }
                    }
                }
            }else {
                if (txrem.contains("CADS")) {
                    return ValidResult.build(false, "非资本项目数字化请删除CADS字样");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.contrno")
    public ValidResult checkDbcVrfContrnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            String contrno = checkItems.getContrno();
            if (MdaUtils.isEmpty(contrno)) {
                return ValidResult.build(false, "此字段为必输项！");
            } else {
                String str = contrno;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 128) {
                    return ValidResult.build(false, "该字段只能输入128个字符！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.contrno")
    public ValidResult checkDbfVrfContrnoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String contrno = checkItems.getContrno();
            if (MdaUtils.isEmpty(contrno)) {
                return ValidResult.build(false, "此字段为必输项！");
            } else {
                String str = contrno;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 128) {
                    return ValidResult.build(false, "该字段只能输入128个字符！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbcgrp.vrf.invoino")
    public ValidResult checkDbcVrfInvoinoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("1".equals(szflg) && "X".equals(vrfflg)){
            String invoino = checkItems.getInvoino();
            if (MdaUtils.isEmpty(invoino)) {
                return ValidResult.build(false, "此字段为必输项！");
            } else {
                String str = invoino;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 128) {
                    return ValidResult.build(false, "该字段只能输入35个字符！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boppay.dbfgrp.vrf.invoino")
    public ValidResult checkDbfVrfInvoinoN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            String invoino = checkItems.getInvoino();
            if (MdaUtils.isEmpty(invoino)) {
                return ValidResult.build(false, "此字段为必输项！");
            } else {
                String str = invoino;
                byte[] buff = null;
                try {
                    buff = str.getBytes("GB18030");
                } catch (Exception e) {
                    return ValidResult.build(false, "getBytes fail...");
                }
                int len = buff.length;
                if (len > 128) {
                    return ValidResult.build(false, "该字段只能输入128个字符！");
                }
            }
        }
        return null;
    }
}
