Explorar el Código

Merge branch 'wubiyu' into V0.0.7

wubiyu hace 1 año
padre
commit
300da66712

+ 4 - 4
soc-auth/src/main/resources/bootstrap.yml

@@ -14,17 +14,17 @@ spring:
     nacos:
       discovery:
         # 服务注册地址
-        server-addr: 10.87.21.102:8848
-        namespace: 489e15c5-b16f-4c78-87f8-f398f73b6103
+        server-addr: 10.87.21.103:8847
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
       config:
         # 配置中心地址
-        server-addr: 10.87.21.102:8848
+        server-addr: 10.87.21.103:8847
         # 配置文件格式
         file-extension: yml
         # 共享配置
         shared-configs:
           - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
-        namespace: 489e15c5-b16f-4c78-87f8-f398f73b6103
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
 logging:
   file:
     name: logs/${spring.application.name}/info.log

+ 6 - 6
soc-gateway/src/main/resources/bootstrap.yml

@@ -1,6 +1,6 @@
 # Tomcat
 server:
-  port: 8080
+  port: 8081
 
 # Spring
 spring: 
@@ -14,17 +14,17 @@ spring:
     nacos:
       discovery:
         # 服务注册地址
-        server-addr: 10.87.10.54:8848
-        namespace: 083dc0cf-7829-4914-9d5c-d48f1a31015d
+        server-addr: 10.87.21.103:8847
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
       config:
         # 配置中心地址
-        server-addr: 10.87.10.54:8848
+        server-addr: 10.87.21.103:8847
         # 配置文件格式
         file-extension: yml
         # 共享配置
         shared-configs:
           - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
-        namespace: 083dc0cf-7829-4914-9d5c-d48f1a31015d
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
     sentinel:
       #取消控制台懒加载
       eager: true
@@ -33,7 +33,7 @@ spring:
       datasource:
         ds1:
           nacos:
-            server-addr: 10.87.10.54:8848
+            server-addr: 10.87.21.103:8847
             dataId: sentinel-soc-gateway
             groupId: DEFAULT_GROUP
             data-type: json

+ 2 - 2
soc-modules/soc-modules-iot/src/main/resources/bootstrap.yml

@@ -13,11 +13,11 @@ spring:
   cloud:
     nacos:
       discovery:
-        namespace: 73dccc51-5e69-4c22-985e-733be898a242
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
         # 服务注册地址
         server-addr: 10.87.21.103:8847
       config:
-        namespace: 73dccc51-5e69-4c22-985e-733be898a242
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
         # 配置中心地址
         server-addr: 10.87.21.103:8847
         # 配置文件格式

+ 4 - 4
soc-modules/soc-modules-mediator/src/main/resources/bootstrap.yml

@@ -13,13 +13,13 @@ spring:
   cloud:
     nacos:
       discovery:
-        namespace: 598294c7-43c1-4d78-a437-21669f936cbb
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
         # 服务注册地址
-        server-addr: 10.87.21.102:8848
+        server-addr: 10.87.21.103:8847
       config:
-        namespace: 598294c7-43c1-4d78-a437-21669f936cbb
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
         # 配置中心地址
-        server-addr: 10.87.21.102:8848
+        server-addr: 10.87.21.103:8847
         # 配置文件格式
         file-extension: yml
         # 共享配置

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

@@ -77,14 +77,11 @@
             <artifactId>commons-text</artifactId>
             <version>1.8</version>
         </dependency>
-
-
         <dependency>
             <groupId>com.xunmei</groupId>
             <artifactId>soc-common-swagger</artifactId>
             <version>${soc.version}</version>
         </dependency>
-
         <dependency>
             <groupId>com.xunmei</groupId>
             <artifactId>soc-common-core</artifactId>
@@ -95,6 +92,41 @@
             <artifactId>soc-api-system</artifactId>
             <version>${soc.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.dc.eai</groupId>
+            <artifactId>esb_cdpackage</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/cdpackage.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>com.dc.eai</groupId>
+            <artifactId>esb-client-api</artifactId>
+            <version>1.1.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/esb-client-api-1.1.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>com.dc.eai</groupId>
+            <artifactId>esb_framework</artifactId>
+            <version>3.0.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/framework3.0.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>com.dc.eai</groupId>
+            <artifactId>esb_security_tools</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/security_tools.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>com.dc.eai</groupId>
+            <artifactId>esb_x509</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/x509.jar</systemPath>
+        </dependency>
     </dependencies>
 
     <build>

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

@@ -0,0 +1,38 @@
+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 org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+
+/**
+ * 短信服务
+ * @author wubiyu[2024/03/15]
+ */
+@RequestMapping("/sms")
+@RestController
+public class SmsController extends BaseController {
+
+    /**
+     *短信服务
+     */
+    @Resource
+    private ISmsService smsService;
+
+    /**
+     * 发送短信
+     * @param smsData
+     * @return {@link AjaxResult}
+     */
+    @PostMapping("/send")
+    public AjaxResult send(@RequestBody SmsInfoVo smsData) {
+        return smsService.send(smsData);
+    }
+}

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

@@ -0,0 +1,17 @@
+package com.xunmei.sms.service;
+
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.sms.vo.SmsInfoVo;
+
+/**
+ * 短信服务
+ * @author wubiyu[2024/03/15]
+ */
+public interface ISmsService {
+    /**
+     * 发送短信
+     * @param data
+     * @return {@link AjaxResult}
+     */
+    AjaxResult send(SmsInfoVo data);
+}

+ 59 - 0
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/service/SmsService.java

@@ -0,0 +1,59 @@
+package com.xunmei.sms.service;
+
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SmsService implements ISmsService {
+
+    private static Logger logger = LoggerFactory.getLogger(SmsService.class);
+
+    /**
+     * 发送短信
+     * @param data
+     * @return {@link AjaxResult}
+     */
+    @Override
+    public AjaxResult send(SmsInfoVo data) {
+        try {
+            logger.debug("【发送短信】开始,数据:" + JSONObject.toJSON(data));
+            CompositeData smsCompositeData = SmsInfoVo.convertTo(data);
+            logger.debug("【发送短信】转换后数据:" + JSONObject.toJSON(smsCompositeData));
+            if (smsCompositeData == null) {
+                logger.error("【发送短信】转换数据出错:原数据:"+JSONObject.toJSON(data));
+                return AjaxResult.error("【发送短信】转换数据出错");
+            }
+            CompositeData rspData = ESBClient.request(smsCompositeData);
+            logger.debug("【发送短信】返回数据:" + JSONObject.toJSON(rspData));
+            return getResult(rspData);
+        } catch (Exception ex) {
+            logger.error("【发送短信】发送时内部异常:数据:"+JSONObject.toJSON(data),ex);
+            return AjaxResult.error("【发送短信】发送时内部异常");
+        }
+    }
+
+    private AjaxResult getResult(CompositeData repData) {
+        boolean result = false;
+        try {
+            String retStatus = repData.getStruct("SYS_HEAD")
+                    .getField("RET_STATUS").strValue();
+            String retCode = repData.getStruct("SYS_HEAD").getArray("RET")
+                    .getStruct(0).getField("RET_CODE").strValue();
+            if ("S".equals(retStatus) && "000000".equals(retCode)) {
+                return AjaxResult.success();
+            } else {
+                String retMsg = repData.getStruct("SYS_HEAD").getArray("RET")
+                        .getStruct(0).getField("RET_MSG").strValue();
+                return AjaxResult.error(retMsg);
+            }
+        } catch (Exception e) {
+            return AjaxResult.error("【发送短信】解析发送结果时内部异常");
+        }
+    }
+}

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

@@ -0,0 +1,259 @@
+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;
+
+@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;
+        }
+    }
+}

+ 30 - 0
soc-modules/soc-modules-sms/src/main/resources/bootstrap.yml

@@ -0,0 +1,30 @@
+# Tomcat
+server:
+  port: 9002
+
+# Spring
+spring: 
+  application:
+    # 应用名称
+    name: soc-sms
+  profiles:
+    # 环境配置
+    active: dev
+  cloud:
+    nacos:
+      discovery:
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
+        # 服务注册地址
+        server-addr: 10.87.21.103:8847
+      config:
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
+        # 配置中心地址
+        server-addr: 10.87.21.103:8847
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
+logging:
+  file:
+    name: logs/${spring.application.name}/info.log

+ 4 - 4
soc-modules/soc-modules-system/src/main/resources/bootstrap.yml

@@ -13,13 +13,13 @@ spring:
   cloud:
     nacos:
       discovery:
-        namespace: 73dccc51-5e69-4c22-985e-733be898a242
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
         # 服务注册地址
-        server-addr: 10.87.21.102:8848
+        server-addr: 10.87.21.103:8847
       config:
-        namespace: 73dccc51-5e69-4c22-985e-733be898a242
+        namespace: ffd30d7d-0a40-4674-ab19-e00aef378714
         # 配置中心地址
-        server-addr: 10.87.21.102:8848
+        server-addr: 10.87.21.103:8847
         # 配置文件格式
         file-extension: yml
         # 共享配置