tanbin 2 tháng trước cách đây
mục cha
commit
88b93a49dc

+ 4 - 1
device-api-service/src/main/java/com/xy/service/DeviceMqttConsumerImpl.java

@@ -80,6 +80,7 @@ public class DeviceMqttConsumerImpl implements DeviceMqttConsumer {
     @Override
     @ApiOperation("设备消息推送")
     public void devicePushMsg(DeviceMqttDto.RequestParams requestParams) {
+        log.info("设备消息推送MQTT:{}", JSONUtil.toJsonPrettyStr(requestParams));
         DeviceEventMsg deviceEventMsg = JSONUtil.toBean(requestParams.getData(), DeviceEventMsg.class);
         if (deviceEventMsg != null) {
             Long deviceId = deviceEventMsg.getDeviceId();
@@ -215,6 +216,7 @@ public class DeviceMqttConsumerImpl implements DeviceMqttConsumer {
 
 
             //短信通知
+            log.info("设备告警,短信通知处理开始。。。");
             deviceSmsPushMsg(merc,deviceInfo,createTime,code);
         }
     }
@@ -254,6 +256,7 @@ public class DeviceMqttConsumerImpl implements DeviceMqttConsumer {
         }
         //温度异常
         Boolean b = R.feignCheckData(mercSmsSubscriptionService.isSubscribedByCode(new MercSmsSubscriptionDto.Vo().setMercId(merc.getId()).setEventCode(eventCode)));
+        log.info("设备告警,商户是否订阅短信通知:{},eventCode:{}",b,eventCode);
         boolean isSubscribed = BooleanUtil.isTrue(b);
         //商户是否订阅短信通知
         if(isSubscribed&&StrUtil.isNotEmpty(exceptionType)){
@@ -262,7 +265,7 @@ public class DeviceMqttConsumerImpl implements DeviceMqttConsumer {
                 String tel = userInfo.getTel();
                 //短信推送 设备告警:设备${device_id}于${time}发生${exception_type}异常。请登录后台查看详情并及时处理。
                 Long configId = MsgConfigId.SMS_NOTIFY_DEVICE.getId();
-                String formatDate = LocalDateTimeUtil.format(createTime, DatePattern.NORM_DATE_PATTERN);
+                String formatDate = LocalDateTimeUtil.format(createTime, DatePattern.NORM_DATETIME_PATTERN);
                 Map<String, Object> templateParams = MapUtil.newHashMap();
                 templateParams.put("device_id", deviceName);
                 templateParams.put("time", formatDate);