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
8950f7b3
Commit
8950f7b3
authored
Apr 20, 2020
by
huangZW
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://115.159.76.241/haoban3.0/haoban-manage3.0.git
into developer
parents
ad0e5976
b39eb848
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
10 deletions
+70
-10
WxEnterpriseController.java
.../haoban/manage/web/controller/WxEnterpriseController.java
+70
-10
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseController.java
View file @
8950f7b3
...
@@ -17,6 +17,7 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -17,6 +17,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
com.alibaba.druid.util.StringUtils
;
import
com.alibaba.druid.util.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.enterprise.api.dto.EnterpriseAndUserDTO
;
import
com.gic.enterprise.api.dto.EnterpriseAndUserDTO
;
...
@@ -28,6 +29,7 @@ import com.gic.enterprise.api.service.StoreService;
...
@@ -28,6 +29,7 @@ import com.gic.enterprise.api.service.StoreService;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO
;
import
com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO
;
...
@@ -45,7 +47,10 @@ import com.gic.haoban.manage.web.config.Config;
...
@@ -45,7 +47,10 @@ import com.gic.haoban.manage.web.config.Config;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
com.gic.haoban.manage.web.vo.StoreVo
;
import
com.gic.haoban.manage.web.vo.StoreVo
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.service.qywx.QywxCorpApiService
;
import
com.gic.wechat.api.service.qywx.QywxCorpApiService
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.gic.wechat.token.api.dto.QywxCorpInfoDTO
;
import
com.gic.wechat.token.api.dto.QywxCorpInfoDTO
;
import
com.gic.wechat.token.api.service.QywxTokenManageService
;
import
com.gic.wechat.token.api.service.QywxTokenManageService
;
...
@@ -65,9 +70,11 @@ public class WxEnterpriseController extends WebBaseController{
...
@@ -65,9 +70,11 @@ public class WxEnterpriseController extends WebBaseController{
@Autowired
@Autowired
private
QywxTokenManageService
qywxTokenManageService
;
private
QywxTokenManageService
qywxTokenManageService
;
@Autowired
@Autowired
private
WxApplicationApiService
wxApplication
ApiService
;
private
QywxDepartmentApiService
qywxDepartment
ApiService
;
@Autowired
@Autowired
private
Config
config
;
private
Config
config
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
//授权企业列表
//授权企业列表
...
@@ -224,18 +231,18 @@ public class WxEnterpriseController extends WebBaseController{
...
@@ -224,18 +231,18 @@ public class WxEnterpriseController extends WebBaseController{
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getSessionUser
();
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getSessionUser
();
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
wxEnterprise
!=
null
&&
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
wxEnterprise
.
getContactSecret
())
||
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
wxEnterprise
.
getWxSecretKey
()
))){
if
(
wxEnterprise
!=
null
&&
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
wxEnterprise
.
getContactSecret
(),
wxEnterprise
.
getWxSecretKey
(
))){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
}
//微信企业绑定接口
//微信企业绑定接口
绑定通讯录key
@IgnoreLogin
@IgnoreLogin
@RequestMapping
(
"wx-enterprise-secret-set"
)
@RequestMapping
(
"wx-enterprise-
contact-
secret-set"
)
public
HaobanResponse
wxEnterpriseSecretSet
(
String
contactSecret
,
String
wxSecretKey
)
{
public
HaobanResponse
wxEnterpriseSecretSet
(
String
contactSecret
)
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
contactSecret
,
wxSecretKey
)){
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
contactSecret
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
}
String
wxEnterpriseId
=
""
;
String
wxEnterpriseId
=
""
;
...
@@ -245,13 +252,66 @@ public class WxEnterpriseController extends WebBaseController{
...
@@ -245,13 +252,66 @@ public class WxEnterpriseController extends WebBaseController{
if
(
wxEnterprise
==
null
){
if
(
wxEnterprise
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
}
wxEnterprise
.
setContactSecret
(
contactSecret
);
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
contactSecret
,
login
.
getStaffDTO
().
getWxUserId
());
wxEnterprise
.
setWxSecretKey
(
wxSecretKey
);
if
(
user
!=
null
){
wxEnterpriseApiService
.
update
(
wxEnterprise
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
}
//微信企业绑定接口绑定通讯录key
@IgnoreLogin
@RequestMapping
(
"wx-enterprise-wx-secret-set"
)
public
HaobanResponse
wxEnterpriseWxSecretSet
(
String
wxSecretKey
)
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
wxSecretKey
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
String
wxEnterpriseId
=
""
;
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getSessionUser
();
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
wxEnterprise
.
getCorpid
(),
wxSecretKey
,
login
.
getStaffDTO
().
getWxUserId
());
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
res
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
JSONObject
json
=
JSON
.
parseObject
(
res
);
if
(
"0"
.
equals
(
json
.
getString
(
"errcode"
))){
wxEnterprise
.
setWxSecretKey
(
wxSecretKey
);
wxEnterpriseApiService
.
update
(
wxEnterprise
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
}
}
//微信企业会员小程序
@IgnoreLogin
@RequestMapping
(
"wx-enterprise-member-secret-set"
)
public
HaobanResponse
wxEnterpriseMemberSecretSet
(
String
memberSecret
)
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
memberSecret
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
String
wxEnterpriseId
=
""
;
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getSessionUser
();
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
memberSecret
,
login
.
getStaffDTO
().
getWxUserId
());
if
(
user
!=
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
}
}
}
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