Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SiEn
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
SiEn
Commits
08ef93c7
Commit
08ef93c7
authored
Nov 04, 2020
by
zhangjw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1:完善订单推送逻辑
parent
ddcf6b33
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
18 deletions
+25
-18
customer-service/src/main/java/com/ym/im/entity/Stroke.java
+0
-7
customer-service/src/main/java/com/ym/im/mq/Receiver.java
+10
-11
customer-service/src/main/java/com/ym/im/service/MsgBodyService.java
+14
-0
customer-service/src/main/java/com/ym/im/service/impl/UserSingleChatServiceImpl.java
+1
-0
No files found.
customer-service/src/main/java/com/ym/im/entity/Stroke.java
View file @
08ef93c7
package
com
.
ym
.
im
.
entity
;
import
com.ym.im.validation.group.ChatRecordSaveGroup
;
import
com.ym.im.validation.group.ChatRecordSendGroup
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.groups.Default
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.sql.Timestamp
;
import
java.util.Date
;
/**
* 行程表
...
...
@@ -144,6 +139,4 @@ public class Stroke implements Serializable {
@ApiModelProperty
(
"是否是优惠调机,0-否,1-是"
)
private
Boolean
isDiscount
;
@ApiModelProperty
(
value
=
"发送时间"
)
private
Date
sendTime
;
}
customer-service/src/main/java/com/ym/im/mq/Receiver.java
View file @
08ef93c7
package
com
.
ym
.
im
.
mq
;
import
com.ym.im.entity.MsgBody
;
import
com.ym.im.entity.StaffSocketInfo
;
import
com.ym.im.entity.Stroke
;
import
com.ym.im.entity.UserSocketInfo
;
import
com.ym.im.entity.*
;
import
com.ym.im.entity.base.NettyConstant
;
import
com.ym.im.entity.model.IdModel
;
import
com.ym.im.handler.ChannelGroupHandler
;
import
com.ym.im.service.ChatService
;
import
com.ym.im.service.StaffService
;
import
com.ym.im.util.JsonUtils
;
import
lombok.SneakyThrows
;
...
...
@@ -28,9 +26,6 @@ import java.util.Set;
@Component
public
class
Receiver
{
@Autowired
private
Queue
queue
;
@Resource
(
name
=
"myRedisTemplate"
)
private
RedisTemplate
redisTemplate
;
...
...
@@ -40,6 +35,9 @@ public class Receiver {
@Autowired
private
ChannelGroupHandler
channelGroup
;
@Autowired
private
ChatService
staffSingleChatServiceImpl
;
@RabbitListener
(
queues
=
"#{staffOfflineQueue.name}"
)
public
void
offlineHandler
(
StaffSocketInfo
staffSocketInfo
)
{
...
...
@@ -67,7 +65,7 @@ public class Receiver {
/**
* 订单相关处理
*
* @param
orderModel
* @param
json
*/
@SneakyThrows
@RabbitListener
(
queues
=
"#{orderQueue.name}"
)
...
...
@@ -76,14 +74,15 @@ public class Receiver {
log
.
info
(
"订单信息: "
+
json
);
final
Long
mcId
=
stroke
.
getMcId
();
final
Long
userId
=
stroke
.
getUserId
();
final
UserSocketInfo
userSocketInfo
=
channelGroup
.
USER_GROUP
.
get
(
userId
);
final
UserSocketInfo
userSocketInfo
=
channelGroup
.
USER_GROUP
.
get
(
20L
);
if
(
userSocketInfo
==
null
)
{
return
;
}
stroke
.
setSendTime
(
new
Date
());
final
MsgBody
<
Stroke
>
orderInfo
=
new
MsgBody
<
Stroke
>().
setCode
(
MsgBody
.
ORDER
).
setData
(
stroke
);
final
StaffSocketInfo
staffSocketInfo
=
channelGroup
.
getMerchantStaff
(
userSocketInfo
.
getStaffId
(
stroke
.
getMcId
()))
==
null
?
staffService
.
getIdleStaff
(
mcId
,
userId
)
:
channelGroup
.
getMerchantStaff
(
userSocketInfo
.
getStaffId
(
stroke
.
getMcId
()));
if
(
staffSocketInfo
!=
null
)
{
final
ChatRecord
chatRecord
=
new
ChatRecord
().
setMsgInfo
(
json
).
setUserId
(
userId
).
setSendTime
(
new
Date
()).
setMsgType
(
MsgBody
.
ORDER
);
final
MsgBody
<
ChatRecord
>
orderInfo
=
new
MsgBody
<
ChatRecord
>().
setCode
(
MsgBody
.
ORDER
).
setData
(
chatRecord
);
staffSingleChatServiceImpl
.
save
(
staffSocketInfo
.
getStaffId
(),
orderInfo
);
staffSocketInfo
.
writeAndFlush
(
orderInfo
);
log
.
info
(
"客服订单: "
+
"给客服("
+
staffSocketInfo
.
getStaffId
()
+
")发送订单:"
+
json
);
}
...
...
customer-service/src/main/java/com/ym/im/service/MsgBodyService.java
View file @
08ef93c7
...
...
@@ -15,7 +15,21 @@ import javax.validation.constraints.NotNull;
**/
public
interface
MsgBodyService
{
/**
* 消息流程处理器
*
* @param ctx
* @param msgBody
* @throws JsonProcessingException
*/
void
msgBodyHandle
(
@NotNull
ChannelHandlerContext
ctx
,
@Valid
MsgBody
<
ChatRecord
>
msgBody
)
throws
JsonProcessingException
;
/**
* 发送与回执
*
* @param channel
* @param msgBody
* @throws JsonProcessingException
*/
void
sendAndAck
(
NioSocketChannel
channel
,
MsgBody
<
ChatRecord
>
msgBody
)
throws
JsonProcessingException
;
}
customer-service/src/main/java/com/ym/im/service/impl/UserSingleChatServiceImpl.java
View file @
08ef93c7
...
...
@@ -113,6 +113,7 @@ public class UserSingleChatServiceImpl implements ChatService {
if
(
staffId
==
null
)
{
staffSocketInfo
=
staffService
.
getIdleStaff
(
merchantId
,
id
);
if
(
staffSocketInfo
==
null
)
{
log
.
info
(
"当前没有客服在线! "
);
return
null
;
}
}
else
{
...
...
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