Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lingxi-lxy-yanshou
Project
Project
Details
Activity
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
后端-黄柯铭
lingxi-lxy-yanshou
Commits
d5be870a
Commit
d5be870a
authored
Jul 23, 2021
by
yzc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增发送系统自定义消息内部接口
parent
65f21964
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
190 additions
and
9 deletions
+190
-9
MessageTitle.java
...ava/com/ssy/lingxi/message/api/constant/MessageTitle.java
+12
-0
SystemMessageControllerFeignFallback.java
...ge/api/fallback/SystemMessageControllerFeignFallback.java
+8
-2
SystemMessageControllerFeign.java
...ingxi/message/api/feign/SystemMessageControllerFeign.java
+15
-6
SystemMessageCustomRequest.java
...xi/message/api/vo/request/SystemMessageCustomRequest.java
+79
-0
SystemMessageController.java
...gxi/message/controller/inner/SystemMessageController.java
+12
-0
IMemberMessageService.java
...com/ssy/lingxi/message/service/IMemberMessageService.java
+7
-0
MemberMessageServiceImpl.java
.../lingxi/message/serviceimpl/MemberMessageServiceImpl.java
+57
-1
No files found.
message-service/message-service-api/src/main/java/com/ssy/lingxi/message/api/constant/MessageTitle.java
0 → 100644
View file @
d5be870a
package
com
.
ssy
.
lingxi
.
message
.
api
.
constant
;
/**
* 消息标题
* @author yzc
* @version 2.0.0
* @date 2021/7/23
*/
public
interface
MessageTitle
{
String
confirm_demand_quotation
=
"确认报价"
;
}
message-service/message-service-api/src/main/java/com/ssy/lingxi/message/api/fallback/SystemMessageControllerFeignFallback.java
View file @
d5be870a
...
@@ -3,6 +3,7 @@ package com.ssy.lingxi.message.api.fallback;
...
@@ -3,6 +3,7 @@ package com.ssy.lingxi.message.api.fallback;
import
com.ssy.lingxi.common.response.ResponseCode
;
import
com.ssy.lingxi.common.response.ResponseCode
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.message.api.feign.SystemMessageControllerFeign
;
import
com.ssy.lingxi.message.api.feign.SystemMessageControllerFeign
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageCustomRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -12,12 +13,17 @@ import java.util.List;
...
@@ -12,12 +13,17 @@ import java.util.List;
public
class
SystemMessageControllerFeignFallback
implements
SystemMessageControllerFeign
{
public
class
SystemMessageControllerFeignFallback
implements
SystemMessageControllerFeign
{
@Override
@Override
public
Wrapper
sendSystemMessage
(
SystemMessageRequest
request
)
{
public
Wrapper
<
Void
>
sendSystemMessage
(
SystemMessageRequest
request
)
{
return
Wrapper
.
fail
(
ResponseCode
.
SERVICE_MESSAGE_ERROR
);
return
Wrapper
.
fail
(
ResponseCode
.
SERVICE_MESSAGE_ERROR
);
}
}
@Override
@Override
public
Wrapper
batchSendSystemMessage
(
List
<
SystemMessageRequest
>
request
)
{
public
Wrapper
<
Void
>
batchSendSystemMessage
(
List
<
SystemMessageRequest
>
request
)
{
return
Wrapper
.
fail
(
ResponseCode
.
SERVICE_MESSAGE_ERROR
);
}
@Override
public
Wrapper
<
Void
>
sendCustomMessage
(
SystemMessageCustomRequest
request
)
{
return
Wrapper
.
fail
(
ResponseCode
.
SERVICE_MESSAGE_ERROR
);
return
Wrapper
.
fail
(
ResponseCode
.
SERVICE_MESSAGE_ERROR
);
}
}
}
}
message-service/message-service-api/src/main/java/com/ssy/lingxi/message/api/feign/SystemMessageControllerFeign.java
View file @
d5be870a
package
com
.
ssy
.
lingxi
.
message
.
api
.
feign
;
package
com
.
ssy
.
lingxi
.
message
.
api
.
feign
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageCustomRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -20,18 +21,26 @@ public interface SystemMessageControllerFeign {
...
@@ -20,18 +21,26 @@ public interface SystemMessageControllerFeign {
/**
/**
* 发送系统消息
* 发送系统消息
* @param request
* @param request
接口参数
* @return
* @return
返回结果
*/
*/
@PostMapping
(
"/message/systemMessage/feign/send"
)
@PostMapping
(
"/message/systemMessage/feign/send"
)
Wrapper
sendSystemMessage
(
@RequestBody
SystemMessageRequest
request
);
Wrapper
<
Void
>
sendSystemMessage
(
@RequestBody
SystemMessageRequest
request
);
/**
/**
* 发送系统消息(批量)
* 发送系统消息(批量)
* @param request
* @param request
接口参数
* @return
* @return
返回结果
*/
*/
@PostMapping
(
"/message/systemMessage/feign/batchSend"
)
@PostMapping
(
"/message/systemMessage/feign/batchSend"
)
Wrapper
batchSendSystemMessage
(
@RequestBody
List
<
SystemMessageRequest
>
request
);
Wrapper
<
Void
>
batchSendSystemMessage
(
@RequestBody
List
<
SystemMessageRequest
>
request
);
/**
* 发送系统消息
* @param request 接口参数
* @return 返回结果
*/
@PostMapping
(
"/message/systemMessage/feign/custom"
)
Wrapper
<
Void
>
sendCustomMessage
(
@RequestBody
SystemMessageCustomRequest
request
);
}
}
message-service/message-service-api/src/main/java/com/ssy/lingxi/message/api/vo/request/SystemMessageCustomRequest.java
0 → 100644
View file @
d5be870a
package
com
.
ssy
.
lingxi
.
message
.
api
.
vo
.
request
;
import
java.io.Serializable
;
/**
* 系统自定义消息
* @author yzc
* @version 2.0.0
* @date 2020/11/30
*/
public
class
SystemMessageCustomRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6965770140466930623L
;
/**
* 接收会员id
*/
private
Long
memberId
;
/**
* 接收角色id
*/
private
Long
roleId
;
/**
* 接收用户id
*/
private
Long
userId
;
/**
* 消息标题
*/
private
String
title
;
/**
* 消息内容
*/
private
String
content
;
public
Long
getMemberId
()
{
return
memberId
;
}
public
void
setMemberId
(
Long
memberId
)
{
this
.
memberId
=
memberId
;
}
public
Long
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
Long
roleId
)
{
this
.
roleId
=
roleId
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
}
message-service/src/main/java/com/ssy/lingxi/message/controller/inner/SystemMessageController.java
View file @
d5be870a
...
@@ -2,6 +2,7 @@ package com.ssy.lingxi.message.controller.inner;
...
@@ -2,6 +2,7 @@ package com.ssy.lingxi.message.controller.inner;
import
com.ssy.lingxi.common.controller.BaseController
;
import
com.ssy.lingxi.common.controller.BaseController
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageCustomRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.service.IMemberMessageService
;
import
com.ssy.lingxi.message.service.IMemberMessageService
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -46,4 +47,15 @@ public class SystemMessageController extends BaseController {
...
@@ -46,4 +47,15 @@ public class SystemMessageController extends BaseController {
messageService
.
batchSendSystemMessage
(
request
);
messageService
.
batchSendSystemMessage
(
request
);
return
Wrapper
.
success
();
return
Wrapper
.
success
();
}
}
/**
* 发送系统消息
* @param request
* @return
*/
@PostMapping
(
"/custom"
)
Wrapper
sendCustomMessage
(
@RequestBody
SystemMessageCustomRequest
request
)
{
messageService
.
sendCustomMessage
(
request
);
return
Wrapper
.
success
();
}
}
}
message-service/src/main/java/com/ssy/lingxi/message/service/IMemberMessageService.java
View file @
d5be870a
...
@@ -7,6 +7,7 @@ import com.ssy.lingxi.common.response.PageData;
...
@@ -7,6 +7,7 @@ import com.ssy.lingxi.common.response.PageData;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdRequest
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdRequest
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdsRequest
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdsRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageCustomRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.response.MessageResponse
;
import
com.ssy.lingxi.message.api.vo.response.MessageResponse
;
...
@@ -92,5 +93,11 @@ public interface IMemberMessageService {
...
@@ -92,5 +93,11 @@ public interface IMemberMessageService {
* @param request 请求参数
* @param request 请求参数
*/
*/
void
batchSendSystemMessage
(
List
<
SystemMessageRequest
>
request
);
void
batchSendSystemMessage
(
List
<
SystemMessageRequest
>
request
);
/**
* 发送系统消息
* @param request 请求参数
*/
void
sendCustomMessage
(
SystemMessageCustomRequest
request
);
}
}
message-service/src/main/java/com/ssy/lingxi/message/serviceimpl/MemberMessageServiceImpl.java
View file @
d5be870a
...
@@ -9,6 +9,7 @@ import com.ssy.lingxi.common.response.ResponseCode;
...
@@ -9,6 +9,7 @@ import com.ssy.lingxi.common.response.ResponseCode;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.common.response.Wrapper
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdRequest
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdRequest
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdsRequest
;
import
com.ssy.lingxi.message.api.vo.request.MessageIdsRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageCustomRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.request.SystemMessageRequest
;
import
com.ssy.lingxi.message.api.vo.response.MessageResponse
;
import
com.ssy.lingxi.message.api.vo.response.MessageResponse
;
import
com.ssy.lingxi.message.constant.MessageConstants
;
import
com.ssy.lingxi.message.constant.MessageConstants
;
...
@@ -289,7 +290,7 @@ public class MemberMessageServiceImpl implements IMemberMessageService {
...
@@ -289,7 +290,7 @@ public class MemberMessageServiceImpl implements IMemberMessageService {
// 推送未读消息数
// 推送未读消息数
memberMessageList
.
forEach
(
memberMessage
->
{
memberMessageList
.
forEach
(
memberMessage
->
{
messageEventService
.
onMessage
(
systemMessageRequest
.
getMemberId
(),
systemMessageRequest
.
get
RoleId
(),
memberMessage
.
getRecUserId
());
messageEventService
.
onMessage
(
memberMessage
.
getRecMemberId
(),
memberMessage
.
getRec
RoleId
(),
memberMessage
.
getRecUserId
());
if
(
Arrays
.
stream
(
MessageBusinessTypeEnum
.
values
()).
anyMatch
(
e
->
e
.
getCode
().
equals
(
messageNotice
.
getBusinessType
())))
{
if
(
Arrays
.
stream
(
MessageBusinessTypeEnum
.
values
()).
anyMatch
(
e
->
e
.
getCode
().
equals
(
messageNotice
.
getBusinessType
())))
{
List
<
PushDevice
>
pushDeviceList
=
pushDeviceRepository
.
findAllByMemberIdAndRoleId
(
systemMessageRequest
.
getMemberId
(),
systemMessageRequest
.
getRoleId
());
List
<
PushDevice
>
pushDeviceList
=
pushDeviceRepository
.
findAllByMemberIdAndRoleId
(
systemMessageRequest
.
getMemberId
(),
systemMessageRequest
.
getRoleId
());
...
@@ -348,4 +349,59 @@ public class MemberMessageServiceImpl implements IMemberMessageService {
...
@@ -348,4 +349,59 @@ public class MemberMessageServiceImpl implements IMemberMessageService {
sendSystemMessage
(
systemMessageRequest
);
sendSystemMessage
(
systemMessageRequest
);
}
}
}
}
@Override
public
void
sendCustomMessage
(
SystemMessageCustomRequest
request
)
{
if
(
Objects
.
isNull
(
request
.
getMemberId
())
||
Objects
.
isNull
(
request
.
getRoleId
()))
{
return
;
}
List
<
MemberMessage
>
memberMessageList
=
new
ArrayList
<>();
if
(
Objects
.
isNull
(
request
.
getUserId
()))
{
List
<
Long
>
userIds
=
memberFeignService
.
getUserByMemberIds
(
request
.
getMemberId
());
memberMessageList
=
userIds
.
stream
().
map
(
userId
->
{
MemberMessage
memberMessage
=
new
MemberMessage
();
memberMessage
.
setSendMemberId
(
0L
);
memberMessage
.
setSendRoleId
(
0L
);
memberMessage
.
setRecMemberId
(
request
.
getMemberId
());
memberMessage
.
setRecRoleId
(
request
.
getRoleId
());
memberMessage
.
setRecUserId
(
userId
);
memberMessage
.
setTitle
(
request
.
getTitle
());
memberMessage
.
setContent
(
request
.
getContent
());
memberMessage
.
setUrl
(
""
);
memberMessage
.
setAppUrl
(
""
);
memberMessage
.
setDeleted
(
CommonBooleanEnum
.
NO
.
getCode
());
memberMessage
.
setStatus
(
CommonBooleanEnum
.
NO
.
getCode
());
memberMessage
.
setType
(
MessageTypeEnum
.
SYSTEM
.
getCode
());
memberMessage
.
setSendTime
(
System
.
currentTimeMillis
());
memberMessage
.
setCreateTime
(
System
.
currentTimeMillis
());
return
memberMessage
;
}).
collect
(
Collectors
.
toList
());
}
else
{
// 指定发送到会员下的用户
MemberMessage
memberMessage
=
new
MemberMessage
();
memberMessage
.
setSendMemberId
(
0L
);
memberMessage
.
setSendRoleId
(
0L
);
memberMessage
.
setRecMemberId
(
request
.
getMemberId
());
memberMessage
.
setRecRoleId
(
request
.
getRoleId
());
memberMessage
.
setRecUserId
(
request
.
getUserId
());
memberMessage
.
setTitle
(
request
.
getTitle
());
memberMessage
.
setContent
(
request
.
getContent
());
memberMessage
.
setUrl
(
""
);
memberMessage
.
setAppUrl
(
""
);
memberMessage
.
setDeleted
(
CommonBooleanEnum
.
NO
.
getCode
());
memberMessage
.
setStatus
(
CommonBooleanEnum
.
NO
.
getCode
());
memberMessage
.
setType
(
MessageTypeEnum
.
SYSTEM
.
getCode
());
memberMessage
.
setSendTime
(
System
.
currentTimeMillis
());
memberMessage
.
setCreateTime
(
System
.
currentTimeMillis
());
}
memberMessageRepository
.
saveAll
(
memberMessageList
);
// 推送未读消息数
memberMessageList
.
forEach
(
memberMessage
->
{
messageEventService
.
onMessage
(
memberMessage
.
getRecMemberId
(),
memberMessage
.
getRecRoleId
(),
memberMessage
.
getRecUserId
());
});
}
}
}
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