Commit e3824f42 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/master'

parents eda33414 432c9e4a
...@@ -3,6 +3,7 @@ package com.xxfc.platform.im.biz; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.im.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
...@@ -13,6 +14,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -13,6 +14,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil; import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists;
import com.mongodb.client.result.DeleteResult; import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult; import com.mongodb.client.result.UpdateResult;
import com.xxfc.platform.im.dto.CommentVo; import com.xxfc.platform.im.dto.CommentVo;
...@@ -88,9 +90,7 @@ public class MsgBiz { ...@@ -88,9 +90,7 @@ public class MsgBiz {
goodPageInfo.setPageSize(totalSize % limit == 0 ? totalSize / limit : totalSize / limit + 1); goodPageInfo.setPageSize(totalSize % limit == 0 ? totalSize / limit : totalSize / limit + 1);
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} else { } else {
List<Integer> ids = new ArrayList<>(); List<Integer> ids = getType();
ids.add(2);
ids.add(4);
query = new Query(Criteria.where("body.type").in(ids).and("visible").is(1)); query = new Query(Criteria.where("body.type").in(ids).and("visible").is(1));
int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size(); int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size();
query.with(pageable); query.with(pageable);
...@@ -113,9 +113,7 @@ public class MsgBiz { ...@@ -113,9 +113,7 @@ public class MsgBiz {
page = page == null ? 1 : page; page = page == null ? 1 : page;
limit = limit == null ? 10 : limit; limit = limit == null ? 10 : limit;
Pageable pageable = PageRequest.of(--page, limit); Pageable pageable = PageRequest.of(--page, limit);
List<Integer> ids = new ArrayList<>(); List<Integer> ids = getType();
ids.add(2);
ids.add(4);
Query query = new Query(Criteria.where("body.type").in(ids).and("count.praise").gt(getNumber()).and("visible").is(1)); Query query = new Query(Criteria.where("body.type").in(ids).and("count.praise").gt(getNumber()).and("visible").is(1));
int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size(); int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size();
query.with(pageable); query.with(pageable);
...@@ -370,6 +368,17 @@ public class MsgBiz { ...@@ -370,6 +368,17 @@ public class MsgBiz {
} }
public List<Integer> getType() {
List<Integer> list = Lists.newArrayList();
Dictionary dictionary = thirdFeign.findDictionaryByTypeAndCode(IM_TYPE, DictionaryKey.IM_MSG_TYPE_LIST);
if (dictionary != null && StringUtils.isNotBlank(dictionary.getDetail())) {
log.info("查询IM限制数为字典表的结果为: dictionary = {}", dictionary.toString());
list = JSONArray.parseArray( dictionary.getDetail(), Integer.class);
}
return list;
}
/** /**
* 后台管理接口 * 后台管理接口
*/ */
...@@ -427,9 +436,7 @@ public class MsgBiz { ...@@ -427,9 +436,7 @@ public class MsgBiz {
goodPageInfo.setTotal(totalSize); goodPageInfo.setTotal(totalSize);
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} else { } else {
List<Integer> ids = new ArrayList<>(); List<Integer> ids = getType();
ids.add(2);
ids.add(4);
query = new Query(Criteria.where("body.type").in(ids)); query = new Query(Criteria.where("body.type").in(ids));
int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size(); int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size();
query.with(pageable); query.with(pageable);
......
...@@ -37,6 +37,12 @@ public class DictionaryKey { ...@@ -37,6 +37,12 @@ public class DictionaryKey {
* IM限制条数 * IM限制条数
*/ */
public static final String MSG_LIMIT_NUMBER = "MSG_LIMIT_NUMBER"; public static final String MSG_LIMIT_NUMBER = "MSG_LIMIT_NUMBER";
/**
*
*/
public static final String IM_MSG_TYPE_LIST = "IM_MSG_TYPE_LIST";
/** /**
* 支付 * 支付
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment