|
@@ -1,13 +1,10 @@
|
|
|
package com.szwl.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.szwl.feign.bean.SzwlFeign;
|
|
|
import com.szwl.mapper.TEquipmentMapper;
|
|
|
import com.szwl.model.bo.R;
|
|
|
import com.szwl.model.entity.TEquipment;
|
|
|
-import com.szwl.model.query.StatisticsParam;
|
|
|
import com.szwl.model.utils.PushUtils;
|
|
|
import com.szwl.service.TEquipmentService;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -16,8 +13,6 @@ import org.springframework.amqp.core.MessageProperties;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* <p>
|
|
|
* 设备表 服务实现类
|
|
@@ -33,6 +28,7 @@ public class TEquipmentServiceImpl extends ServiceImpl<TEquipmentMapper, TEquipm
|
|
|
|
|
|
@Autowired
|
|
|
SzwlFeign szwlFeign;
|
|
|
+
|
|
|
@Override
|
|
|
public String sentMessage(String clientId, String json) {
|
|
|
|
|
@@ -41,20 +37,20 @@ public class TEquipmentServiceImpl extends ServiceImpl<TEquipmentMapper, TEquipm
|
|
|
return "该设备不存在";
|
|
|
}
|
|
|
String channel = equipment.getChannel();
|
|
|
- String equimentType = equipment.getEquimentType();
|
|
|
- if(StringUtils.isEmpty(channel)||channel.equals("1")||StringUtils.isEmpty(equimentType)){
|
|
|
+ String equipmentType = equipment.getEquimentType();
|
|
|
+ if (StringUtils.isEmpty(channel) || "1".equals(channel) || StringUtils.isEmpty(equipmentType)) {
|
|
|
//用个推
|
|
|
PushUtils.push(equipment.getGtClientId(), "", "", json);
|
|
|
return "success";
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(channel)&&channel.equals("2")&&StringUtils.isNotEmpty(equimentType)){
|
|
|
+ if (StringUtils.isNotEmpty(channel) && "2".equals(channel) && StringUtils.isNotEmpty(equipmentType)) {
|
|
|
//用Mq
|
|
|
//1 创建消息
|
|
|
MessageProperties messageProperties = new MessageProperties();
|
|
|
messageProperties.setContentType("text/plain");
|
|
|
org.springframework.amqp.core.Message message = new org.springframework.amqp.core.Message(json.getBytes(), messageProperties);
|
|
|
- amqpTemplate.send(equimentType, clientId, message);
|
|
|
- System.out.println("mq发送成功,clientId="+clientId+"&json="+json);
|
|
|
+ amqpTemplate.send(equipmentType, clientId, message);
|
|
|
+ System.out.println("mq发送成功,clientId=" + clientId + "&json=" + json);
|
|
|
|
|
|
return "success";
|
|
|
}
|