| | |
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 推荐记录 -(新后台)
|
| | | * @param callback
|
| | | * @param key
|
| | | * @param type
|
| | | * @param pageIndex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getNewPushRecordList")
|
| | | public void getNewPushRecordList(String callback, String key, Integer type, Integer pageIndex, PrintWriter out){
|
| | | try {
|
| | | |
| | | if (pageIndex == null || pageIndex < 0){
|
| | | pageIndex = 1;
|
| | | }
|
| | | |
| | | if (type == null) {
|
| | | type = 0;
|
| | | }
|
| | | |
| | | List<PushRecord> list = pushRecordService.getPushRecordList(key, type, pageIndex);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无更多数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | int count = pushRecordService.getCount(key, type, pageIndex);
|
| | | |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", list);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | |
| | | }
|