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
572dd1c9
Commit
572dd1c9
authored
Feb 23, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加日志
parent
ab8f0b18
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
38 deletions
+48
-38
DepartmentApiService.java
...m/gic/haoban/manage/api/service/DepartmentApiService.java
+2
-0
DepartmentApiServiceImpl.java
...ge/service/service/out/impl/DepartmentApiServiceImpl.java
+39
-0
WxEnterpriseApiServiceImpl.java
.../service/service/out/impl/WxEnterpriseApiServiceImpl.java
+0
-37
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+4
-0
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+3
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DepartmentApiService.java
View file @
572dd1c9
...
...
@@ -113,4 +113,6 @@ public interface DepartmentApiService {
*/
List
<
DepartmentDTO
>
listByChainId
(
String
chainId
,
String
wxEnterpriseId
);
void
initwxDepartment
(
String
corpid
,
String
suiteid
,
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentApiServiceImpl.java
View file @
572dd1c9
...
...
@@ -5,6 +5,8 @@ import java.util.Date;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.haoban.base.api.common.Constant
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -314,4 +316,41 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
return
EntityUtil
.
changeEntityListByJSON
(
DepartmentDTO
.
class
,
list
);
}
@Override
public
void
initwxDepartment
(
String
corpid
,
String
suiteid
,
String
wxEnterpriseId
)
{
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listDepartment
(
corpid
,
suiteid
,
null
);
logger
.
info
(
"企业所有部门数据:{}"
,
JSON
.
toJSONString
(
list
));
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
this
.
addAllDepartment
(
list
,
1
,
wxEnterpriseId
);
}
}
private
void
addAllDepartment
(
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
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
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
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
);
}
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseApiServiceImpl.java
View file @
572dd1c9
...
...
@@ -80,13 +80,6 @@ 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
...
...
@@ -111,34 +104,4 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
TabHaobanWxEnterprise
enterprise
=
this
.
wxEnterpriseService
.
getEnterpriseBycorpId
(
corpId
);
return
EntityUtil
.
changeEntityByJSON
(
WxEnterpriseDTO
.
class
,
enterprise
);
}
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
);
}
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
572dd1c9
...
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.gic.haoban.common.utils.GlobalVar
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.WxApplicationApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.web.anno.IgnoreLogin
;
...
...
@@ -35,6 +36,8 @@ public class ApplicationController extends WebBaseController{
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
Config
config
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@RequestMapping
(
"application-list"
)
public
HaobanResponse
applicationList
()
{
...
...
@@ -71,6 +74,7 @@ public class ApplicationController extends WebBaseController{
applicationDTO
.
setAgentName
(
dto
.
getAgentName
());
applicationDTO
.
setSiteId
(
dto
.
getSuiteId
());
wxApplicationApiService
.
addSuite
(
applicationDTO
);
this
.
departmentApiService
.
initwxDepartment
(
dto
.
getCorpid
(),
suiteId
,
enterpriseDTO
.
getWxEnterpriseId
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
result
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_0
,
dto
);
...
...
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
572dd1c9
...
...
@@ -29,7 +29,9 @@
<dubbo:reference
interface=
"com.gic.enterprise.api.service.StoreService"
id=
"storeService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.DepartmentService"
id=
"departmentService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.DepartmentApiService"
id=
"departmentApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.DepartmentApiService"
id=
"departmentApiService"
>
<dubbo:method
name=
"initwxDepartment"
async=
"true"
/>
</dubbo:reference>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.StoreGroupService"
id=
"storeGroupService"
/>
<dubbo:reference
interface=
"com.gic.clerk.api.service.ClerkService"
id=
"clerkService"
/>
...
...
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