package com.brilliance.isc.convert.mt1xx;
import com.brilliance.isc.swift.objmtconvert.manager.MtCreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.commontag.ActnoBicAdrTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.commontag.DcDateCurAmtTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.mt1xx.MT110Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt1xx.mt1XXAbsCreator.MT110AbsCreator;
import com.brilliance.isc.swift.objmtconvert.util.Constans;
import org.junit.Test;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;


public class Mt110Test {
    @Test
    public void Mt110_Test()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
//        Map map = new HashMap();
//        map.put("msgType","110");//报文类型
//        map.put("recvBic", "CIPSCNSHXXX");//收报行
//        map.put("sendBic", "PSBCCNBJXXX");//发报行
//        //20
//        map.put("SendersReference","SendersReference");
        //53a
        ActnoBicAdrTagXXX actnoBicAdrTag53a=new ActnoBicAdrTagXXX("53");
        //actnoBicAdrTag53a.setInfo("A");
        actnoBicAdrTag53a.setAddress("WHYHCNHBXXX"+Constans.CRLF+"CHANGSHAXXXX");
        //actnoBicAdrTag53a.setCode("THISIS41A");
        //actnoBicAdrTag53a.setBic("THISIS41A");
        //actnoBicAdrTag53a.setAcctno("6226TEST0001");
        actnoBicAdrTag53a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag53a.setLocation("WHYHCNHBXXX");
        //map.put("actnoBicAdr53a", actnoBicAdrTag53a);
        //54D
        ActnoBicAdrTagXXX actnoBicAdrTag54a=new ActnoBicAdrTagXXX("54");
        //actnoBicAdrTag54a.setInfo("A");
        actnoBicAdrTag54a.setAddress("WHYHCNHBXXX"+Constans.CRLF+"CHANGSHAXXXX");
        //actnoBicAdrTag54a.setCode("THISIS41A");
        //actnoBicAdrTag54a.setBic("THISIS41A");
        //actnoBicAdrTag54a.setAcctno("6226TEST0001");
        actnoBicAdrTag54a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag54a.setLocation("WHYHCNHBXXX");
        //map.put("actnoBicAdr54a", actnoBicAdrTag54a);
        //72
        //map.put("SendertoReceiverInformation","SendertoReceiverInformation");

        //list循环体
        List<MT110AbsCreator> list110 = new LinkedList<>();
        //循环1
        MT110AbsCreator mt110AbsCreator=new MT110AbsCreator();
        mt110AbsCreator.setChequeNumber("ChequeNumber");
        mt110AbsCreator.setDateofIssue("112233");

        DcDateCurAmtTagXXX dcdatecuramt32a=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32a.setDate("990516");
        dcdatecuramt32a.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a.setCurrency("USD");
        mt110AbsCreator.setAmount32a(dcdatecuramt32a);

        ActnoBicAdrTagXXX actnoBicAdrTag50a=new ActnoBicAdrTagXXX("50","110");
        //actnoBicAdrTag50a.setInfo("A");
        actnoBicAdrTag50a.setAddress("1/WHYHCNHBXXX");
        //actnoBicAdrTag50a.setCode("THISIS41A");
        //actnoBicAdrTag50a.setBic("GCYXXXXXX12");
        //actnoBicAdrTag50a.setAcctno("6226TEST0001");
        actnoBicAdrTag50a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag50a.setLocation("WHYHCNHBXXX");
        mt110AbsCreator.setPayer50a(actnoBicAdrTag50a);

        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        //actnoBicAdrTag52a.setBic("THISIS41A");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");
        mt110AbsCreator.setDrawerBank52a(actnoBicAdrTag52a);

        ActnoBicAdrTagXXX actnoBicAdrTag59a=new ActnoBicAdrTagXXX("59","110");
        //actnoBicAdrTag59a.setInfo("A");
        actnoBicAdrTag59a.setAddress("1/WHYHCNHBXXX");
        //actnoBicAdrTag59a.setCode("THISIS41A");
        //actnoBicAdrTag59a.setBic("THISIS41A");
        actnoBicAdrTag59a.setAcctno("6226TEST0001");
        //actnoBicAdrTag59a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59a.setLocation("WHYHCNHBXXX");
        mt110AbsCreator.setPayee59a(actnoBicAdrTag59a);

        list110.add(mt110AbsCreator);

        //循环2
        MT110AbsCreator mt110AbsCreator2=new MT110AbsCreator();
        mt110AbsCreator2.setChequeNumber("ChequeNumber");
        mt110AbsCreator2.setDateofIssue("112233");

        DcDateCurAmtTagXXX dcdatecuramt32a2=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32a2.setDate("990516");
        dcdatecuramt32a2.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a2.setCurrency("USD");
        mt110AbsCreator2.setAmount32a(dcdatecuramt32a2);

        ActnoBicAdrTagXXX actnoBicAdrTag50a2=new ActnoBicAdrTagXXX("50","110");
        //actnoBicAdrTag50a2.setInfo("A");
        actnoBicAdrTag50a2.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag50a2.setCode("THISIS41A");
        //actnoBicAdrTag50a2.setBic("THISIS41A");
        actnoBicAdrTag50a2.setAcctno("6226TEST0001");
        //actnoBicAdrTag50a2.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag50a2.setLocation("WHYHCNHBXXX");
        mt110AbsCreator2.setPayer50a(actnoBicAdrTag50a2);

        ActnoBicAdrTagXXX actnoBicAdrTag52a2=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a2.setInfo("A");
        actnoBicAdrTag52a2.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a2.setCode("THISIS41A");
        //actnoBicAdrTag52a2.setBic("THISIS41A");
        //actnoBicAdrTag52a2.setAcctno("6226TEST0001");
        actnoBicAdrTag52a2.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a2.setLocation("WHYHCNHBXXX");
        mt110AbsCreator2.setDrawerBank52a(actnoBicAdrTag52a2);

        ActnoBicAdrTagXXX actnoBicAdrTag59a2=new ActnoBicAdrTagXXX("59","110");
        //actnoBicAdrTag59a2.setInfo("A");
        actnoBicAdrTag59a2.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag59a2.setCode("THISIS41A");
        //actnoBicAdrTag59a2.setBic("THISIS41A");
        actnoBicAdrTag59a2.setAcctno("6226TEST0001");
        //actnoBicAdrTag59a2.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59a2.setLocation("WHYHCNHBXXX");
        mt110AbsCreator2.setPayee59a(actnoBicAdrTag59a2);

        list110.add(mt110AbsCreator2);

        //map.put("cycleDomain",list110);


        //构造参数传入MT报文类型
        MT110Creator mt110Creator=new MT110Creator("110");
        mt110Creator.setSendBic("PSBCCNBJXXX");
        mt110Creator.setRecvBic("CIPSCNSHXXX");
        mt110Creator.setSendersReference("SendersReference");
        mt110Creator.setSendersCorrespondent53a(actnoBicAdrTag53a);
        mt110Creator.setReceiversCorrespondent54a(actnoBicAdrTag54a);
        mt110Creator.setSendertoReceiverInformation("SendertoReceiverInformation"+Constans.CRLF+"CHANGSHAXXXX");
        mt110Creator.setCycleDomain(list110);

       MtCreatorManager.packMT(mt110Creator);



    }

    @Test
    public void Mt110_Test_2()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        //53D
        ActnoBicAdrTagXXX actnoBicAdrTag53a=new ActnoBicAdrTagXXX("53");
        //actnoBicAdrTag53a.setInfo("A");
        actnoBicAdrTag53a.setAddress("WHYHCNHBXXX"+Constans.CRLF+"CHANGSHAXXXX");
        //actnoBicAdrTag53a.setCode("THISIS41A");
        //actnoBicAdrTag53a.setBic("THISIS41A");
        //actnoBicAdrTag53a.setAcctno("6226TEST0001");
        actnoBicAdrTag53a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag53a.setLocation("WHYHCNHBXXX");
        //map.put("actnoBicAdr53a", actnoBicAdrTag53a);
        //54D
        ActnoBicAdrTagXXX actnoBicAdrTag54a=new ActnoBicAdrTagXXX("54");
        //actnoBicAdrTag54a.setInfo("A");
        actnoBicAdrTag54a.setAddress("WHYHCNHBXXX"+Constans.CRLF+"CHANGSHAXXXX");
        //actnoBicAdrTag54a.setCode("THISIS41A");
        //actnoBicAdrTag54a.setBic("THISIS41A");
        //actnoBicAdrTag54a.setAcctno("6226TEST0001");
        actnoBicAdrTag54a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag54a.setLocation("WHYHCNHBXXX");
        //map.put("actnoBicAdr54a", actnoBicAdrTag54a);
        //72
        //map.put("SendertoReceiverInformation","SendertoReceiverInformation");

        //list循环体
        List<MT110AbsCreator> list110 = new LinkedList<>();
        //循环1
        MT110AbsCreator mt110AbsCreator=new MT110AbsCreator();
        mt110AbsCreator.setChequeNumber("ChequeNumber");
        mt110AbsCreator.setDateofIssue("112233");

        DcDateCurAmtTagXXX dcdatecuramt32a=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32a.setDate("990516");
        dcdatecuramt32a.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a.setCurrency("USD");
        mt110AbsCreator.setAmount32a(dcdatecuramt32a);

        ActnoBicAdrTagXXX actnoBicAdrTag50a=new ActnoBicAdrTagXXX("50","110");
        //actnoBicAdrTag50a.setInfo("A");
        actnoBicAdrTag50a.setAddress("1/WHYHCNHBXXX");
        //actnoBicAdrTag50a.setCode("THISIS41A");
        //actnoBicAdrTag50a.setBic("THISIS41A");
        actnoBicAdrTag50a.setAcctno("6226TEST0001");
        //actnoBicAdrTag50a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag50a.setLocation("WHYHCNHBXXX");
        mt110AbsCreator.setPayer50a(actnoBicAdrTag50a);

        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        //actnoBicAdrTag52a.setBic("THISIS41A");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");
        mt110AbsCreator.setDrawerBank52a(actnoBicAdrTag52a);

        ActnoBicAdrTagXXX actnoBicAdrTag59a=new ActnoBicAdrTagXXX("59","110");
        //actnoBicAdrTag59a.setInfo("A");
        actnoBicAdrTag59a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag59a.setCode("THISIS41A");
        //actnoBicAdrTag59a.setBic("THISIS41A");
        actnoBicAdrTag59a.setAcctno("6226TEST0001");
        //actnoBicAdrTag59a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59a.setLocation("WHYHCNHBXXX");
        mt110AbsCreator.setPayee59a(actnoBicAdrTag59a);

        list110.add(mt110AbsCreator);

        //循环2
        MT110AbsCreator mt110AbsCreator2=new MT110AbsCreator();
        mt110AbsCreator2.setChequeNumber("ChequeNumber");
        mt110AbsCreator2.setDateofIssue("112233");

        DcDateCurAmtTagXXX dcdatecuramt32a2=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32a2.setDate("990516");
        dcdatecuramt32a2.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a2.setCurrency("USD");
        mt110AbsCreator2.setAmount32a(dcdatecuramt32a2);

        ActnoBicAdrTagXXX actnoBicAdrTag50a2=new ActnoBicAdrTagXXX("50","110");
        //actnoBicAdrTag50a2.setInfo("A");
        actnoBicAdrTag50a2.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag50a2.setCode("THISIS41A");
        //actnoBicAdrTag50a2.setBic("THISIS41A");
        actnoBicAdrTag50a2.setAcctno("6226TEST0001");
        //actnoBicAdrTag50a2.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag50a2.setLocation("WHYHCNHBXXX");
        mt110AbsCreator2.setPayer50a(actnoBicAdrTag50a2);

        ActnoBicAdrTagXXX actnoBicAdrTag52a2=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a2.setInfo("A");
        actnoBicAdrTag52a2.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a2.setCode("THISIS41A");
        //actnoBicAdrTag52a2.setBic("THISIS41A");
        //actnoBicAdrTag52a2.setAcctno("6226TEST0001");
        actnoBicAdrTag52a2.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a2.setLocation("WHYHCNHBXXX");
        mt110AbsCreator2.setDrawerBank52a(actnoBicAdrTag52a2);

        ActnoBicAdrTagXXX actnoBicAdrTag59a2=new ActnoBicAdrTagXXX("59","110");
        //actnoBicAdrTag59a2.setInfo("A");
        actnoBicAdrTag59a2.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag59a2.setCode("THISIS41A");
        //actnoBicAdrTag59a2.setBic("THISIS41A");
        actnoBicAdrTag59a2.setAcctno("6226TEST0001");
        //actnoBicAdrTag59a2.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59a2.setLocation("WHYHCNHBXXX");
        mt110AbsCreator2.setPayee59a(actnoBicAdrTag59a2);

        list110.add(mt110AbsCreator2);

        //map.put("cycleDomain",list110);


        //构造参数传入MT报文类型
        MT110Creator mt110Creator=new MT110Creator("110");
        mt110Creator.setSendBic("PSBCCNBJXXX");
        mt110Creator.setRecvBic("CIPSCNSHXXX");
        mt110Creator.setSendersReference("SendersReference");
        mt110Creator.setSendersCorrespondent53a(actnoBicAdrTag53a);
        mt110Creator.setReceiversCorrespondent54a(actnoBicAdrTag54a);
        mt110Creator.setSendertoReceiverInformation("SendertoReceiverInformation"+Constans.CRLF+"CHANGSHAXXXX");
        mt110Creator.setCycleDomain(list110);

        MtCreatorManager.packMT(mt110Creator);



    }
}
