|
@@ -2,8 +2,10 @@ package com.huimv.wine.ws;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.util.BeanUtil;
|
|
|
import com.huimv.wine.entity.Device;
|
|
|
+import com.huimv.wine.entity.Wine;
|
|
|
import com.huimv.wine.entity.vo.WsEvent;
|
|
|
import com.huimv.wine.mapper.DeviceMapper;
|
|
|
+import com.huimv.wine.mapper.WineMapper;
|
|
|
import com.huimv.wine.utils.SpringContextUtil;
|
|
|
import com.huimv.wine.utils.WebsocketSellerUtil;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -32,6 +34,8 @@ public class SellerController extends TextWebSocketHandler {
|
|
|
|
|
|
//需要用这种方式注入
|
|
|
DeviceMapper deviceMapper = SpringContextUtil.getBean(DeviceMapper.class);
|
|
|
+ WineMapper wineMapper = SpringContextUtil.getBean(WineMapper.class);
|
|
|
+
|
|
|
Device device = deviceMapper.getByDeviceId(seq);
|
|
|
if (ObjectUtils.isEmpty(device)){
|
|
|
device = new Device();
|
|
@@ -44,8 +48,7 @@ public class SellerController extends TextWebSocketHandler {
|
|
|
|
|
|
// 添加到session的映射关系中
|
|
|
WebsocketSellerUtil.addSession(seq, session);
|
|
|
-
|
|
|
- infoOfDevice(session,deviceMapper);
|
|
|
+ infoOfDevice(wineMapper,device,session,deviceMapper);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -58,7 +61,6 @@ public class SellerController extends TextWebSocketHandler {
|
|
|
// 删除映射关系
|
|
|
WebsocketSellerUtil.removeSession(seq);
|
|
|
|
|
|
-// WebsocketSellerUtil.sendMessageForAll(message);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -91,7 +93,12 @@ public class SellerController extends TextWebSocketHandler {
|
|
|
throwable.printStackTrace();
|
|
|
}
|
|
|
|
|
|
- public void infoOfDevice(Session session, DeviceMapper deviceMapper) {
|
|
|
+ public void infoOfDevice(WineMapper wineMapper,Device device,Session session, DeviceMapper deviceMapper) {
|
|
|
+
|
|
|
+// Wine wine = wineMapper.selectById(device.getWine1());
|
|
|
+// wineMapper.selectById( device.getWine2());
|
|
|
+// wineMapper.selectById( device.getWine3());
|
|
|
+// wineMapper.selectById( device.getWine4());
|
|
|
|
|
|
|
|
|
}
|