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
Expand all
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 {
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
;
import
com.gic.haoban.manage.api.dto.OpenStaffDTO
;
import
com.gic.haoban.manage.api.dto.OpenStaffListDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO
;
...
...
@@ -48,11 +46,14 @@ public interface OpenStaffMapper {
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
);
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
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;
public
class
QwOpenResultInitBO
implements
Serializable
{
private
boolean
is_login
;
private
String
uuid
;
private
String
qrcode
;
...
...
@@ -12,6 +14,14 @@ public class QwOpenResultInitBO implements Serializable {
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
()
{
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 {
ServiceResponse
<
Page
<
OpenStaffListDTO
>>
page
(
OpenStaffPageQDTO
qdto
,
BasePageInfo
basePageInfo
);
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
This diff is collapsed.
Click to expand it.
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
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.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.util.DingUtils
;
import
com.gic.haoban.manage.service.util.HBQwMonitorUtils
;
...
...
@@ -16,16 +16,12 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.joda.time.DateTime
;
import
org.redisson.api.RMap
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.ServiceResponse
;
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.hm.HmQrcodeTempService
;
...
...
@@ -56,6 +52,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
private
WxUserAddLogMapper
wxUserAddLogMapper
;
@Autowired
private
HaobanCommonMQApiService
haobanCommonMQApiService
;
@Autowired
private
OpenStaffService
openStaffService
;
@Override
...
...
@@ -178,4 +176,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
DingUtils
.
send
(
"halfTimer告警,wxEnterpriseId="
+
wxEnterpriseId
,
null
,
false
);
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;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 企微托管账号
...
...
@@ -200,6 +201,18 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
qwUserId
=
openStaff
.
getQwUserId
();
log
.
info
(
"重新初始化"
);
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
)
{
openStaff
=
new
TabOpenStaff
();
...
...
@@ -207,7 +220,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
openStaff
.
setWxEnterpriseId
(
qdto
.
getWxEnterpriseId
());
openStaff
.
setEnterpriseId
(
qdto
.
getEnterpriseId
());
}
ServiceResponse
<
QwOpenResultInitBO
>
resp
=
OpenUtils
.
init
(
qwUserId
);
ServiceResponse
<
QwOpenResultInitBO
>
resp
=
OpenUtils
.
init
(
qwUserId
,
true
);
log
.
info
(
"resp={}"
,
JSONObject
.
toJSONString
(
resp
));
QwOpenResultInitBO
init
=
resp
.
getResult
();
openStaff
.
setUuid
(
init
.
getUuid
());
...
...
@@ -276,13 +289,14 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override
public
List
<
String
>
listAllOnlineStaff
()
{
return
this
.
openStaffMapper
.
listAll
(
null
,
null
);
return
this
.
listAllOnlineStaff
(
null
,
null
);
}
@Override
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
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/OpenUtils.java
View file @
0849373c
...
...
@@ -20,13 +20,13 @@ public class OpenUtils {
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
();
if
(
null
!=
qwUserId
)
{
initJson
.
put
(
"vid"
,
qwUserId
);
}
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
);
if
(!
initResult
.
isOk
())
{
return
ServiceResponse
.
failure
(
"9999"
,
initResult
.
getErrmsg
());
...
...
@@ -35,11 +35,17 @@ public class OpenUtils {
String
uuid
=
initBO
.
getUuid
();
// 设置回调
setCallback
(
uuid
);
if
(
initBO
.
isIs_login
())
{
logger
.
info
(
"客户端是登录中的={}"
,
qwUserId
);
return
ServiceResponse
.
success
(
initBO
);
}
if
(
qrcodeFlag
)
{
// 获取二维码
ServiceResponse
<
QwOpenResultInitBO
>
response
=
getQrcode
(
uuid
,
initBO
,
1
);
if
(!
response
.
isSuccess
())
{
return
response
;
}
}
return
ServiceResponse
.
success
(
initBO
);
}
...
...
@@ -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
* @return
*/
p
rivate
static
boolean
isLogin
(
String
uuid
)
{
p
ublic
static
boolean
isLogin
(
String
uuid
)
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"uuid"
,
uuid
);
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 @@
where open_staff_id = #{id}
</update>
<update
id=
"updateByAutoLogin"
>
update tab_haoban_open_staff set uuid=#{uuid} , login_remark = '自动登录成功' where open_staff_id = #{id}
</update>
<delete
id=
"deleteByPrimaryKey"
>
update tab_haoban_open_staff
set delete_flag = 1,
...
...
@@ -229,8 +233,8 @@
and a.delete_flag = 0
</select>
<select
id=
"listAll
"
resultType=
"java.lang.String
"
>
select
staff_id
from tab_haoban_open_staff where
<select
id=
"listAll
Online"
resultMap=
"BaseResultMap
"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_open_staff where
status_flag = 1 and delete_flag = 0
<if
test=
"null !=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