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

import com.brilliance.isc.bo.bopdecbo.Dbb;
import com.brilliance.isc.bo.bopdecbo.Dbe;
import com.brilliance.isc.bo.model.CheckItems;
import com.brilliance.isc.common.transaction.newcheck.*;
import com.brilliance.isc.mda.dao.DbbMapper;
import com.brilliance.isc.mda.dao.DbeMapper;
import com.brilliance.isc.mda.dao.DbuMapper;
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.Map;

@Component
public class BopremValidator extends AbstractModuleValidator<CheckItems> {

    @Autowired
    private BopdecCommon bopdecCommon;

    @Autowired
    private BopdecCommonValidator bopdecCommonValidator;


    @Autowired
    private DbbMapper dbbMapper;

    @Autowired
    private DbeMapper dbeMapper;

    @Autowired
    private DbuMapper dbuMapper;

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

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

    @Validate(path = "boprem.dbbgrp.bas.buscode")
    public ValidResult checkDbbBuscodeN1000(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)) {
                        Dbb dbb = dbbMapper.selectByBuscode(buscode);
                        if(!MdaUtils.isEmpty(dbb)){
                            return ValidResult.build(false, "系统已存在该业务编号，请重新指定！");
                        }
                    }
                }
            }
        }
        return null;
    }

    @Validate(path = "boprem.dbegrp.bas.buscode")
    public ValidResult checkDbeBuscodeN1000(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)) {
                        Dbe dbe = dbeMapper.selectByBuscode(buscode);
                        if(!MdaUtils.isEmpty(dbe)){
                            return ValidResult.build(false, "系统已存在该业务编号，请重新指定！");
                        }
                    }
                }
            }
        }
        return null;
    }

    @Validate(path = "boprem.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 = "boprem.dbbgrp.bas.actiontype")
    public ValidResult checkDbbBasActiontypeN100(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 = "boprem.dbbgrp.dcl.actiontype")
    public ValidResult checkDbbDclActiontypeN1000(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 = "boprem.dbbgrp.vrf.actiontype")
    public ValidResult checkDbbVrfActiontypeN1000(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 = "boprem.dbegrp.bas.actiontype")
    public ValidResult checkDbeBasActiontypeN100(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 = "boprem.dbegrp.vrf.actiontype")
    public ValidResult checkDbeVrfActiontypeN100(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 = "boprem.dbbgrp.bas.custcod")
    public ValidResult checkDbbCustcodN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkCustcod(checkItems);
        }
        return null;
    }

//    @Warning(path = "boprem.dbbgrp.bas.custcod")
//    public WarningResult warncheckDbbCustcodN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASCUSTCOD";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckCustcod(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.custcod")
//    public WarningResult warncheckDbeCustcodN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASCUSTCOD";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckCustcod(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbbgrp.bas.exrate")
    public ValidResult checkDbbExrateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkExrate(checkItems);
        }
        return null;
    }
    @Validate(path = "boprem.dbegrp.bas.exrate")
    public ValidResult checkDbeExrateN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkExrate(checkItems);
        }
        return null;
    }

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

//    @Warning(path = "boprem.dbbgrp.bas.fcyacc")
//    public WarningResult warncheckDbbFcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASFCYACC";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckFcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.fcyacc")
//    public WarningResult warncheckDbeFcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASFCYACC";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckFcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

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

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

//    @Warning(path = "boprem.dbbgrp.bas.idcode")
//    public WarningResult warncheckDbbIdcodeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASIDCODE";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckIdcode(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.idcode")
//    public WarningResult warncheckDbeIdcodeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASIDCODE";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckIdcode(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbbgrp.bas.lcyacc")
//    public WarningResult warncheckDbbLcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASLCYACC";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckLcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.lcyacc")
//    public WarningResult warncheckDbeLcyaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASLCYACC";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckLcyacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

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

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

//    @Warning(path = "boprem.dbbgrp.bas.oppuser")
//    public WarningResult warncheckDbbOppuserN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASOPPUSER";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckOppuser(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.oppuser")
//    public WarningResult warncheckDbeOppuserN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASOPPUSER";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckOppuser(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbbgrp.bas.othacc")
//    public WarningResult warncheckDbbOthaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASOTHACC";
//        if("1".equals(szflg)){
//            return bopdecCommonValidator.warncheckOthacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.othacc")
//    public WarningResult warncheckDbeOthaccN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASOTHACC";
//        if("2".equals(szflg)){
//            return bopdecCommonValidator.warncheckOthacc(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

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

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

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

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

    @Validate(path = "boprem.dbbgrp.bas.ownextkey")
    public ValidResult checkDbbOwnextkeyN100(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 = "boprem.dbegrp.bas.ownextkey")
    public ValidResult checkDbeOwnextkeyN100(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 = "boprem.dbbgrp.bas.actiondesc")
    public ValidResult checkDbbBasActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("1".equals(szflg)){
            return bopdecCommonValidator.checkBasActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boprem.dbbgrp.dcl.actiondesc")
    public ValidResult checkDbbDclActiondescN100(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 = "boprem.dbbgrp.vrf.actiondesc")
    public ValidResult checkDbbVrfActiondescN100(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 = "boprem.dbegrp.bas.actiondesc")
    public ValidResult checkDbeBasActiondescN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            return bopdecCommonValidator.checkBasActiondesc(checkItems);
        }
        return null;
    }

    @Validate(path = "boprem.dbegrp.vrf.actiondesc")
    public ValidResult checkDbeVrfActiondescN100(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 = "boprem.dbbgrp.bas.method")
    public ValidResult checkDbbMethodsN100(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 = "boprem.dbegrp.bas.method")
    public ValidResult checkDbeMethodsN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            String method = checkItems.getMethod();
            if (MdaUtils.isEmpty(method)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

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

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

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

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

//    @Warning(path = "boprem.dbbgrp.bas.custype")
//    public WarningResult warncheckDbbCustypeN80(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBBBASCUSTYPE";
//        if("1".equals(szflg)){
//            bopdecCommonValidator.warncheckCustype(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

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

//    @Warning(path = "boprem.dbegrp.bas.custype")
//    public WarningResult warncheckDbeCustypeN80(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String subid = "BOPDBEBASCUSTYPE";
//        if("2".equals(szflg)){
//            bopdecCommonValidator.warncheckCustype(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }



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

    @Validate(path = "boprem.dbbgrp.dcl.country")
    public ValidResult checkDbbDclCountryN100(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 bopdecCommonValidator.checkCommonCountry(checkItems);
        }
        return null;
    }

//    @Warning(path = "boprem.dbbgrp.dcl.country")
//    public WarningResult warncheckDbbDclCountryN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBBDCLCOUNTRY";
//        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 = "boprem.dbegrp.vrf.country")
    public ValidResult checkDbeVrfCountryN100(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 = "boprem.dbbgrp.dcl.crtuser")
    public ValidResult checkDbbDclCrtuserN100(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 = "boprem.dbbgrp.vrf.crtuser")
    public ValidResult checkDbbVrfCrtuserN100(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 = "boprem.dbegrp.vrf.crtuser")
    public ValidResult checkDbeCrtuserN100(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 = "boprem.dbbgrp.dcl.inptelc")
    public ValidResult checkDbbDclInptelcN100(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 = "boprem.dbbgrp.vrf.inptelc")
    public ValidResult checkDbbVrfInptelcN100(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 = "boprem.dbbgrp.vrf.inptelc")
//    public WarningResult warncheckDbbVrfInptelcN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String vrfflg = checkItems.getVrfflg();
//        String subid = "BOPDBBVRFINPTELC";
//        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 = "boprem.dbegrp.vrf.inptelc")
    public ValidResult checkDbeVrfInptelcN100(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 = "boprem.dbbgrp.dcl.isref")
    public ValidResult checkIsrefN100(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 = "boprem.dbbgrp.dcl.paytype")
    public ValidResult checkPaytypeN100(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 = "boprem.dbbgrp.dcl.paytype")
//    public WarningResult warncheckPaytypeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBBDCLPAYTYPE";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckPaytype(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbbgrp.dcl.rptdate")
    public ValidResult checkDbbDclRptdateN100(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 = "boprem.dbbgrp.vrf.rptdate")
    public ValidResult checkDbbVrfRptdateN100(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 = "boprem.dbegrp.vrf.rptdate")
    public ValidResult checkDbeVrfRptdateN100(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 = "boprem.dbbgrp.dcl.tc1amt")
    public ValidResult checkDbbTc1amtN100(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 = "boprem.dbbgrp.dcl.tc2amt")
    public ValidResult checkTc2amtN100(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 = "boprem.dbbgrp.dcl.tx2rem")
    public ValidResult checkTx2remN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String dclflg = checkItems.getDclflg();
        if("1".equals(szflg) && "X".equals(dclflg)){
            return bopdecCommonValidator.checkTx2rem(checkItems);
        }
        return null;
    }

    // dftset 申报类型选择跨境申报或者境内申报时提示“请注意手工补录基础交易申报”
    @Warning(path = "boprem.szflg")
    public WarningResult warnCheckSzflg(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String subid = "BOPREMSZFLG";
        String transName = checkItems.getTransName().toUpperCase();
        if(MdaUtils.compareTo("DFTSET",transName) == 0){
            if(MdaUtils.compareTo("1",szflg) == 0 || MdaUtils.compareTo("2",szflg) == 0){
                return WarningResult.build(subid,"请注意手工补录基础交易申报");
            }
        }
        return WarningResult.buildEmpty(subid);
    }

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

    @Validate(path = "boprem.dbbgrp.dcl.txcode")
    public ValidResult checkTxcodeN100(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 = "boprem.dbbgrp.dcl.txcode")
//    public WarningResult warncheckTxcodeN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBBDCLTXCODE";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTxcode(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbbgrp.dcl.txcode2")
    public ValidResult checkTxcode2N100(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 = "boprem.dbbgrp.dcl.txcode2")
//    public WarningResult warncheckTxcode2N100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBBDCLTXCODE2";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTxcode2(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbbgrp.dcl.txrem")
    public ValidResult checkTxremN100(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 = "boprem.dbbgrp.dcl.txrem")
//    public WarningResult warncheckTxremN100(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBBDCLTXREM";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warncheckTxrem(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbbgrp.bas.rptno")
    public ValidResult checkDbbBasRptnoN100(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 = "boprem.dbbgrp.dcl.rptno")
    public ValidResult checkDbbDclRptnoN100(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 = "boprem.dbbgrp.vrf.rptno")
    public ValidResult checkDbbVrfRptnoN100(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 = "boprem.dbegrp.bas.rptno")
    public ValidResult checkDbeBasRptnoN100(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 = "boprem.dbegrp.vrf.rptno")
    public ValidResult checkDbeVrfRptnoN100(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 = "boprem.dbegrp.bas.oppacc")
    public ValidResult checkRecgrpBasOppaccN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        if("2".equals(szflg)){
            String oppacc = checkItems.getOppacc();
            if (MdaUtils.isEmpty(oppacc)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }


    @Validate(path = "boprem.dbbgrp.bas.txccy")
    public ValidResult checkDbbBasTxccyN100(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 = "boprem.dbegrp.bas.txccy")
    public ValidResult checkDbeBasTxccyN100(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 = "boprem.dbegrp.vrf.isref")
    public ValidResult checkDbeVrfIsrefN100(CheckItems checkItems){
        String szflg = checkItems.getSzflg();
        String vrfflg = checkItems.getVrfflg();
        String isref = checkItems.getVrfisref();
        if("2".equals(szflg) && "X".equals(vrfflg)){
            if (MdaUtils.isEmpty(isref)) {
                return ValidResult.build(false, "此字段为必输项！");
            }
        }
        return null;
    }

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

    @Validate(path = "boprem.dbegrp.vrf.paytype")
    public ValidResult checkRecgrpVrfPaytypeN100(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 = "boprem.dbbgrp.dcl.regno")
    public ValidResult checkDbbDclRegnoN950(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 = "boprem.dbbgrp.dcl.regno")
//    public WarningResult warncheckDbbDclRegnoN950(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String dclflg = checkItems.getDclflg();
//        String subid = "BOPDBBDCLREGNO";
//        if("1".equals(szflg) && "X".equals(dclflg)){
//            return bopdecCommonValidator.warnCheckRegno1(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbegrp.vrf.regno")
    public ValidResult checkDbeVrfRegnoN950(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 = "boprem.dbegrp.vrf.regno")
//    public WarningResult warncheckDbeVrfRegnoN950(CheckItems checkItems){
//        String szflg = checkItems.getSzflg();
//        String vrfflg = checkItems.getVrfflg();
//        String subid = "BOPDBEVRFREGNO";
//        if("2".equals(szflg) && "X".equals(vrfflg)){
//            return bopdecCommonValidator.warncheckRegno2(checkItems,subid);
//        }
//        return WarningResult.buildEmpty(subid);
//    }

    @Validate(path = "boprem.dbegrp.vrf.tc1amt")
    public ValidResult checkDbeVrfTc1amtN100(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("I");
            }
        }
        return null;
    }

    @Validate(path = "boprem.dbegrp.vrf.tc2amt")
    public ValidResult checkDbeVrfTc2amtN100(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 = "boprem.dbegrp.vrf.tx2rem")
    public ValidResult checkDbeVrfTx2remN100(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 = "boprem.dbegrp.vrf.txcode")
    public ValidResult checkDbeVrfTxcodeN100(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 = "boprem.dbegrp.vrf.txcode2")
    public ValidResult checkDbeVrfTxcode2N100(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) || MdaUtils.isBigDecimalEmpty(tc2amt)){
                tc2amt = BigDecimal.ZERO;
            }
            String tx2rem = checkItems.getTx2rem();
            String txcode = checkItems.getTxcode();
            if(MdaUtils.isEmpty(txcode)){
                txcode = "";
            }
            String txcode2 = checkItems.getTxcode2();
            if(MdaUtils.isEmpty(txcode2)){
                txcode2 = "";
            }
            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 = "boprem.dbegrp.vrf.txrem")
    public ValidResult checkDbeVrfTxremN100(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 = "boprem.dbbgrp.vrf.contrno")
    public ValidResult checkDbbVrfContrnoN100(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, "该字段只能输入20个字符！");
                }
            }
        }
        return null;
    }

    @Validate(path = "boprem.dbegrp.vrf.contrno")
    public ValidResult checkDbeVrfContrnoN100(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 = "boprem.dbbgrp.vrf.invoino")
    public ValidResult checkDbbVrfInvoinoN100(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 = "boprem.dbegrp.vrf.invoino")
    public ValidResult checkDbeVrfInvoinoN100(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;
    }
}
