直播间分页结果修改

This commit is contained in:
谢洪龙 2017-07-21 16:08:32 +08:00
parent 1aac98e96e
commit e328440200
2 changed files with 15 additions and 5 deletions

View File

@ -7,6 +7,7 @@ package com.ifish.helper;
import com.ifish.Interceptor.IfishException; import com.ifish.Interceptor.IfishException;
import com.ifish.bean.LiveRoomPageInfo; import com.ifish.bean.LiveRoomPageInfo;
import com.ifish.bean.PageResult;
import com.ifish.bean.Tbl_Device_User; import com.ifish.bean.Tbl_Device_User;
import com.ifish.bean.Tbl_Live_Message; import com.ifish.bean.Tbl_Live_Message;
import com.ifish.bean.Tbl_Live_Room; import com.ifish.bean.Tbl_Live_Room;
@ -362,7 +363,6 @@ public class LiveRoomHelper implements LiveRoomHelperI {
try { try {
if (firstResult != null && pageSize != null) { if (firstResult != null && pageSize != null) {
Map<String, Object> returnMap = new HashMap<String, Object>();
List<LiveRoomPageInfo> timeList = new ArrayList<LiveRoomPageInfo>(); List<LiveRoomPageInfo> timeList = new ArrayList<LiveRoomPageInfo>();
String key = redisKeyHelperI.getListTbl_Live_Room_RedisKey(firstResult, pageSize, orders); String key = redisKeyHelperI.getListTbl_Live_Room_RedisKey(firstResult, pageSize, orders);
String redisString = redisHelperI.getRedis(key); String redisString = redisHelperI.getRedis(key);
@ -388,10 +388,10 @@ public class LiveRoomHelper implements LiveRoomHelperI {
count = tbl_Live_Room_Mapper.getLiveRoomListCount(); count = tbl_Live_Room_Mapper.getLiveRoomListCount();
redisHelperI.setRedis(key, count.toString()); redisHelperI.setRedis(key, count.toString());
} }
returnMap.put("orders", orders); PageResult page = new PageResult();
returnMap.put("total", count); page.setList(timeList);
returnMap.put("liveRoomInfo", timeList); page.setTotalCount(count);
return IfishUtil.toJson(ResultEnum.success.getKey(), returnMap); return IfishUtil.returnPageData(page, ResultEnum.success.getKey());
} }
return IfishUtil.toJson(ResultEnum.fail101.getKey(), ""); return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
} catch (Exception e) { } catch (Exception e) {

View File

@ -15,6 +15,7 @@ import java.security.NoSuchAlgorithmException;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -309,6 +310,7 @@ public class IfishUtil {
public static Map<String, Object> toJson(String key, Object value) { public static Map<String, Object> toJson(String key, Object value) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("result", key); map.put("result", key);
List<Object> list = null;
if (value.equals("")) { if (value.equals("")) {
map.put("data", null); map.put("data", null);
} else { } else {
@ -318,6 +320,14 @@ public class IfishUtil {
map.put("total", map1.get("total")); map.put("total", map1.get("total"));
map1.remove("total"); map1.remove("total");
} }
if (map1.get("orders") != null && StringUtils.isNotBlank(map1.get("orders").toString())) {
map.put("orders", map1.get("orders"));
map1.remove("orders");
}
if (map1.get("list") != null && StringUtils.isNotBlank(map1.get("list").toString())) {
list = (List<Object>) map1.get("list");
map1.remove("list");
}
} }
map.put("data", value); map.put("data", value);
} }