Explorar el Código

add
mqtt信息发送

lifang hace 2 semanas
padre
commit
12de0a71ec

+ 36 - 36
nb-admin/src/main/resources/application-dev.yml

@@ -147,42 +147,42 @@ request:
     # 请求不可重复接收时间 10分钟
     repeat-interval: 600
 
-
-# 阿里云对接配置
-iot:
-  consumers:
-    - enable: false
-      consumer: com.nb.aliyun.service.consumer.NBAndFourGConsumerGroupService
-      name: NB
-      config:
-        accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
-        accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
-        consumerGroupId: "NZKDBbvhxUqtcF5VqDb2000100"
-        aliyunUid: "1238892013759131"
-        regionId: "cn-shanghai"
-        iotInstanceId: "iot-060a0bgd"
-        productKey: he1fACg7ySx
-    - enable: false
-      consumer: com.nb.aliyun.service.consumer.NBAndFourGConsumerGroupService
-      name: 4G
-      config:
-        accessKey: "LTAI5tRaK95AqvWiQ9LspZ3q"
-        accessSecret: "wZUpYGeztNcV4tGbBLfK2OvxnZzZF3"
-        consumerGroupId: "0na0olXpWEmWgMucxIH1000100"
-        aliyunUid: "1777492656465771"
-        regionId: "cn-shanghai"
-        iotInstanceId: "iot-06z00hi2guq5qi3"
-        productKey: k0g9w9xRhhi
-aliyun:
-  accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
-  accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
-
-oss:
-  aliyun:
-    accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
-    accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
-    endpoint: "oss-cn-hangzhou.aliyuncs.com"
-    bucketName: "tuoren-nb-dev"
+#
+## 阿里云对接配置
+#iot:
+#  consumers:
+#    - enable: false
+#      consumer: com.nb.aliyun.service.consumer.NBAndFourGConsumerGroupService
+#      name: NB
+#      config:
+#        accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
+#        accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
+#        consumerGroupId: "NZKDBbvhxUqtcF5VqDb2000100"
+#        aliyunUid: "1238892013759131"
+#        regionId: "cn-shanghai"
+#        iotInstanceId: "iot-060a0bgd"
+#        productKey: he1fACg7ySx
+#    - enable: false
+#      consumer: com.nb.aliyun.service.consumer.NBAndFourGConsumerGroupService
+#      name: 4G
+#      config:
+#        accessKey: "LTAI5tRaK95AqvWiQ9LspZ3q"
+#        accessSecret: "wZUpYGeztNcV4tGbBLfK2OvxnZzZF3"
+#        consumerGroupId: "0na0olXpWEmWgMucxIH1000100"
+#        aliyunUid: "1777492656465771"
+#        regionId: "cn-shanghai"
+#        iotInstanceId: "iot-06z00hi2guq5qi3"
+#        productKey: k0g9w9xRhhi
+#aliyun:
+#  accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
+#  accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
+#
+#oss:
+#  aliyun:
+#    accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
+#    accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
+#    endpoint: "oss-cn-hangzhou.aliyuncs.com"
+#    bucketName: "tuoren-nb-dev"
 notify:
   wechat:
     url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=c3e093fe-5125-47d5-a171-0f4be2f61a78

+ 5 - 5
nb-admin/src/main/resources/application.yml

@@ -102,8 +102,8 @@ management:
     web:
       exposure:
         include: heapdump,metrics
-yixinqian:
-  baseUrl: http://192.168.188.169:8091
-  appId: 1753176443000
-  appKey: 82bdcf8ea9ae053e7b30a6a5633466d6
-  tokenExpire: 3600
+#yixinqian:
+#  baseUrl: http://192.168.188.169:8091
+#  appId: 1753176443000
+#  appKey: 82bdcf8ea9ae053e7b30a6a5633466d6
+#  tokenExpire: 3600

+ 1 - 1
nb-core/src/main/java/com/nb/core/sms/AliSmsClientConfig.java

@@ -12,7 +12,7 @@ import com.aliyun.teaopenapi.models.*;
  * @Description TODO
  * @createTime 2022年10月12日 10:52:00
  */
-@Configuration
+//@Configuration
 public class AliSmsClientConfig {
     @Value("${aliyun.accessKey}")
     private String accessKeyId;

+ 6 - 3
nb-core/src/main/java/com/nb/core/sms/SmsHelper.java

@@ -6,6 +6,7 @@ import com.aliyun.dysmsapi20170525.*;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.aliyun.tea.TeaException;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 
 import java.util.Map;
@@ -18,10 +19,10 @@ import java.util.Map;
  * @createTime 2022年10月13日 09:28:00
  */
 @Configuration
-@AllArgsConstructor
 public class SmsHelper {
 
-    private final Client client;
+    @Autowired(required = false)
+    private Client client;
 
     public void sendVerifyCode(String phone,String code){
         Map<String, String> map = MapUtil.of("code", code);
@@ -46,8 +47,10 @@ public class SmsHelper {
     private void sendMsg(com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest){
         com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
         try {
+            if(client!=null){
+                SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            }
             // 复制代码运行请自行打印 API 的返回值
-            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
         } catch (TeaException error) {
             // 如有需要,请打印 error
             com.aliyun.teautil.Common.assertAsString(error.message);

+ 4 - 2
nb-service/app-assistant/src/main/java/com/nb/app/assistant/service/LocalAssistantUserBindService.java

@@ -95,7 +95,7 @@ public class LocalAssistantUserBindService extends BaseService<AssistantUserBind
     @Lazy
     private LocalImRoomService imRoomService;
 
-    @Autowired
+    @Autowired(required = false)
     @Lazy
     private SmsHelper smsHelper;
 
@@ -220,8 +220,10 @@ public class LocalAssistantUserBindService extends BaseService<AssistantUserBind
             if(consultConfig==null||!Boolean.TRUE.equals(consultConfig.getMsgPush())){
                 return;
             }
+            if(smsHelper!=null){
+                smsHelper.sendPainCall(doctorUser.getUsername(),userBind.getPatientCode());
+            }
             //发送短信通知
-            smsHelper.sendPainCall(doctorUser.getUsername(),userBind.getPatientCode());
         }
     }
 

+ 1 - 1
nb-service/web-service/src/main/java/com/nb/web/service/bus/YiXinQian/YixinqianConfig.java

@@ -18,5 +18,5 @@ public class YixinqianConfig {
     /** 应用密钥 */
     private String appKey;
     /** AccessToken有效期(毫秒) */
-    private Long tokenExpire;
+    private Long tokenExpire=1000L;
 }