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
9da18c5e
Commit
9da18c5e
authored
Nov 07, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台添加IM接口
parent
b737e663
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
0 deletions
+88
-0
MsgQueryDto.java
...i/src/main/java/com/xxfc/platform/im/dto/MsgQueryDto.java
+16
-0
MsgBiz.java
...server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
+66
-0
MsgController.java
...rc/main/java/com/xxfc/platform/im/rest/MsgController.java
+6
-0
No files found.
xx-im/xx-im-api/src/main/java/com/xxfc/platform/im/dto/MsgQueryDto.java
0 → 100644
View file @
9da18c5e
package
com
.
xxfc
.
platform
.
im
.
dto
;
import
lombok.Data
;
@Data
public
class
MsgQueryDto
{
private
Integer
page
;
private
Integer
limit
;
private
Integer
source
;
private
Long
startTime
;
private
Long
endTime
;
private
Integer
praise
;
private
Integer
comment
;
private
String
username
;
private
Integer
type
;
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
View file @
9da18c5e
...
@@ -5,6 +5,8 @@ import cn.hutool.core.bean.BeanUtil;
...
@@ -5,6 +5,8 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.bean.copier.CopyOptions
;
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.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.vo.ImiVo
;
import
com.github.wxiaoqi.security.admin.vo.ImiVo
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
...
@@ -13,6 +15,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
...
@@ -13,6 +15,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
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
;
import
com.xxfc.platform.im.dto.MsgQueryDto
;
import
com.xxfc.platform.im.dto.PraiseVo
;
import
com.xxfc.platform.im.dto.PraiseVo
;
import
com.xxfc.platform.im.dto.QuestionParamDto
;
import
com.xxfc.platform.im.dto.QuestionParamDto
;
import
com.xxfc.platform.im.model.*
;
import
com.xxfc.platform.im.model.*
;
...
@@ -53,6 +56,8 @@ public class MsgBiz {
...
@@ -53,6 +56,8 @@ public class MsgBiz {
@Autowired
@Autowired
ThirdFeign
thirdFeign
;
ThirdFeign
thirdFeign
;
@Autowired
UserFeign
userFeign
;
/**
/**
* 获取消息列表
* 获取消息列表
*
*
...
@@ -339,6 +344,67 @@ public class MsgBiz {
...
@@ -339,6 +344,67 @@ public class MsgBiz {
* 后台管理接口
* 后台管理接口
*/
*/
public
ObjectRestResponse
getMsgList
(
MsgQueryDto
msgQueryDto
){
//获取所有朋友圈
Integer
page
=
msgQueryDto
.
getPage
()
==
null
?
1
:
msgQueryDto
.
getPage
();
Integer
limit
=
msgQueryDto
.
getLimit
()
==
null
?
10
:
msgQueryDto
.
getLimit
();
Pageable
pageable
=
PageRequest
.
of
(--
page
,
limit
);
Query
query
=
null
;
List
<
Msg
>
msgList
=
null
;
if
(
msgQueryDto
.
getType
()
!=
null
)
{
query
=
new
Query
(
Criteria
.
where
(
"body.type"
).
is
(
msgQueryDto
.
getType
()));
//评论数
if
(
msgQueryDto
.
getComment
()
!=
null
)
{
query
.
addCriteria
(
Criteria
.
where
(
"count.comment"
).
gte
(
msgQueryDto
.
getComment
()));
}
//点赞数
if
(
msgQueryDto
.
getPraise
()
!=
null
)
{
query
.
addCriteria
(
Criteria
.
where
(
"count.praise"
).
gte
(
msgQueryDto
.
getPraise
()));
}
//来源
if
(
msgQueryDto
.
getSource
()
!=
null
)
{
if
(
msgQueryDto
.
getSource
()
==
1
)
{
query
.
addCriteria
(
Criteria
.
where
(
"source"
).
is
(
msgQueryDto
.
getSource
()));
}
else
{
query
.
addCriteria
(
Criteria
.
where
(
"source"
).
is
(
msgQueryDto
.
getSource
()).
orOperator
(
Criteria
.
where
(
"source"
).
is
(
null
)));
}
}
//下单时间
if
(
msgQueryDto
.
getStartTime
()
!=
null
)
{
query
.
addCriteria
(
Criteria
.
where
(
"body.time"
).
gte
(
msgQueryDto
.
getStartTime
()).
orOperator
(
Criteria
.
where
(
"body.time"
).
lte
(
msgQueryDto
.
getEndTime
())));
}
//用户名
if
(
StringUtils
.
isNotBlank
(
msgQueryDto
.
getUsername
()))
{
AppUserLogin
appUserLogin
=
userFeign
.
one
(
msgQueryDto
.
getUsername
());
if
(
appUserLogin
!=
null
)
{
query
.
addCriteria
(
Criteria
.
where
(
"userId"
).
is
(
appUserLogin
.
getImUserid
()));
}
}
int
totalSize
=
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
).
size
();
query
.
with
(
pageable
);
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
"time"
));
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
null
);
PageInfo
<
MsgVo
>
goodPageInfo
=
new
PageInfo
<>(
replaceMsgResult
(
msgList
));
goodPageInfo
.
setPageSize
(
totalSize
%
limit
==
0
?
totalSize
/
limit
:
totalSize
/
limit
+
1
);
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
else
{
List
<
Integer
>
ids
=
new
ArrayList
<>();
ids
.
add
(
2
);
ids
.
add
(
4
);
query
=
new
Query
(
Criteria
.
where
(
"body.type"
).
in
(
ids
));
int
totalSize
=
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
).
size
();
query
.
with
(
pageable
);
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
"time"
));
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
null
);
PageInfo
<
MsgVo
>
goodPageInfo
=
new
PageInfo
<>(
replaceMsgResult
(
msgList
));
goodPageInfo
.
setPageSize
(
totalSize
%
limit
==
0
?
totalSize
/
limit
:
totalSize
/
limit
+
1
);
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
}
/**
/**
* 新增消息接口
* 新增消息接口
* @param param
* @param param
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/MsgController.java
View file @
9da18c5e
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.im.rest;
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.im.rest;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.im.biz.MsgBiz
;
import
com.xxfc.platform.im.biz.MsgBiz
;
import
com.xxfc.platform.im.dto.MsgQueryDto
;
import
com.xxfc.platform.im.model.AddMsgParam
;
import
com.xxfc.platform.im.model.AddMsgParam
;
import
com.xxfc.platform.im.model.Msg
;
import
com.xxfc.platform.im.model.Msg
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -50,4 +51,9 @@ public class MsgController {
...
@@ -50,4 +51,9 @@ public class MsgController {
public
ObjectRestResponse
updateMsg
(
@RequestBody
Msg
msg
)
{
public
ObjectRestResponse
updateMsg
(
@RequestBody
Msg
msg
)
{
return
msgBiz
.
update
(
msg
);
return
msgBiz
.
update
(
msg
);
}
}
@PostMapping
(
value
=
"/bg/app/unauth/list"
)
public
ObjectRestResponse
getMsgList
(
@RequestBody
MsgQueryDto
msgQueryDto
)
{
return
msgBiz
.
getMsgList
(
msgQueryDto
);
}
}
}
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