删除设备删除直播间,直播间添加乱码修改,删除直播间缓存修改,推送列表缓存删除修改
This commit is contained in:
parent
77580eab64
commit
c2c29af6d0
|
|
@ -43,6 +43,9 @@ public class DeviceHelper implements DeviceHelperI {
|
|||
@Autowired
|
||||
private UserHelperI userHelperI;
|
||||
|
||||
@Autowired
|
||||
private LiveRoomHelperI liveRoomHelperI;
|
||||
|
||||
/**
|
||||
* 根据用户Id获取绑定设备集合
|
||||
*
|
||||
|
|
@ -567,6 +570,9 @@ public class DeviceHelper implements DeviceHelperI {
|
|||
Tbl_Device device = getDeviceByCameraId(cameraId);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device(device);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(device_User);
|
||||
//删除此摄像头的直播间信息
|
||||
liveRoomHelperI.deleteLiveRoom(cameraId);
|
||||
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,15 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
@Override
|
||||
public Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
|
||||
try {
|
||||
if (StringUtils.isNotBlank(liveRoom.getRoomName())) {
|
||||
String roomName = new String(liveRoom.getRoomName().getBytes("iso-8859-1"), "UTF-8");
|
||||
liveRoom.setRoomName(roomName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(liveRoom.getRoomDesc())) {
|
||||
String roomDesc = new String(liveRoom.getRoomDesc().getBytes("iso-8859-1"), "UTF-8");
|
||||
liveRoom.setRoomDesc(roomDesc);
|
||||
}
|
||||
|
||||
if (liveRoom.getUserId() == null || liveRoom.getUserId() <= 0) {
|
||||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
|
|
@ -111,6 +120,7 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
cameraUser.setIsLive("1");
|
||||
cameraChange = true;
|
||||
}
|
||||
|
||||
//新增直播间
|
||||
liveRoom.setCreateTime(new Date());
|
||||
liveRoom.setPopularityValue(0);
|
||||
|
|
@ -120,11 +130,17 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
deviceHelperI.updateDeviceUser(cameraUser);
|
||||
}
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(liveRoom);
|
||||
Map map = new HashMap();
|
||||
map.put("cameraId", cameraId);
|
||||
map.put("isLive", cameraUser.getIsLive());
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", liveRoom.getRoomId());
|
||||
map.put("userId", liveRoom.getUserId());
|
||||
map.put("cameraId", liveRoom.getCameraId());
|
||||
map.put("roomName", liveRoom.getRoomName());
|
||||
map.put("roomDesc", liveRoom.getRoomDesc());
|
||||
map.put("popularityValue", liveRoom.getPopularityValue());
|
||||
map.put("roomStatus", liveRoom.getRoomStatus());
|
||||
map.put("roomImg", liveRoom.getRoomImg());
|
||||
map.put("createTime", liveRoom.getCreateTime());
|
||||
map.put("zanNum", liveRoom.getZanNum());
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
|
|
@ -621,4 +637,24 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头删除直播间
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteLiveRoom(String cameraId) {
|
||||
try {
|
||||
Tbl_Live_Room live_Room = getTbl_Live_RoomByCameraId(cameraId);
|
||||
if (live_Room != null) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(live_Room);
|
||||
}
|
||||
int i = tbl_Live_Room_Mapper.deleteLive_RoomByCameraId(cameraId);
|
||||
return i;
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public interface LiveRoomHelperI {
|
|||
* @return
|
||||
*/
|
||||
Object getLiveRoomInfoByRoomId(Integer rommId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据摄像头ID获取直播间信息
|
||||
*
|
||||
|
|
@ -93,4 +93,12 @@ public interface LiveRoomHelperI {
|
|||
* @return
|
||||
*/
|
||||
Object popularityValue(Integer roomId, Integer userId);
|
||||
|
||||
/**
|
||||
* 根据摄像头删除直播间
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
Integer deleteLiveRoom(String cameraId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.ifish.bean.Tbl_Device_Statistics;
|
|||
import com.ifish.bean.Tbl_Device_User;
|
||||
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.util.RedisKey;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -309,7 +310,6 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
public String getTbl_Live_Room_CountRedisKey() {
|
||||
return RedisKey.LIVEROOM_COUNT;
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
deleteTbl_DeviceInfo(device);
|
||||
try {
|
||||
Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(device.getDeviceId());
|
||||
deleteRedisByTbl_Device_Statistics(device_Statistics);
|
||||
deleteTbl_Device_StatisticsInfo(device_Statistics);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
|
@ -407,7 +407,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
deleteTbl_Device_StatisticsInfo(device);
|
||||
try {
|
||||
Tbl_Device device1 = deviceHelper.getDeviceById(device.getDeviceId());
|
||||
deleteRedisByTbl_Device(device1);
|
||||
deleteTbl_DeviceInfo(device1);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
|
@ -432,9 +432,9 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
deleteTbl_Device_UserInfo(tbl_Device_User);
|
||||
try {
|
||||
Tbl_Device device1 = deviceHelper.getDeviceById(tbl_Device_User.getDeviceId());
|
||||
deleteRedisByTbl_Device(device1);
|
||||
deleteTbl_DeviceInfo(device1);
|
||||
Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(tbl_Device_User.getDeviceId());
|
||||
deleteRedisByTbl_Device_Statistics(device_Statistics);
|
||||
deleteTbl_Device_StatisticsInfo(device_Statistics);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
|
@ -486,7 +486,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByRoomId(live_Room.getRoomId()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getCameraId())) {
|
||||
redisHelperI.deleteRedis(live_Room.getCameraId());
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByCameraId(live_Room.getCameraId()));
|
||||
}
|
||||
if (live_Room.getUserId() != null && live_Room.getUserId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByUserId(live_Room.getUserId()));
|
||||
|
|
@ -514,4 +514,80 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
redisHelperI.deleteRedis(RedisKey.LIVEMESSAGE_COUNT + tbl_Live_Message.getRoomId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台推送消息列表缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAdmin_Tbl_Push_List_BySelect(Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) {
|
||||
return RedisKey.PUSHLIST_SELECT + start + "_" + length + "_" + sdkVersion + "_" + phoneNumber + "_" + mac + "_" + phoneType + "_" + pushType + "_" + sortField + "_" + sortMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台推送消息列表查询数量缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAdmin_Tbl_Push_List_Count_BySelect(String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) {
|
||||
return RedisKey.PUSHLIST_SELECT + "count_" + sdkVersion + "_" + phoneNumber + "_" + mac + "_" + phoneType + "_" + pushType + "_" + sortField + "_" + sortMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台推送消息列表总数缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAdmin_Tbl_Push_List_AllCount() {
|
||||
return RedisKey.PUSHLIST_SELECT;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件删除推送列表缓存
|
||||
*
|
||||
* @param pushId
|
||||
*/
|
||||
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()));
|
||||
}
|
||||
deleteRedisByTbl_Push_ListToAllRedisList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除推送列表类缓存
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList() {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.PUSHLIST_SELECT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.ifish.bean.Tbl_Device_Statistics;
|
|||
import com.ifish.bean.Tbl_Device_User;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
@ -257,6 +258,54 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public String getTbl_Push_List_RedisByPushId(Integer pushId);
|
||||
|
||||
/**
|
||||
* 后台推送消息列表缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getAdmin_Tbl_Push_List_BySelect(Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode);
|
||||
|
||||
/**
|
||||
* 后台推送消息列表查询数量缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getAdmin_Tbl_Push_List_Count_BySelect(String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode);
|
||||
|
||||
/**
|
||||
* 后台推送消息列表总数缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getAdmin_Tbl_Push_List_AllCount();
|
||||
|
||||
/**
|
||||
* 根据MD5值获取redis缓存key键值(注册账号用)
|
||||
*
|
||||
|
|
@ -322,4 +371,16 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public void deleteRedisByTbl_Live_Message(Tbl_Live_Message tbl_Live_Message);
|
||||
|
||||
/**
|
||||
* 根据条件删除推送列表缓存
|
||||
*
|
||||
* @param pushId
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List);
|
||||
|
||||
/**
|
||||
* 删除推送列表类缓存
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,4 +224,12 @@ public interface Tbl_Live_Room_Mapper {
|
|||
@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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ public class RedisKey {
|
|||
*/
|
||||
public static final String PUSHLIST_PUSHID = "pushlistE:id_";
|
||||
|
||||
/**
|
||||
* 后台推送列表缓存条件
|
||||
*/
|
||||
public static final String PUSHLIST_SELECT = "pushlistE:se_";
|
||||
|
||||
/**
|
||||
* 邮箱验证有效缓存key
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue