Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ff2be652
authored
Sep 11, 2017
by
lyhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the injection of ccService from
parent
9cd546b6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
79 deletions
src/main/java/com/ctrip/fun/admin/controller/tools/CallCenterController.java
src/main/java/com/ctrip/fun/admin/eventhandler/NewStateEventHandler.java
src/main/java/com/ctrip/fun/admin/controller/tools/CallCenterController.java
View file @
ff2be652
...
...
@@ -42,6 +42,7 @@ import com.ctrip.fun.admin.service.system.UserService;
import
com.ctrip.fun.admin.service.tools.CallCenterService
;
import
com.ctrip.fun.admin.utility.Util
;
import
com.ctrip.fun.admin.vo.callcenter.AbstractEventHandler
;
import
com.ctrip.fun.admin.vo.callcenter.RsmwNewStateEvent
;
import
com.ctrip.fun.common.vo.PagedResponseBean
;
import
com.ctrip.fun.common.vo.basic.UserExtQuery
;
import
com.ctrip.fun.common.vo.user.RegisterBean
;
...
...
@@ -134,7 +135,26 @@ public class CallCenterController {
// 2)执行命令并返回结果
if
(
eventHandler
!=
null
){
result
=
eventHandler
.
handle
(
commandJSONObject
);
eventHandler
.
handle
(
commandJSONObject
);
RsmwNewStateEvent
eventObj
=
JSON
.
toJavaObject
(
commandJSONObject
,
RsmwNewStateEvent
.
class
);
String
mobileNo
=
eventObj
.
getConnectedLineNumber
().
replaceFirst
(
"^0*"
,
""
);
try
{
if
(
StringUtil
.
isBlank
(
mobileNo
))
{
logger
.
error
(
"mobile is null in ccdesk!"
);
throw
new
CommonException
(-
02
,
"ccdesk返回客户手机号为空!"
);
}
String
uid
=
this
.
queryRegisterUid
(
mobileNo
);
if
(
StringUtils
.
isNotBlank
(
uid
))
{
return
String
.
format
(
"redirect:/system/user/%s/detailByUid"
,
uid
);
}
else
{
return
"/tools/validCode"
;
}
}
catch
(
CommonException
e
)
{
return
"error"
;
}
}
else
{
result
=
"event="
+
event
+
", event字段有误,没有找到对应的eventHandler"
;
logger
.
warn
(
"event="
+
event
+
", event字段有误,没有找到对应的eventHandler"
);
...
...
@@ -145,8 +165,6 @@ public class CallCenterController {
return
e
.
getMessage
();
}
return
result
;
}
...
...
src/main/java/com/ctrip/fun/admin/eventhandler/NewStateEventHandler.java
View file @
ff2be652
...
...
@@ -12,19 +12,11 @@ import org.springframework.stereotype.Controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.fun.admin.exception.CommonException
;
import
com.ctrip.fun.admin.service.system.UserService
;
import
com.ctrip.fun.admin.service.tools.CallCenterService
;
import
com.ctrip.fun.admin.utility.SpringSecurityUtil
;
import
com.ctrip.fun.admin.vo.callcenter.AbstractEventHandler
;
import
com.ctrip.fun.admin.vo.callcenter.RsmwNewStateEvent
;
import
com.ctrip.fun.common.vo.PagedResponseBean
;
import
com.ctrip.fun.common.vo.basic.UserExtQuery
;
import
com.ctrip.fun.common.vo.user.UserBean
;
import
com.ctrip.fun.common.vo.user.UserExtBean
;
import
com.ctrip.fun.common.vo.user.UserQuery
;
...
...
@@ -62,11 +54,6 @@ public class NewStateEventHandler extends AbstractEventHandler {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
private
CallCenterService
ccService
;
private
UserService
userService
;
@Override
...
...
@@ -90,31 +77,11 @@ public class NewStateEventHandler extends AbstractEventHandler {
// UserDetails user = (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
String
username
=
SpringSecurityUtil
.
getCurrentUserName
();
NewStateWebSocket
.
unicast
(
username
,
mobileNo
);
try
{
if
(
StringUtil
.
isBlank
(
mobileNo
))
{
logger
.
error
(
"mobile is null in ccdesk!"
);
throw
new
CommonException
(-
02
,
"ccdesk返回客户手机号为空!"
);
}
String
uid
=
this
.
queryRegisterUid
(
mobileNo
);
if
(
StringUtils
.
isNotBlank
(
uid
))
{
return
String
.
format
(
"redirect:/system/user/%s/detailByUid"
,
uid
);
}
else
{
return
"/tools/validCode"
;
}
}
catch
(
CommonException
e
)
{
return
"error"
;
}
/*
// 调rsmw接口,查询绑定关系,拿到aid,也就时websocket里的clientId
RsmwServer rsmwServer = ApplicationHelper.getApplicationContext().getBean("rsmwServer", RsmwServer.class);
AgentSipPhoneBindInfoResponse agentSipPhoneBindInfoResponse = rsmwServer.getBindInfo(null, sipPeerName);
...
...
@@ -241,47 +208,4 @@ public class NewStateEventHandler extends AbstractEventHandler {
return
""
;
}
private
String
queryRegisterUid
(
String
mobileNo
)
throws
CommonException
{
String
uid
=
null
;
UserExtQuery
query
=
new
UserExtQuery
();
query
.
setMobile
(
mobileNo
);
query
.
setPagerOffset
(
0
);
query
.
setSortField
(
"registerTime"
);
PagedResponseBean
<
UserExtBean
>
response
=
userService
.
list
(
""
,
query
);
Collection
<
UserExtBean
>
users
=
response
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
users
))
{
List
<
UserExtBean
>
list
=
(
List
)
users
;
UserExtBean
user
=
list
.
get
(
0
);
uid
=
user
.
getUid
();
}
else
{
// 查询携程注册信息
UserQuery
memberRequest
=
new
UserQuery
();
memberRequest
.
setUid
(
mobileNo
);
UserBean
memberResponse
=
ccService
.
getMemberInfo
(
""
,
memberRequest
);
// getMemberInfo接口会将携程用户同步为爱玩用户
if
(
StringUtils
.
isNotBlank
(
memberResponse
.
getUid
()))
{
uid
=
memberResponse
.
getUid
();
}
}
return
uid
;
}
public
CallCenterService
getCcService
()
{
return
ccService
;
}
public
UserService
getUserService
()
{
return
userService
;
}
public
void
setCcService
(
CallCenterService
ccService
)
{
this
.
ccService
=
ccService
;
}
public
void
setUserService
(
UserService
userService
)
{
this
.
userService
=
userService
;
}
}
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