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
223ea1ad
Commit
223ea1ad
authored
Feb 03, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
转移接口处理
parent
de59dca3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
164 additions
and
53 deletions
+164
-53
TransferActiveCodeDTO.java
.../com/gic/haoban/manage/api/dto/TransferActiveCodeDTO.java
+64
-0
TransferActiveCodeQDTO.java
...ic/haoban/manage/api/dto/qdto/TransferActiveCodeQDTO.java
+12
-12
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+1
-1
StaffMapper.java
...com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
+1
-2
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+58
-14
StaffMapper.xml
...manage3-service/src/main/resources/mapper/StaffMapper.xml
+0
-3
WxEnterpriseActiveDataServiceTest.java
...vice/src/test/java/WxEnterpriseActiveDataServiceTest.java
+13
-7
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+3
-2
TransferActiveCodeQO.java
...va/com/gic/haoban/manage/web/qo/TransferActiveCodeQO.java
+12
-12
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/TransferActiveCodeDTO.java
0 → 100644
View file @
223ea1ad
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description: 转移返回结果DTO
* @Author: wenhua
* @Date: 2023/2/3 10:47
*/
public
class
TransferActiveCodeDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 转移总数
*/
private
Integer
totalNum
;
/**
* 成功总数
*/
private
Integer
successNum
;
/**
* 失败总数
*/
private
Integer
failedNum
;
/**
* 失败明细
*/
private
List
<
Map
<
String
,
String
>>
failedList
;
public
Integer
getTotalNum
()
{
return
totalNum
;
}
public
void
setTotalNum
(
Integer
totalNum
)
{
this
.
totalNum
=
totalNum
;
}
public
Integer
getSuccessNum
()
{
return
successNum
;
}
public
void
setSuccessNum
(
Integer
successNum
)
{
this
.
successNum
=
successNum
;
}
public
Integer
getFailedNum
()
{
return
failedNum
;
}
public
void
setFailedNum
(
Integer
failedNum
)
{
this
.
failedNum
=
failedNum
;
}
public
List
<
Map
<
String
,
String
>>
getFailedList
()
{
return
failedList
;
}
public
void
setFailedList
(
List
<
Map
<
String
,
String
>>
failedList
)
{
this
.
failedList
=
failedList
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/qdto/TransferActiveCodeQDTO.java
View file @
223ea1ad
...
...
@@ -12,27 +12,27 @@ public class TransferActiveCodeQDTO implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
/**
* 转移成员的
userid。只支持加密的useri
d
* 转移成员的
staffI
d
*/
private
String
handover
_userid
;
private
String
handover
StaffId
;
/**
* 接收成员的
userid。只支持加密的useri
d
* 接收成员的
staffI
d
*/
private
String
takeover
_useri
d
;
private
String
takeover
StaffI
d
;
public
String
getHandover
_useri
d
()
{
return
handover
_useri
d
;
public
String
getHandover
StaffI
d
()
{
return
handover
StaffI
d
;
}
public
void
setHandover
_userid
(
String
handover_useri
d
)
{
this
.
handover
_userid
=
handover_useri
d
;
public
void
setHandover
StaffId
(
String
handoverStaffI
d
)
{
this
.
handover
StaffId
=
handoverStaffI
d
;
}
public
String
getTakeover
_useri
d
()
{
return
takeover
_useri
d
;
public
String
getTakeover
StaffI
d
()
{
return
takeover
StaffI
d
;
}
public
void
setTakeover
_userid
(
String
takeover_useri
d
)
{
this
.
takeover
_userid
=
takeover_useri
d
;
public
void
setTakeover
StaffId
(
String
takeoverStaffI
d
)
{
this
.
takeover
StaffId
=
takeoverStaffI
d
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
223ea1ad
...
...
@@ -329,5 +329,5 @@ public interface StaffApiService {
/**
* 转移员工许可
*/
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
Integer
>
batchTransferLicense
(
List
<
TransferActiveCodeQDTO
>
transferActiveCodeQOList
,
String
wxEnterpriseId
);
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
TransferActiveCodeDTO
>
batchTransferLicense
(
List
<
TransferActiveCodeQDTO
>
transferActiveCodeQOList
,
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
View file @
223ea1ad
...
...
@@ -168,11 +168,10 @@ public interface StaffMapper {
*/
Integer
getOccupyNum
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
TabHaobanStaff
getStaffInfoByWxOpenUserId
(
@Param
(
"wxOpenUseId"
)
String
wxOpenUseId
);
/**
* 通过wxOpenUserId更新企业成员许可信息
*/
void
updateStaffInfoBy
WxOpenUserId
(
@Param
(
"wxOpenUseId"
)
String
wxOpenUse
Id
,
void
updateStaffInfoBy
StaffId
(
@Param
(
"staffId"
)
String
staff
Id
,
@Param
(
"activeTime"
)
Date
activeTime
,
@Param
(
"expireTime"
)
Date
expireTime
,
@Param
(
"activeCode"
)
String
activeCode
,
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
223ea1ad
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
...
...
@@ -936,25 +937,68 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
public
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
Integer
>
batchTransferLicense
(
List
<
TransferActiveCodeQDTO
>
transferActiveCodeQOList
,
String
wxEnterpriseId
)
{
public
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
TransferActiveCodeDTO
>
batchTransferLicense
(
List
<
TransferActiveCodeQDTO
>
transferActiveCodeQOList
,
String
wxEnterpriseId
)
{
TransferActiveCodeDTO
result
=
new
TransferActiveCodeDTO
();
if
(
CollUtil
.
isEmpty
(
transferActiveCodeQOList
)){
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
" 传入的参数有误!"
,
result
);
}
//拼接staffIdList
List
<
String
>
staffIds
=
new
ArrayList
<>();
transferActiveCodeQOList
.
stream
().
forEach
(
a
->{
staffIds
.
add
(
a
.
getHandoverStaffId
());
staffIds
.
add
(
a
.
getTakeoverStaffId
());
});
List
<
TabHaobanStaff
>
tabHaobanStaffs
=
staffMapper
.
listByIds
(
staffIds
);
if
(
CollUtil
.
isEmpty
(
tabHaobanStaffs
)){
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
"通讯录成员不存在!"
,
result
);
}
WxEnterpriseDTO
wxEnterpriseDTO
=
this
.
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
String
openCorpid
=
wxEnterpriseDTO
.
getOpenCorpid
();
String
serviceCorpid
=
config
.
getCorpid
();
List
<
AccountTransferUserDTO
>
accountTransferUserDTOList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
transferActiveCodeQOList
),
AccountTransferUserDTO
.
class
);
//拼接转移参数
Map
<
String
,
TabHaobanStaff
>
collect
=
tabHaobanStaffs
.
stream
().
collect
(
Collectors
.
toMap
(
TabHaobanStaff:
:
getStaffId
,
a
->
a
));
Map
<
String
,
String
>
map
=
tabHaobanStaffs
.
stream
().
collect
(
Collectors
.
toMap
(
TabHaobanStaff:
:
getWxOpenUseId
,
a
->
a
.
getStaffId
()));
List
<
AccountTransferUserDTO
>
accountTransferUserDTOList
=
new
ArrayList
<>();
transferActiveCodeQOList
.
stream
().
forEach
(
a
->{
AccountTransferUserDTO
accountTransferUserDTO
=
new
AccountTransferUserDTO
();
TabHaobanStaff
handoverStaff
=
collect
.
get
(
a
.
getHandoverStaffId
());
TabHaobanStaff
takeOverStaff
=
collect
.
get
(
a
.
getTakeoverStaffId
());
accountTransferUserDTO
.
setHandover_userid
(
handoverStaff
.
getWxOpenUseId
());
accountTransferUserDTO
.
setTakeover_userid
(
takeOverStaff
.
getWxOpenUseId
());
accountTransferUserDTOList
.
add
(
accountTransferUserDTO
);
});
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
List
<
AccountTransferUserDTO
>>
listServiceResponse
=
qywxOrderApiService
.
batchTransferLicense
(
serviceCorpid
,
openCorpid
,
accountTransferUserDTOList
);
logger
.
info
(
"转移成员返回结果:{}"
,
JSONObject
.
toJSONString
(
listServiceResponse
));
if
(
Constant
.
SUCCESS
.
equals
(
listServiceResponse
.
getCode
())){
//企微转移成功,好办staff表对应更新
transferActiveCodeQOList
.
stream
().
forEach
(
a
->{
//先查询转移成员的许可信息
TabHaobanStaff
staffDTO
=
staffMapper
.
getStaffInfoByWxOpenUserId
(
a
.
getHandover_userid
());
//置空转移成员的许可信息
staffMapper
.
updateStaffInfoByWxOpenUserId
(
a
.
getHandover_userid
(),
null
,
null
,
null
,
0
);
//更新接收成员的许可信息
staffMapper
.
updateStaffInfoByWxOpenUserId
(
a
.
getTakeover_userid
(),
staffDTO
.
getActiveTime
(),
staffDTO
.
getExpireTime
(),
staffDTO
.
getActiveCode
(),
1
);
});
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
success
();
}
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
listServiceResponse
.
getCode
(),
listServiceResponse
.
getMessage
());
List
<
AccountTransferUserDTO
>
resultList
=
listServiceResponse
.
getResult
();
result
.
setTotalNum
(
resultList
.
size
());
int
successNum
=
0
,
failedNum
=
0
;
List
<
Map
<
String
,
String
>>
failedList
=
new
ArrayList
<>();
for
(
AccountTransferUserDTO
dto
:
resultList
)
{
if
(
Constant
.
SUCCESS
.
equals
(
dto
.
getErrcode
())){
//企微转移成功,好办staff表对应更新
successNum
++;
TabHaobanStaff
handoverStaff
=
collect
.
get
(
map
.
get
(
dto
.
getHandover_userid
()));
TabHaobanStaff
takeOverStaff
=
collect
.
get
(
map
.
get
(
dto
.
getTakeover_userid
()));
//置空转移成员的许可信息
staffMapper
.
updateStaffInfoByStaffId
(
handoverStaff
.
getStaffId
(),
null
,
null
,
null
,
0
);
//更新接收成员的许可信息
staffMapper
.
updateStaffInfoByStaffId
(
takeOverStaff
.
getStaffId
(),
takeOverStaff
.
getActiveTime
(),
takeOverStaff
.
getExpireTime
(),
takeOverStaff
.
getActiveCode
(),
1
);
}
else
{
//企微转移失败,记录失败明细
failedNum
++;
TabHaobanStaff
handoverStaff
=
collect
.
get
(
map
.
get
(
dto
.
getHandover_userid
()));
TabHaobanStaff
takeOverStaff
=
collect
.
get
(
map
.
get
(
dto
.
getTakeover_userid
()));
Map
<
String
,
String
>
stringMap
=
new
HashMap
<>(
8
);
stringMap
.
put
(
"handoverStaffName"
,
handoverStaff
.
getStaffName
());
stringMap
.
put
(
"takeOverStaffName"
,
takeOverStaff
.
getStaffName
());
failedList
.
add
(
stringMap
);
}
}
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
success
(
result
);
}
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
listServiceResponse
.
getCode
(),
listServiceResponse
.
getMessage
(),
result
);
}
}
haoban-manage3-service/src/main/resources/mapper/StaffMapper.xml
View file @
223ea1ad
...
...
@@ -607,9 +607,6 @@
SELECT count(*) FROM tab_haoban_staff WHERE status_flag = 0 and update_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and active_status = 1 and wx_enterprise_id = #{wxEnterpriseId}
</select>
<select
id=
"getStaffInfoByWxOpenUserId"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM tab_haoban_staff WHERE wx_open_user_id = #{wxOpenUseId}
</select>
<update
id=
"updateStaffInfoByWxOpenUserId"
>
update tab_haoban_staff set
...
...
haoban-manage3-service/src/test/java/WxEnterpriseActiveDataServiceTest.java
View file @
223ea1ad
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.TransferActiveCodeDTO
;
import
com.gic.haoban.manage.api.dto.qdto.TransferActiveCodeQDTO
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.hm.HmPageApiService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseActiveDataService
;
import
com.google.gson.JsonObject
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,14 +38,17 @@ public class WxEnterpriseActiveDataServiceTest {
public
void
test1
(){
List
<
TransferActiveCodeQDTO
>
transferActiveCodeQOList
=
new
ArrayList
<>();
TransferActiveCodeQDTO
transferActiveCodeQDTO
=
new
TransferActiveCodeQDTO
();
transferActiveCodeQDTO
.
setHandover
_userid
(
"wo59NLDQAACLAXbOdqrz-70qpl72cWcA
"
);
transferActiveCodeQDTO
.
setTakeover
_userid
(
"wo59NLDQAApF0TAIJkdCZjESTGq-fuEQ
"
);
transferActiveCodeQDTO
.
setHandover
StaffId
(
"1fccf6ff6ecf434d9b00f31227b45d63
"
);
transferActiveCodeQDTO
.
setTakeover
StaffId
(
"8a3a60a4e5b546b79087ee70f1844b25
"
);
transferActiveCodeQOList
.
add
(
transferActiveCodeQDTO
);
TransferActiveCodeQDTO
transferActiveCodeQDTO1
=
new
TransferActiveCodeQDTO
();
transferActiveCodeQDTO1
.
setHandover_userid
(
"wo59NLDQAAxWVUBU76zh3jRMXZ8TOxfw"
);
transferActiveCodeQDTO1
.
setTakeover_userid
(
"wo59NLDQAArJKx2wWmQGWTOd36ueijwQ"
);
transferActiveCodeQOList
.
add
(
transferActiveCodeQDTO1
);
ServiceResponse
<
Integer
>
integerServiceResponse
=
staffApiService
.
batchTransferLicense
(
transferActiveCodeQOList
,
"ca66a01b79474c40b3e7c7f93daf1a3b"
);
// TransferActiveCodeQDTO transferActiveCodeQDTO1 = new TransferActiveCodeQDTO();
// transferActiveCodeQDTO1.setHandoverStaffId("wo59NLDQAAxWVUBU76zh3jRMXZ8TOxfw");
// transferActiveCodeQDTO1.setTakeoverStaffId("wo59NLDQAArJKx2wWmQGWTOd36ueijwQ");
// transferActiveCodeQOList.add(transferActiveCodeQDTO1);
ServiceResponse
<
TransferActiveCodeDTO
>
transferLicense
=
staffApiService
.
batchTransferLicense
(
transferActiveCodeQOList
,
"ca66a01b79474c40b3e7c7f93daf1a3b"
);
System
.
out
.
println
(
"222222222222"
+
JSONObject
.
toJSONString
(
transferLicense
));
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
223ea1ad
...
...
@@ -617,8 +617,9 @@ public class StaffController extends WebBaseController {
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
List
<
TransferActiveCodeQDTO
>
transferActiveCodeQDTOList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
transferActiveCodeQOList
),
TransferActiveCodeQDTO
.
class
);
ServiceResponse
<
Integer
>
integerServiceResponse
=
staffApiService
.
batchTransferLicense
(
transferActiveCodeQDTOList
,
wxEnterpriseId
);
return
RestResponse
.
successResult
(
integerServiceResponse
);
ServiceResponse
<
TransferActiveCodeDTO
>
transferActiveCodeDTOServiceResponse
=
staffApiService
.
batchTransferLicense
(
transferActiveCodeQDTOList
,
wxEnterpriseId
);
return
RestResponse
.
successResult
(
transferActiveCodeDTOServiceResponse
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/TransferActiveCodeQO.java
View file @
223ea1ad
...
...
@@ -12,27 +12,27 @@ public class TransferActiveCodeQO implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
/**
* 转移成员的
userid。只支持加密的useri
d
* 转移成员的
staffI
d
*/
private
String
handover
_userid
;
private
String
handover
StaffId
;
/**
* 接收成员的
userid。只支持加密的useri
d
* 接收成员的
staffI
d
*/
private
String
takeover
_useri
d
;
private
String
takeover
StaffI
d
;
public
String
getHandover
_useri
d
()
{
return
handover
_useri
d
;
public
String
getHandover
StaffI
d
()
{
return
handover
StaffI
d
;
}
public
void
setHandover
_userid
(
String
handover_useri
d
)
{
this
.
handover
_userid
=
handover_useri
d
;
public
void
setHandover
StaffId
(
String
handoverStaffI
d
)
{
this
.
handover
StaffId
=
handoverStaffI
d
;
}
public
String
getTakeover
_useri
d
()
{
return
takeover
_useri
d
;
public
String
getTakeover
StaffI
d
()
{
return
takeover
StaffI
d
;
}
public
void
setTakeover
_userid
(
String
takeover_useri
d
)
{
this
.
takeover
_userid
=
takeover_useri
d
;
public
void
setTakeover
StaffId
(
String
takeoverStaffI
d
)
{
this
.
takeover
StaffId
=
takeoverStaffI
d
;
}
}
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