直播间接口新增根据摄像头ID获取详情,用户邮箱登陆接口修改
This commit is contained in:
parent
f26af8a2f4
commit
230187426e
|
|
@ -107,10 +107,25 @@ public class LiveRoom {
|
|||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/liveRoom/v3/getLiveRoomInfo.do", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/liveRoom/v3/getLiveRoomInfoByRoomId", method = RequestMethod.GET)
|
||||
public Object getLiveRoomInfo(Integer roomId) {
|
||||
try {
|
||||
return liveRoomHelperI.getLiveRoomInfo(roomId);
|
||||
return liveRoomHelperI.getLiveRoomInfoByRoomId(roomId);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间信息
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/liveRoom/v3/getLiveRoomInfoByCameraId", method = RequestMethod.GET)
|
||||
public Object getLiveRoomInfo(String cameraId) {
|
||||
try {
|
||||
return liveRoomHelperI.getLiveRoomInfoByCameraId(cameraId);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class Login {
|
|||
* @param md5
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/registerEmail", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/registerEmail", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
|
||||
public Object registerEmailUser(String md5) {
|
||||
return userHelperI.registerEmail(md5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,14 +131,14 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public Tbl_Live_Room getLive_RoomById(Integer roomId) throws Exception {
|
||||
public Tbl_Live_Room getTbl_Live_RoomByCameraId(String cameraId) throws Exception {
|
||||
Tbl_Live_Room live_Room = null;
|
||||
String key = redisKeyHelperI.getTbl_Live_RoomRedisKeyByRoomId(roomId);
|
||||
String key = redisKeyHelperI.getTbl_Live_RoomRedisKeyByCameraId(cameraId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
live_Room = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
|
||||
} else {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomById(roomId);
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomByCameraId(cameraId);
|
||||
if (live_Room != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(live_Room));
|
||||
}
|
||||
|
|
@ -152,19 +152,19 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public Tbl_Live_Room getTbl_Live_RoomById(Integer roomId) throws Exception {
|
||||
Tbl_Live_Room device = null;
|
||||
public Tbl_Live_Room getTbl_Live_RoomByRoomId(Integer roomId) throws Exception {
|
||||
Tbl_Live_Room live_Room = null;
|
||||
String key = redisKeyHelperI.getTbl_Live_RoomRedisKeyByRoomId(roomId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
device = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
|
||||
live_Room = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
|
||||
} else {
|
||||
device = tbl_Live_Room_Mapper.getTbl_Live_RoomById(roomId);
|
||||
if (device != null && device.getRoomId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomById(roomId);
|
||||
if (live_Room != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(live_Room));
|
||||
}
|
||||
}
|
||||
return device;
|
||||
return live_Room;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -212,7 +212,7 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
// return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
|
||||
// }
|
||||
// }
|
||||
Tbl_Live_Room live = getLive_RoomById(roomId);
|
||||
Tbl_Live_Room live = getTbl_Live_RoomByRoomId(roomId);
|
||||
if (live != null) {
|
||||
if (live.getZanNum() != null && live.getZanNum() >= 0) {
|
||||
live.setZanNum(live.getZanNum() + 1);
|
||||
|
|
@ -249,7 +249,7 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
String messageContent = new String(liveMessage.getMessageContent().getBytes("ISO-8859-1"), "UTF-8");
|
||||
liveMessage.setMessageContent(messageContent);
|
||||
if (roomId != null && userId != null && StringUtils.isNotBlank(messageContent)) {
|
||||
Tbl_Live_Room live_Room = getLive_RoomById(roomId);
|
||||
Tbl_Live_Room live_Room = getTbl_Live_RoomByRoomId(roomId);
|
||||
Tbl_User user = userHelperI.getUserById(userId);
|
||||
if (live_Room != null && user != null) {
|
||||
liveMessage.setCreateTime(new Date());
|
||||
|
|
@ -325,15 +325,49 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getLiveRoomInfo(Integer roomId) {
|
||||
public Object getLiveRoomInfoByRoomId(Integer roomId) {
|
||||
try {
|
||||
if (roomId != null) {
|
||||
//查找直播间信息
|
||||
Tbl_Live_Room curLiveRoom = getLive_RoomById(roomId);
|
||||
Tbl_Live_Room curLiveRoom = getTbl_Live_RoomByRoomId(roomId);
|
||||
if (curLiveRoom != null) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", roomId);
|
||||
map.put("userId", curLiveRoom.getUserId());
|
||||
map.put("cameraId", curLiveRoom.getCameraId());
|
||||
map.put("roomName", curLiveRoom.getRoomName());
|
||||
map.put("roomDesc", curLiveRoom.getRoomDesc());
|
||||
map.put("popularityValue", curLiveRoom.getPopularityValue());
|
||||
map.put("roomStatus", curLiveRoom.getRoomStatus());
|
||||
map.put("roomImg", curLiveRoom.getRoomImg());
|
||||
map.put("createTime", curLiveRoom.getCreateTime());
|
||||
map.put("zanNum", curLiveRoom.getZanNum());
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), map);
|
||||
}
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头ID获取直播间信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getLiveRoomInfoByCameraId(String cameraId) {
|
||||
try {
|
||||
if (cameraId != null) {
|
||||
//查找直播间信息
|
||||
Tbl_Live_Room curLiveRoom = getTbl_Live_RoomByCameraId(cameraId);
|
||||
if (curLiveRoom != null) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", curLiveRoom.getRoomId());
|
||||
map.put("cameraId", curLiveRoom.getCameraId());
|
||||
map.put("userId", curLiveRoom.getUserId());
|
||||
map.put("roomName", curLiveRoom.getRoomName());
|
||||
map.put("roomDesc", curLiveRoom.getRoomDesc());
|
||||
map.put("popularityValue", curLiveRoom.getPopularityValue());
|
||||
|
|
@ -420,7 +454,7 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
int i = tbl_Live_Room_Mapper.updateLiveRoom(liveRoom);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(liveRoom);
|
||||
Tbl_Live_Room live = getLive_RoomById(liveRoom.getRoomId());
|
||||
Tbl_Live_Room live = getTbl_Live_RoomByRoomId(liveRoom.getRoomId());
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), live);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -456,7 +490,7 @@ public class LiveRoomHelper implements LiveRoomHelperI {
|
|||
tbl_Live_Room_Mapper.insertTbl_Live_Watch(browseRoom);
|
||||
}
|
||||
//查找直播间信息
|
||||
Tbl_Live_Room curLiveRoom = getLive_RoomById(roomId);
|
||||
Tbl_Live_Room curLiveRoom = getTbl_Live_RoomByRoomId(roomId);
|
||||
if (curLiveRoom != null) {
|
||||
Integer popularityValue = null;
|
||||
if (curLiveRoom.getPopularityValue() == null) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,15 @@ public interface LiveRoomHelperI {
|
|||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Object getLiveRoomInfo(Integer rommId);
|
||||
Object getLiveRoomInfoByRoomId(Integer rommId);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID获取直播间信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public Object getLiveRoomInfoByCameraId(String cameraId);
|
||||
|
||||
/**
|
||||
* 根据条件查询直播间列表
|
||||
|
|
|
|||
|
|
@ -193,6 +193,17 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
return RedisKey.LIVEROOM_ROOMID + roomId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTbl_Live_RoomRedisKeyByCameraId(String cameraId) {
|
||||
return RedisKey.LIVEROOM_CAMERAID + cameraId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
|
|
@ -342,6 +353,9 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
if (live_Room.getRoomId() != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByRoomId(live_Room.getRoomId()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getCameraId())) {
|
||||
redisHelperI.deleteRedis(live_Room.getCameraId());
|
||||
}
|
||||
if (live_Room.getUserId() != null && live_Room.getUserId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByUserId(live_Room.getUserId()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,14 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public String getTbl_Live_RoomRedisKeyByRoomId(Integer roomId);
|
||||
|
||||
/**
|
||||
* 根据摄像头Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public String getTbl_Live_RoomRedisKeyByCameraId(String cameraId);
|
||||
|
||||
/**
|
||||
* 根据用户Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
|
|
|
|||
|
|
@ -50,19 +50,19 @@ public class UserHelper implements UserHelperI {
|
|||
*/
|
||||
@Autowired
|
||||
private Tbl_User_Mapper tbl_User_Mapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeviceHelperI deviceHelperI;
|
||||
|
||||
|
||||
@Autowired
|
||||
private HardWareTypeHelperI hardWareTypeHelperI;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SendMobile sendMobile;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FastDFSClientI fastDFSClientI;
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public class UserHelper implements UserHelperI {
|
|||
return checkUserPassword(tmpUser, user);
|
||||
} //如果用户邮箱不为空,进行邮箱登陆
|
||||
else if (StringUtils.isNotBlank(user.getUserEmail())) {
|
||||
tmpUser = tbl_User_Mapper.getUserByUserEmail(user.getPhoneNumber());
|
||||
tmpUser = tbl_User_Mapper.getUserByUserEmail(user.getUserEmail());
|
||||
return checkUserPassword(tmpUser, user);
|
||||
} //如果用户手机邮箱都为空,用户ID不为空,则进行游客登陆
|
||||
else if (user.getUserId() != null && user.getUserId() > 0) {
|
||||
|
|
@ -149,7 +149,7 @@ public class UserHelper implements UserHelperI {
|
|||
dataMap.put("userSex", user.getUserSex());
|
||||
dataMap.put("userImg", user.getUserImg());
|
||||
dataMap.put("nickName", user.getNickName());
|
||||
|
||||
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
|
||||
}
|
||||
|
||||
|
|
@ -162,6 +162,10 @@ public class UserHelper implements UserHelperI {
|
|||
if (StringUtils.isBlank(user.getUserEmail()) || StringUtils.isBlank(user.getUserPassword())) {
|
||||
return IfishUtil.returnJson(ResultEnum.error401.getKey(), "");
|
||||
} else {
|
||||
Tbl_User tmpUser = getUserByEmail(user.getUserEmail());
|
||||
if (tmpUser != null) {
|
||||
return IfishUtil.returnJson(ResultEnum.warn201.getKey(), "");
|
||||
}
|
||||
String md5 = IfishUtil.EncoderByMd5(user.getUserEmail() + user.getUserPassword());
|
||||
Map map = new HashMap();
|
||||
map.put("email", user.getUserEmail());
|
||||
|
|
@ -353,7 +357,7 @@ public class UserHelper implements UserHelperI {
|
|||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object updateUser(Tbl_User user) {
|
||||
try {
|
||||
|
|
@ -382,7 +386,7 @@ public class UserHelper implements UserHelperI {
|
|||
curUser.setUserSex(userSex);
|
||||
bln = true;
|
||||
}
|
||||
|
||||
|
||||
String registerId = user.getJiguangUserid();
|
||||
if (StringUtils.isNotBlank(registerId)) {
|
||||
curUser.setJiguangUserid(registerId);
|
||||
|
|
@ -431,7 +435,7 @@ public class UserHelper implements UserHelperI {
|
|||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tbl_User user = getUserById(userId);
|
||||
user.setUserImg(img);
|
||||
int i = tbl_User_Mapper.updateUser(user);
|
||||
|
|
@ -482,7 +486,7 @@ public class UserHelper implements UserHelperI {
|
|||
Map userMap = getUserMap(user);
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), userMap);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
|
|
@ -662,7 +666,7 @@ public class UserHelper implements UserHelperI {
|
|||
dataMap.put("device", deviceMap.get("list"));
|
||||
dataMap.put("camera", deviceMap.get("list2"));
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -762,7 +766,7 @@ public class UserHelper implements UserHelperI {
|
|||
if (tmpUser.getUpdateTime() != null) {
|
||||
userMap.put("updateTime", IfishUtil.format(tmpUser.getUpdateTime()));
|
||||
}
|
||||
|
||||
|
||||
return userMap;
|
||||
}
|
||||
|
||||
|
|
@ -791,9 +795,9 @@ public class UserHelper implements UserHelperI {
|
|||
//封装设备返回信息
|
||||
list.add(getDeviceInfo(device, deviceUser));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("list", list);
|
||||
map.put("list2", list2);
|
||||
|
|
@ -909,5 +913,5 @@ public class UserHelper implements UserHelperI {
|
|||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,15 @@ public interface Tbl_Live_Room_Mapper {
|
|||
@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);
|
||||
|
||||
/**
|
||||
* 根据开播时间来查询直播间
|
||||
*
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ public class RedisKey {
|
|||
*/
|
||||
public static final String LIVEROOM_ROOMID = "liveroomE:id_";
|
||||
|
||||
/**
|
||||
* 直播间详情表缓存前缀,以摄像头ID进行存储
|
||||
*/
|
||||
public static final String LIVEROOM_CAMERAID = "liveroomE:cid_";
|
||||
|
||||
/**
|
||||
* 直播间详情表缓存前缀,以直播间ID进行存储
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue