Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
09616a82
Commit
09616a82
authored
Nov 28, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature-delay-add' into feature-delay-add
parents
25bb2c70
e6835b7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
MsgBiz.java
...server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
+30
-0
MsgController.java
...rc/main/java/com/xxfc/platform/im/rest/MsgController.java
+9
-0
No files found.
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
View file @
09616a82
...
...
@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.vo.ImiVo
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.RandomUtil
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.mongodb.client.result.DeleteResult
;
...
...
@@ -24,6 +25,7 @@ import com.xxfc.platform.universal.constant.DictionaryKey;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.bson.types.ObjectId
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -124,6 +126,34 @@ public class MsgBiz {
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
public
ObjectRestResponse
getHotMsgListWithoutOne
(
String
messageId
,
Integer
number
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
Integer
userId
=
null
;
if
(
appUserDTO
!=
null
)
{
userId
=
appUserDTO
.
getImUserid
();
}
number
=
number
==
null
?
10
:
number
;
Query
query
=
new
Query
(
Criteria
.
where
(
"body.type"
).
is
(
4
).
and
(
"count.praise"
).
gt
(
getNumber
()).
and
(
"visible"
).
is
(
1
));
if
(
StringUtils
.
isNotBlank
(
messageId
))
{
query
.
addCriteria
(
Criteria
.
where
(
"_id"
).
ne
(
new
ObjectId
(
messageId
)));
}
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
"count.praise"
));
List
<
Msg
>
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
userId
);
Set
<
Msg
>
resultList
=
new
HashSet
<>();
if
(
CollectionUtils
.
isNotEmpty
(
msgList
))
{
if
(
number
>=
msgList
.
size
())
{
return
ObjectRestResponse
.
succ
(
msgList
);
}
Set
<
Integer
>
set
=
new
HashSet
<>();
RandomUtil
.
randomSet
(
msgList
.
size
(),
number
,
set
,
number
);
for
(
Integer
i
:
set
)
{
resultList
.
add
(
msgList
.
get
(
i
));
}
}
return
ObjectRestResponse
.
succ
(
resultList
);
}
public
ObjectRestResponse
get
(
String
id
)
{
//获取所有朋友圈
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/MsgController.java
View file @
09616a82
...
...
@@ -61,5 +61,14 @@ public class MsgController {
return
msgBiz
.
getMsgList
(
msgQueryDto
);
}
@GetMapping
(
value
=
"/app/unauth/getHostMsgList"
)
public
ObjectRestResponse
getHostMsgList
(
String
messageId
,
Integer
number
)
{
return
msgBiz
.
getHotMsgListWithoutOne
(
messageId
,
number
);
}
@GetMapping
(
value
=
"/app/unauth/get"
)
public
ObjectRestResponse
getDetail
(
String
id
)
{
return
msgBiz
.
get
(
id
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment