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
6aabb1fb
Commit
6aabb1fb
authored
Feb 22, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加日志
parent
49b32169
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
1 deletions
+65
-1
QywxCorpInfoSimpleDTO.java
.../com/gic/haoban/manage/api/dto/QywxCorpInfoSimpleDTO.java
+17
-0
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+3
-0
WxEnterpriseApiServiceImpl.java
.../service/service/out/impl/WxEnterpriseApiServiceImpl.java
+45
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/QywxCorpInfoSimpleDTO.java
View file @
6aabb1fb
...
...
@@ -58,6 +58,16 @@ public class QywxCorpInfoSimpleDTO implements Serializable{
/* 有效0 删除1 */
private
Integer
delStatus
=
0
;
/**
* 权限等级。
1:通讯录基本信息只读
2:通讯录全部信息只读(已废弃)
3:通讯录全部信息读写
4:单个基本信息只读
5:通讯录全部信息只写(已废弃)
* **/
private
Integer
level
;
public
Integer
getErrcode
()
{
return
errcode
;
}
...
...
@@ -202,4 +212,11 @@ public class QywxCorpInfoSimpleDTO implements Serializable{
this
.
delStatus
=
delStatus
;
}
public
Integer
getLevel
()
{
return
level
;
}
public
void
setLevel
(
Integer
level
)
{
this
.
level
=
level
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
6aabb1fb
...
...
@@ -123,6 +123,9 @@ public class MessageApiServiceImpl implements MessageApiService {
departmentDTO
.
setIsStore
(
0
);
departmentDTO
.
setRelatedId
(
qywxCallBackDTO
.
getId
()+
""
);
TabHaobanDepartment
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
);
if
(
parentDepartment
==
null
){
return
;
}
departmentDTO
.
setParentDepartmentId
(
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainId
(
parentDepartment
.
getChainId
()+
Constant
.
ID_SEPARATOR
+
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainName
(
parentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parentDepartment
.
getChainName
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseApiServiceImpl.java
View file @
6aabb1fb
...
...
@@ -4,6 +4,12 @@ import java.util.ArrayList;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.wechat.api.dto.qywx.DepartmentDTO
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -35,6 +41,10 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private
WxEnterpriseMapper
wxEnterpriseMapper
;
@Autowired
private
WxApplicationService
wxApplicationService
;
@Autowired
private
QywxDepartmentApiService
qywxDepartmentApiService
;
@Autowired
private
DepartmentService
departmentService
;
@Override
public
void
callbackReviceEnterprise
(
QywxCorpInfoSimpleDTO
dto
)
{
...
...
@@ -70,6 +80,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
wxApplicationService
.
update
(
tab
);
}
log
.
info
(
"企业微信授权处理完成"
);
if
(
dto
.
getLevel
()
!=
null
&&
dto
.
getLevel
()
==
3
){
//如果是通讯录应用拉取所有部门初始化
List
<
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listDepartment
(
dto
.
getCorpid
(),
dto
.
getSuiteId
(),
null
);
log
.
info
(
"企业所有部门数据:{}"
,
JSON
.
toJSONString
(
list
));
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
this
.
addAllDepartment
(
list
,
1
,
wxEnterpriseId
);
}
}
}
@Override
...
...
@@ -89,6 +106,33 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
return
wxDTO
;
}
private
void
addAllDepartment
(
List
<
DepartmentDTO
>
list
,
Integer
parentId
,
String
wxEnterpriseId
){
int
level
=
1
;
String
chainId
=
"0"
;
String
chainName
=
"0"
;
if
(
parentId
!=
1
){
TabHaobanDepartment
parent
=
this
.
departmentService
.
getByWxId
(
parentId
+
""
);
if
(
parent
!=
null
){
level
=
parent
.
getLevel
()
+
1
;
chainId
=
parent
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
parent
.
getDepartmentId
();
chainName
=
parent
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parent
.
getChainName
();
}
}
for
(
DepartmentDTO
departmentDTO
:
list
){
if
(
parentId
==
departmentDTO
.
getParentid
()){
com
.
gic
.
haoban
.
manage
.
api
.
dto
.
DepartmentDTO
dto
=
new
com
.
gic
.
haoban
.
manage
.
api
.
dto
.
DepartmentDTO
();
dto
.
setDepartmentName
(
departmentDTO
.
getName
());
dto
.
setLevel
(
level
);
dto
.
setWxEnterpriseId
(
wxEnterpriseId
);
dto
.
setWxDepartmentId
(
departmentDTO
.
getId
()+
""
);
dto
.
setParentDepartmentId
(
parentId
+
""
);
dto
.
setChainId
(
chainId
);
dto
.
setChainName
(
chainName
);
this
.
departmentService
.
add
(
dto
);
this
.
addAllDepartment
(
list
,
departmentDTO
.
getId
(),
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