推送修改
This commit is contained in:
parent
e4def06bd1
commit
2f2ba3d487
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class LiveRoomPageInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2438713198151455034L;
|
||||
//直播间ID
|
||||
private Integer roomId;
|
||||
//用户ID
|
||||
private Integer userId;
|
||||
//用户类型
|
||||
private String userType;
|
||||
//昵称
|
||||
private String nickName;
|
||||
//用户头像
|
||||
private String userImg;
|
||||
//用户最后一次登录时间
|
||||
private Date loginTime;
|
||||
//摄像头ID
|
||||
private String cameraId;
|
||||
//直播间名称
|
||||
private String roomName;
|
||||
//直播宣言
|
||||
private String roomDesc;
|
||||
//人气值
|
||||
private Integer popularityValue;
|
||||
//活跃度
|
||||
private String liveness;
|
||||
//直播天数
|
||||
private Integer numberDays;
|
||||
//距离
|
||||
private Double distance;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//评论数
|
||||
private Integer pinglunNum;
|
||||
//点赞数量
|
||||
private Integer zanNum;
|
||||
//直播间展示图
|
||||
private String roomImg;
|
||||
|
||||
public Integer getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(Integer roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public String getCameraId() {
|
||||
return cameraId;
|
||||
}
|
||||
|
||||
public void setCameraId(String cameraId) {
|
||||
this.cameraId = cameraId;
|
||||
}
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public void setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
}
|
||||
|
||||
public String getRoomDesc() {
|
||||
return roomDesc;
|
||||
}
|
||||
|
||||
public void setRoomDesc(String roomDesc) {
|
||||
this.roomDesc = roomDesc;
|
||||
}
|
||||
|
||||
public Integer getPopularityValue() {
|
||||
return popularityValue;
|
||||
}
|
||||
|
||||
public void setPopularityValue(Integer popularityValue) {
|
||||
this.popularityValue = popularityValue;
|
||||
}
|
||||
|
||||
public Integer getNumberDays() {
|
||||
return numberDays;
|
||||
}
|
||||
|
||||
public void setNumberDays(Integer numberDays) {
|
||||
this.numberDays = numberDays;
|
||||
}
|
||||
|
||||
public Double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(Double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getUserImg() {
|
||||
return userImg;
|
||||
}
|
||||
|
||||
public void setUserImg(String userImg) {
|
||||
this.userImg = userImg;
|
||||
}
|
||||
|
||||
public String getLiveness() {
|
||||
return liveness;
|
||||
}
|
||||
|
||||
public void setLiveness(String liveness) {
|
||||
this.liveness = liveness;
|
||||
}
|
||||
|
||||
public Date getLoginTime() {
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(Date loginTime) {
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public Integer getPinglunNum() {
|
||||
return pinglunNum;
|
||||
}
|
||||
|
||||
public void setPinglunNum(Integer pinglunNum) {
|
||||
this.pinglunNum = pinglunNum;
|
||||
}
|
||||
|
||||
public Integer getZanNum() {
|
||||
return zanNum;
|
||||
}
|
||||
|
||||
public void setZanNum(Integer zanNum) {
|
||||
this.zanNum = zanNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roomImg
|
||||
*/
|
||||
public String getRoomImg() {
|
||||
return roomImg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roomImg the roomImg to set
|
||||
*/
|
||||
public void setRoomImg(String roomImg) {
|
||||
this.roomImg = roomImg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = -7095234476683939631L;
|
||||
private static final long serialVersionUID = 204106348073538365L;
|
||||
|
||||
/**
|
||||
* 设备Id
|
||||
|
|
@ -80,12 +80,6 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
@Column(name = "on_off", nullable = true, length = 1)
|
||||
private String onOff;
|
||||
|
||||
/**
|
||||
* 是否接收离线通知:1接收,0不接受
|
||||
*/
|
||||
@Column(name = "off_line", nullable = true, length = 1)
|
||||
private String offLine;
|
||||
|
||||
/**
|
||||
* 今天是否提醒:1提醒、0不提醒
|
||||
*/
|
||||
|
|
@ -314,24 +308,6 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
this.onOff = onOff;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否接收离线通知:1接收,0不接受
|
||||
*
|
||||
* @return 是否接收离线通知:1接收
|
||||
*/
|
||||
public String getOffLine() {
|
||||
return this.offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否接收离线通知:1接收,0不接受
|
||||
*
|
||||
* @param offLine 是否接收离线通知:1接收,0不接受
|
||||
*/
|
||||
public void setOffLine(String offLine) {
|
||||
this.offLine = offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今天是否提醒:1提醒、0不提醒
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class Tbl_Device_User implements java.io.Serializable {
|
|||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = -4018159739383033383L;
|
||||
private static final long serialVersionUID = 5123379244673522530L;
|
||||
|
||||
/**
|
||||
* id
|
||||
|
|
@ -36,7 +36,7 @@ public class Tbl_Device_User implements java.io.Serializable {
|
|||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
@Column(name = "user_id", unique = true, nullable = false, length = 10)
|
||||
@Column(name = "user_id", nullable = false, length = 10)
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
|
|
@ -93,6 +93,12 @@ public class Tbl_Device_User implements java.io.Serializable {
|
|||
@Column(name = "is_live", nullable = true, length = 1)
|
||||
private String isLive;
|
||||
|
||||
/**
|
||||
* 是否开启离线提醒,1开启,0关闭,默认1
|
||||
*/
|
||||
@Column(name = "off_line", nullable = true, length = 1)
|
||||
private String offLine;
|
||||
|
||||
/**
|
||||
* 获取id
|
||||
*
|
||||
|
|
@ -290,4 +296,22 @@ public class Tbl_Device_User implements java.io.Serializable {
|
|||
public void setIsLive(String isLive) {
|
||||
this.isLive = isLive;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否开启离线提醒,1开启,0关闭,默认1
|
||||
*
|
||||
* @return 是否开启离线提醒
|
||||
*/
|
||||
public String getOffLine() {
|
||||
return this.offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否开启离线提醒,1开启,0关闭,默认1
|
||||
*
|
||||
* @param offLine 是否开启离线提醒,1开启,0关闭,默认1
|
||||
*/
|
||||
public void setOffLine(String offLine) {
|
||||
this.offLine = offLine;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.bean;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 用户观看直播记录(tbl_live_watch)
|
||||
*
|
||||
* @author bianj
|
||||
* @version 1.0.0 2017-07-14
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "tbl_live_watch")
|
||||
public class Tbl_Live_Watch {
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = -3178390426587691302L;
|
||||
|
||||
/**
|
||||
* 直播间ID
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "room_id", unique = true, nullable = false, length = 10)
|
||||
private Integer roomId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "user_id", unique = true, nullable = false, length = 10)
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column(name = "update_time", nullable = true)
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time", nullable = false)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 获取直播间ID
|
||||
*
|
||||
* @return 直播间ID
|
||||
*/
|
||||
public Integer getRoomId() {
|
||||
return this.roomId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置直播间ID
|
||||
*
|
||||
* @param roomId 直播间ID
|
||||
*/
|
||||
public void setRoomId(Integer roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*
|
||||
* @return 用户id
|
||||
*/
|
||||
public Integer getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户id
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取修改时间
|
||||
*
|
||||
* @return 修改时间
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置修改时间
|
||||
*
|
||||
* @param updateTime 修改时间
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取创建时间
|
||||
*
|
||||
* @return 创建时间
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置创建时间
|
||||
*
|
||||
* @param createTime 创建时间
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ import com.ifish.bean.Tbl_Live_Message;
|
|||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
import com.ifish.mapper.Tbl_Live_Room_Mapper;
|
||||
import com.ifish.util.RedisKey;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -30,6 +31,8 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
private DeviceHelperI deviceHelper;
|
||||
@Autowired
|
||||
private UserHelperI userHelperI;
|
||||
@Autowired
|
||||
private Tbl_Live_Room_Mapper tbl_Live_Room_Mapper;
|
||||
|
||||
/**
|
||||
* 根据phoneNumber获取Tbl_User用户信息的Redis缓存key键值
|
||||
|
|
@ -507,7 +510,11 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Live_Room(Tbl_Live_Room live_Room) {
|
||||
|
||||
if ((live_Room.getRoomId() == null || live_Room.getRoomId() == 0) && StringUtils.isNotBlank(live_Room.getCameraId())) {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomByCameraId(live_Room.getCameraId());
|
||||
} else if (StringUtils.isBlank(live_Room.getCameraId()) && (live_Room.getRoomId() != null && live_Room.getRoomId() > 0)) {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomById(live_Room.getRoomId());
|
||||
}
|
||||
if (live_Room.getRoomId() != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByRoomId(live_Room.getRoomId()));
|
||||
}
|
||||
|
|
@ -602,6 +609,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
*
|
||||
* @param pushId
|
||||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List) {
|
||||
if (tbl_Push_List.getPushId() != null) {
|
||||
redisHelperI.deleteRedis(getTbl_Push_List_RedisByPushId(tbl_Push_List.getPushId()));
|
||||
|
|
@ -612,8 +620,17 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
/**
|
||||
* 删除推送列表类缓存
|
||||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList() {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.PUSHLIST_SELECT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除鱼缸厂信息缓存
|
||||
*/
|
||||
@Override
|
||||
public void deleteTbl_Vender_List_RedisKey() {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.VENDER_CODE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,4 +382,10 @@ public interface RedisKeyHelperI {
|
|||
* 删除推送列表类缓存
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList();
|
||||
|
||||
/**
|
||||
* 删除鱼缸厂信息缓存
|
||||
*/
|
||||
public void deleteTbl_Vender_List_RedisKey();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE device_id= #{deviceid}")
|
||||
Tbl_Device getDeviceById(@Param("deviceid") Integer deviceid);
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE camera_id= #{cameraID}")
|
||||
Tbl_Device getDeviceByCameraId(@Param("cameraID") String cameraID);
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE mac_address= #{mac_address}")
|
||||
Tbl_Device getDeviceByMacAddress(@Param("mac_address") String macAddress);
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id = #{userid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE user_id = #{userid}")
|
||||
List<Tbl_Device_User> getDeviceUsersByUserId(@Param("userid") Integer userid);
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +71,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id <> ${userid} AND device_id = #{deviceid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE user_id <> ${userid} AND device_id = #{deviceid}")
|
||||
List<Tbl_Device_User> getOtherDeviceUsersByOtherUserIdAndDeviceId(@Param("userid") Integer userid, @Param("deviceid") Integer deviceId);
|
||||
|
||||
/**
|
||||
|
|
@ -81,7 +81,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id = #{userid} AND device_id = #{deviceid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE user_id = #{userid} AND device_id = #{deviceid}")
|
||||
Tbl_Device_User getDeviceUsersByUserIdAndDeviceId(@Param("userid") Integer userid, @Param("deviceid") Integer deviceId);
|
||||
|
||||
/**
|
||||
|
|
@ -90,7 +90,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE device_id = #{deviceid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE device_id = #{deviceid}")
|
||||
List<Tbl_Device_User> getDeviceUsersByDeviceId(@Param("deviceid") Integer deviceId);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public class Tbl_Device_MapperSql {
|
|||
if (StringUtils.isNotBlank(device_User.getIsLive())) {
|
||||
sb.append("is_live = #{deviceUser.isLive}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device_User.getOffLine())) {
|
||||
sb.append("off_line = #{deviceUser.offLine}, ");
|
||||
}
|
||||
sb.append("update_time = now() ");
|
||||
sb.append(" WHERE id = #{deviceUser.id}");
|
||||
return sb.toString();
|
||||
|
|
@ -234,9 +237,6 @@ public class Tbl_Device_MapperSql {
|
|||
if (StringUtils.isNotBlank(device.getOnOff())) {
|
||||
sb.append("on_off = #{device.onOff}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getOffLine())) {
|
||||
sb.append("off_line = #{device.offLine} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getTodayRemind())) {
|
||||
sb.append("today_remind = #{device.todayRemind}, ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,235 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.mapper;
|
||||
|
||||
import com.ifish.bean.LiveRoomPageInfo;
|
||||
import com.ifish.bean.Tbl_Live_Message;
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import com.ifish.bean.Tbl_Live_Watch;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.SelectKey;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface Tbl_Live_Room_Mapper {
|
||||
|
||||
/**
|
||||
* 建立一个直播间
|
||||
*/
|
||||
@Insert("INSERT INTO tbl_live_room (user_id,camera_id,room_name,room_desc,room_status,popularity_value,create_time,room_Img) VALUES("
|
||||
+ "#{liveroom.userId},#{liveroom.cameraId},#{liveroom.roomName},#{liveroom.roomDesc},#{liveroom.roomStatus},#{liveroom.popularityValue},now(),#{liveroom.roomImg})")
|
||||
@SelectKey(statement = "select @@IDENTITY as room_id", keyProperty = "liveroom.roomId", keyColumn = "room_id", before = false, resultType = int.class)
|
||||
Integer insertLiveRoom(@Param("liveroom") Tbl_Live_Room liveRoom);
|
||||
|
||||
/**
|
||||
* 插入一条直播间评论
|
||||
*
|
||||
* @param live_Message
|
||||
* @return
|
||||
*/
|
||||
@Insert("INSERT INTO TBL_LIVE_MESSAGE (room_id,user_id,as_user_id,message_content,create_time) VALUES (#{livemessage.roomId},#{livemessage.userId},#{livemessage.asUserId},#{livemessage.messageContent},#{livemessage.createTime})")
|
||||
@SelectKey(statement = "select @@IDENTITY as message_id", keyProperty = "livemessage.messageId", keyColumn = "message_id", before = false, resultType = int.class)
|
||||
Integer insertLiveMessage(@Param("livemessage") Tbl_Live_Message live_Message);
|
||||
|
||||
/**
|
||||
* 查询直播间总赞数
|
||||
*
|
||||
* @param roomID
|
||||
* @return
|
||||
*/
|
||||
@Select("select count(*) from tbl_live_room_zan where room_id=#{roomid} ")
|
||||
Integer getLiveRoomZanCountByRoomId(@Param("roomid") Integer roomID);
|
||||
|
||||
/**
|
||||
* 查询某个用户是否点赞了某个直播间
|
||||
*
|
||||
* @param roomID
|
||||
* @param userID
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT COUNT(1) FROM TBL_LIVE_ROOM_ZAN WHERE ROOM_ID = #{roomid} AND USER_ID = #{userid}")
|
||||
Integer IsZan(@Param("roomid") Integer roomID, @Param("userid") Integer userID);
|
||||
|
||||
/**
|
||||
* 取消点赞
|
||||
*
|
||||
* @param roomID
|
||||
* @param userID
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE FROM TBL_LIVE_ROOM_ZAN WHERE ROOM_ID = #{roomid} AND USER_ID = #{userid}")
|
||||
Integer cancelZan(@Param("roomid") Integer roomID, @Param("userid") Integer userID);
|
||||
|
||||
/**
|
||||
* 执行点赞
|
||||
*
|
||||
* @param roomID
|
||||
* @param userID
|
||||
* @return
|
||||
*/
|
||||
@Insert("INSERT INTO TBL_LIVE_ROOM_ZAN(ROOM_ID,USER_ID,CREATE_TIME) VALUES (#{roomid},#{userid},NOW())")
|
||||
Integer ImplementZan(@Param("roomid") Integer roomID, @Param("userid") Integer userID);
|
||||
|
||||
/**
|
||||
* 根据房间ID查询直播间信息
|
||||
*
|
||||
* @param roomid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT ROOM_ID,USER_ID,CAMERA_ID,ROOM_NAME,ROOM_DESC,ROOM_STATUS,POPULARITY_VALUE,CREATE_TIME,UPDATE_TIME,room_Img,zanNum FROM TBL_LIVE_ROOM WHERE ROOM_ID = #{roomid}")
|
||||
Tbl_Live_Room getTbl_Live_RoomById(@Param("roomid") Integer roomid);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID查询直播间信息
|
||||
*
|
||||
* @param roomid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT ROOM_ID,USER_ID,CAMERA_ID,ROOM_NAME,ROOM_DESC,ROOM_STATUS,POPULARITY_VALUE,CREATE_TIME,UPDATE_TIME,room_Img,zanNum FROM TBL_LIVE_ROOM WHERE CAMERA_ID = #{cameraid}")
|
||||
Tbl_Live_Room getTbl_Live_RoomByCameraId(@Param("cameraid") String cameraid);
|
||||
|
||||
/**
|
||||
* 根据开播时间来查询直播间
|
||||
*
|
||||
* @param pageSize
|
||||
* @param FirstResult
|
||||
* @return
|
||||
*/
|
||||
@Select(" select a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum,count(*) as pinglunNum from ("
|
||||
+ " SELECT l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,l.create_time AS createTime,"
|
||||
+ " td.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,l.room_Img AS roomImg,"
|
||||
+ " (TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays,l.zanNum,b.message_id"
|
||||
+ " from tbl_user u"
|
||||
+ " LEFT JOIN tbl_device_user c ON u.user_id=c.user_id "
|
||||
+ " LEFT JOIN tbl_device td ON c.device_id = td.device_id"
|
||||
+ " LEFT JOIN tbl_live_room l ON u.user_id=l.user_id and l.camera_id = td.camera_id"
|
||||
+ " LEFT JOIN tbl_live_message b ON l.room_id = b.room_id"
|
||||
+ " where c.is_live='1' AND l.room_status='1' ) as a"
|
||||
+ " GROUP BY a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum"
|
||||
+ " ORDER BY a.createTime DESC LIMIT ${first},${pagesize}")
|
||||
List<LiveRoomPageInfo> getLiveRoomListByCreateTime(@Param("pagesize") Integer pageSize, @Param("first") Integer FirstResult);
|
||||
|
||||
/**
|
||||
* 根据开播时间来查询直播间
|
||||
*
|
||||
* @param pageSize
|
||||
* @param FirstResult
|
||||
* @return
|
||||
*/
|
||||
@Select(" select a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum,count(*) as pinglunNum from ("
|
||||
+ " SELECT l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,l.create_time AS createTime,"
|
||||
+ " td.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,l.room_Img AS roomImg,"
|
||||
+ " (TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays,l.zanNum,b.message_id"
|
||||
+ " from tbl_user u"
|
||||
+ " LEFT JOIN tbl_device_user c ON u.user_id=c.user_id "
|
||||
+ " LEFT JOIN tbl_device td ON c.device_id = td.device_id"
|
||||
+ " LEFT JOIN tbl_live_room l ON u.user_id=l.user_id and l.camera_id = td.camera_id"
|
||||
+ " LEFT JOIN tbl_live_message b ON l.room_id = b.room_id"
|
||||
+ " where c.is_live='1' AND l.room_status='1' ) as a"
|
||||
+ " GROUP BY a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum"
|
||||
+ " ORDER BY a.popularityValue DESC LIMIT ${first},${pagesize}")
|
||||
List<LiveRoomPageInfo> getLiveRoomListByRenqi(@Param("pagesize") Integer pageSize, @Param("first") Integer FirstResult);
|
||||
|
||||
/**
|
||||
* 查询所有直播间数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT COUNT(1)"
|
||||
+ " from tbl_user u"
|
||||
+ " LEFT JOIN tbl_device_user c ON u.user_id=c.user_id "
|
||||
+ " LEFT JOIN tbl_device td ON c.device_id = td.device_id"
|
||||
+ " LEFT JOIN tbl_live_room l ON u.user_id=l.user_id and l.camera_id = td.camera_id"
|
||||
+ " where c.is_live='1' AND l.room_status='1'")
|
||||
Integer getLiveRoomListCount();
|
||||
|
||||
/**
|
||||
* 修改直播间信息
|
||||
*
|
||||
* @param live_Room
|
||||
* @return
|
||||
*/
|
||||
@UpdateProvider(type = Tbl_Live_Room_MapperSql.class, method = "updateLiveRoom")
|
||||
Integer updateLiveRoom(@Param("live") Tbl_Live_Room live_Room);
|
||||
|
||||
/**
|
||||
* 修改人气值
|
||||
*
|
||||
* @param live_Room
|
||||
* @return
|
||||
*/
|
||||
@Update("UPDATE TBL_LIVE_ROOM SET popularity_value = #{live.popularityValue} WHERE room_id = #{live.roomId}")
|
||||
Integer updateLiveRoomPopularityValue(@Param("live") Tbl_Live_Room live_Room);
|
||||
|
||||
/**
|
||||
* 根据直播间ID获取此直播间评论列表
|
||||
*
|
||||
* @param roomid
|
||||
* @return
|
||||
*/
|
||||
@Select("select l.message_id as messageId,l.room_id as roomId,l.user_id as userId,l.as_user_id as asUserId,"
|
||||
+ "uu.nick_name as asUserName,u.user_img as userImg,u.nick_name as userName,l.message_content as messageContent,l.create_time as createTime "
|
||||
+ "from tbl_live_message l "
|
||||
+ "LEFT JOIN tbl_user u ON l.user_id = u.user_id "
|
||||
+ "LEFT JOIN tbl_user uu ON l.as_user_id=uu.user_id "
|
||||
+ "WHERE room_id = #{roomid} ORDER BY l.create_time DESC LIMIT ${first},${page} ")
|
||||
List<Map> getLive_MessagesListByRoomId(@Param("roomid") Integer roomid, @Param("first") Integer firstResult, @Param("page") Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取直播间评论总数
|
||||
*
|
||||
* @param roomid
|
||||
* @return
|
||||
*/
|
||||
@Select("select count(1) from tbl_live_message WHERE room_id = #{roomid}")
|
||||
Integer getLive_MessagesCountByRoomId(@Param("roomid") Integer roomid);
|
||||
|
||||
/**
|
||||
* 根据直播间和用户ID获取观看记录
|
||||
*
|
||||
* @param roomId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT ROOM_ID,USER_ID,UPDATE_TIME,CREATE_TIME FROM TBL_LIVE_WATCH WHERE ROOM_ID=#{roomid} AND USER_ID=#{userid}")
|
||||
Tbl_Live_Watch getTbl_Live_WatchByRoomIdAndUserId(@Param("roomid") Integer roomId, @Param("userid") Integer userId);
|
||||
|
||||
/**
|
||||
* 修改用户直播观看记录
|
||||
*
|
||||
* @param live
|
||||
* @return
|
||||
*/
|
||||
@Update("UPDATE TBL_LIVE_WATCH SET UPDATE_TIME=#{live.updateTime} WHERE room_id=#{live.roomId} AND user_id=#{live.userId}")
|
||||
Integer updateTbl_Live_Watch(@Param("live") Tbl_Live_Watch live);
|
||||
|
||||
/**
|
||||
* 插入一条用户观看记录
|
||||
*
|
||||
* @param live
|
||||
* @return
|
||||
*/
|
||||
@Insert("INSERT INTO TBL_LIVE_WATCH(room_id,user_id,update_time,create_time) VALUES (#{live.roomId},#{live.userId},#{live.updateTime},#{live.createTime})")
|
||||
Integer insertTbl_Live_Watch(@Param("live") Tbl_Live_Watch live);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID删除直播间
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE TBL_LIVE_ROOM WHERE camera_id = #{cameraid}")
|
||||
Integer deleteLive_RoomByCameraId(@Param("cameraid") String cameraId);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.mapper;
|
||||
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class Tbl_Live_Room_MapperSql {
|
||||
|
||||
/**
|
||||
* 修改直播间信息
|
||||
*
|
||||
* @param live_Room
|
||||
* @return
|
||||
*/
|
||||
public String updateLiveRoom(@Param("live") Tbl_Live_Room live_Room) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("UPDATE TBL_LIVE_ROOM SET ");
|
||||
|
||||
if (StringUtils.isNotBlank(live_Room.getCameraId())) {
|
||||
sb.append("camera_id = #{live.cameraId}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getRoomDesc())) {
|
||||
sb.append("room_desc = #{live.roomDesc}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getRoomImg())) {
|
||||
sb.append("room_img = #{live.roomImg}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getRoomName())) {
|
||||
sb.append("room_name = #{live.roomName}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getRoomStatus())) {
|
||||
sb.append("room_status = #{live.roomStatus}, ");
|
||||
}
|
||||
if (live_Room.getPopularityValue() != null && live_Room.getPopularityValue() >= 0) {
|
||||
sb.append("popularity_value = #{live.popularityValue}, ");
|
||||
}
|
||||
if (live_Room.getZanNum() != null && live_Room.getZanNum() >= 0) {
|
||||
sb.append("zanNum = #{live.zanNum}, ");
|
||||
}
|
||||
if (sb.lastIndexOf(",") == sb.length() - 2) {
|
||||
sb.deleteCharAt(sb.length() - 2);
|
||||
}
|
||||
sb.append(" WHERE room_id=#{live.roomId} ");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -70,6 +70,8 @@ public class ExecuteJob implements Job {
|
|||
//是否被绑定
|
||||
if (list != null) {
|
||||
for (Tbl_Device_User deviceUser : list) {
|
||||
//是否开启离线提醒
|
||||
if (deviceUser.getOffLine().equals("1")) {
|
||||
Integer userId = deviceUser.getUserId();
|
||||
String showName = deviceUser.getShowName();
|
||||
String title = PushTypeEnum.offline_push.getValue();
|
||||
|
|
@ -116,6 +118,7 @@ public class ExecuteJob implements Job {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("error msg:{}", e.toString());
|
||||
|
|
|
|||
Loading…
Reference in New Issue