Ver Fonte

20240911_sun

15143018065 há 1 mês atrás
pai
commit
d2585ef133

+ 20 - 3
ruoyi-api/ruoyi-api-system/pom.xml

@@ -8,7 +8,7 @@
         <version>3.6.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-    
+
     <artifactId>ruoyi-api-system</artifactId>
 
     <description>
@@ -16,7 +16,7 @@
     </description>
 
     <dependencies>
-		
+
         <!-- RuoYi Common Core-->
         <dependency>
             <groupId>com.ruoyi</groupId>
@@ -35,6 +35,23 @@
             <version>${druid.version}</version>
         </dependency>
 
+        <!-- 阿里云短信相关 -->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.5.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>dysmsapi20170525</artifactId>
+            <version>2.0.22</version>
+        </dependency>
+
     </dependencies>
 
-</project>
+</project>

+ 71 - 0
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/utils/AliyunConfig.java

@@ -0,0 +1,71 @@
+package com.ruoyi.system.utils;
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.exceptions.ServerException;
+import com.aliyuncs.profile.DefaultProfile;
+import com.google.gson.Gson;
+import java.util.*;
+import com.aliyuncs.dysmsapi.model.v20170525.*;
+import org.springframework.util.ObjectUtils;
+
+public class AliyunConfig {
+
+    public static void main(String[] args) {
+        try {
+            String res = sendSms("15143018065", "{\"name\":\""
+                    + "孙坤阳" + "\", \"type\":\"跌倒\"}");
+            if (org.apache.commons.lang3.ObjectUtils.isEmpty(res)) {
+                System.out.println("阿里云短信服务连接异常");
+            }
+            System.out.println(res);
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+    private static DefaultProfile PROFILE;
+
+    private static final String ACCESS_KEY_ID = "LTAI5tNSsCKLJ8oQh4pNDTip";
+
+    private static final String ACCESS_KEY_SECRET = "XjTV9GW2W7DCcjAKXO8TCk3MXzpymy";
+
+    private static final String TEMPLETE_CODE = "SMS_274930423";
+
+    private static final String SIGN_NAME = "吉林省盛创科技";
+
+    public static String sendSms(String phone, String param) throws Exception {
+        if (ObjectUtils.isEmpty(PROFILE)) {
+            PROFILE = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY_ID, ACCESS_KEY_SECRET);
+        }
+        /** use STS Token
+         DefaultProfile profile = DefaultProfile.getProfile(
+         "<your-region-id>",           // The region ID
+         "<your-access-key-id>",       // The AccessKey ID of the RAM account
+         "<your-access-key-secret>",   // The AccessKey Secret of the RAM account
+         "<your-sts-token>");          // STS Token
+         **/
+        IAcsClient client = new DefaultAcsClient(PROFILE);
+
+        SendSmsRequest request = new SendSmsRequest();
+        request.setPhoneNumbers(phone);//接收短信的手机号码
+        request.setSignName(SIGN_NAME);//短信签名名称
+        request.setTemplateCode(TEMPLETE_CODE);//短信模板CODE
+        request.setTemplateParam(param);//短信模板变量对应的实际值
+        try {
+            SendSmsResponse response = client.getAcsResponse(request);
+            System.out.println(new Gson().toJson(response));
+            if (response.getCode() != null && response.getCode().equals("OK")) {
+                return "0";
+            } else {
+                return "500";
+            }
+        } catch (ClientException e) {
+            System.out.println("ErrCode:" + e.getErrCode());
+            System.out.println("ErrMsg:" + e.getErrMsg());
+            System.out.println("RequestId:" + e.getRequestId());
+        }
+        return null;
+    }
+}

+ 8 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/WlfwYjbw.java

@@ -117,6 +117,14 @@ public class WlfwYjbw extends BaseEntity
 
     private String cljg;
 
+    private String xxlx;
+
+    private String fjxx1;
+
+    private String fjxx2;
+
+    private String fjxx3;
+
     @TableField(exist = false)
     private String lrXm;
 

+ 4 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/WlfwYjbwMapper.xml

@@ -33,6 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateUnit"    column="update_unit"    />
         <result property="updateUnitName"    column="update_unit_name"    />
         <result property="state"    column="state"    />
+        <result property="xxlx"    column="xxlx"    />
+        <result property="fjxx1"    column="fjxx1"    />
+        <result property="fjxx2"    column="fjxx2"    />
+        <result property="fjxx3"    column="fjxx3"    />
     </resultMap>
 
     <select id="getAdc" parameterType="WlfwYjbw" resultType="java.util.Map">

+ 40 - 16
ruoyi-ui/src/views/system/yjbw/index.vue

@@ -1,10 +1,21 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="报文类型" prop="bwlx">
-        <el-select v-model="queryParams.bwlx" placeholder="请选择报文类型" clearable>
+<!--      <el-form-item label="报文类型" prop="bwlx">-->
+<!--        <el-select v-model="queryParams.bwlx" placeholder="请选择报文类型" clearable>-->
+<!--          <el-option-->
+<!--            v-for="dict in dict.type.WL004"-->
+<!--            :key="dict.value"-->
+<!--            :label="dict.label"-->
+<!--            :value="dict.value"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+
+      <el-form-item label="信息类型" prop="xxlx">
+        <el-select v-model="queryParams.xxlx" placeholder="请选择信息类型" clearable>
           <el-option
-            v-for="dict in dict.type.WL004"
+            v-for="dict in dict.type.WL015"
             :key="dict.value"
             :label="dict.label"
             :value="dict.value"
@@ -82,9 +93,9 @@
           {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
         </template>
       </el-table-column>
-      <el-table-column label="报文类型" align="center" prop="bwlx">
+      <el-table-column label="信息类型" align="center" prop="xxlx">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.WL004" :value="scope.row.bwlx"/>
+          <dict-tag :options="dict.type.WL015" :value="scope.row.xxlx"/>
         </template>
       </el-table-column>
       <el-table-column label="设备编号" align="center" prop="sbbh"/>
@@ -94,7 +105,7 @@
           <span>{{ special(scope.row.sbsj, 'time') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="触发原因" align="center" prop="cfjg"/>
+      <el-table-column label="触发结果" align="center" prop="cfjg"/>
       <el-table-column label="是否处理" align="center" prop="iscl">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.CZ035" :value="scope.row.iscl"/>
@@ -103,7 +114,7 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
         <template slot-scope="scope">
           <el-button
-            v-if="scope.row.iscl === '0'"
+            v-if="scope.row.iscl === '0' && scope.row.xxlx === '监控报警'"
             size="mini"
             type="text"
             icon="el-icon-edit"
@@ -145,26 +156,38 @@
         <h3>智能硬件报文信息</h3>
         <table>
           <tr>
+            <td>信息类型</td>
+            <td>{{ translateDict('WL015', form.xxlx) }}</td>
             <td>报文类型</td>
             <td>{{ translateDict('WL004', form.bwlx) }}</td>
-            <td>设备编号</td>
-            <td>{{ form.sbbh }}</td>
           </tr>
           <tr>
+            <td>设备编号</td>
+            <td>{{ form.sbbh }}</td>
             <td>归属老人</td>
             <td>{{ form.lrXm }}</td>
+          </tr>
+          <tr>
             <td>接收时间</td>
             <td>{{ special(form.sbsj, 'time') }}</td>
+            <td>触发结果</td>
+            <td>{{ form.cfjg }}</td>
           </tr>
           <tr>
-            <td>触发原因</td>
-            <td>{{ form.cfjg }}</td>
-            <td>处理结果</td>
-            <td>{{ form.cljg }}</td>
+            <td>附加信息</td>
+            <td colspan="3">{{ form.fjxx1 }}</td>
+          </tr>
+          <tr>
+            <td>附加信息</td>
+            <td colspan="3">{{ form.fjxx2 }}</td>
           </tr>
           <tr>
-            <td>报文信息</td>
-            <td colspan="3">{{ form.jbsj }}</td>
+            <td>附加信息</td>
+            <td colspan="3">{{ form.fjxx3 }}</td>
+          </tr>
+          <tr>
+            <td>处理结果</td>
+            <td colspan="3">{{ form.cljg }}</td>
           </tr>
         </table>
       </el-scrollbar>
@@ -198,7 +221,7 @@ import {mapState} from "vuex";
 
 export default {
   name: "Yjbw",
-  dicts: ['WL004', 'CZ035'],
+  dicts: ['WL004', 'WL015', 'CZ035'],
   computed: {
     ...mapState(['user'])
   },
@@ -235,6 +258,7 @@ export default {
         bwlx: null,
         sbbh: null,
         lrId: null,
+        xxlx: '监控报警',
       },
       paramJg: '',
       // 表单参数