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
2f484556
Commit
2f484556
authored
Jun 03, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secret接口更改
parent
310fe0c9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
173 additions
and
38 deletions
+173
-38
DealSyncOperationApiServiceImpl.java
...ice/service/out/impl/DealSyncOperationApiServiceImpl.java
+11
-1
DepartmentApiServiceImpl.java
...ge/service/service/out/impl/DepartmentApiServiceImpl.java
+9
-6
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+20
-15
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+31
-4
QywxGroupSyncOperation.java
...ic/haoban/manage/service/task/QywxGroupSyncOperation.java
+12
-5
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+20
-3
WxEnterpriseController.java
.../haoban/manage/web/controller/WxEnterpriseController.java
+63
-2
InfoController.java
.../com/gic/haoban/manage/web/controller/InfoController.java
+6
-1
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+1
-1
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DealSyncOperationApiServiceImpl.java
View file @
2f484556
...
...
@@ -18,6 +18,7 @@ import com.gic.haoban.common.utils.PageUtil;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.SyncTaskStatusEnum
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
...
...
@@ -94,6 +95,9 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
@Autowired
private
SecretSettingService
secretSettingService
;
private
static
final
String
LOCK_KEY
=
"sync_wx_lock_"
;
private
static
final
String
LOCK_SUCCESS_KEY
=
"sync_wx_success_lock_"
;
...
...
@@ -514,9 +518,15 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
@Override
@Deprecated
public
void
dealQywxDepartment
(
String
taskId
,
String
wxEnterpriseId
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
qywxDepartmentApiService
.
listSelfDepartment
(
wxEnterpriseDTO
.
getCorpid
(),
wxEnterpriseDTO
.
getContactSecret
(),
1
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret"
);
return
;
}
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
qywxDepartmentApiService
.
listSelfDepartment
(
wxEnterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
1
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"没有数据同步"
);
return
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentApiServiceImpl.java
View file @
2f484556
...
...
@@ -685,6 +685,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
@Override
@Deprecated
public
ServiceResponse
gicDel
(
String
departmentId
)
{
ServiceResponse
hr
=
new
ServiceResponse
();
hr
.
setCode
(
1
);
...
...
@@ -718,12 +719,13 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
TabHaobanDepartment
department
=
departmentService
.
selectById
(
departmentId
);
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
department
.
getWxEnterpriseId
());
if
(
enterpriseDTO
!=
null
)
{
JSONResponse
jp
=
qywxDepartmentApiService
.
deleteSelfDepartment
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
Integer
.
parseInt
(
department
.
getWxDepartmentId
()));
if
(
jp
.
getErrorCode
()
!=
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信删除部门失败"
);
return
hr
;
}
//todo 不需要了
// JSONResponse jp = qywxDepartmentApiService.deleteSelfDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), Integer.parseInt(department.getWxDepartmentId()));
// if(jp.getErrorCode() != 0) {
// hr.setCode(0);
// hr.setMessage("微信删除部门失败");
// return hr;
// }
}
departmentService
.
del
(
departmentId
);
...
...
@@ -747,6 +749,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
@Override
@Deprecated
public
void
initwxDepartmentMQ
(
String
res
)
{
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseService
.
selectById
(
res
);
if
(
enterpriseDTO
!=
null
){
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
2f484556
...
...
@@ -6,6 +6,9 @@ import cn.hutool.core.collection.CollectionUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.wechat.api.dto.qywx.QywxIinkExternalMessageDTO
;
import
com.gic.wechat.api.dto.qywx.QywxImageExternalMessageDTO
;
import
com.gic.wechat.api.dto.qywx.QywxTextExternalMessageDTO
;
...
...
@@ -40,12 +43,6 @@ import com.gic.enterprise.api.service.StoreService;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.contacts.manage.api.dto.SearchDataDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.MemberStoreDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService
;
...
...
@@ -59,12 +56,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService
;
import
com.gic.haoban.manage.service.service.MemberUnionRelatedService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseRelatedService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.member.api.dto.MemberDTO
;
import
com.gic.member.api.service.MemberOpenCardBusinessService
;
...
...
@@ -126,6 +117,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
MaterialApiService
materialApiService
;
@Autowired
private
SecretSettingService
secretSettingService
;
@Override
public
List
<
MemberStoreDTO
>
listByExTernalUseridAndWxUserId
(
String
externalUserid
,
String
wxUserId
)
{
...
...
@@ -441,7 +435,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return
""
;
}
List
<
TabHaobanWxEnterpriseRelated
>
list
=
wxEnterpriseRelatedService
.
getByWxEnterpriseId
(
wxEnterprise
.
getWxEnterpriseId
());
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
wxEnterprise
.
getWxSecretKey
(),
selfExternalUserId
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
)
{
log
.
info
(
"没有配置secret"
);
return
""
;
}
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
selfExternalUserId
);
log
.
info
(
"【新增外部联系人回调】unionIdJson={}"
,
JSON
.
toJSONString
(
unionIdJson
));
String
unionId
=
""
;
...
...
@@ -587,7 +587,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return
""
;
}
dto
.
setSuiteid
(
wxEnterprise
.
getWxSecretKey
());
dto
.
setSuiteid
(
secretSetting
.
getSecretVal
());
MemberUnionidRelatedDTO
exsitDTO
=
memberUnionRelatedService
.
getByParams
(
userId
,
tabHaobanWxEnterpriseRelated
.
getEnterpriseId
(),
name
,
createTime
);
String
uuid
=
""
;
...
...
@@ -645,7 +645,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
public
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
)
{
log
.
info
(
"【刷下好友】wxUserId={}"
,
wxUserId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
enterprise
.
getCorpid
(),
enterprise
.
getWxSecretKey
(),
wxUserId
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
return
;
}
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
enterprise
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
log
.
info
(
"【刷下好友】res={}"
,
res
);
if
(
StringUtils
.
isBlank
(
res
)){
return
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
2f484556
...
...
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.redis.data.anno.RedisCache
;
...
...
@@ -100,6 +101,9 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
@Autowired
private
SecretSettingService
secretSettingService
;
@Override
public
StaffDTO
selectById
(
String
staffId
)
{
...
...
@@ -312,7 +316,15 @@ public class StaffApiServiceImpl implements StaffApiService {
res
.
setCode
(
2
);
return
res
;
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
userId
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
res
.
setMessage
(
"没有配置secret"
);
res
.
setCode
(
4
);
return
res
;
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
userId
);
if
(
null
==
user
)
{
logger
.
info
(
"企业微信用户不存在:{}:{}"
,
wxEnterpriseId
,
userId
);
res
.
setMessage
(
"企业微信用户不存在"
);
...
...
@@ -428,7 +440,12 @@ public class StaffApiServiceImpl implements StaffApiService {
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
)
{
Date
now
=
new
Date
();
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
userId
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret"
);
return
;
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
userId
);
if
(
user
==
null
){
return
;
}
...
...
@@ -1048,7 +1065,12 @@ public class StaffApiServiceImpl implements StaffApiService {
if
(
null
==
enterpriseDTO
)
{
return
null
;
}
String
userId
=
qywxUserApiService
.
getSelfWxUserIdByPhonenumber
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
phoneNumber
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
return
null
;
}
String
userId
=
qywxUserApiService
.
getSelfWxUserIdByPhonenumber
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
phoneNumber
);
logger
.
info
(
"获取userId:{},{}"
,
phoneNumber
,
userId
);
if
(
userId
==
null
)
{
return
null
;
...
...
@@ -1325,7 +1347,12 @@ public class StaffApiServiceImpl implements StaffApiService {
for
(
TabHaobanStaffDepartmentRelated
tab
:
retList
)
{
if
(
clerkCode
.
equals
(
tab
.
getClerkCode
()))
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
department
.
getWxEnterpriseId
());
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterpriseDTO
.
getCorpid
(),
wxEnterpriseDTO
.
getContactSecret
(),
tab
.
getWxUserId
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
wxEnterpriseDTO
.
getWxEnterpriseId
());
return
null
;
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
tab
.
getWxUserId
());
if
(
user
!=
null
)
{
resp
.
setResult
(
user
.
getQr_code
());
return
resp
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/QywxGroupSyncOperation.java
View file @
2f484556
...
...
@@ -12,19 +12,18 @@ import com.gic.haoban.base.api.common.Constant;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.SyncTaskStatusEnum
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncTask
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.PreDealService
;
import
com.gic.haoban.manage.service.service.SyncTaskService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
...
...
@@ -86,6 +85,9 @@ public class QywxGroupSyncOperation implements BaseSyncOperation {
@Autowired
private
QywxClerkSyncOperation
qywxClerkSyncOperation
;
@Autowired
private
SecretSettingService
secretSettingService
;
@Override
public
void
dealSingleByMq
(
DealParamMqDTO
dealParamMqDTO
,
TabHaobanPreDealLog
dataPre
)
{
logger
.
info
(
"处理企业微信部门:{}"
,
JSONObject
.
toJSONString
(
dealParamMqDTO
));
...
...
@@ -187,7 +189,12 @@ public class QywxGroupSyncOperation implements BaseSyncOperation {
public
void
dealSuccess
(
String
taskId
,
String
dataId
,
String
enterpriseId
,
String
wxEnterpriseId
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
List
<
UserDTO
>
list
=
this
.
qywxUserApiService
.
listSelfDepartmentUser
(
wxEnterpriseDTO
.
getCorpid
(),
wxEnterpriseDTO
.
getContactSecret
(),
dataId
,
0
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret:{},{}"
,
taskId
,
wxEnterpriseId
);
return
;
}
List
<
UserDTO
>
list
=
this
.
qywxUserApiService
.
listSelfDepartmentUser
(
wxEnterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
dataId
,
0
);
//预处理门店 写入预处理表
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
2f484556
...
...
@@ -11,10 +11,12 @@ import java.util.stream.Collectors;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.common.utils.GlobalVar
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.ApplicationSettingApiService
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
...
...
@@ -134,7 +136,12 @@ public class ApplicationController extends WebBaseController{
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
){
if
(
StringUtils
.
isNotBlank
(
enterpriseDTO
.
getContactSecret
())
&&
enterpriseDTO
.
getContactFlag
()
!=
null
&&
enterpriseDTO
.
getContactFlag
()
==
0
){
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
(),
null
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
if
(
enterpriseDTO
.
getContactFlag
()
!=
null
&&
enterpriseDTO
.
getContactFlag
()
==
0
){
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"同步企业微信架构"
,
login
.
getStaffDTO
().
getWxUserId
(),
"首次同步企业微信架构"
);
if
(
StringUtils
.
isBlank
(
taskId
)){
log
.
info
(
"【是否绑定】taskId={}"
,
taskId
);
...
...
@@ -165,7 +172,12 @@ public class ApplicationController extends WebBaseController{
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
){
if
(
StringUtils
.
isNotBlank
(
enterpriseDTO
.
getContactSecret
())
&&
enterpriseDTO
.
getContactFlag
()
!=
null
){
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
(),
null
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
log
.
info
(
"没有配置secret"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
if
(
StringUtils
.
isNotBlank
(
secretSetting
.
getSecretVal
())
&&
enterpriseDTO
.
getContactFlag
()
!=
null
){
String
taskId
=
dealSyncOperationApiService
.
createQywxTask
(
wxEnterpriseId
,
"后门同步企业微信架构"
,
login
.
getStaffDTO
().
getWxUserId
(),
"后门同步企业微信架构"
);
if
(
StringUtils
.
isBlank
(
taskId
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
...
...
@@ -203,7 +215,12 @@ public class ApplicationController extends WebBaseController{
applicationDTO
.
setAgentName
(
dto
.
getAgentName
());
applicationDTO
.
setSiteId
(
dto
.
getSuiteId
());
wxApplicationApiService
.
addSuite
(
applicationDTO
);
this
.
departmentApiService
.
initwxDepartment
(
dto
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
enterpriseDTO
.
getWxEnterpriseId
());
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
(),
null
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
return
;
}
this
.
departmentApiService
.
initwxDepartment
(
dto
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
enterpriseDTO
.
getWxEnterpriseId
());
enterpriseDTO
.
setContactFlag
(
1
);
wxEnterpriseApiService
.
update
(
enterpriseDTO
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseController.java
View file @
2f484556
...
...
@@ -31,6 +31,7 @@ import com.gic.wechat.api.dto.qywx.UserDTO;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.gic.wechat.token.api.dto.QywxCorpInfoDTO
;
import
com.gic.wechat.token.api.service.QywxTokenManageService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -40,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@RestController
...
...
@@ -219,10 +221,28 @@ public class WxEnterpriseController extends WebBaseController{
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getLoginUser
();
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
wxEnterprise
!=
null
&&
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
wxEnterprise
.
getContactSecret
(),
wxEnterprise
.
getWxSecretKey
())){
List
<
SecretSettingDTO
>
listSecret
=
wxEnterpriseApiService
.
listSecret
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
listSecret
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
Set
<
Integer
>
secretTypeList
=
listSecret
.
stream
().
filter
(
secretSettingDTO
->
{
return
secretSettingDTO
.
getCheckFlag
()
==
1
;
}).
map
(
secretSettingDTO
->
{
return
secretSettingDTO
.
getSecretType
();
}).
collect
(
Collectors
.
toSet
());
if
(
CollectionUtils
.
isEmpty
(
secretTypeList
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
if
(
secretTypeList
.
contains
(
SecretTypeEnum
.
HAOBAN_HELP
)&&
secretTypeList
.
contains
(
SecretTypeEnum
.
CONTACT_CUSTOMER
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
// if(wxEnterprise != null && org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterprise.getContactSecret(),wxEnterprise.getWxSecretKey())){
// return resultResponse(HaoBanErrCode.ERR_1,false);
// }
// return resultResponse(HaoBanErrCode.ERR_1,true);
}
...
...
@@ -353,6 +373,45 @@ public class WxEnterpriseController extends WebBaseController{
}
//微信企业绑定接口绑定通讯录key
@IgnoreLogin
@RequestMapping
(
"wx-enterprise-haoban-secret-set"
)
public
HaobanResponse
wxEnterpriseHaobanSecretSet
(
String
contactSecret
)
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
contactSecret
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
String
wxEnterpriseId
=
""
;
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getLoginUser
();
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
contactSecret
=
contactSecret
.
trim
();
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
contactSecret
,
login
.
getStaffDTO
().
getWxUserId
());
logger
.
info
(
"【保存联系人key】user={}"
,
JSON
.
toJSONString
(
user
));
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
(),
null
);
if
(
null
==
secretSetting
)
{
secretSetting
=
new
SecretSettingDTO
();
}
secretSetting
.
setSecretType
(
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
secretSetting
.
setSecretName
(
SecretTypeEnum
.
HAOBAN_HELP
.
getName
());
secretSetting
.
setWxEnterpriseId
(
wxEnterpriseId
);
if
(
user
!=
null
){
secretSetting
.
setSecretVal
(
contactSecret
);
secretSetting
.
setCheckFlag
(
1
);
wxEnterpriseApiService
.
saveSecretSetting
(
secretSetting
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
else
{
secretSetting
.
setCheckFlag
(
0
);
wxEnterpriseApiService
.
saveSecretSetting
(
secretSetting
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10013
);
}
}
//微信企业会员小程序
@IgnoreLogin
@RequestMapping
(
"secret-list"
)
...
...
@@ -369,6 +428,8 @@ public class WxEnterpriseController extends WebBaseController{
List
<
SecretSettingDTO
>
listSecret
=
wxEnterpriseApiService
.
listSecret
(
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
listSecret
);
}
//企业信息
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/InfoController.java
View file @
2f484556
...
...
@@ -15,6 +15,7 @@ import com.gic.haoban.base.api.common.ServiceResponse;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
...
...
@@ -154,10 +155,14 @@ public class InfoController extends WebBaseController{
logger
.
info
(
"改企业不存在:{}"
,
qo
.
getGicEnterpriseId
());
return
resultResponse
(
HaoBanErrCode
.
ERR_400002
);
}
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDetailDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
(),
qo
.
getGicEnterpriseId
());
if
(
null
==
secretSetting
||
StringUtils
.
isBlank
(
secretSetting
.
getSecretVal
()))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10019
);
}
MemberLoginQo
user
=
new
MemberLoginQo
();
if
(
StringUtils
.
isBlank
(
qo
.
getUserId
()))
{
String
userDTOJson
=
qywxUserApiService
.
getUserByCode
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getMemberSecret
(),
qo
.
getCode
());
String
userDTOJson
=
qywxUserApiService
.
getUserByCode
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
qo
.
getCode
());
logger
.
info
(
"会员微信登录信息=============>{}"
,
userDTOJson
);
user
=
JSON
.
parseObject
(
userDTOJson
,
MemberLoginQo
.
class
);
if
(
user
==
null
)
{
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
2f484556
...
...
@@ -207,7 +207,7 @@ public enum HaoBanErrCode {
ERR_10018
(
10018
,
"审核记录已存在"
),
ERR_10019
(
10019
,
"没有配置secret"
),
ERR_999
(
999
,
"操作失败"
),
ERR_DEFINE
(-
888
,
"自定义错误"
),
...
...
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