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
0849373c
Commit
0849373c
authored
Jun 25, 2024
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企微托管
parent
377f8a69
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
170 additions
and
46 deletions
+170
-46
HaobanTimerApiService.java
.../gic/haoban/manage/api/service/HaobanTimerApiService.java
+6
-0
OpenStaffMapper.java
...gic/haoban/manage/service/dao/mapper/OpenStaffMapper.java
+5
-3
QwOpenResultInitBO.java
...om/gic/haoban/manage/service/pojo/QwOpenResultInitBO.java
+10
-0
OpenStaffService.java
...m/gic/haoban/manage/service/service/OpenStaffService.java
+10
-0
OpenStaffServiceImpl.java
...ban/manage/service/service/impl/OpenStaffServiceImpl.java
+80
-30
HaobanTimerApiServiceImpl.java
...e/service/service/out/impl/HaobanTimerApiServiceImpl.java
+8
-5
OpenStaffApiServiceImpl.java
...age/service/service/out/impl/OpenStaffApiServiceImpl.java
+17
-3
OpenUtils.java
...in/java/com/gic/haoban/manage/service/util/OpenUtils.java
+28
-3
OpenStaffMapper.xml
...ge3-service/src/main/resources/mapper/OpenStaffMapper.xml
+6
-2
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/HaobanTimerApiService.java
View file @
0849373c
...
@@ -122,5 +122,11 @@ public interface HaobanTimerApiService {
...
@@ -122,5 +122,11 @@ public interface HaobanTimerApiService {
public
void
halfTimer
(
String
wxEnterpriseId
)
;
public
void
halfTimer
(
String
wxEnterpriseId
)
;
/**
* 校验是否登录中
* @param params
*/
void
openStaffTimer
(
String
params
)
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/OpenStaffMapper.java
View file @
0849373c
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
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.qdto.OpenStaffPageQDTO
;
import
com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO
;
...
@@ -48,11 +46,14 @@ public interface OpenStaffMapper {
...
@@ -48,11 +46,14 @@ public interface OpenStaffMapper {
List
<
StaffClerkRelationDTO
>
listOpenStaffByStore
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"list"
)
List
<
String
>
storeIdList
);
List
<
StaffClerkRelationDTO
>
listOpenStaffByStore
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"list"
)
List
<
String
>
storeIdList
);
List
<
String
>
listAll
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
)
;
List
<
TabOpenStaff
>
listAllOnline
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
)
;
List
<
String
>
listOpenStoreId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
List
<
String
>
listOpenStoreId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
void
updateStopTime
(
@Param
(
"id"
)
Long
openStaffId
,
@Param
(
"type"
)
int
type
,
@Param
(
"time"
)
int
time
);
void
updateStopTime
(
@Param
(
"id"
)
Long
openStaffId
,
@Param
(
"type"
)
int
type
,
@Param
(
"time"
)
int
time
);
int
getNum
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"status"
)
int
status
)
;
int
getNum
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"status"
)
int
status
)
;
int
updateByAutoLogin
(
@Param
(
"id"
)
Long
openStaffId
,
@Param
(
"uuid"
)
String
uuid
)
;
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/QwOpenResultInitBO.java
View file @
0849373c
...
@@ -4,6 +4,8 @@ import java.io.Serializable;
...
@@ -4,6 +4,8 @@ import java.io.Serializable;
public
class
QwOpenResultInitBO
implements
Serializable
{
public
class
QwOpenResultInitBO
implements
Serializable
{
private
boolean
is_login
;
private
String
uuid
;
private
String
uuid
;
private
String
qrcode
;
private
String
qrcode
;
...
@@ -12,6 +14,14 @@ public class QwOpenResultInitBO implements Serializable {
...
@@ -12,6 +14,14 @@ public class QwOpenResultInitBO implements Serializable {
private
String
qrcode_data
;
private
String
qrcode_data
;
public
boolean
isIs_login
()
{
return
is_login
;
}
public
void
setIs_login
(
boolean
is_login
)
{
this
.
is_login
=
is_login
;
}
public
String
getQrcode_data
()
{
public
String
getQrcode_data
()
{
return
qrcode_data
;
return
qrcode_data
;
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/OpenStaffService.java
View file @
0849373c
...
@@ -20,4 +20,14 @@ public interface OpenStaffService {
...
@@ -20,4 +20,14 @@ public interface OpenStaffService {
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
);
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
);
List
<
String
>
listAllStaffId
(
String
wxEnterpriseId
)
;
List
<
String
>
listAllStaffId
(
String
wxEnterpriseId
)
;
/**
* 自动登录 返回新的uuid
* @param openStaffId
* @param qwUserId
* @return
*/
String
autoLogin
(
Long
openStaffId
,
Long
qwUserId
)
;
void
openStaffTimer
();
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/OpenStaffServiceImpl.java
View file @
0849373c
...
@@ -16,6 +16,7 @@ import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
...
@@ -16,6 +16,7 @@ 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.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.enums.OpenStaffOfflineEnum
;
import
com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO
;
import
com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
...
@@ -23,6 +24,7 @@ import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper;
...
@@ -23,6 +24,7 @@ import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabOpenStaff
;
import
com.gic.haoban.manage.service.entity.TabOpenStaff
;
import
com.gic.haoban.manage.service.pojo.QwOpenResultInitBO
;
import
com.gic.haoban.manage.service.service.OpenStaffService
;
import
com.gic.haoban.manage.service.service.OpenStaffService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.util.OpenUtils
;
import
com.gic.haoban.manage.service.util.OpenUtils
;
...
@@ -51,11 +53,11 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -51,11 +53,11 @@ public class OpenStaffServiceImpl implements OpenStaffService {
@Autowired
@Autowired
private
StoreService
storeService
;
private
StoreService
storeService
;
@Autowired
@Autowired
private
ClerkService
clerkService
;
private
ClerkService
clerkService
;
@Autowired
@Autowired
private
NoticeMessageApiService
noticeMessageApiService
;
private
NoticeMessageApiService
noticeMessageApiService
;
@Autowired
@Autowired
private
StaffMapper
staffMapper
;
private
StaffMapper
staffMapper
;
@Override
@Override
public
TabOpenStaff
save
(
TabOpenStaff
tab
)
{
public
TabOpenStaff
save
(
TabOpenStaff
tab
)
{
...
@@ -82,7 +84,7 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -82,7 +84,7 @@ public class OpenStaffServiceImpl implements OpenStaffService {
}
}
@Override
@Override
public
void
logout
(
String
uuid
,
String
loginRemark
,
int
step
,
String
noticeReason
)
{
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
;
...
@@ -101,26 +103,26 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -101,26 +103,26 @@ public class OpenStaffServiceImpl implements OpenStaffService {
this
.
openStaffMapper
.
update
(
openStaff
);
this
.
openStaffMapper
.
update
(
openStaff
);
// 发送通知
// 发送通知
if
(
StringUtils
.
isNotBlank
(
noticeReason
))
{
if
(
StringUtils
.
isNotBlank
(
noticeReason
))
{
log
.
info
(
"发送退出登录通知,staffId={}"
,
openStaff
.
getStaffId
());
log
.
info
(
"发送退出登录通知,staffId={}"
,
openStaff
.
getStaffId
());
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
openStaff
.
getStaffId
())
;
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
openStaff
.
getStaffId
());
this
.
noticeMessageApiService
.
sendMessageForOpenStaff
(
openStaff
.
getEnterpriseId
(),
staff
.
getStaffName
()
,
noticeReason
);
this
.
noticeMessageApiService
.
sendMessageForOpenStaff
(
openStaff
.
getEnterpriseId
(),
staff
.
getStaffName
()
,
noticeReason
);
// 发送通知
// 发送通知
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"reason"
,
noticeReason
);
map
.
put
(
"reason"
,
noticeReason
);
int
messageType
=
NoticeMessageTypeEnum
.
HAOBAN_OPEN_STAFF_LOGOUT
.
getType
();
int
messageType
=
NoticeMessageTypeEnum
.
HAOBAN_OPEN_STAFF_LOGOUT
.
getType
();
NoticeMessageUtil
.
sendNoticeMessageByStaff
(
openStaff
.
getEnterpriseId
(),
openStaff
.
getStaffId
(),
"-1"
,
messageType
,
null
,
map
,
null
);
NoticeMessageUtil
.
sendNoticeMessageByStaff
(
openStaff
.
getEnterpriseId
(),
openStaff
.
getStaffId
(),
"-1"
,
messageType
,
null
,
map
,
null
);
}
}
}
}
@Override
@Override
public
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
)
{
public
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
)
{
log
.
info
(
"分页查询条件={}"
,
JSONObject
.
toJSONString
(
qdto
));
log
.
info
(
"分页查询条件={}"
,
JSONObject
.
toJSONString
(
qdto
));
String
wxEnterpriseId
=
qdto
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
qdto
.
getWxEnterpriseId
();
String
enterpriseId
=
qdto
.
getEnterpriseId
();
String
enterpriseId
=
qdto
.
getEnterpriseId
();
List
<
String
>
storeIdList
=
null
;
List
<
String
>
storeIdList
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
qdto
.
getStoreGroupIdList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
qdto
.
getStoreGroupIdList
()))
{
storeIdList
=
this
.
getStoreIdList
(
enterpriseId
,
qdto
.
getStoreGroupIdList
())
;
storeIdList
=
this
.
getStoreIdList
(
enterpriseId
,
qdto
.
getStoreGroupIdList
())
;
}
}
if
(
StringUtils
.
isNotBlank
(
qdto
.
getClerkId
())
||
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
if
(
StringUtils
.
isNotBlank
(
qdto
.
getClerkId
())
||
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
List
<
String
>
staffIds
=
staffClerkRelationService
.
listAllStaffIdForOpenStaff
(
enterpriseId
,
wxEnterpriseId
,
qdto
.
getClerkId
(),
storeIdList
);
List
<
String
>
staffIds
=
staffClerkRelationService
.
listAllStaffIdForOpenStaff
(
enterpriseId
,
wxEnterpriseId
,
qdto
.
getClerkId
(),
storeIdList
);
...
@@ -131,48 +133,48 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -131,48 +133,48 @@ public class OpenStaffServiceImpl implements OpenStaffService {
}
}
PageHelper
.
startPage
(
basePageInfo
);
PageHelper
.
startPage
(
basePageInfo
);
List
<
OpenStaffListDTO
>
list
=
this
.
openStaffMapper
.
list
(
qdto
);
List
<
OpenStaffListDTO
>
list
=
this
.
openStaffMapper
.
list
(
qdto
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
ServiceResponse
.
success
(
new
Page
<>());
return
ServiceResponse
.
success
(
new
Page
<>());
}
}
Set
<
String
>
staffIdList
=
list
.
stream
().
map
(
dto
->
dto
.
getStaffId
()).
collect
(
Collectors
.
toSet
());
Set
<
String
>
staffIdList
=
list
.
stream
().
map
(
dto
->
dto
.
getStaffId
()).
collect
(
Collectors
.
toSet
());
List
<
StaffClerkRelationDTO
>
relationDTOList
=
staffClerkRelationService
.
listByWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffIdList
);
List
<
StaffClerkRelationDTO
>
relationDTOList
=
staffClerkRelationService
.
listByWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffIdList
);
relationDTOList
=
relationDTOList
.
stream
().
filter
(
o
->
o
.
getEnterpriseId
().
equals
(
enterpriseId
)).
collect
(
Collectors
.
toList
())
;
relationDTOList
=
relationDTOList
.
stream
().
filter
(
o
->
o
.
getEnterpriseId
().
equals
(
enterpriseId
)).
collect
(
Collectors
.
toList
())
;
Map
<
String
,
ClerkDTO
>
clerkMap
=
new
HashMap
<>()
;
Map
<
String
,
ClerkDTO
>
clerkMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
relationDTOList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
relationDTOList
))
{
Set
<
String
>
clerkIdSet
=
relationDTOList
.
stream
().
map
(
o
->
o
.
getClerkId
()).
collect
(
Collectors
.
toSet
())
;
Set
<
String
>
clerkIdSet
=
relationDTOList
.
stream
().
map
(
o
->
o
.
getClerkId
()).
collect
(
Collectors
.
toSet
())
;
if
(
CollectionUtils
.
isNotEmpty
(
clerkIdSet
))
{
if
(
CollectionUtils
.
isNotEmpty
(
clerkIdSet
))
{
List
<
ClerkDTO
>
clerkDTOS
=
this
.
clerkService
.
getClerkByIds
(
clerkIdSet
);
List
<
ClerkDTO
>
clerkDTOS
=
this
.
clerkService
.
getClerkByIds
(
clerkIdSet
);
clerkMap
.
putAll
(
clerkDTOS
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getClerkId
(),
o
->
o
,
(
k1
,
k2
)
->
k1
)));
clerkMap
.
putAll
(
clerkDTOS
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getClerkId
(),
o
->
o
,
(
k1
,
k2
)
->
k1
)));
}
}
}
}
log
.
info
(
"导购={}"
,
JSONObject
.
toJSONString
(
clerkMap
));
log
.
info
(
"导购={}"
,
JSONObject
.
toJSONString
(
clerkMap
));
for
(
OpenStaffListDTO
item
:
list
)
{
for
(
OpenStaffListDTO
item
:
list
)
{
String
staffId
=
item
.
getStaffId
()
;
String
staffId
=
item
.
getStaffId
();
List
<
StoreClerkDTO
>
clerkList
=
new
ArrayList
<>()
;
List
<
StoreClerkDTO
>
clerkList
=
new
ArrayList
<>();
for
(
StaffClerkRelationDTO
clerkRelation
:
relationDTOList
){
for
(
StaffClerkRelationDTO
clerkRelation
:
relationDTOList
)
{
if
(
clerkRelation
.
getStaffId
().
equals
(
staffId
)){
if
(
clerkRelation
.
getStaffId
().
equals
(
staffId
))
{
String
storeId
=
clerkRelation
.
getStoreId
()
;
String
storeId
=
clerkRelation
.
getStoreId
();
String
clerkId
=
clerkRelation
.
getClerkId
()
;
String
clerkId
=
clerkRelation
.
getClerkId
();
ClerkDTO
clerkDTO
=
clerkMap
.
get
(
clerkId
)
;
ClerkDTO
clerkDTO
=
clerkMap
.
get
(
clerkId
);
if
(
null
!=
clerkDTO
)
{
if
(
null
!=
clerkDTO
)
{
StoreClerkDTO
cs
=
new
StoreClerkDTO
();
StoreClerkDTO
cs
=
new
StoreClerkDTO
();
cs
.
setClerkId
(
clerkId
);
cs
.
setClerkId
(
clerkId
);
cs
.
setClerkName
(
clerkDTO
.
getClerkName
());
cs
.
setClerkName
(
clerkDTO
.
getClerkName
());
cs
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
cs
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
StoreDTO
store
=
this
.
storeService
.
getStore
(
storeId
);
StoreDTO
store
=
this
.
storeService
.
getStore
(
storeId
);
if
(
null
!=
store
)
{
if
(
null
!=
store
)
{
cs
.
setStoreId
(
storeId
);
cs
.
setStoreId
(
storeId
);
cs
.
setStoreName
(
store
.
getStoreName
());
cs
.
setStoreName
(
store
.
getStoreName
());
cs
.
setStoreCode
(
store
.
getStoreCode
());
cs
.
setStoreCode
(
store
.
getStoreCode
());
}
}
clerkList
.
add
(
cs
)
;
clerkList
.
add
(
cs
);
}
}
}
}
}
}
item
.
setClerkList
(
clerkList
);
item
.
setClerkList
(
clerkList
);
}
}
Page
<
OpenStaffListDTO
>
retPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
list
,
OpenStaffListDTO
.
class
);
Page
<
OpenStaffListDTO
>
retPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
list
,
OpenStaffListDTO
.
class
);
log
.
info
(
"分页查询结果={}"
,
JSONObject
.
toJSONString
(
retPage
,
true
));
log
.
info
(
"分页查询结果={}"
,
JSONObject
.
toJSONString
(
retPage
,
true
));
return
ServiceResponse
.
success
(
retPage
);
return
ServiceResponse
.
success
(
retPage
);
}
}
...
@@ -201,4 +203,52 @@ public class OpenStaffServiceImpl implements OpenStaffService {
...
@@ -201,4 +203,52 @@ public class OpenStaffServiceImpl implements OpenStaffService {
return
searchStoreIds
;
return
searchStoreIds
;
}
}
@Override
public
String
autoLogin
(
Long
openStaffId
,
Long
qwUserId
)
{
ServiceResponse
<
QwOpenResultInitBO
>
initResp
=
OpenUtils
.
init
(
qwUserId
,
false
);
log
.
info
(
"自动登录-初始化={},{}"
,
qwUserId
,
JSONObject
.
toJSONString
(
initResp
));
if
(
initResp
.
isSuccess
()
&&
StringUtils
.
isNotBlank
(
initResp
.
getResult
().
getUuid
()))
{
QwOpenResultInitBO
bo
=
initResp
.
getResult
();
String
newUuid
=
bo
.
getUuid
();
if
(
bo
.
isIs_login
())
{
this
.
openStaffMapper
.
updateByAutoLogin
(
qwUserId
,
newUuid
);
return
newUuid
;
}
boolean
autLogin
=
OpenUtils
.
autoLogin
(
newUuid
);
if
(
autLogin
)
{
this
.
openStaffMapper
.
updateByAutoLogin
(
qwUserId
,
newUuid
);
return
newUuid
;
}
}
return
null
;
}
/**
* 1. 首次登录流程
* 初始化 扫码登录
* <p>
* 2. 自动重连流程
* 如果登录了很多号,我结束服务,重启服务后
* 初始化接口 vid传登陆过的账号userid 然后 初始化接口返回有个is_login=true 代表连上了如果是false就走自动登录接口
* 如果自动登录失败,获取二维码扫码登录
* <p>
* 3. 自动登录
* 如果一个号登录了,调用了退出接口,下次初始化接口vid填这个号的id然后调用自动登录接口,登录失败 走扫码
*/
@Override
public
void
openStaffTimer
()
{
log
.
info
(
"定时检查托管状态"
);
List
<
TabOpenStaff
>
list
=
this
.
openStaffMapper
.
listAllOnline
(
null
,
null
);
for
(
TabOpenStaff
item
:
list
)
{
String
uuid
=
item
.
getUuid
();
boolean
isLogin
=
OpenUtils
.
isLogin
(
uuid
);
// 未登录
if
(!
isLogin
)
{
String
autLogin
=
this
.
autoLogin
(
item
.
getOpenStaffId
(),
item
.
getQwUserId
());
if
(
null
==
autLogin
)
{
this
.
logout
(
uuid
,
"定时检查异"
,
0
,
OpenStaffOfflineEnum
.
OFFLINE2
.
getDesc
());
}
}
}
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/HaobanTimerApiServiceImpl.java
View file @
0849373c
...
@@ -7,7 +7,7 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap
...
@@ -7,7 +7,7 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap
import
com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper
;
import
com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog
;
import
com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog
;
import
com.gic.haoban.manage.service.service.
QywxErrorLogService
;
import
com.gic.haoban.manage.service.service.
*
;
import
com.gic.haoban.manage.service.service.chat.GroupChatDataService
;
import
com.gic.haoban.manage.service.service.chat.GroupChatDataService
;
import
com.gic.haoban.manage.service.util.DingUtils
;
import
com.gic.haoban.manage.service.util.DingUtils
;
import
com.gic.haoban.manage.service.util.HBQwMonitorUtils
;
import
com.gic.haoban.manage.service.util.HBQwMonitorUtils
;
...
@@ -16,16 +16,12 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -16,16 +16,12 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.joda.time.DateTime
;
import
org.redisson.api.RMap
;
import
org.redisson.api.RMap
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.service.HaobanTimerApiService
;
import
com.gic.haoban.manage.api.service.HaobanTimerApiService
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.ExternalMemberService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.chat.GroupChatService
;
import
com.gic.haoban.manage.service.service.chat.GroupChatService
;
import
com.gic.haoban.manage.service.service.hm.HmQrcodeTempService
;
import
com.gic.haoban.manage.service.service.hm.HmQrcodeTempService
;
...
@@ -56,6 +52,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
...
@@ -56,6 +52,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
private
WxUserAddLogMapper
wxUserAddLogMapper
;
private
WxUserAddLogMapper
wxUserAddLogMapper
;
@Autowired
@Autowired
private
HaobanCommonMQApiService
haobanCommonMQApiService
;
private
HaobanCommonMQApiService
haobanCommonMQApiService
;
@Autowired
private
OpenStaffService
openStaffService
;
@Override
@Override
...
@@ -178,4 +176,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
...
@@ -178,4 +176,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
DingUtils
.
send
(
"halfTimer告警,wxEnterpriseId="
+
wxEnterpriseId
,
null
,
false
);
DingUtils
.
send
(
"halfTimer告警,wxEnterpriseId="
+
wxEnterpriseId
,
null
,
false
);
log
.
info
(
"结束单向数据={}"
,
wxEnterpriseId
);
log
.
info
(
"结束单向数据={}"
,
wxEnterpriseId
);
}
}
@Override
public
void
openStaffTimer
(
String
params
)
{
this
.
openStaffService
.
openStaffTimer
()
;
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/OpenStaffApiServiceImpl.java
View file @
0849373c
...
@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
...
@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 企微托管账号
* 企微托管账号
...
@@ -200,6 +201,18 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -200,6 +201,18 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
qwUserId
=
openStaff
.
getQwUserId
();
qwUserId
=
openStaff
.
getQwUserId
();
log
.
info
(
"重新初始化"
);
log
.
info
(
"重新初始化"
);
this
.
openStaffService
.
logout
(
openStaff
.
getUuid
(),
"重新初始化"
,
0
,
null
);
this
.
openStaffService
.
logout
(
openStaff
.
getUuid
(),
"重新初始化"
,
0
,
null
);
// 自动登录
String
newUuid
=
this
.
openStaffService
.
autoLogin
(
openStaff
.
getOpenStaffId
(),
openStaff
.
getQwUserId
())
;
if
(
null
!=
newUuid
)
{
log
.
info
(
"自动登录成功"
);
openStaff
.
setAuthTime
(
new
Date
());
openStaff
.
setStatusFlag
(
1
);
openStaff
.
setUuid
(
newUuid
);
openStaff
.
setLoginRemark
(
"自动登录成功"
);
this
.
openStaffMapper
.
update
(
openStaff
);
OpenStaffDTO
dto
=
EntityUtil
.
changeEntityByJSON
(
OpenStaffDTO
.
class
,
openStaff
);
return
ServiceResponse
.
success
(
dto
);
}
}
}
if
(
null
==
openStaff
)
{
if
(
null
==
openStaff
)
{
openStaff
=
new
TabOpenStaff
();
openStaff
=
new
TabOpenStaff
();
...
@@ -207,7 +220,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -207,7 +220,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
openStaff
.
setWxEnterpriseId
(
qdto
.
getWxEnterpriseId
());
openStaff
.
setWxEnterpriseId
(
qdto
.
getWxEnterpriseId
());
openStaff
.
setEnterpriseId
(
qdto
.
getEnterpriseId
());
openStaff
.
setEnterpriseId
(
qdto
.
getEnterpriseId
());
}
}
ServiceResponse
<
QwOpenResultInitBO
>
resp
=
OpenUtils
.
init
(
qwUserId
);
ServiceResponse
<
QwOpenResultInitBO
>
resp
=
OpenUtils
.
init
(
qwUserId
,
true
);
log
.
info
(
"resp={}"
,
JSONObject
.
toJSONString
(
resp
));
log
.
info
(
"resp={}"
,
JSONObject
.
toJSONString
(
resp
));
QwOpenResultInitBO
init
=
resp
.
getResult
();
QwOpenResultInitBO
init
=
resp
.
getResult
();
openStaff
.
setUuid
(
init
.
getUuid
());
openStaff
.
setUuid
(
init
.
getUuid
());
...
@@ -276,13 +289,14 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
...
@@ -276,13 +289,14 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override
@Override
public
List
<
String
>
listAllOnlineStaff
()
{
public
List
<
String
>
listAllOnlineStaff
()
{
return
this
.
openStaffMapper
.
listAll
(
null
,
null
);
return
this
.
listAllOnlineStaff
(
null
,
null
);
}
}
@Override
@Override
public
List
<
String
>
listAllOnlineStaff
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
public
List
<
String
>
listAllOnlineStaff
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
return
this
.
openStaffMapper
.
listAll
(
wxEnterpriseId
,
enterpriseId
);
List
<
TabOpenStaff
>
list
=
this
.
openStaffMapper
.
listAllOnline
(
wxEnterpriseId
,
enterpriseId
);
return
list
.
stream
().
map
(
o
->
o
.
getStaffId
()).
collect
(
Collectors
.
toList
());
}
}
@Override
@Override
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/OpenUtils.java
View file @
0849373c
...
@@ -20,13 +20,13 @@ public class OpenUtils {
...
@@ -20,13 +20,13 @@ public class OpenUtils {
private
static
final
String
openHost
=
"http://47.94.7.218:8089/wxwork/%s"
;
private
static
final
String
openHost
=
"http://47.94.7.218:8089/wxwork/%s"
;
public
static
ServiceResponse
<
QwOpenResultInitBO
>
init
(
Long
qwUserId
)
{
public
static
ServiceResponse
<
QwOpenResultInitBO
>
init
(
Long
qwUserId
,
boolean
qrcodeFlag
)
{
JSONObject
initJson
=
new
JSONObject
();
JSONObject
initJson
=
new
JSONObject
();
if
(
null
!=
qwUserId
)
{
if
(
null
!=
qwUserId
)
{
initJson
.
put
(
"vid"
,
qwUserId
);
initJson
.
put
(
"vid"
,
qwUserId
);
}
}
String
initStr
=
HttpClient
.
sendPostJSON
(
String
.
format
(
openHost
,
"init"
),
initJson
.
toJSONString
(),
"utf-8"
);
String
initStr
=
HttpClient
.
sendPostJSON
(
String
.
format
(
openHost
,
"init"
),
initJson
.
toJSONString
(),
"utf-8"
);
logger
.
info
(
"
init={}"
,
initStr
);
logger
.
info
(
"
企微初始化,req={},{}"
,
initJson
.
toJSONString
()
,
initStr
);
QwOpenResultBO
initResult
=
result
(
initStr
);
QwOpenResultBO
initResult
=
result
(
initStr
);
if
(!
initResult
.
isOk
())
{
if
(!
initResult
.
isOk
())
{
return
ServiceResponse
.
failure
(
"9999"
,
initResult
.
getErrmsg
());
return
ServiceResponse
.
failure
(
"9999"
,
initResult
.
getErrmsg
());
...
@@ -35,11 +35,17 @@ public class OpenUtils {
...
@@ -35,11 +35,17 @@ public class OpenUtils {
String
uuid
=
initBO
.
getUuid
();
String
uuid
=
initBO
.
getUuid
();
// 设置回调
// 设置回调
setCallback
(
uuid
);
setCallback
(
uuid
);
if
(
initBO
.
isIs_login
())
{
logger
.
info
(
"客户端是登录中的={}"
,
qwUserId
);
return
ServiceResponse
.
success
(
initBO
);
}
if
(
qrcodeFlag
)
{
// 获取二维码
// 获取二维码
ServiceResponse
<
QwOpenResultInitBO
>
response
=
getQrcode
(
uuid
,
initBO
,
1
);
ServiceResponse
<
QwOpenResultInitBO
>
response
=
getQrcode
(
uuid
,
initBO
,
1
);
if
(!
response
.
isSuccess
())
{
if
(!
response
.
isSuccess
())
{
return
response
;
return
response
;
}
}
}
return
ServiceResponse
.
success
(
initBO
);
return
ServiceResponse
.
success
(
initBO
);
}
}
...
@@ -101,12 +107,31 @@ public class OpenUtils {
...
@@ -101,12 +107,31 @@ public class OpenUtils {
}
}
/**
/**
* 自动登录
*
* @param uuid
*/
public
static
boolean
autoLogin
(
String
uuid
)
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"uuid"
,
uuid
);
String
backJson
=
HttpClient
.
sendPostJSON
(
String
.
format
(
openHost
,
"automaticLogin"
),
json
.
toJSONString
(),
"utf-8"
);
logger
.
info
(
"自动登录={},uuid={}"
,
backJson
,
uuid
);
JSONObject
resultJson
=
JSONObject
.
parseObject
(
backJson
);
int
errcode
=
resultJson
.
getIntValue
(
"errcode"
);
if
(
errcode
==
0
)
{
logger
.
info
(
"自动登录成功={}"
);
return
true
;
}
return
false
;
}
/**
* 判断账号是否登录中
* 判断账号是否登录中
*
*
* @param uuid
* @param uuid
* @return
* @return
*/
*/
p
rivate
static
boolean
isLogin
(
String
uuid
)
{
p
ublic
static
boolean
isLogin
(
String
uuid
)
{
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"uuid"
,
uuid
);
json
.
put
(
"uuid"
,
uuid
);
String
backJson
=
HttpClient
.
sendPostJSON
(
String
.
format
(
openHost
,
"GetProfile"
),
json
.
toJSONString
(),
"utf-8"
);
String
backJson
=
HttpClient
.
sendPostJSON
(
String
.
format
(
openHost
,
"GetProfile"
),
json
.
toJSONString
(),
"utf-8"
);
...
...
haoban-manage3-service/src/main/resources/mapper/OpenStaffMapper.xml
View file @
0849373c
...
@@ -111,6 +111,10 @@
...
@@ -111,6 +111,10 @@
where open_staff_id = #{id}
where open_staff_id = #{id}
</update>
</update>
<update
id=
"updateByAutoLogin"
>
update tab_haoban_open_staff set uuid=#{uuid} , login_remark = '自动登录成功' where open_staff_id = #{id}
</update>
<delete
id=
"deleteByPrimaryKey"
>
<delete
id=
"deleteByPrimaryKey"
>
update tab_haoban_open_staff
update tab_haoban_open_staff
set delete_flag = 1,
set delete_flag = 1,
...
@@ -229,8 +233,8 @@
...
@@ -229,8 +233,8 @@
and a.delete_flag = 0
and a.delete_flag = 0
</select>
</select>
<select
id=
"listAll
"
resultType=
"java.lang.String
"
>
<select
id=
"listAll
Online"
resultMap=
"BaseResultMap
"
>
select
staff_id
from tab_haoban_open_staff where
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_open_staff where
status_flag = 1 and delete_flag = 0
status_flag = 1 and delete_flag = 0
<if
test=
"null !=wxEnterpriseId"
>
<if
test=
"null !=wxEnterpriseId"
>
and wx_enterprise_id = #{wxEnterpriseId}
and wx_enterprise_id = #{wxEnterpriseId}
...
...
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