api-设备唯一Id 修改为 设备号 + 场馆号 + 进场OR出场

This commit is contained in:
limqhz
2020-07-23 17:03:45 +08:00
parent 16e2f04c38
commit 94b8e9c320
3 changed files with 14 additions and 11 deletions

View File

@@ -76,8 +76,8 @@ public class AppMessageHandlerAdapter implements MessageService {
if (thisVenue == null ){ if (thisVenue == null ){
logger.error("this client choose venue Error! venueId == " + heartBeat.getVenueId()); logger.error("this client choose venue Error! venueId == " + heartBeat.getVenueId());
} else { } else {
ClientChannelCache.putChannelType(heartBeat.getDeviceName(),heartBeat.getVenueId(),heartBeat.getEnterOrOut(),channel);
deviceService.online(heartBeat.getDeviceName(),heartBeat.getVenueId(),heartBeat.getEnterOrOut(),thisVenue.getType(),clientId); deviceService.online(heartBeat.getDeviceName(),heartBeat.getVenueId(),heartBeat.getEnterOrOut(),thisVenue.getType(),clientId);
ClientChannelCache.putChannelType(heartBeat.getDeviceName(),heartBeat.getVenueId(),heartBeat.getEnterOrOut(),channel);
} }
} }
} }

View File

@@ -1,6 +1,7 @@
package com.test.netty.client; package com.test.netty.client;
import com.sv.netty.utils.JsonUtils; import com.sv.netty.utils.JsonUtils;
import com.test.netty.client.message.DeviceType;
import com.test.netty.client.message.HeartBeat; import com.test.netty.client.message.HeartBeat;
import com.test.netty.client.message.MessageDTO; import com.test.netty.client.message.MessageDTO;
import io.netty.channel.Channel; import io.netty.channel.Channel;
@@ -88,8 +89,10 @@ public class ClientHandler extends SimpleChannelInboundHandler<String> {
*/ */
private HeartBeat getHbMessage() { private HeartBeat getHbMessage() {
HeartBeat hb = new HeartBeat(); HeartBeat hb = new HeartBeat();
hb.setDeviceName("DeviceIdUtil.generateDeviceId(mContext)"); // hb.setDeviceName("DeviceIdUtil.generateDeviceId(mContext)");
hb.setDeviceName("shebeiweiyishibiehao");
hb.setVenueId(32); // TODO hb.setVenueId(32); // TODO
hb.setEnterOrOut(DeviceType.ENTER);
return hb; return hb;
} }

View File

@@ -126,7 +126,7 @@
<if test="venueType != null"> <if test="venueType != null">
#{venueType}, #{venueType},
</if> </if>
<if test="venueType != null"> <if test="deviceType != null">
#{deviceType}, #{deviceType},
</if> </if>
<if test="status != null"> <if test="status != null">
@@ -247,24 +247,24 @@
<update id="offline"> <update id="offline">
UPDATE sv_device set status = 0,modified_time = now() UPDATE sv_device set status = 0,modified_time = now()
WHERE name = #{deviceName} and venue_id=#{venueId} WHERE name = #{deviceName} and venue_id=#{venueId}
<if test="venueType != null"> <if test="deviceType != null">
and venue_type = #{venueType} and device_type = #{deviceType}
</if> </if>
</update> </update>
<update id="online"> <update id="online">
UPDATE sv_device set status = 2,modified_time = now() UPDATE sv_device set status = 2,modified_time = now()
WHERE name = #{deviceName} and venue_id=#{venueId} WHERE name = #{deviceName} and venue_id=#{venueId}
<if test="venueType != null"> <if test="deviceType != null">
and venue_type = #{venueType} and device_type = #{deviceType}
</if> </if>
</update> </update>
<select id="checkDevice" resultType="java.lang.Integer"> <select id="checkDevice" resultType="java.lang.Integer">
SELECT count(1) FROM sv_device SELECT count(1) FROM sv_device
WHERE 1=1 AND name = #{deviceName} and venue_id=#{venueId} and deleted = 0 WHERE 1=1 AND name = #{deviceName} and venue_id=#{venueId} and deleted = 0
<if test="venueType != null"> <if test="deviceType != null">
and venue_type = #{venueType} and device_type = #{deviceType}
</if> </if>
</select> </select>
@@ -272,8 +272,8 @@
SELECT SELECT
<include refid="Field"></include> FROM sv_device <include refid="Field"></include> FROM sv_device
WHERE 1=1 AND name = #{deviceName} and venue_id=#{venueId} and deleted = 0 WHERE 1=1 AND name = #{deviceName} and venue_id=#{venueId} and deleted = 0
<if test="venueType != null"> <if test="deviceType != null">
and venue_type = #{venueType} and device_type = #{deviceType}
</if> </if>
</select> </select>