Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
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
wecloud_im_server
Commits
2b4abe25
Commit
2b4abe25
authored
Nov 12, 2020
by
zhangjw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "1:修改mq配置 2:完善客服模块订单处理逻辑 (待完善)"
This reverts commit
3eed56ed
parent
be4059d0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
51 deletions
+8
-51
customer-service/src/main/java/com/ym/im/entity/MsgBody.java
+1
-5
customer-service/src/main/java/com/ym/im/mq/Receiver.java
+5
-44
customer-service/src/main/resources/application-dev.yml
+2
-2
No files found.
customer-service/src/main/java/com/ym/im/entity/MsgBody.java
View file @
2b4abe25
...
...
@@ -29,8 +29,6 @@ public class MsgBody<T> implements Serializable {
public
static
final
int
ORDER
=
5
;
public
static
final
int
DISTRIBUTION_STAFF
=
6
;
public
static
final
int
BINDINGFAILURE
=
7
;
public
static
final
int
MERCHANTS_OFFLINE
=
8
;
@NotNull
(
message
=
"{error.msg_body_status_empty}"
,
groups
=
MsgBodyGroup
.
class
)
@ApiModelProperty
(
value
=
" * 操作类型说明\n"
+
...
...
@@ -43,9 +41,7 @@ public class MsgBody<T> implements Serializable {
" * 4、用户上线\n"
+
" * 5、订单"
+
" * 6、分配客服"
+
" * 7、绑定失败"
+
" * 8、当前客服不在线,请稍后等待"
" * 7、绑定失败"
)
private
Integer
code
;
...
...
customer-service/src/main/java/com/ym/im/mq/Receiver.java
View file @
2b4abe25
package
com
.
ym
.
im
.
mq
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
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.ChatRecordService
;
import
com.ym.im.service.ChatService
;
import
com.ym.im.service.SessionListService
;
import
com.ym.im.service.StaffService
;
import
com.ym.im.util.JsonUtils
;
import
lombok.SneakyThrows
;
...
...
@@ -21,8 +18,6 @@ import javax.annotation.Resource;
import
java.util.Date
;
import
java.util.Set
;
import
static
com
.
ym
.
im
.
entity
.
ChatRecord
.
RECEIVE
;
/**
* @author: JJww
* @Date:2019-05-30
...
...
@@ -43,18 +38,6 @@ public class Receiver {
@Autowired
private
ChatService
staffSingleChatServiceImpl
;
@Autowired
private
SessionListService
sessiontListService
;
@Autowired
private
ChatRecordService
chatRecordService
;
/**
* 卓美亚商户ID 默认商户
*/
private
static
final
Long
JUMEIRAH_ID
=
1L
;
@RabbitListener
(
queues
=
"#{staffOfflineQueue.name}"
)
public
void
offlineHandler
(
StaffSocketInfo
staffSocketInfo
)
{
...
...
@@ -96,37 +79,14 @@ public class Receiver {
return
;
}
final
StaffSocketInfo
staffSocketInfo
=
channelGroup
.
getMerchantStaff
(
userSocketInfo
.
getStaffId
(
stroke
.
getMcId
()))
==
null
?
staffService
.
getIdleStaff
(
mcId
,
userId
)
:
channelGroup
.
getMerchantStaff
(
userSocketInfo
.
getStaffId
(
stroke
.
getMcId
()));
final
MsgBody
<
ChatRecord
>
orderInfo
=
new
MsgBody
<
ChatRecord
>().
setCode
(
MsgBody
.
ORDER
).
setData
(
new
ChatRecord
().
setMsgInfo
(
json
).
setUserId
(
userId
).
setSendTime
(
new
Date
()).
setMsgType
(
MsgBody
.
ORDER
));
if
(
staffSocketInfo
==
null
)
{
//没有商户在线 逻辑待优化....完善
log
.
info
(
"当前客服不在线,请稍后等待!"
);
final
ChatRecord
chatRecord
=
orderInfo
.
getData
();
chatRecord
.
setId
(
IdWorker
.
getId
())
.
setMerchantId
(
JUMEIRAH_ID
)
.
setSendReceive
(
RECEIVE
)
.
setCreateTime
(
new
Date
());
chatRecordService
.
insertSelective
(
chatRecord
);
this
.
updateMerchantList
(
orderInfo
);
userSocketInfo
.
writeAndFlush
(
new
MsgBody
<>().
setCode
(
MsgBody
.
MERCHANTS_OFFLINE
));
return
;
}
orderInfo
.
getData
().
setMerchantId
(
staffSocketInfo
.
getMerchantId
());
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
);
this
.
updateMerchantList
(
orderInfo
);
if
(
staffSocketInfo
!=
null
)
{
staffSocketInfo
.
writeAndFlush
(
orderInfo
);
log
.
info
(
"客服订单: "
+
"给客服("
+
staffSocketInfo
.
getStaffId
()
+
")发送订单:"
+
json
);
}
private
void
updateMerchantList
(
MsgBody
<
ChatRecord
>
msgBody
)
{
final
Date
now
=
new
Date
();
final
ChatRecord
chatRecord
=
msgBody
.
getData
();
final
Long
userId
=
chatRecord
.
getUserId
();
final
Long
merchantId
=
chatRecord
.
getMerchantId
();
final
Set
<
Long
>
merchantList
=
channelGroup
.
USER_GROUP
.
get
(
userId
).
getSessionList
();
if
(!
merchantList
.
contains
(
merchantId
))
{
sessiontListService
.
save
(
new
Session
().
setId
(
IdWorker
.
getId
()).
setUserId
(
userId
).
setMerchantId
(
merchantId
).
setCreateTime
(
now
).
setModifyTime
(
now
));
merchantList
.
add
(
merchantId
);
}
}
}
\ No newline at end of file
customer-service/src/main/resources/application-dev.yml
View file @
2b4abe25
...
...
@@ -28,8 +28,8 @@ spring:
port
:
5672
username
:
root
password
:
root
staff-offline-Queue-Name
:
staff.offline
.dev
order-queue-name
:
push.order
.dev
staff-offline-Queue-Name
:
staff.offline
order-queue-name
:
push.order
exchange-name
:
delay.exchange
listener
:
simple
:
...
...
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