package com.brilliance.isc.doc.handle.impl.cipspay;

import com.brilliance.mda.runtime.mda.util.Dates;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import com.brilliance.isc.common.codetable.service.CodetableService;
import com.brilliance.isc.common.exception.CommonServiceException;
import com.brilliance.isc.common.setgll.vo.SetgllVo;
import com.brilliance.isc.common.trndoc.vo.DoceotVo;
import com.brilliance.isc.common.util.StringUtils;
import com.brilliance.isc.common.util.Utils;
import com.brilliance.isc.vo.CipmodVo;
import com.google.common.collect.ImmutableMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.cache.annotation.CacheInvocationParameter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class BuildCipspayLetter {

    @Autowired
    private CodetableService codetableService;

    public Map<String, Object> build(List<SetgllVo> setglls, DoceotVo doceotVo) {
        Map<String, Object> map = new HashMap();
        int index = -1;
        String objmod = doceotVo.getObjmod();
        if (StringUtils.isNotEmpty(objmod)) {
            String indexStr = objmod.substring(objmod.indexOf("(")+1, objmod.indexOf(")"));
            try {
                index = Integer.parseInt(indexStr);
            } catch (Exception e) {
                throw new CommonServiceException("无法获取结算数据");
            }
        }
        if (index == -1) {
            throw new CommonServiceException("无法获取结算数据");
        }
        SetgllVo setgllVo = setglls.get(index);
        if (!"CIV".equals(setgllVo.getSftmt()) && !"CIU".equals(setgllVo.getSftmt())) {
            throw new CommonServiceException("清算模式不是CIPS系统");
        }
        if ("CIU".equals(setgllVo.getSftmt())) {
            map.put("typ", "cips111");
            this.buildCips111Body(map, setgllVo, doceotVo);
        } else if ("CIV".equals(setgllVo.getSftmt())) {
            map.put("typ","cips112");
            this.buildCips112Body(map, setgllVo, doceotVo);
        }
        //rol
        map.put("rol",setgllVo.getRol());
        return map;
    }

    /**
     * cips112 组报
     * @param map
     * @param setgllVo
     * @param doceotVo
     */
    private void buildCips111Body(Map<String, Object> map, SetgllVo setgllVo, DoceotVo doceotVo) {
        CipmodVo cipmod = setgllVo.getSespay().getCipmod();
        //3对键值对形式的map装在list中
        List<Map> msgBody = new ArrayList<>();
        //起息日
        msgBody.add(ImmutableMap.of("label","起息日","field",":30A:","value", Utils.fmtDate(Dates.today(), "dd.MM.yyyy")));
        //货币符号，金额
        msgBody.add(ImmutableMap.of("label","货币符号，金额","field",":32A:","value",setgllVo.getAcccur()+" "+setgllVo.getAccamt().abs()));
        //原始货币符号，金额 缺陷ID：283653
        //上海分行业务老师要求放开，显示该字段
        msgBody.add(ImmutableMap.of("label","原始货币符号，金额","field",":YJE:","value",cipmod.getCur33b()+" "+cipmod.getAmt33b()));
        //业务种类
        if (StringUtils.isNotEmpty(cipmod.getBustyp())) {
            String label = codetableService.getTblLabel(cipmod.getBustyp(), "KJYWZL", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "业务种类", "field", ":CEE:", "value", cipmod.getBustyp() + "-" + label));
        }
        //端到端标识
        if (StringUtils.isNotEmpty(cipmod.getDddbsh())) {
            msgBody.add(ImmutableMap.of("label", "端到端标识", "field", ":DDD:", "value", cipmod.getDddbsh()));
        }
        //费用承担方
        if (StringUtils.isNotEmpty(cipmod.getFeecod())) {
            String label = codetableService.getTblLabel(cipmod.getFeecod(), "FEECOD", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "费用承担方", "field", ":COD:", "value", cipmod.getFeecod() + "-" + label));
        }
        //付款人名称
        if (StringUtils.isNotEmpty(cipmod.getOrcnam())) {
            msgBody.add(ImmutableMap.of("label", "付款人名称", "field", ":50A:", "value", formatTxt(cipmod.getOrcnam())));
        }
        //付款人账号 真实账号
        if (StringUtils.isNotEmpty(cipmod.getRelorcact())) {
            msgBody.add(ImmutableMap.of("label", "付款人账号", "field", ":50C:", "value", cipmod.getRelorcact()));
        }
        //付款人地址
        if (StringUtils.isNotEmpty(cipmod.getOrcadr())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址", "field", ":50B:", "value", formatTxt(cipmod.getOrcadr())));
        }
        //FHD2 付款人地址2
        if (StringUtils.isNotEmpty(cipmod.getFkrdz2())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址2", "field", ":FHD2:", "value", formatTxt(cipmod.getFkrdz2())));
        }
        //FHD3 付款人地址3
        if (StringUtils.isNotEmpty(cipmod.getFkrdz3())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址3", "field", ":FHD3:", "value", formatTxt(cipmod.getFkrdz3())));
        }
        //FHD4 付款人地址4
        if (StringUtils.isNotEmpty(cipmod.getFkrdz4())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址4", "field", ":FHD4:", "value", formatTxt(cipmod.getFkrdz4())));
        }
        //FHD5 付款人地址5
        if (StringUtils.isNotEmpty(cipmod.getFkrdz5())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址5", "field", ":FHD5:", "value", formatTxt(cipmod.getFkrdz5())));
        }
        //FHD6 付款人地址6
        if (StringUtils.isNotEmpty(cipmod.getFkrdz6())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址6", "field", ":FHD6:", "value", formatTxt(cipmod.getFkrdz6())));
        }
        //FHD7 付款人地址7
        if (StringUtils.isNotEmpty(cipmod.getFkrdz7())) {
            msgBody.add(ImmutableMap.of("label", "付款人地址7", "field", ":FHD7:", "value", formatTxt(cipmod.getFkrdz7())));
        }
        //FKH 付款人开户行行号
        if (StringUtils.isNotEmpty(cipmod.getFkrkhh())) {
            msgBody.add(ImmutableMap.of("label", "付款人开户行行号", "field", ":FKH:", "value", cipmod.getFkrkhh()));
        }
        //FKM 付款人开户行名称(付款非银行支付机构名称)
        if (StringUtils.isNotEmpty(cipmod.getFukrhm())) {
            msgBody.add(ImmutableMap.of("label", "付款人开户行名称(付款非银行支付机构名称)", "field", ":FKM:", "value", cipmod.getFukrhm()));
        }
        //FZH 付款直接参与者行号
        if (StringUtils.isNotEmpty(cipmod.getStaonebch())) {
            msgBody.add(ImmutableMap.of("label", "付款直接参与者行号", "field", ":FZH:", "value", cipmod.getStaonebch()));
        }
        //FZM 付款直接参与者名称
        if (StringUtils.isNotEmpty(cipmod.getStaonebchnam())) {
            msgBody.add(ImmutableMap.of("label", "付款直接参与者名称", "field", ":FZM:", "value", cipmod.getStaonebchnam()));
        }
        //FJH 付款间接参与者行号
        if (StringUtils.isNotEmpty(cipmod.getStasehbch())) {
            msgBody.add(ImmutableMap.of("label", "付款间接参与者行号", "field", ":FJH:", "value", cipmod.getStasehbch()));
        }
        //FJM 付款间接参与者名称
        if (StringUtils.isNotEmpty(cipmod.getStasehbchnam())) {
            msgBody.add(ImmutableMap.of("label", "付款间接参与者名称", "field", ":FJM:", "value", cipmod.getStasehbchnam()));
        }
        //59A 收款人名称
        if (StringUtils.isNotEmpty(cipmod.getPyenam())) {
            msgBody.add(ImmutableMap.of("label", "收款人名称", "field", ":59A:", "value", formatTxt(cipmod.getPyenam())));
        }
        //59C 收款人账号
        if (StringUtils.isNotEmpty(cipmod.getPyeact())) {
            msgBody.add(ImmutableMap.of("label", "收款人账号", "field", ":59C:", "value", cipmod.getPyeact()));
        }
        //59B 收款人地址
        if (StringUtils.isNotEmpty(cipmod.getPyeadr())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址", "field", ":59B:", "value", formatTxt(cipmod.getPyeadr())));
        }
        //SHD2 收款人地址2
        if (StringUtils.isNotEmpty(cipmod.getSkrdz2())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址2", "field", ":SHD2:", "value", formatTxt(cipmod.getSkrdz2())));
        }
        //SHD3 收款人地址3
        if (StringUtils.isNotEmpty(cipmod.getSkrdz3())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址3", "field", ":SHD3:", "value", formatTxt(cipmod.getSkrdz3())));
        }
        //SHD4 收款人地址4
        if (StringUtils.isNotEmpty(cipmod.getSkrdz4())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址4", "field", ":SHD4:", "value", formatTxt(cipmod.getSkrdz4())));
        }
        //SHD5 收款人地址5
        if (StringUtils.isNotEmpty(cipmod.getSkrdz5())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址5", "field", ":SHD5:", "value", formatTxt(cipmod.getSkrdz5())));
        }
        //SHD6 收款人地址6
        if (StringUtils.isNotEmpty(cipmod.getSkrdz6())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址6", "field", ":SHD6:", "value", formatTxt(cipmod.getSkrdz6())));
        }
        //SHD7 收款人地址7
        if (StringUtils.isNotEmpty(cipmod.getSkrdz7())) {
            msgBody.add(ImmutableMap.of("label", "收款人地址7", "field", ":SHD7:", "value", formatTxt(cipmod.getSkrdz7())));
        }
        //SKH 收款人开户行行号
        if (StringUtils.isNotEmpty(cipmod.getPyebchkey())) {
            msgBody.add(ImmutableMap.of("label", "收款人开户行行号", "field", ":SKH:", "value", cipmod.getPyebchkey()));
        }
        //SKM 收款人开户行名称(收款非银行支付机构名称)
        if (StringUtils.isNotEmpty(cipmod.getPyebchnam())) {
            msgBody.add(ImmutableMap.of("label", "收款人开户行名称（收款非银行支付机构名称）", "field", ":SKM:", "value", cipmod.getPyebchnam()));
        }
        //SZH 收款直接参与者行号
        if (StringUtils.isNotEmpty(cipmod.getReconebch())) {
            msgBody.add(ImmutableMap.of("label", "收款直接参与者行号", "field", ":SZH:", "value", cipmod.getReconebch()));
        }
        //SZM 收款直接参与者名称
        if (StringUtils.isNotEmpty(cipmod.getReconebchnam())) {
            msgBody.add(ImmutableMap.of("label", "收款直接参与者名称", "field", ":SZM:", "value", cipmod.getReconebchnam()));
        }
        //SJH 收款间接参与者行号
        if (StringUtils.isNotEmpty(cipmod.getRecsehbch())) {
            msgBody.add(ImmutableMap.of("label", "收款间接参与者行号", "field", ":SJH:", "value", cipmod.getRecsehbch()));
        }
        //SJM 收款间接参与者名称
        if (StringUtils.isNotEmpty(cipmod.getRecsehbchnam())) {
            msgBody.add(ImmutableMap.of("label", "收款间接参与者名称", "field", ":SJM:", "value", cipmod.getRecsehbchnam()));
        }
        //FY1 附言
        if (StringUtils.isNotEmpty(cipmod.getCommen())) {
            msgBody.add(ImmutableMap.of("label", "附言", "field", ":FY1:", "value", formatTxt(cipmod.getCommen())));
        }
        //FY2 附言2
        if (StringUtils.isNotEmpty(cipmod.getFuynh2())) {
            msgBody.add(ImmutableMap.of("label", "附言2", "field", ":FY2:", "value", formatTxt(cipmod.getFuynh2())));
        }
        //FY3 附言3
        if (StringUtils.isNotEmpty(cipmod.getFuynh3())) {
            msgBody.add(ImmutableMap.of("label", "附言3", "field", ":FY3:", "value", formatTxt(cipmod.getFuynh3())));
        }
        //FY4 附言4
        if (StringUtils.isNotEmpty(cipmod.getFuynh4())) {
            msgBody.add(ImmutableMap.of("label", "附言4", "field", ":FY4:", "value", formatTxt(cipmod.getFuynh4())));
        }
        //FY1 费用1
        if (cipmod.getFeiyon() != null && cipmod.getFeiyon().compareTo(BigDecimal.ZERO) != 0) {
            msgBody.add(ImmutableMap.of("label", "费用1", "field", ":FY1:", "value", cipmod.getFeiyon()));
        }
        //FFH1 付费行1
        if (StringUtils.isNotEmpty(cipmod.getFufeih())) {
            msgBody.add(ImmutableMap.of("label", "付费行1", "field", ":FFH1:", "value", cipmod.getFufeih()));
        }
        //FY2 费用2
        if (cipmod.getFeiyn2() != null && cipmod.getFeiyn2().compareTo(BigDecimal.ZERO) != 0) {
            msgBody.add(ImmutableMap.of("label", "费用2", "field", ":FY2:", "value", cipmod.getFeiyn2()));
        }
        //FFH2 付费行2
        if (StringUtils.isNotEmpty(cipmod.getFfeih2())) {
            msgBody.add(ImmutableMap.of("label", "付费行2", "field", ":FFH2:", "value", cipmod.getFfeih2()));
        }
        //ZJ1 中介机构1行号
        if (StringUtils.isNotEmpty(cipmod.getZjg1hh())) {
            msgBody.add(ImmutableMap.of("label", "中介机构1行号", "field", ":ZJ1:", "value", cipmod.getZjg1hh()));
        }
        //ZJ1M 中介机构1名称
        if (StringUtils.isNotEmpty(cipmod.getZjg1mc())) {
            msgBody.add(ImmutableMap.of("label", "中介机构1名称", "field", ":ZJ1M:", "value", cipmod.getZjg1mc()));
        }
        //ZJ2 中介机构2行号
        if (StringUtils.isNotEmpty(cipmod.getZjg2hh())) {
            msgBody.add(ImmutableMap.of("label", "中介机构2行号", "field", ":ZJ2:", "value", cipmod.getZjg2hh()));
        }
        //ZJ2M 中介机构2名称
        if (StringUtils.isNotEmpty(cipmod.getZjg2mc())) {
            msgBody.add(ImmutableMap.of("label", "中介机构2名称", "field", ":ZJ2M:", "value", cipmod.getZjg2mc()));
        }
        //FKRZ 付款人组织机构代码
        if (StringUtils.isNotEmpty(cipmod.getFkrzhj())) {
            msgBody.add(ImmutableMap.of("label", "付款人组织机构代码", "field", ":FKRZ:", "value", cipmod.getFkrzhj()));
        }
        //FKRJ 付款人证件类型
        if(StringUtils.isNotEmpty(cipmod.getFkrzjl())){
            String label = codetableService.getTblLabel(cipmod.getFkrzjl(), "ZHJLEX", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "付款人证件类型", "field", ":FKRJ:", "value", cipmod.getFkrzjl()+ "-" +label));
        }
        //FKRH 付款人证件号码
        if (StringUtils.isNotEmpty(cipmod.getFkrzjh())) {
            msgBody.add(ImmutableMap.of("label", "付款人证件号码", "field", ":FKRH:", "value", cipmod.getFkrzjh()));
        }
        //FKRG 付款人常驻国家（地区）代码
        if (StringUtils.isNotEmpty(cipmod.getFkrzgj())) {
            String label = codetableService.getTblLabel(cipmod.getFkrzgj(), "CTYTXT", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "付款人常驻国家（地区）代码", "field", ":FKRG:", "value", cipmod.getFkrzgj()+ "-" +label));
        }
        //FKRE 付款人EID
        if (StringUtils.isNotEmpty(cipmod.getFkreid())) {
            msgBody.add(ImmutableMap.of("label", "付款人EID", "field", ":FKRE:", "value", cipmod.getFkreid()));
        }
        //FKFY 付款非银行支付机构账号
        if (StringUtils.isNotEmpty(cipmod.getFkfyzh())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构账号", "field", ":FKFY:", "value", cipmod.getFkfyzh()));
        }
        //FKZ1 付款非银行支付机构地址1
        if (StringUtils.isNotEmpty(cipmod.getFkfdz1())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址1", "field", ":FKZ1:", "value", formatTxt(cipmod.getFkfdz1())));
        }
        //FKZ2 付款非银行支付机构地址2
        if (StringUtils.isNotEmpty(cipmod.getFkfdz2())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址2", "field", ":FKZ2:", "value", formatTxt(cipmod.getFkfdz2())));
        }
        //FKZ3 付款非银行支付机构地址3
        if (StringUtils.isNotEmpty(cipmod.getFkfdz3())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址3", "field", ":FKZ3:", "value", formatTxt(cipmod.getFkfdz3())));
        }
        //FKZ4 付款非银行支付机构地址4
        if (StringUtils.isNotEmpty(cipmod.getFkfdz4())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址4", "field", ":FKZ4:", "value", formatTxt(cipmod.getFkfdz4())));
        }
        //FKZ5 付款非银行支付机构地址5
        if (StringUtils.isNotEmpty(cipmod.getFkfdz5())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址5", "field", ":FKZ5:", "value", formatTxt(cipmod.getFkfdz5())));
        }
        //FKZ6 付款非银行支付机构地址6
        if (StringUtils.isNotEmpty(cipmod.getFkfdz6())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址6", "field", ":FKZ6:", "value", formatTxt(cipmod.getFkfdz6())));
        }
        //FKZ7 付款非银行支付机构地址7
        if (StringUtils.isNotEmpty(cipmod.getFkfdz7())) {
            msgBody.add(ImmutableMap.of("label", "付款非银行支付机构地址7", "field", ":FKZ7:", "value", formatTxt(cipmod.getFkfdz7())));
        }
        //SKRZ 收款人组织机构代码
        if (StringUtils.isNotEmpty(cipmod.getSkrzhj())) {
            msgBody.add(ImmutableMap.of("label", "收款人组织机构代码", "field", ":SKRZ:", "value", cipmod.getSkrzhj()));
        }
        //SKRL 收款人证件类型
        if(StringUtils.isNotEmpty(cipmod.getSkrzjl())){
            String label = codetableService.getTblLabel(cipmod.getSkrzjl(), "ZHJLEX", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "收款人证件类型", "field", ":SKRL:", "value", cipmod.getSkrzjl()+ "-" +label));
        }
        //SKRH 收款人证件号码
        if (StringUtils.isNotEmpty(cipmod.getSkrzjh())) {
            msgBody.add(ImmutableMap.of("label", "收款人证件号码", "field", ":SKRH:", "value", cipmod.getSkrzjh()));
        }
        //SKZG 收款人常驻国家（地区）代码
        if (StringUtils.isNotEmpty(cipmod.getSkrzgj())) {
            String label = codetableService.getTblLabel(cipmod.getSkrzgj(), "CTYTXT", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "收款人常驻国家（地区）代码", "field", ":SKZG:", "value", cipmod.getSkrzgj()+ "-" +label));
        }
        //SKEI 收款人EID
        if (StringUtils.isNotEmpty(cipmod.getSkreid())) {
            msgBody.add(ImmutableMap.of("label", "收款人EID", "field", ":SKEI:", "value", cipmod.getSkreid()));
        }
        //SKYZ 收款非银行支付机构账号
        if (StringUtils.isNotEmpty(cipmod.getSkfyzh())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构账号", "field", ":SKYZ:", "value", cipmod.getSkfyzh()));
        }
        //SKD1 收款非银行支付机构地址1
        if (StringUtils.isNotEmpty(cipmod.getSkfdz1())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址1", "field", ":SKD1:", "value", formatTxt(cipmod.getSkfdz1())));
        }
        //SKD2 收款非银行支付机构地址2
        if (StringUtils.isNotEmpty(cipmod.getSkfdz2())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址2", "field", ":SKD2:", "value", formatTxt(cipmod.getSkfdz2())));
        }
        //SKD3 收款非银行支付机构地址3
        if (StringUtils.isNotEmpty(cipmod.getSkfdz3())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址3", "field", ":SKD3:", "value", formatTxt(cipmod.getSkfdz3())));
        }
        //SKD4 收款非银行支付机构地址4
        if (StringUtils.isNotEmpty(cipmod.getSkfdz4())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址4", "field", ":SKD4:", "value", formatTxt(cipmod.getSkfdz4())));
        }
        //SKD5 收款非银行支付机构地址5
        if (StringUtils.isNotEmpty(cipmod.getSkfdz5())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址5", "field", ":SKD5:", "value", formatTxt(cipmod.getSkfdz5())));
        }
        //SKD6 收款非银行支付机构地址6
        if (StringUtils.isNotEmpty(cipmod.getSkfdz6())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址6", "field", ":SKD6:", "value", formatTxt(cipmod.getSkfdz6())));
        }
        //SKD7 收款非银行支付机构地址7
        if (StringUtils.isNotEmpty(cipmod.getSkfdz7())) {
            msgBody.add(ImmutableMap.of("label", "收款非银行支付机构地址7", "field", ":SKD7:", "value", formatTxt(cipmod.getSkfdz7())));
        }
        //DDU1 订单描述1
        if (StringUtils.isNotEmpty(cipmod.getDdmsu1())) {
            msgBody.add(ImmutableMap.of("label", "订单描述1", "field", ":DDU1:", "value", formatTxt(cipmod.getDdmsu1())));
        }
        //DDU2 订单描述2
        if (StringUtils.isNotEmpty(cipmod.getDdmsu2())) {
            msgBody.add(ImmutableMap.of("label", "订单描述2", "field", ":DDU2:", "value", formatTxt(cipmod.getDdmsu2())));
        }
        //DDU3 订单描述3
        if (StringUtils.isNotEmpty(cipmod.getDdmsu3())) {
            msgBody.add(ImmutableMap.of("label", "订单描述3", "field", ":DDU3:", "value", formatTxt(cipmod.getDdmsu3())));
        }
        //DDU4 订单描述4
        if (StringUtils.isNotEmpty(cipmod.getDdmsu4())) {
            msgBody.add(ImmutableMap.of("label", "订单描述4", "field", ":DDU4:", "value", formatTxt(cipmod.getDdmsu4())));
        }
        //DDU5 订单描述5
        if (StringUtils.isNotEmpty(cipmod.getDdmsu5())) {
            msgBody.add(ImmutableMap.of("label", "订单描述5", "field", ":DDU5:", "value", formatTxt(cipmod.getDdmsu5())));
        }
        //DDU6 订单描述6
        if (StringUtils.isNotEmpty(cipmod.getDdmsu6())) {
            msgBody.add(ImmutableMap.of("label", "订单描述6", "field", ":DDU6:", "value", formatTxt(cipmod.getDdmsu6())));
        }
        //DDU7 订单描述7
        if (StringUtils.isNotEmpty(cipmod.getDdmsu7())) {
            msgBody.add(ImmutableMap.of("label", "订单描述7", "field", ":DDU7:", "value", formatTxt(cipmod.getDdmsu7())));
        }
        //DDU8 订单描述8
        if (StringUtils.isNotEmpty(cipmod.getDdmsu8())) {
            msgBody.add(ImmutableMap.of("label", "订单描述8", "field", ":DDU8:", "value", formatTxt(cipmod.getDdmsu8())));
        }
        //DDA 订单编号
        if (StringUtils.isNotEmpty(cipmod.getDdbhao())) {
            msgBody.add(ImmutableMap.of("label", "订单编号", "field", ":DDA:", "value", cipmod.getDdbhao()));
        }
        //致收款人银行附言1
        if(StringUtils.isNotEmpty(cipmod.getFuyns1())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言1", "field", ":FYS1:", "value", formatTxt(cipmod.getFuyns1())));
        }
        //致收款人银行附言2
        if(StringUtils.isNotEmpty(cipmod.getFuyns2())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言2", "field", ":FYS2:", "value", formatTxt(cipmod.getFuyns2())));
        }
        //致收款人银行附言3
        if(StringUtils.isNotEmpty(cipmod.getFuyns3())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言3", "field", ":FYS3:", "value", formatTxt(cipmod.getFuyns3())));
        }
        //致收款人银行附言4
        if(StringUtils.isNotEmpty(cipmod.getFuyns4())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言4", "field", ":FYS4:", "value", formatTxt(cipmod.getFuyns4())));
        }
        map.put("msgBody",msgBody);
    }
    /**
     * cips112 组报
     * @param map
     * @param setgllVo
     * @param doceotVo
     */
    private void buildCips112Body(Map<String, Object> map, SetgllVo setgllVo, DoceotVo doceotVo) {
        CipmodVo cipmod = setgllVo.getSespay().getCipmod();
        //3对键值对形式的map装在list中
        List<Map> msgBody = new ArrayList<>();
        //起息日
        msgBody.add(ImmutableMap.of("label","起息日","field",":30A:","value", Utils.fmtDate(Dates.today(), "dd.MM.yyyy")));
        //货币符号，金额
        msgBody.add(ImmutableMap.of("label","货币符号，金额","field",":32A:","value",setgllVo.getAcccur() + " "+setgllVo.getAccamt().abs()));
        //业务种类
        if (StringUtils.isNotEmpty(cipmod.getBustyp())) {
            String label = codetableService.getTblLabel(cipmod.getBustyp(), "KJYWZL", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "业务种类", "field", ":CEE:", "value", cipmod.getBustyp() + "-" + label));
        }
        //端到端标识
        if (StringUtils.isNotEmpty(cipmod.getDddbsh())) {
            msgBody.add(ImmutableMap.of("label", "端到端标识", "field", ":DDD:", "value", cipmod.getDddbsh()));
        }
        //付款行行号
        if(StringUtils.isNotEmpty(cipmod.getFkhkhh())){
            msgBody.add(ImmutableMap.of("label", "付款行行号", "field", ":FKHH:", "value", cipmod.getFkhkhh()));
        }
        //付款行名称
        if(StringUtils.isNotEmpty(cipmod.getFkkhmc())){
            msgBody.add(ImmutableMap.of("label", "付款行名称", "field", ":FKHM:", "value", cipmod.getFkkhmc()));
        }
        //付款行账号
        if(StringUtils.isNotEmpty(cipmod.getRelorcact())){
            msgBody.add(ImmutableMap.of("label", "付款行账号", "field", ":FKZH:", "value", cipmod.getRelorcact()));
        } else if(StringUtils.isNotEmpty(cipmod.getFkkhzh())){
            msgBody.add(ImmutableMap.of("label", "付款行账号", "field", ":FKZH:", "value", cipmod.getFkkhzh()));
        }
        //付款行地址
        if(StringUtils.isNotEmpty(cipmod.getFkhdzh())){
            msgBody.add(ImmutableMap.of("label", "付款行地址", "field", ":FKDZ:", "value", formatTxt(cipmod.getFkhdzh())));
        }
        //付款行开户行行号
        if(StringUtils.isNotEmpty(cipmod.getFkrkhh())){
            msgBody.add(ImmutableMap.of("label", "付款行开户行行号", "field", ":FKH:", "value", cipmod.getFkrkhh()));
        }
        //付款行开户行名称
        if(StringUtils.isNotEmpty(cipmod.getFukrhm())){
            msgBody.add(ImmutableMap.of("label", "付款行开户行名称", "field", ":FKM:", "value", cipmod.getFukrhm()));
        }
        //付款直接参与者行号
        if(StringUtils.isNotEmpty(cipmod.getStaonebch())){
            msgBody.add(ImmutableMap.of("label", "付款直接参与者行号", "field", ":FZH:", "value", cipmod.getStaonebch()));
        }
        //付款直接参与者名称
        if(StringUtils.isNotEmpty(cipmod.getStaonebchnam())){
            msgBody.add(ImmutableMap.of("label", "付款直接参与者名称", "field", ":FZM:", "value", cipmod.getStaonebchnam()));
        }
        //付款间接参与者行号
        if(StringUtils.isNotEmpty(cipmod.getStasehbch())){
            msgBody.add(ImmutableMap.of("label", "付款间接参与者行号", "field", ":FJH:", "value", cipmod.getStasehbch()));
        }
        //付款间接参与者名称
        if(StringUtils.isNotEmpty(cipmod.getStasehbchnam())){
            msgBody.add(ImmutableMap.of("label", "付款间接参与者名称", "field", ":FJM:", "value", cipmod.getStasehbchnam()));
        }
        //收款行行号
        if(StringUtils.isNotEmpty(cipmod.getSkkhhh())){
            msgBody.add(ImmutableMap.of("label", "收款行行号", "field", ":SKHH:", "value", cipmod.getSkkhhh()));
        }
        //收款行名称
        if(StringUtils.isNotEmpty(cipmod.getSkkhhm())){
            msgBody.add(ImmutableMap.of("label", "收款行名称", "field", ":SKHM:", "value", cipmod.getSkkhhm()));
        }
        //收款行账号
        if(StringUtils.isNotEmpty(cipmod.getSkkhzh())){
            msgBody.add(ImmutableMap.of("label", "收款行账号", "field", ":SKZH:", "value", cipmod.getSkkhzh()));
        }
        //收款行地址
        if(StringUtils.isNotEmpty(cipmod.getSkkhdz())){
            msgBody.add(ImmutableMap.of("label", "收款行地址", "field", ":SKDZ:", "value", cipmod.getSkkhdz()));
        }
        //收款人开户行行号
        if(StringUtils.isNotEmpty(cipmod.getPyebchkey())){
            msgBody.add(ImmutableMap.of("label", "收款行开户行行号", "field", ":SKH:", "value", cipmod.getPyebchkey()));
        }
        //收款人开户行名称
        if(StringUtils.isNotEmpty(cipmod.getPyebchnam())){
            msgBody.add(ImmutableMap.of("label", "收款行开户行名称", "field", ":SKM:", "value", cipmod.getPyebchnam()));
        }
        //收款直接参与者行号
        if(StringUtils.isNotEmpty(cipmod.getReconebch())){
            msgBody.add(ImmutableMap.of("label", "收款直接参与者行号", "field", ":SZH:", "value", cipmod.getReconebch()));
        }
        //收款直接参与者名称
        if(StringUtils.isNotEmpty(cipmod.getReconebchnam())){
            msgBody.add(ImmutableMap.of("label", "收款直接参与者名称", "field", ":SZM:", "value", cipmod.getReconebchnam()));
        }
        //收款间接参与者行号
        if(StringUtils.isNotEmpty(cipmod.getRecsehbch())){
            msgBody.add(ImmutableMap.of("label", "收款间接参与者行号", "field", ":SJH:", "value", cipmod.getRecsehbch()));
        }
        //收款间接参与者名称
        if(StringUtils.isNotEmpty(cipmod.getRecsehbchnam())){
            msgBody.add(ImmutableMap.of("label", "收款间接参与者名称", "field", ":SJM:", "value", cipmod.getRecsehbchnam()));
        }
        //附言
        if(StringUtils.isNotEmpty(cipmod.getCommen())){
            msgBody.add(ImmutableMap.of("label", "附言", "field", ":FY1:", "value", formatTxt(cipmod.getCommen())));
        }
        //附言2
        if(StringUtils.isNotEmpty(cipmod.getFuynh2())){
            msgBody.add(ImmutableMap.of("label", "附言2", "field", ":FY2:", "value", formatTxt(cipmod.getFuynh2())));
        }
        //附言3
        if(StringUtils.isNotEmpty(cipmod.getFuynh3())){
            msgBody.add(ImmutableMap.of("label", "附言3", "field", ":FY3:", "value", formatTxt(cipmod.getFuynh3())));
        }
        //附言4
        if(StringUtils.isNotEmpty(cipmod.getFuynh4())){
            msgBody.add(ImmutableMap.of("label", "附言4", "field", ":FY4:", "value", formatTxt(cipmod.getFuynh4())));
        }
        //中介机构1行号
        if(StringUtils.isNotEmpty(cipmod.getZjg1hh())){
            msgBody.add(ImmutableMap.of("label", "中介机构1行号", "field", ":ZJ1:", "value", cipmod.getZjg1hh()));
        }
        //中介机构1名称
        if(StringUtils.isNotEmpty(cipmod.getZjg1mc())){
            msgBody.add(ImmutableMap.of("label", "中介机构1名称", "field", ":ZJ1M:", "value", cipmod.getZjg1mc()));
        }
        //中介机构2行号
        if(StringUtils.isNotEmpty(cipmod.getZjg2hh())){
            msgBody.add(ImmutableMap.of("label", "中介机构2行号", "field", ":ZJ2:", "value", cipmod.getZjg2hh()));
        }
        //中介机构2名称
        if(StringUtils.isNotEmpty(cipmod.getZjg2mc())){
            msgBody.add(ImmutableMap.of("label", "中介机构2名称", "field", ":ZJ2M:", "value", cipmod.getZjg2mc()));
        }
        //COV付款人组织机构代码
        if(StringUtils.isNotEmpty(cipmod.getCfkrzj())){
            msgBody.add(ImmutableMap.of("label", "COV付款人组织机构代码", "field", ":CFKR:", "value", cipmod.getCfkrzj()));
        }
        //COV付款人证件类型
        if(StringUtils.isNotEmpty(cipmod.getCfkzjl())){
            String label = codetableService.getTblLabel(cipmod.getCfkzjl(), "ZHJLEX", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "COV付款人证件类型", "field", ":CFKZ:", "value", cipmod.getCfkzjl()+ "-" +label));
        }
        //COV付款人证件号码
        if(StringUtils.isNotEmpty(cipmod.getCfkzjh())){
            msgBody.add(ImmutableMap.of("label", "COV付款人证件号码", "field", ":CFZJ:", "value", cipmod.getCfkzjh()));
        }
        //COV付款人常驻国家（地区）代码
        if(StringUtils.isNotEmpty(cipmod.getCfkrgj())){
            String label = codetableService.getTblLabel(cipmod.getCfkrgj(), "CTYTXT", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "COV付款人常驻国家（地区）代码", "field", ":CFKG:", "value", cipmod.getCfkrgj() + "-" + label));
        }
        //COV付款人EID
        if(StringUtils.isNotEmpty(cipmod.getCfkeid())){
            msgBody.add(ImmutableMap.of("label", "COV付款人EID", "field", ":CFKI:", "value", cipmod.getCfkeid()));
        }
        //COV付款人非银行支付机构账号
        if(StringUtils.isNotEmpty(cipmod.getCfkfzh())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构账号", "field", ":CFKF:", "value", cipmod.getCfkfzh()));
        }
        //COV付款人非银行支付机构地址1
        if(StringUtils.isNotEmpty(cipmod.getCffdz1())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址1", "field", ":CFZ1:", "value", formatTxt(cipmod.getCffdz1())));
        }
        //COV付款人非银行支付机构地址2
        if(StringUtils.isNotEmpty(cipmod.getCffdz2())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址2", "field", ":CFZ2:", "value", formatTxt(cipmod.getCffdz2())));
        }
        //COV付款人非银行支付机构地址3
        if(StringUtils.isNotEmpty(cipmod.getCffdz3())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址3", "field", ":CFZ3:", "value", formatTxt(cipmod.getCffdz3())));
        }
        //COV付款人非银行支付机构地址4
        if(StringUtils.isNotEmpty(cipmod.getCffdz4())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址4", "field", ":CFZ4:", "value", formatTxt(cipmod.getCffdz4())));
        }
        //COV付款人非银行支付机构地址5
        if(StringUtils.isNotEmpty(cipmod.getCffdz5())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址5", "field", ":CFZ5:", "value", formatTxt(cipmod.getCffdz5())));
        }
        //COV付款人非银行支付机构地址6
        if(StringUtils.isNotEmpty(cipmod.getCffdz6())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址6", "field", ":CFZ6:", "value", formatTxt(cipmod.getCffdz6())));
        }
        //COV付款人非银行支付机构地址7
        if(StringUtils.isNotEmpty(cipmod.getCffdz7())){
            msgBody.add(ImmutableMap.of("label", "COV付款人非银行支付机构地址7", "field", ":CFZ7:", "value", formatTxt(cipmod.getCffdz7())));
        }
        //COV收款人组织机构代码
        if(StringUtils.isNotEmpty(cipmod.getCskrzj())){
            msgBody.add(ImmutableMap.of("label", "COV收款人组织机构代码", "field", ":CSFR:", "value", cipmod.getCskrzj()));
        }
        //COV收款人证件类型
        if(StringUtils.isNotEmpty(cipmod.getCskzjl())){
            String label = codetableService.getTblLabel(cipmod.getCskzjl(), "ZHJLEX", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "COV收款人证件类型", "field", ":CSKZ:", "value", cipmod.getCskzjl() + "-" + label));
        }
        //COV收款人证件号码
        if(StringUtils.isNotEmpty(cipmod.getCskzjh())){
            msgBody.add(ImmutableMap.of("label", "COV收款人证件号码", "field", ":CSKJ:", "value", cipmod.getCskzjh()));
        }
        //COV收款人常驻国家（地区）代码
        if(StringUtils.isNotEmpty(cipmod.getCskrgj())){
            String label = codetableService.getTblLabel(cipmod.getCskrgj(), "CTYTXT", doceotVo.getDocuil());
            msgBody.add(ImmutableMap.of("label", "COV收款人常驻国家（地区）代码", "field", ":CSKG:", "value", cipmod.getCskrgj() + "-" + label));
        }
        //COV收款人EID
        if(StringUtils.isNotEmpty(cipmod.getCskeid())){
            msgBody.add(ImmutableMap.of("label", "COV收款人EID", "field", ":CSKD:", "value", cipmod.getCskeid()));
        }
        //COV收款非银行支付机构账号
        if(StringUtils.isNotEmpty(cipmod.getCskfzh())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构账号", "field", ":CSKF:", "value", cipmod.getCskfzh()));
        }
        //COV收款非银行支付机构地址1
        if(StringUtils.isNotEmpty(cipmod.getCsfdz1())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址1", "field", ":SFD1:", "value", formatTxt(cipmod.getCsfdz1())));
        }
        //COV收款非银行支付机构地址2
        if(StringUtils.isNotEmpty(cipmod.getCsfdz2())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址2", "field", ":SFD2:", "value", formatTxt(cipmod.getCsfdz2())));
        }
        //COV收款非银行支付机构地址3
        if(StringUtils.isNotEmpty(cipmod.getCsfdz3())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址3", "field", ":SFD3:", "value", formatTxt(cipmod.getCsfdz3())));
        }
        //COV收款非银行支付机构地址4
        if(StringUtils.isNotEmpty(cipmod.getCsfdz4())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址4", "field", ":SFD4:", "value", formatTxt(cipmod.getCsfdz4())));
        }
        //COV收款非银行支付机构地址5
        if(StringUtils.isNotEmpty(cipmod.getCsfdz5())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址5", "field", ":SFD5:", "value", formatTxt(cipmod.getCsfdz5())));
        }
        //COV收款非银行支付机构地址6
        if(StringUtils.isNotEmpty(cipmod.getCsfdz6())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址6", "field", ":SFD6:", "value", formatTxt(cipmod.getCsfdz6())));
        }
        //COV收款非银行支付机构地址7
        if(StringUtils.isNotEmpty(cipmod.getCsfdz7())){
            msgBody.add(ImmutableMap.of("label", "COV收款非银行支付机构地址7", "field", ":SFD7:", "value", formatTxt(cipmod.getCsfdz7())));
        }
        //订单编号
        if(StringUtils.isNotEmpty(cipmod.getDdbhao())){
            msgBody.add(ImmutableMap.of("label", "订单编号", "field", ":DDBO:", "value", cipmod.getDdbhao()));
        }
        //订单描述
        if(StringUtils.isNotEmpty(cipmod.getDdmisu())){
            msgBody.add(ImmutableMap.of("label", "订单描述", "field", ":DDMS:", "value", formatTxt(cipmod.getDdmisu())));
        }
        if("X".equals(cipmod.getCovflg())){
            //COV付款人开户行行号
            if(StringUtils.isNotEmpty(cipmod.getCfkkhh())){
                msgBody.add(ImmutableMap.of("label", "COV付款人开户行行号", "field", ":CFKH:", "value", cipmod.getCfkkhh()));
            }
            //COV付款人开户行名称(COV付款非银行支付机构名称)
            if(StringUtils.isNotEmpty(cipmod.getCfkkhm())){
                msgBody.add(ImmutableMap.of("label", "COV付款人开户行名称(COV付款非银行支付机构名称)", "field", ":CFKM:", "value", cipmod.getCfkkhm()));
            }
            //COV付款人账号
            if(StringUtils.isNotEmpty(cipmod.getCfkrzh())){
                msgBody.add(ImmutableMap.of("label", "COV付款人账号", "field", ":CFRZ:", "value", cipmod.getCfkrzh()));
            }
            //COV付款人名称
            if(StringUtils.isNotEmpty(cipmod.getCfkrmc())){
                msgBody.add(ImmutableMap.of("label", "COV付款人名称", "field", ":CFRM:", "value", cipmod.getCfkrmc()));
            }
            //COV付款人地址1
            if(StringUtils.isNotEmpty(cipmod.getCfkdz1())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址1", "field", ":CFD1:", "value", formatTxt(cipmod.getCfkdz1())));
            }
            //COV付款人地址2
            if(StringUtils.isNotEmpty(cipmod.getCfkdz2())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址2", "field", ":CFD2:", "value", formatTxt(cipmod.getCfkdz2())));
            }
            //COV付款人地址3
            if(StringUtils.isNotEmpty(cipmod.getCfkdz3())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址3", "field", ":CFD3:", "value", formatTxt(cipmod.getCfkdz3())));
            }
            //COV付款人地址4
            if(StringUtils.isNotEmpty(cipmod.getCfkdz4())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址4", "field", ":CFD4:", "value", formatTxt(cipmod.getCfkdz4())));
            }
            //COV付款人地址5
            if(StringUtils.isNotEmpty(cipmod.getCfkdz5())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址5", "field", ":CFD5:", "value", formatTxt(cipmod.getCfkdz5())));
            }
            //COV付款人地址6
            if(StringUtils.isNotEmpty(cipmod.getCfkdz6())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址6", "field", ":CFD6:", "value", formatTxt(cipmod.getCfkdz6())));
            }
            //COV付款人地址7
            if(StringUtils.isNotEmpty(cipmod.getCfkdz7())){
                msgBody.add(ImmutableMap.of("label", "COV付款人地址7", "field", ":CFD7:", "value", formatTxt(cipmod.getCfkdz7())));
            }
            //COV收款人开户行行号
            if(StringUtils.isNotEmpty(cipmod.getCskkhh())){
                msgBody.add(ImmutableMap.of("label", "COV收款人开户行行号", "field", ":CSKH:", "value", cipmod.getCskkhh()));
            }
            //COV收款人开户行名称(COV收款非银行支付机构名称)
            if(StringUtils.isNotEmpty(cipmod.getCskkhm())){
                msgBody.add(ImmutableMap.of("label", "COV收款人开户行名称(COV收款非银行支付机构名称)", "field", ":CSKM:", "value", cipmod.getCskkhm()));
            }
            //COV收款人账号
            if(StringUtils.isNotEmpty(cipmod.getCskrzh())){
                msgBody.add(ImmutableMap.of("label", "COV收款人账号", "field", ":CSRZ:", "value", cipmod.getCskrzh()));
            }
            //COV收款人名称
            if(StringUtils.isNotEmpty(cipmod.getCskrmc())){
                msgBody.add(ImmutableMap.of("label", "COV收款人名称", "field", ":CSRM:", "value", cipmod.getCskrmc()));
            }
            //COV收款人地址1
            if(StringUtils.isNotEmpty(cipmod.getCskdz1())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址1", "field", ":CSD1:", "value", formatTxt(cipmod.getCskdz1())));
            }
            //COV收款人地址2
            if(StringUtils.isNotEmpty(cipmod.getCskdz2())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址2", "field", ":CSD2:", "value", formatTxt(cipmod.getCskdz2())));
            }
            //COV收款人地址3
            if(StringUtils.isNotEmpty(cipmod.getCskdz3())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址3", "field", ":CSD3:", "value", formatTxt(cipmod.getCskdz3())));
            }
            //COV收款人地址4
            if(StringUtils.isNotEmpty(cipmod.getCskdz4())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址4", "field", ":CSD4:", "value", formatTxt(cipmod.getCskdz4())));
            }
            //COV收款人地址5
            if(StringUtils.isNotEmpty(cipmod.getCskdz5())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址5", "field", ":CSD5:", "value", formatTxt(cipmod.getCskdz5())));
            }
            //COV收款人地址6
            if(StringUtils.isNotEmpty(cipmod.getCskdz6())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址6", "field", ":CSD6:", "value", formatTxt(cipmod.getCskdz6())));
            }
            //COV收款人地址7
            if(StringUtils.isNotEmpty(cipmod.getCskdz7())){
                msgBody.add(ImmutableMap.of("label", "COV收款人地址7", "field", ":CSD7:", "value", formatTxt(cipmod.getCskdz7())));
            }
            //COV中介机构1
            if(StringUtils.isNotEmpty(cipmod.getCzjjg1())){
                msgBody.add(ImmutableMap.of("label", "COV中介机构1", "field", ":CZJ1:", "value", cipmod.getCzjjg1()));
            }
            //COV中介机构1名称
            if(StringUtils.isNotEmpty(cipmod.getCzj1mc())){
                msgBody.add(ImmutableMap.of("label", "COV中介机构1名称", "field", ":CZJ1M:", "value", cipmod.getCzj1mc()));
            }
            //COV附言1
            if(StringUtils.isNotEmpty(cipmod.getCovfuy())){
                msgBody.add(ImmutableMap.of("label", "COV附言1", "field", ":CFY1:", "value", formatTxt(cipmod.getCovfuy())));
            }
            //COV附言2
            if(StringUtils.isNotEmpty(cipmod.getCovfy2())){
                msgBody.add(ImmutableMap.of("label", "COV附言2", "field", ":CFY2:", "value", formatTxt(cipmod.getCovfy2())));
            }
            //COV附言3
            if(StringUtils.isNotEmpty(cipmod.getCovfy3())){
                msgBody.add(ImmutableMap.of("label", "COV附言3", "field", ":CFY3:", "value", formatTxt(cipmod.getCovfy3())));
            }
            //COV附言4
            if(StringUtils.isNotEmpty(cipmod.getCovfy4())){
                msgBody.add(ImmutableMap.of("label", "COV附言4", "field", ":CFY4:", "value", formatTxt(cipmod.getCovfy4())));
            }
        }
        //致收款人银行附言1
        if(StringUtils.isNotEmpty(cipmod.getFuyns1())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言1", "field", ":FYS1:", "value", formatTxt(cipmod.getFuyns1())));
        }
        //致收款人银行附言2
        if(StringUtils.isNotEmpty(cipmod.getFuyns2())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言2", "field", ":FYS2:", "value", formatTxt(cipmod.getFuyns2())));
        }
        //致收款人银行附言3
        if(StringUtils.isNotEmpty(cipmod.getFuyns3())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言3", "field", ":FYS3:", "value", formatTxt(cipmod.getFuyns3())));
        }
        //致收款人银行附言4
        if(StringUtils.isNotEmpty(cipmod.getFuyns4())){
            msgBody.add(ImmutableMap.of("label", "致收款人银行附言4", "field", ":FYS4:", "value", formatTxt(cipmod.getFuyns4())));
        }
        map.put("msgBody",msgBody);
    }

    /**
     * 将回车换行替换成<BR/>
     * @return
     */
    private String formatTxt(String value) {
        if (StringUtils.isNotEmpty(value)) {
            return value.replaceAll("\r?\n", "<br/>").replaceAll(" ", "&nbsp;");
        }
        return "";
    }
}
