Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
dca63b77
Commit
dca63b77
authored
Jun 12, 2024
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企微托管
parent
4282a081
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
16 deletions
+65
-16
NoticeMessageTypeEnum.java
...om/gic/haoban/manage/api/enums/NoticeMessageTypeEnum.java
+1
-0
QywxCallbackController.java
.../haoban/manage/web/controller/QywxCallbackController.java
+45
-8
OpenStaffService.java
...m/gic/haoban/manage/service/service/OpenStaffService.java
+1
-1
OpenStaffServiceImpl.java
...ban/manage/service/service/impl/OpenStaffServiceImpl.java
+13
-2
OpenStaffApiServiceImpl.java
...age/service/service/out/impl/OpenStaffApiServiceImpl.java
+5
-5
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/NoticeMessageTypeEnum.java
View file @
dca63b77
...
@@ -66,6 +66,7 @@ public enum NoticeMessageTypeEnum {
...
@@ -66,6 +66,7 @@ public enum NoticeMessageTypeEnum {
CUSTOMER_APPLY_ORDER_REFUND
(
4005
,
"客户申请退单通知"
,
NoticeMessageCategoryTypeEnum
.
CUSTOMER
.
getType
(),
"customer_apply_order_refund"
,
"/pages/route/index?pageType="
,
"hbapp_customer_order_detail"
,
"customerApplyChargebackOrder"
,
"haobanNotice"
),
CUSTOMER_APPLY_ORDER_REFUND
(
4005
,
"客户申请退单通知"
,
NoticeMessageCategoryTypeEnum
.
CUSTOMER
.
getType
(),
"customer_apply_order_refund"
,
"/pages/route/index?pageType="
,
"hbapp_customer_order_detail"
,
"customerApplyChargebackOrder"
,
"haobanNotice"
),
CUSTOMER_SUCCESS_ORDER_REFUND
(
4006
,
"客户成功退单通知"
,
NoticeMessageCategoryTypeEnum
.
CUSTOMER
.
getType
(),
"customer_success_order_refund"
,
"/pages/route/index?pageType="
,
"hbapp_user_bill_detail"
,
"customerChargebackOrderSuccess"
,
"haobanNotice"
),
CUSTOMER_SUCCESS_ORDER_REFUND
(
4006
,
"客户成功退单通知"
,
NoticeMessageCategoryTypeEnum
.
CUSTOMER
.
getType
(),
"customer_success_order_refund"
,
"/pages/route/index?pageType="
,
"hbapp_user_bill_detail"
,
"customerChargebackOrderSuccess"
,
"haobanNotice"
),
FRIEND_DEL_STAFF
(
4007
,
"删除好友通知"
,
NoticeMessageCategoryTypeEnum
.
CUSTOMER
.
getType
(),
"friend_del_staff"
,
"/pages/route/index?pageType="
,
"hbapp_customer_detail"
,
"friendDelStaff"
,
"haobanNotice"
),
FRIEND_DEL_STAFF
(
4007
,
"删除好友通知"
,
NoticeMessageCategoryTypeEnum
.
CUSTOMER
.
getType
(),
"friend_del_staff"
,
"/pages/route/index?pageType="
,
"hbapp_customer_detail"
,
"friendDelStaff"
,
"haobanNotice"
),
HAOBAN_OPEN_STAFF_LOGOUT
(
4008
,
"企微托管账号退出登录"
,
NoticeMessageCategoryTypeEnum
.
AUTHORIZED
.
getType
(),
"haoban_open_staff_logout"
,
"/pages/route/index?pageType="
,
"hbapp_customer_detail"
,
"haobanOpenStaffLogout"
,
"haobanNotice"
),
// 订单- 待发货订单提醒
// 订单- 待发货订单提醒
...
...
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/controller/QywxCallbackController.java
View file @
dca63b77
...
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.authcenter.commons.util.IgnoreLogin
;
import
com.gic.authcenter.commons.util.IgnoreLogin
;
import
com.gic.haoban.manage.api.enums.QwOpenStepEnum
;
import
com.gic.haoban.manage.api.enums.QwOpenStepEnum
;
import
com.gic.haoban.manage.api.service.OpenStaffApiService
;
import
com.gic.haoban.manage.api.service.OpenStaffApiService
;
import
com.gic.haoban.task.manage.api.dto.open.OpenQwMessageDTO
;
import
com.gic.haoban.task.manage.api.enums.OpenQwMsgTypeEnum
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -13,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -13,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@Controller
@Controller
...
@@ -82,18 +86,51 @@ public class QywxCallbackController extends WebBaseController {
...
@@ -82,18 +86,51 @@ public class QywxCallbackController extends WebBaseController {
}
}
private
void
chat
(
String
uuid
,
JSONObject
json
)
{
private
void
chat
(
String
uuid
,
JSONObject
json
)
{
logger
.
info
(
"消息"
);
int
msgtype
=
json
.
getIntValue
(
"msgtype"
)
;
int
msgtype
=
json
.
getIntValue
(
"msgtype"
)
;
// 1导购发 2好友发
List
<
String
>
msgList
=
Arrays
.
asList
(
"0"
,
"2"
,
"101"
)
;
i
nt
sendType
=
1
;
i
f
(!
msgList
.
contains
(
msgtype
+
""
))
{
if
(
msgtype
==
2
)
{
logger
.
info
(
"不处理的消息"
);
sendType
=
2
;
return
;
}
}
int
isRoom
=
0
;
logger
.
info
(
"处理消息"
);
if
(
json
.
getIntValue
(
"is_room"
)
==
1
)
{
int
isRoom
=
json
.
getIntValue
(
"is_room"
)
;
Long
receiver
=
json
.
getLong
(
"receiver"
)
;
Long
sender
=
json
.
getLong
(
"sender"
)
;
String
content
=
json
.
getString
(
"content"
)
;
String
fileId
=
json
.
getString
(
"file_id"
)
;
Long
roomId
=
json
.
getLong
(
"room_conversation_id"
)
;
OpenQwMessageDTO
msg
=
new
OpenQwMessageDTO
();
msg
.
setIsRoom
(
isRoom
);
msg
.
setUuid
(
uuid
);
msg
.
setReceiver
(
receiver
);
msg
.
setSender
(
sender
);
msg
.
setContent
(
content
);
msg
.
setRoomId
(
roomId
);
msg
.
setFileId
(
fileId
);
msg
.
setSendTime
(
json
.
getLong
(
"send_time"
));
if
(
msgtype
==
101
)
{
msg
.
setAeskey
(
json
.
getString
(
"aeskey"
));
}
if
(
msgtype
==
14
)
{
msg
.
setAeskey
(
json
.
getString
(
"aes_key"
));
}
msg
.
setOpenimCdnAuthkey
(
json
.
getString
(
"openim_cdn_authkey"
));
if
(
msgtype
==
101
||
msgtype
==
14
)
{
msg
.
setMsgtype
(
OpenQwMsgTypeEnum
.
IMAGE
);
}
else
{
msg
.
setMsgtype
(
OpenQwMsgTypeEnum
.
text
);
}
this
.
setSendType
(
msgtype
,
msg
);
this
.
openQwApiService
.
saveChatLog
(
msg
)
;
}
private
void
setSendType
(
int
msgtype
,
OpenQwMessageDTO
msg
)
{
if
(
msgtype
==
101
)
{
msg
.
setSendType
(
2
);
}
else
if
(
msgtype
==
14
)
{
msg
.
setSendType
(
1
);
}
else
{
}
else
{
this
.
openQwApiService
.
saveChatLog
(
uuid
,
json
.
getLong
(
"sender"
),
json
.
getLong
(
"receiver"
),
json
.
getString
(
"content"
),
sendType
)
;
msg
.
setSendType
(
0
)
;
}
}
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/OpenStaffService.java
View file @
dca63b77
...
@@ -16,7 +16,7 @@ public interface OpenStaffService {
...
@@ -16,7 +16,7 @@ public interface OpenStaffService {
public
TabOpenStaff
getByUUID
(
String
uuid
)
;
public
TabOpenStaff
getByUUID
(
String
uuid
)
;
public
void
logout
(
String
uuid
,
String
loginRemark
,
int
step
)
;
public
void
logout
(
String
uuid
,
String
loginRemark
,
int
step
,
String
noticeReason
)
;
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
);
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/OpenStaffServiceImpl.java
View file @
dca63b77
...
@@ -12,11 +12,12 @@ import com.gic.enterprise.api.dto.StoreDTO;
...
@@ -12,11 +12,12 @@ import com.gic.enterprise.api.dto.StoreDTO;
import
com.gic.enterprise.api.dto.StoreSearchDTO
;
import
com.gic.enterprise.api.dto.StoreSearchDTO
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.manage.api.dto.OpenStaffDTO
;
import
com.gic.haoban.manage.api.dto.OpenStaffListDTO
;
import
com.gic.haoban.manage.api.dto.OpenStaffListDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StoreClerkDTO
;
import
com.gic.haoban.manage.api.dto.StoreClerkDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO
;
import
com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper
;
import
com.gic.haoban.manage.service.entity.TabOpenStaff
;
import
com.gic.haoban.manage.service.entity.TabOpenStaff
;
import
com.gic.haoban.manage.service.service.OpenStaffService
;
import
com.gic.haoban.manage.service.service.OpenStaffService
;
...
@@ -74,7 +75,7 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -74,7 +75,7 @@ public class OpenStaffServiceImpl implements OpenStaffService {
}
}
@Override
@Override
public
void
logout
(
String
uuid
,
String
loginRemark
,
int
step
)
{
public
void
logout
(
String
uuid
,
String
loginRemark
,
int
step
,
String
noticeReason
)
{
TabOpenStaff
openStaff
=
this
.
getByUUID
(
uuid
);
TabOpenStaff
openStaff
=
this
.
getByUUID
(
uuid
);
if
(
null
==
openStaff
)
{
if
(
null
==
openStaff
)
{
return
;
return
;
...
@@ -91,6 +92,16 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -91,6 +92,16 @@ public class OpenStaffServiceImpl implements OpenStaffService {
openStaff
.
setUuid
(
null
);
openStaff
.
setUuid
(
null
);
openStaff
.
setLoginRemark
(
loginRemark
);
openStaff
.
setLoginRemark
(
loginRemark
);
this
.
openStaffMapper
.
update
(
openStaff
);
this
.
openStaffMapper
.
update
(
openStaff
);
// 发送通知
if
(
StringUtils
.
isNotBlank
(
noticeReason
))
{
log
.
info
(
"发送退出登录通知,staffId={}"
,
openStaff
.
getStaffId
());
// 发送通知
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"reason"
,
noticeReason
);
int
messageType
=
NoticeMessageTypeEnum
.
HAOBAN_OPEN_STAFF_LOGOUT
.
getType
();
NoticeMessageUtil
.
sendNoticeMessageByStaff
(
openStaff
.
getEnterpriseId
(),
openStaff
.
getStaffId
(),
null
,
messageType
,
null
,
map
,
null
);
}
}
}
@Override
@Override
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/OpenStaffApiServiceImpl.java
View file @
dca63b77
...
@@ -93,7 +93,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -93,7 +93,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
}
}
this
.
openStaffMapper
.
updateLoginStep
(
openStaff
.
getOpenStaffId
(),
step
)
;
this
.
openStaffMapper
.
updateLoginStep
(
openStaff
.
getOpenStaffId
(),
step
)
;
if
(
QwOpenStepEnum
.
isFail
(
step
))
{
if
(
QwOpenStepEnum
.
isFail
(
step
))
{
this
.
openStaffService
.
logout
(
uuid
,
"企微返回退出/登录超时"
,
0
);
this
.
openStaffService
.
logout
(
uuid
,
"企微返回退出/登录超时"
,
0
,
null
);
}
}
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
();
}
}
...
@@ -107,13 +107,13 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -107,13 +107,13 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
String
wxEnterpriseId
=
openStaff
.
getWxEnterpriseId
()
;
String
wxEnterpriseId
=
openStaff
.
getWxEnterpriseId
()
;
List
<
String
>
backWxEnterpriseIdList
=
this
.
wxEnterpriseService
.
getWxEnterpriseIdByName
(
corpName
)
;
List
<
String
>
backWxEnterpriseIdList
=
this
.
wxEnterpriseService
.
getWxEnterpriseIdByName
(
corpName
)
;
if
(
CollectionUtils
.
isEmpty
(
backWxEnterpriseIdList
)
||
backWxEnterpriseIdList
.
size
()>
1
||
!
backWxEnterpriseIdList
.
get
(
0
).
equals
(
wxEnterpriseId
))
{
if
(
CollectionUtils
.
isEmpty
(
backWxEnterpriseIdList
)
||
backWxEnterpriseIdList
.
size
()>
1
||
!
backWxEnterpriseIdList
.
get
(
0
).
equals
(
wxEnterpriseId
))
{
this
.
openStaffService
.
logout
(
uuid
,
"授权登录账号与当前账号不一致"
,
10
);
this
.
openStaffService
.
logout
(
uuid
,
"授权登录账号与当前账号不一致"
,
10
,
null
);
log
.
info
(
"登录的企业不对={},{}"
,
uuid
,
corpName
);
log
.
info
(
"登录的企业不对={},{}"
,
uuid
,
corpName
);
return
ServiceResponse
.
failure
(
"9999"
,
"登录错误"
)
;
return
ServiceResponse
.
failure
(
"9999"
,
"登录错误"
)
;
}
}
TabOpenStaff
staff
=
this
.
openStaffMapper
.
getByQwUserId
(
qwUserId
)
;
TabOpenStaff
staff
=
this
.
openStaffMapper
.
getByQwUserId
(
qwUserId
)
;
if
(
null
!=
staff
&&
staff
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
))
{
if
(
null
!=
staff
&&
staff
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
))
{
this
.
openStaffService
.
logout
(
uuid
,
"只能托管一个企微企业"
,
0
);
this
.
openStaffService
.
logout
(
uuid
,
"只能托管一个企微企业"
,
0
,
null
);
log
.
info
(
"只能托管一个企业={},{}"
,
uuid
,
corpName
);
log
.
info
(
"只能托管一个企业={},{}"
,
uuid
,
corpName
);
return
ServiceResponse
.
failure
(
"9999"
,
"只能托管一个企业"
)
;
return
ServiceResponse
.
failure
(
"9999"
,
"只能托管一个企业"
)
;
}
}
...
@@ -130,7 +130,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -130,7 +130,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override
@Override
public
ServiceResponse
<
Void
>
logout
(
String
uuid
)
{
public
ServiceResponse
<
Void
>
logout
(
String
uuid
)
{
this
.
openStaffService
.
logout
(
uuid
,
null
,
0
);
this
.
openStaffService
.
logout
(
uuid
,
null
,
0
,
"手机端结束登录"
);
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
();
}
}
...
@@ -181,7 +181,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -181,7 +181,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
}
}
qwUserId
=
openStaff
.
getQwUserId
()
;
qwUserId
=
openStaff
.
getQwUserId
()
;
log
.
info
(
"重新初始化,退出登录"
);
log
.
info
(
"重新初始化,退出登录"
);
this
.
openStaffService
.
logout
(
openStaff
.
getUuid
(),
"重新初始化,退出登录"
,
0
);
this
.
openStaffService
.
logout
(
openStaff
.
getUuid
(),
"重新初始化,退出登录"
,
0
,
null
);
}
}
if
(
null
==
openStaff
)
{
if
(
null
==
openStaff
)
{
openStaff
=
new
TabOpenStaff
()
;
openStaff
=
new
TabOpenStaff
()
;
...
...
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