Răsfoiți Sursa

根据现场调试修改短信服务

gaoxiong 1 an în urmă
părinte
comite
0e48e179f3

+ 9 - 4
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteSmsService.java

@@ -1,15 +1,20 @@
 package com.xunmei.system.api;
 
 import com.xunmei.common.core.constant.ServiceNameConstants;
-import com.xunmei.system.api.factory.RemoteUserFallbackFactory;
+import com.xunmei.common.core.domain.R;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.system.api.factory.RemoteSmsFallbackFactory;
+import com.xunmei.system.api.vo.SmsInfoVo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
-@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SMS, fallbackFactory = RemoteUserFallbackFactory.class)
+@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SMS, fallbackFactory = RemoteSmsFallbackFactory.class)
 public interface RemoteSmsService {
 
-    @GetMapping("/test/send")
-    String testSms(@RequestParam(value = "orgId") Long orgId);
+    @PostMapping("/api/sms/send")
+    R<AjaxResult> sendSms(@RequestBody SmsInfoVo smsData);
 
 }

+ 5 - 2
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteSmsFallbackFactory.java

@@ -1,6 +1,9 @@
 package com.xunmei.system.api.factory;
 
+import com.xunmei.common.core.domain.R;
+import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.system.api.RemoteSmsService;
+import com.xunmei.system.api.vo.SmsInfoVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;
@@ -19,8 +22,8 @@ public class RemoteSmsFallbackFactory implements FallbackFactory<RemoteSmsServic
         log.error("用户服务调用失败:{}", throwable.getMessage());
         return new RemoteSmsService() {
             @Override
-            public String testSms(Long orgId) {
-                return "error";
+            public R<AjaxResult> sendSms(SmsInfoVo smsData) {
+                return null;
             }
         };
     }

+ 111 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/vo/SmsInfoVo.java

@@ -0,0 +1,111 @@
+package com.xunmei.system.api.vo;
+
+import lombok.Data;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author wubiyu[2024/03/18]
+ */
+@Data
+public class SmsInfoVo {
+    private static Logger logger = LoggerFactory.getLogger(SmsInfoVo.class);
+    /**
+     * 交易类型
+     */
+    private String tranType;
+    /**
+     * 机构号
+     */
+    private String branchId;
+    /**
+     * 所属机构号
+     */
+    private String belongBranchId;
+    /**
+     * 消费者系统流水号
+     */
+    private String consumerSeqNo;
+    /**
+     * 客户号
+     */
+    private String custNo;
+    /**
+     * 客户姓名
+     */
+    private String custName;
+
+    /**
+     * 性别
+     */
+    private String sex;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 帐号
+     */
+    private String acctNo;
+    /**
+     * 发生日期 格式:yyyy-MM-dd
+     */
+    private String occurDate;
+    /**
+     * 发生时间:格式:Hh:mm:ss
+     */
+    private String occurTime;
+    /**
+     * 交易金额1
+     */
+    private String tranAmt1;
+    /**
+     * 交易金额1
+     */
+    private String tranAmt2;
+    /**
+     * 交易金额1
+     */
+    private String tranAmt3;
+
+    /**
+     * 支出/存入位1
+     */
+    private String payoutStoreBit1;
+    /**
+     * 支出/存入位2
+     */
+    private String payoutStoreBit2;
+    /**
+     * 支出/存入位1
+     */
+    private String payoutStoreBit3;
+
+    /**
+     * 交易摘要
+     */
+    private String tranRemark;
+    /**
+     * 帐户状态
+     */
+    private String acctStatus;
+    /**
+     * 渠道类型
+     */
+    private String channelType;
+    /**
+     * 备用1
+     */
+    private String bak1;
+    /**
+     * 备用2
+     */
+    private String bak2;
+    /**
+     * 备用3
+     */
+    private String bak3;
+
+}

+ 3 - 0
soc-modules/soc-modules-sms/pom.xml

@@ -135,6 +135,9 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
                 <executions>
                     <execution>
                         <goals>

+ 1 - 1
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/controller/SmsController.java

@@ -3,7 +3,7 @@ package com.xunmei.sms.controller;
 import com.xunmei.common.core.web.controller.BaseController;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.sms.service.ISmsService;
-import com.xunmei.sms.vo.SmsInfoVo;
+import com.xunmei.system.api.vo.SmsInfoVo;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;

+ 1 - 1
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/service/ISmsService.java

@@ -1,7 +1,7 @@
 package com.xunmei.sms.service;
 
 import com.xunmei.common.core.web.domain.AjaxResult;
-import com.xunmei.sms.vo.SmsInfoVo;
+import com.xunmei.system.api.vo.SmsInfoVo;
 
 /**
  * 短信服务

+ 42 - 7
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/service/SmsService.java

@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
 import com.dc.eai.data.CompositeData;
 import com.dcfs.esb.client.ESBClient;
 import com.xunmei.common.core.web.domain.AjaxResult;
-import com.xunmei.sms.vo.SmsInfoVo;
+import com.xunmei.sms.utils.SmsUtil;
+import com.xunmei.system.api.vo.SmsInfoVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 @Service
@@ -15,25 +18,54 @@ public class SmsService implements ISmsService {
     private static Logger logger = LoggerFactory.getLogger(SmsService.class);
 
     /**
+     * 在ESB系统里的 系统编码
+     */
+    @Value("${systemCode}")
+    private String systemCode;
+
+    /**
+     * 系统名称
+     */
+    @Value("${systemName}")
+    private String systemName;
+
+
+    /**
+     * 服务代码
+     */
+    @Value("${serviceCode}")
+    private String serviceCode;
+
+    /**
+     * 服务场景
+     */
+    @Value("${serviceScene}")
+    private String serviceScene;
+
+
+
+
+    /**
      * 发送短信
      * @param data
      * @return {@link AjaxResult}
      */
     @Override
+    @Async
     public AjaxResult send(SmsInfoVo data) {
         try {
-            logger.debug("【发送短信】开始,数据:" + JSONObject.toJSONString(data));
-            CompositeData smsCompositeData = SmsInfoVo.convertTo(data);
-
+            logger.debug("【发送短信】开始,数据:" + JSONObject.toJSON(data));
+            CompositeData smsCompositeData = SmsUtil.createSmsBody(data,systemCode,systemName,serviceCode,serviceScene);
+            logger.debug("【发送短信】转换后数据:" + JSONObject.toJSON(smsCompositeData));
             if (smsCompositeData == null) {
-                logger.error("【发送短信】转换数据出错:原数据:"+JSONObject.toJSONString(data));
+                logger.error("【发送短信】转换数据出错:原数据:"+JSONObject.toJSON(data));
                 return AjaxResult.error("【发送短信】转换数据出错");
             }
             CompositeData rspData = ESBClient.request(smsCompositeData);
-            logger.debug("【发送短信】返回数据:" + JSONObject.toJSONString(rspData));
+            logger.debug("【发送短信】返回数据:" + JSONObject.toJSON(rspData));
             return getResult(rspData);
         } catch (Exception ex) {
-            logger.error("【发送短信】发送时内部异常:数据:"+JSONObject.toJSONString(data),ex);
+            logger.error("【发送短信】发送时内部异常:数据:"+JSONObject.toJSON(data),ex);
             return AjaxResult.error("【发送短信】发送时内部异常");
         }
     }
@@ -56,4 +88,7 @@ public class SmsService implements ISmsService {
             return AjaxResult.error("【发送短信】解析发送结果时内部异常");
         }
     }
+
+
+
 }

+ 313 - 0
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/utils/SmsUtil.java

@@ -0,0 +1,313 @@
+package com.xunmei.sms.utils;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.RandomUtil;
+import com.dc.eai.data.CompositeData;
+import com.dc.eai.data.Field;
+import com.dc.eai.data.FieldAttr;
+import com.dc.eai.data.FieldType;
+import com.xunmei.system.api.vo.SmsInfoVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+
+/**
+ * 短信工具类
+ */
+public class SmsUtil {
+
+    private static Logger logger = LoggerFactory.getLogger(SmsUtil.class);
+
+
+    /**
+     * 消费者系统流水号格式:系统编号(5位)+本系统交易日期(8位:YYYYMMDD)+业务流水序号(10位)
+     * @param systemCode 系统编号
+     * @return
+     */
+    public static String getConsumerSeqNo(String systemCode,String tranDate){
+        StringBuffer sb = new StringBuffer();
+
+        //系统编号
+        sb.append(systemCode);
+
+        //本系统交易日期
+        sb.append(tranDate);
+
+        //业务流水序号
+        String seqNo = RandomUtil.randomNumbers(10);
+        sb.append(seqNo);
+
+        return sb.toString();
+    }
+
+
+
+    /**
+     * 生成短信请求系统头
+     * @return
+     */
+    public static CompositeData getSysHead(String systemCode,String systemName,String serviceCode,String serviceScene){
+        CompositeData sysData = new CompositeData();
+
+        Date nowTime = new Date();
+
+        String yyyyMMdd = DateUtil.format(nowTime, "yyyyMMdd");
+
+        String hhmmss = DateUtil.format(nowTime, "hhmmss");
+
+        //发送方机构ID,当前系统没有设置为空
+        Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue("");
+        sysData.addField("BRANCH_ID", field);
+
+        //消费者系统编号  ESB分配的系统编号
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(systemCode);
+        sysData.addField("CONSUMER_ID", field);
+
+        //消费者系统流水号(直接请求系统) 系统编号(5位)+本系统交易日期(8位:YYYYMMDD)+业务流水序号(10位)
+        String consumerSeqNo = SmsUtil.getConsumerSeqNo(systemCode,yyyyMMdd);
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(consumerSeqNo);
+        sysData.addField("CONSUMER_SEQ_NO", field);
+
+        //文件标识 0-非文件,1-文件
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue("0");
+        sysData.addField("FILE_FLAG", field);
+
+        //原始发起方系统编号 和消费者系统编号一致
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(systemCode);
+        sysData.addField("ORG_SYS_ID", field);
+
+        //原始发起方系统流水号 和 消费者系统编号一致
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(consumerSeqNo);
+        sysData.addField("ORG_SYS_SEQ_NO", field);
+
+        //服务代码
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(serviceCode);
+        sysData.addField("SERVICE_CODE", field);
+
+        //服务场景
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(serviceScene);
+        sysData.addField("SERVICE_SCENE", field);
+
+        //发送方网点号,默认设置为空
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue("");
+        sysData.addField("SUB_BRANCH_ID", field);
+
+        //交易日期 yyyyMMdd
+
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(yyyyMMdd);
+        sysData.addField("TRAN_DATE", field);
+
+        //交易时间 hh:mm:ss
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(hhmmss);
+        sysData.addField("TRAN_TIMESTAMP", field);
+
+        //交易标志 0-正常,1-补正,2-冲销
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue("0");
+        sysData.addField("TRAN_FLAG", field);
+
+        //交易模式
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue("ONLINE");
+        sysData.addField("TRAN_MODE", field);
+
+
+        //交易柜员号,默认为空
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue("");
+        sysData.addField("USER_ID", field);
+
+        //交易系统名
+        field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
+        field.setValue(systemName);
+        sysData.addField("WS_ADDR", field);
+
+        return sysData;
+    }
+
+
+    /**
+     * 构建应用消息体
+     * @return
+     */
+    private static CompositeData getAppHead(){
+        CompositeData appData = new CompositeData();
+
+        //KEY_MSG_FLAG 0-无,1-多页式
+        Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
+        field.setValue("0");
+        appData.addField("KEY_MSG_FLAG", field);
+
+        return appData;
+    }
+
+    /**
+     * 构建发送消息体
+     * @param source
+     * @return
+     */
+    private static CompositeData getBody(SmsInfoVo source){
+        CompositeData body = new CompositeData();
+
+        if (source.getTranType() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 6, 0));
+            field.setValue(source.getTranType());
+            body.addField("TRAN_TYPE", field);
+        }
+
+        if (source.getBelongBranchId() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 9, 0));
+            field.setValue(source.getBelongBranchId());
+            body.addField("BELONG_BRANCH_ID", field);
+        }
+
+        if (source.getCustNo() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 22, 0));
+            field.setValue(source.getCustNo());
+            body.addField("CUST_NO", field);
+        }
+
+        if (source.getCustName() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
+            field.setValue(source.getCustNo());
+            body.addField("CUST_NAME", field);
+        }
+        if (source.getSex() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 2, 0));
+            field.setValue(source.getSex());
+            body.addField("SEX", field);
+        }
+        if (source.getMobile() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 20, 0));
+            field.setValue(source.getMobile());
+            body.addField("MOBILE", field);
+        }
+        if (source.getAcctNo() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 32, 0));
+            field.setValue(source.getAcctNo());
+            body.addField("ACCT_NO", field);
+        }
+
+        if (source.getOccurDate() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 10, 0));
+            field.setValue(source.getOccurDate());
+            body.addField("OCCUR_DATE", field);
+        }
+
+        if (source.getOccurTime() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 10, 0));
+            field.setValue(source.getOccurTime());
+            body.addField("OCCUR_TIME", field);
+        }
+
+        if (source.getTranAmt1() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 17, 0));
+            field.setValue(source.getTranAmt1());
+            body.addField("TRAN_AMT1", field);
+        }
+
+        if (source.getTranAmt2() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 17, 0));
+            field.setValue(source.getTranAmt2());
+            body.addField("TRAN_AMT2", field);
+        }
+
+        if (source.getTranAmt3() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 17, 0));
+            field.setValue(source.getTranAmt3());
+            body.addField("TRAN_AMT3", field);
+        }
+
+        if (source.getPayoutStoreBit1() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
+            field.setValue(source.getPayoutStoreBit1());
+            body.addField("PAYOUT_STORE_BIT1", field);
+        }
+        if (source.getPayoutStoreBit2() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
+            field.setValue(source.getPayoutStoreBit2());
+            body.addField("PAYOUT_STORE_BIT2", field);
+        }
+        if (source.getPayoutStoreBit3() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
+            field.setValue(source.getPayoutStoreBit3());
+            body.addField("PAYOUT_STORE_BIT3", field);
+        }
+        if (source.getTranRemark() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 30, 0));
+            field.setValue(source.getTranRemark());
+            body.addField("TRAN_REMARK", field);
+        }
+        if (source.getAcctStatus() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 100, 0));
+            field.setValue(source.getAcctStatus());
+            body.addField("ACCT_STATUS", field);
+        }
+        if (source.getChannelType() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 2, 0));
+            field.setValue(source.getChannelType());
+            body.addField("CHANNEL_TYPE", field);
+        }
+        if (source.getBak1() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
+            field.setValue(source.getBak1());
+            body.addField("BAK1", field);
+        }
+        if (source.getBak2() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
+            field.setValue(source.getBak2());
+            body.addField("BAK2", field);
+        }
+        if (source.getBak3() != null) {
+            Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
+            field.setValue(source.getBak3());
+            body.addField("BAK3", field);
+        }
+
+        return body;
+    }
+
+
+    /**
+     * 构建发送消息体
+     * @param source 构建body实体
+     * @param systemCode 系统编号
+     * @param systemName 系统名称
+     * @param serviceCode 服务code
+     * @param serviceScene 服务场景
+     * @return
+     */
+    public static CompositeData createSmsBody(SmsInfoVo source, String systemCode, String systemName, String serviceCode, String serviceScene) {
+        try {
+            /***********************************************************************
+             * *********构造请求数据,定义相关结构体*******
+             **********************************************************************/
+            CompositeData reqData = new CompositeData();
+            //构建服务
+            CompositeData sysHead = getSysHead(systemCode, systemName, serviceCode, serviceScene);
+            CompositeData appHead = getAppHead();
+            CompositeData body = getBody(source);
+            reqData.addStruct("SYS_HEAD", sysHead);
+            reqData.addStruct("APP_HEAD", appHead);
+            reqData.addStruct("BODY", body);
+
+            return reqData;
+        } catch (Exception ex) {
+            logger.error("【发送短信】转换数据异常", ex);
+            return null;
+        }
+    }
+
+}

+ 0 - 262
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/vo/SmsInfoVo.java

@@ -1,262 +0,0 @@
-package com.xunmei.sms.vo;
-
-import com.dc.eai.data.CompositeData;
-import com.dc.eai.data.Field;
-import com.dc.eai.data.FieldAttr;
-import com.dc.eai.data.FieldType;
-import lombok.Data;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author wubiyu[2024/03/18]
- */
-@Data
-public class SmsInfoVo {
-    private static Logger logger = LoggerFactory.getLogger(SmsInfoVo.class);
-    /**
-     * 交易类型
-     */
-    private String tranType;
-    /**
-     * 机构号
-     */
-    private String branchId;
-    /**
-     * 消费者系统流水号
-     */
-    private String consumerSeqNo;
-    /**
-     * 客户号
-     */
-    private String custNo;
-    /**
-     * 客户姓名
-     */
-    private String custName;
-
-    /**
-     * 性别
-     */
-    private String sex;
-
-    /**
-     * 手机号
-     */
-    private String mobile;
-
-    /**
-     * 帐号
-     */
-    private String acctNo;
-    /**
-     * 发生日期 格式:yyyy-MM-dd
-     */
-    private String occurDate;
-    /**
-     * 发生时间:格式:Hh:mm:ss
-     */
-    private String occurTime;
-    /**
-     * 交易金额1
-     */
-    private String tranAmt1;
-    /**
-     * 交易金额1
-     */
-    private String tranAmt2;
-    /**
-     * 交易金额1
-     */
-    private String tranAmt3;
-
-    /**
-     * 支出/存入位1
-     */
-    private String payoutStoreBit1;
-    /**
-     * 支出/存入位2
-     */
-    private String payoutStoreBit2;
-    /**
-     * 支出/存入位1
-     */
-    private String payoutStoreBit3;
-
-    /**
-     * 交易摘要
-     */
-    private String tranRemark;
-    /**
-     * 帐户状态
-     */
-    private String acctStatus;
-    /**
-     * 渠道类型
-     */
-    private String channelType;
-    /**
-     * 备用1
-     */
-    private String bak1;
-    /**
-     * 备用2
-     */
-    private String bak2;
-    /**
-     * 备用3
-     */
-    private String bak3;
-
-    public static CompositeData convertTo(SmsInfoVo source) {
-        try {
-            /***********************************************************************
-             * *********构造请求数据,定义相关结构体*******
-             **********************************************************************/
-            CompositeData reqData = new CompositeData();
-            CompositeData sysData = new CompositeData();
-            CompositeData appData = new CompositeData();
-            CompositeData body = new CompositeData();
-
-            reqData.addStruct("SYS_HEAD", sysData);
-            reqData.addStruct("APP_HEAD", appData);
-            reqData.addStruct("BODY", body);
-
-            /***********************************************************************
-             * ********* 系统头 ******************
-             **********************************************************************/
-            if (source.getConsumerSeqNo() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 15, 0));
-                field.setValue(source.getConsumerSeqNo());
-                sysData.addField("CONSUMER_SEQ_NO", field);
-            }
-
-            /***********************************************************************
-             * ********** 应用头 ***************
-             **********************************************************************/
-            if (source.getBranchId() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 9, 0));
-                field.setValue(source.getBranchId());
-                appData.addField("BRANCH_ID", field);
-            }
-
-            // 应用头其他需要上送的数据。。。
-
-            /***********************************************************************
-             * ************* 报文体 ************ 服务代码为11003000002,场景为07定义的输入数据
-             **********************************************************************/
-
-            if (source.getTranType() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 6, 0));
-                field.setValue(source.getTranType());
-                body.addField("TRAN_TYPE", field);
-            }
-            if (source.getCustNo() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 22, 0));
-                field.setValue(source.getCustNo());
-                body.addField("CUST_NO", field);
-            }
-
-            if (source.getCustName() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
-                field.setValue(source.getCustNo());
-                body.addField("CUST_NAME", field);
-            }
-            if (source.getSex() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 2, 0));
-                field.setValue(source.getSex());
-                body.addField("SEX", field);
-            }
-            if (source.getMobile() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 20, 0));
-                field.setValue(source.getMobile());
-                body.addField("MOBILE", field);
-            }
-            if (source.getAcctNo() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 32, 0));
-                field.setValue(source.getAcctNo());
-                body.addField("ACCT_NO", field);
-            }
-
-            if (source.getOccurDate() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 10, 0));
-                field.setValue(source.getOccurDate());
-                body.addField("OCCUR_DATE", field);
-            }
-
-            if (source.getOccurTime() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 10, 0));
-                field.setValue(source.getOccurTime());
-                body.addField("OCCUR_TIME", field);
-            }
-
-            if (source.getTranAmt1() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 17, 0));
-                field.setValue(source.getTranAmt1());
-                body.addField("TRAN_AMT1", field);
-            }
-
-            if (source.getTranAmt2() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 17, 0));
-                field.setValue(source.getTranAmt2());
-                body.addField("TRAN_AMT2", field);
-            }
-
-            if (source.getTranAmt3() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 17, 0));
-                field.setValue(source.getTranAmt3());
-                body.addField("TRAN_AMT3", field);
-            }
-
-            if (source.getPayoutStoreBit1() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
-                field.setValue(source.getPayoutStoreBit1());
-                body.addField("PAYOUT_STORE_BIT1", field);
-            }
-            if (source.getPayoutStoreBit2() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
-                field.setValue(source.getPayoutStoreBit2());
-                body.addField("PAYOUT_STORE_BIT2", field);
-            }
-            if (source.getPayoutStoreBit3() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 1, 0));
-                field.setValue(source.getPayoutStoreBit3());
-                body.addField("PAYOUT_STORE_BIT3", field);
-            }
-            if (source.getTranRemark() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 30, 0));
-                field.setValue(source.getTranRemark());
-                body.addField("TRAN_REMARK", field);
-            }
-            if (source.getAcctStatus() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 100, 0));
-                field.setValue(source.getAcctStatus());
-                body.addField("ACCT_STATUS", field);
-            }
-            if (source.getChannelType() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 2, 0));
-                field.setValue(source.getChannelType());
-                body.addField("CHANNEL_TYPE", field);
-            }
-            if (source.getBak1() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
-                field.setValue(source.getBak1());
-                body.addField("BAK1", field);
-            }
-            if (source.getBak2() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
-                field.setValue(source.getBak2());
-                body.addField("BAK2", field);
-            }
-            if (source.getBak3() != null) {
-                Field field = new Field(new FieldAttr(FieldType.FIELD_STRING, 50, 0));
-                field.setValue(source.getBak3());
-                body.addField("BAK3", field);
-            }
-            return reqData;
-        } catch (Exception ex) {
-            logger.error("【发送短信】转换数据异常", ex);
-            return null;
-        }
-    }
-}

+ 4 - 0
soc-modules/soc-modules-sms/src/main/resources/esb-client.properties

@@ -0,0 +1,4 @@
+url=http://192.111.37.206:30174/YDAQBWGLXT
+uid=YDAQBWGLXT
+readTimeout=60
+connTimeout=10