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
7a2e471d
Commit
7a2e471d
authored
Aug 11, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好办安全升级调整
parent
a16078e8
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
713 additions
and
1482 deletions
+713
-1482
WxEnterpriseDTO.java
...n/java/com/gic/haoban/manage/api/dto/WxEnterpriseDTO.java
+27
-10
WxEnterpriseQwDTO.java
...java/com/gic/haoban/manage/api/dto/WxEnterpriseQwDTO.java
+9
-14
SecretTypeEnum.java
.../java/com/gic/haoban/manage/api/enums/SecretTypeEnum.java
+0
-4
DepartmentApiService.java
...m/gic/haoban/manage/api/service/DepartmentApiService.java
+1
-11
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+0
-35
WxEnterpriseApiService.java
...gic/haoban/manage/api/service/WxEnterpriseApiService.java
+2
-0
TestDataImportController.java
.../manage/web/controller/test/TestDataImportController.java
+1
-67
StaffDepartmentRelatedMapper.java
...nage/service/dao/mapper/StaffDepartmentRelatedMapper.java
+0
-2
StaffMapper.java
...com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
+0
-2
TabHaobanWxEnterprise.java
...c/haoban/manage/service/entity/TabHaobanWxEnterprise.java
+19
-10
StaffDepartmentRelatedService.java
...manage/service/service/StaffDepartmentRelatedService.java
+0
-2
WxEnterpriseService.java
...ic/haoban/manage/service/service/WxEnterpriseService.java
+0
-3
HandoverServiceImpl.java
...oban/manage/service/service/impl/HandoverServiceImpl.java
+39
-36
SecretSettingServiceImpl.java
...manage/service/service/impl/SecretSettingServiceImpl.java
+2
-2
StaffClerkRelationServiceImpl.java
...e/service/service/impl/StaffClerkRelationServiceImpl.java
+23
-14
StaffDepartmentRelatedServiceImpl.java
...rvice/service/impl/StaffDepartmentRelatedServiceImpl.java
+0
-6
WxEnterpriseServiceImpl.java
.../manage/service/service/impl/WxEnterpriseServiceImpl.java
+0
-6
NoticeMessageApiServiceImpl.java
...rvice/service/notify/out/NoticeMessageApiServiceImpl.java
+22
-24
DealSyncOperationApiServiceImpl.java
...ice/service/out/impl/DealSyncOperationApiServiceImpl.java
+3
-3
DepartmentApiServiceImpl.java
...ge/service/service/out/impl/DepartmentApiServiceImpl.java
+0
-83
ExternalClerkRelatedApiServiceImpl.java
.../service/out/impl/ExternalClerkRelatedApiServiceImpl.java
+43
-23
HandoverOperationApiServiceImpl.java
...ice/service/out/impl/HandoverOperationApiServiceImpl.java
+9
-9
MaterialApiServiceImpl.java
...nage/service/service/out/impl/MaterialApiServiceImpl.java
+37
-26
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+61
-68
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+15
-16
MiniprogramSettingServiceImpl.java
...rvice/service/out/impl/MiniprogramSettingServiceImpl.java
+14
-12
QywxTagApiServiceImpl.java
...anage/service/service/out/impl/QywxTagApiServiceImpl.java
+28
-25
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+59
-516
StaffClerkRelationApiServiceImpl.java
...ce/service/out/impl/StaffClerkRelationApiServiceImpl.java
+3
-3
StaffDepartmentRelatedApiServiceImpl.java
...ervice/out/impl/StaffDepartmentRelatedApiServiceImpl.java
+34
-31
WxEnterpriseApiServiceImpl.java
.../service/service/out/impl/WxEnterpriseApiServiceImpl.java
+70
-22
HmLinkApiServiceImpl.java
...age/service/service/out/impl/hm/HmLinkApiServiceImpl.java
+3
-1
HmQrcodeApiServiceImpl.java
...e/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
+13
-12
QywxDeptSyncOperation.java
...gic/haoban/manage/service/task/QywxDeptSyncOperation.java
+3
-5
QywxStaffSyncOperation.java
...ic/haoban/manage/service/task/QywxStaffSyncOperation.java
+15
-14
StaffDepartmentRelatedMapper.xml
...rc/main/resources/mapper/StaffDepartmentRelatedMapper.xml
+0
-7
StaffMapper.xml
...manage3-service/src/main/resources/mapper/StaffMapper.xml
+0
-9
WxEnterpriseMapper.xml
...-service/src/main/resources/mapper/WxEnterpriseMapper.xml
+24
-20
HmLinkTest.java
haoban-manage3-service/src/test/java/HmLinkTest.java
+52
-4
AdminController.java
...com/gic/haoban/manage/web/controller/AdminController.java
+16
-17
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+3
-3
DepartmentContoller.java
...gic/haoban/manage/web/controller/DepartmentContoller.java
+0
-110
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+44
-83
WxEnterpriseController.java
.../haoban/manage/web/controller/WxEnterpriseController.java
+8
-94
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+3
-7
WxEnterpriseInfoController.java
...ban/manage/web/controller/WxEnterpriseInfoController.java
+8
-11
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/WxEnterpriseDTO.java
View file @
7a2e471d
...
@@ -11,8 +11,6 @@ public class WxEnterpriseDTO implements Serializable {
...
@@ -11,8 +11,6 @@ public class WxEnterpriseDTO implements Serializable {
private
String
wxEnterpriseId
;
private
String
wxEnterpriseId
;
private
String
corpid
;
private
String
permanentCode
;
private
String
permanentCode
;
private
String
corpName
;
private
String
corpName
;
...
@@ -106,6 +104,33 @@ public class WxEnterpriseDTO implements Serializable {
...
@@ -106,6 +104,33 @@ public class WxEnterpriseDTO implements Serializable {
private
Integer
useridFlag
;
private
Integer
useridFlag
;
private
String
enterpriseId
;
private
String
enterpriseId
;
private
Integer
wxSecurityType
;
private
String
wxCorpid
;
private
String
openCorpid
;
public
Integer
getWxSecurityType
()
{
return
wxSecurityType
;
}
public
void
setWxSecurityType
(
Integer
wxSecurityType
)
{
this
.
wxSecurityType
=
wxSecurityType
;
}
public
String
getWxCorpid
()
{
return
wxCorpid
;
}
public
String
getOpenCorpid
()
{
return
openCorpid
;
}
public
void
setWxCorpid
(
String
wxCorpid
)
{
this
.
wxCorpid
=
wxCorpid
;
}
public
void
setOpenCorpid
(
String
openCorpid
)
{
this
.
openCorpid
=
openCorpid
;
}
public
String
getMemberSecret
()
{
public
String
getMemberSecret
()
{
return
memberSecret
;
return
memberSecret
;
...
@@ -131,14 +156,6 @@ public class WxEnterpriseDTO implements Serializable {
...
@@ -131,14 +156,6 @@ public class WxEnterpriseDTO implements Serializable {
this
.
wxEnterpriseId
=
wxEnterpriseId
==
null
?
null
:
wxEnterpriseId
.
trim
();
this
.
wxEnterpriseId
=
wxEnterpriseId
==
null
?
null
:
wxEnterpriseId
.
trim
();
}
}
public
String
getCorpid
()
{
return
corpid
;
}
public
void
setCorpid
(
String
corpid
)
{
this
.
corpid
=
corpid
==
null
?
null
:
corpid
.
trim
();
}
public
String
getPermanentCode
()
{
public
String
getPermanentCode
()
{
return
permanentCode
;
return
permanentCode
;
}
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/WxEnterpriseQwDTO.java
View file @
7a2e471d
...
@@ -5,20 +5,23 @@ import java.io.Serializable;
...
@@ -5,20 +5,23 @@ import java.io.Serializable;
public
class
WxEnterpriseQwDTO
implements
Serializable
{
public
class
WxEnterpriseQwDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
int
wxSecurityType
;
private
int
wxSecurityType
;
private
String
wxEnterpriseId
;
private
String
wxEnterpriseId
;
// 企业表中的id(正常同第三方)
private
String
corpid
;
// 好办 助手
// 好办 助手
private
String
dkCorpid
;
private
String
dkCorpid
;
private
String
dkSuiteId
;
private
String
dkSuiteId
;
// 会员小程序dk
// 会员小程序dk
private
String
memberCorpid
;
private
String
memberCorpid
;
private
String
memberSuiteId
;
private
String
memberSuiteId
;
// 第三方
// 第三方
private
String
thirdCorpid
;
private
String
thirdCorpid
;
// 第三方使用的加密的userid
public
boolean
needOpenUserId3th
()
{
return
this
.
wxSecurityType
==
2
||
this
.
wxSecurityType
==
3
;
}
public
String
getDkSuiteId
()
{
public
String
getDkSuiteId
()
{
return
dkSuiteId
;
return
dkSuiteId
;
}
}
...
@@ -47,10 +50,6 @@ public class WxEnterpriseQwDTO implements Serializable {
...
@@ -47,10 +50,6 @@ public class WxEnterpriseQwDTO implements Serializable {
return
wxEnterpriseId
;
return
wxEnterpriseId
;
}
}
public
String
getCorpid
()
{
return
corpid
;
}
public
String
getDkCorpid
()
{
public
String
getDkCorpid
()
{
return
dkCorpid
;
return
dkCorpid
;
}
}
...
@@ -67,10 +66,6 @@ public class WxEnterpriseQwDTO implements Serializable {
...
@@ -67,10 +66,6 @@ public class WxEnterpriseQwDTO implements Serializable {
this
.
wxEnterpriseId
=
wxEnterpriseId
;
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
}
public
void
setCorpid
(
String
corpid
)
{
this
.
corpid
=
corpid
;
}
public
void
setDkCorpid
(
String
dkCorpid
)
{
public
void
setDkCorpid
(
String
dkCorpid
)
{
this
.
dkCorpid
=
dkCorpid
;
this
.
dkCorpid
=
dkCorpid
;
}
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/SecretTypeEnum.java
View file @
7a2e471d
...
@@ -5,10 +5,6 @@ package com.gic.haoban.manage.api.enums;
...
@@ -5,10 +5,6 @@ package com.gic.haoban.manage.api.enums;
*/
*/
public
enum
SecretTypeEnum
{
public
enum
SecretTypeEnum
{
CONTACT_CUSTOMER
(
1
,
"顾客联系"
),
CONTACT_CUSTOMER
(
1
,
"顾客联系"
),
// 2和3废弃
CONTACT_SECRET
(
2
,
"通讯录"
),
// 3和5公用
HAOBAN_HELP
(
3
,
"好办助手"
),
MEMBER_WAPP
(
4
,
"会员小程序"
),
MEMBER_WAPP
(
4
,
"会员小程序"
),
CUSTOMIZED_APP
(
5
,
"自建代开发"
),
CUSTOMIZED_APP
(
5
,
"自建代开发"
),
WEWORK_PAY
(
6
,
"企业支付"
),
WEWORK_PAY
(
6
,
"企业支付"
),
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DepartmentApiService.java
View file @
7a2e471d
...
@@ -54,12 +54,6 @@ public interface DepartmentApiService {
...
@@ -54,12 +54,6 @@ public interface DepartmentApiService {
* @return
* @return
*/
*/
DepartmentDTO
selectByRelatedId
(
String
departId
);
DepartmentDTO
selectByRelatedId
(
String
departId
);
/**
* 放入回收站
* @param departmentId
* @return
*/
ServiceResponse
recycle
(
String
departmentId
);
/**
/**
* 根据参数查询
* 根据参数查询
...
@@ -72,11 +66,7 @@ public interface DepartmentApiService {
...
@@ -72,11 +66,7 @@ public interface DepartmentApiService {
*/
*/
Page
<
DepartmentDTO
>
pageDepartmentByParams
(
BasePageInfo
pageInfo
,
String
wxEnterpriseId
,
String
keyword
,
Page
<
DepartmentDTO
>
pageDepartmentByParams
(
BasePageInfo
pageInfo
,
String
wxEnterpriseId
,
String
keyword
,
Integer
storeFlag
,
Integer
recycleFlag
);
Integer
storeFlag
,
Integer
recycleFlag
);
/**
* 回收站恢复
* @param departmentId
*/
ServiceResponse
repairRecycle
(
String
departmentId
,
String
parentId
);
/**
/**
* 获取根节点
* 获取根节点
* @param wxEnterpriseId
* @param wxEnterpriseId
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
7a2e471d
...
@@ -11,24 +11,17 @@ public interface StaffApiService {
...
@@ -11,24 +11,17 @@ public interface StaffApiService {
StaffDTO
selectById
(
String
staffId
);
StaffDTO
selectById
(
String
staffId
);
StaffDTO
selectSuperByWxEnterpriseId
(
String
wxEnterpriseId
);
List
<
StaffDTO
>
listByIds
(
List
<
String
>
staffIds
);
List
<
StaffDTO
>
listByIds
(
List
<
String
>
staffIds
);
List
<
StaffDTO
>
listByWxUserId
(
String
wxUserId
,
String
wxEnterpriseId
);
List
<
StaffDTO
>
listByWxUserId
(
String
wxUserId
,
String
wxEnterpriseId
);
StaffDTO
selectByNationcodeAndPhoneNumber
(
String
wxEnterpriseId
,
String
nationcode
,
String
phoneNumber
);
StaffDTO
selectByNationcodeAndPhoneNumber
(
String
wxEnterpriseId
,
String
nationcode
,
String
phoneNumber
);
ServiceResponse
add
(
StaffDTO
staff
,
String
departmentIds
);
List
<
StaffDepartmentRelatedDTO
>
listStaffDepartmentByStaffId
(
String
staffId
);
List
<
StaffDepartmentRelatedDTO
>
listStaffDepartmentByStaffId
(
String
staffId
);
Page
<
StaffDTO
>
pageStaff
(
List
<
String
>
departmentId
,
Integer
activeFlag
,
Page
<
StaffDTO
>
pageStaff
(
List
<
String
>
departmentId
,
Integer
activeFlag
,
String
keyword
,
BasePageInfo
pageInfo
,
Integer
relationFlag
,
String
wxEnterpriseId
);
String
keyword
,
BasePageInfo
pageInfo
,
Integer
relationFlag
,
String
wxEnterpriseId
);
@Deprecated
void
del
(
String
staffDepartmentStaffRelatedId
);
/**
/**
* 保存微信成员
* 保存微信成员
*
*
...
@@ -76,23 +69,12 @@ public interface StaffApiService {
...
@@ -76,23 +69,12 @@ public interface StaffApiService {
StaffDepartmentRelatedDTO
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
);
StaffDepartmentRelatedDTO
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
);
int
countByDepartmentId
(
String
departmentId
);
@Deprecated
void
syncGicClerk
(
String
fieldListString
);
@Deprecated
void
addGicClerk
(
GicClerkDTO
clerkDTO
);
StaffDepartmentRelatedDTO
getDepartmentIdAndCode
(
String
departmentId
,
String
code
);
StaffDepartmentRelatedDTO
getDepartmentIdAndCode
(
String
departmentId
,
String
code
);
void
initWxUser
(
String
corpid
,
String
contactSecret
,
String
wxEnterpriseId
,
Integer
wxDepartmentId
,
String
taskId
);
void
initWxUser
(
String
corpid
,
String
contactSecret
,
String
wxEnterpriseId
,
Integer
wxDepartmentId
,
String
taskId
);
List
<
String
>
listUnBindClerk
(
String
storeId
);
List
<
String
>
listUnBindClerk
(
String
storeId
);
@Deprecated
void
cleanGicClerk
(
String
clerkCode
,
String
departmentId
);
String
insertUserLoginLog
(
UserLoginLogDTO
userLoginLogDTO
);
String
insertUserLoginLog
(
UserLoginLogDTO
userLoginLogDTO
);
int
countByDepartmentIds
(
List
<
String
>
departmentIds
);
int
countByDepartmentIds
(
List
<
String
>
departmentIds
);
...
@@ -102,14 +84,6 @@ public interface StaffApiService {
...
@@ -102,14 +84,6 @@ public interface StaffApiService {
List
<
StaffDTO
>
listByUserIdsAndWxEnterpriseId
(
List
<
String
>
userIds
,
String
wxEnterpriseId
);
List
<
StaffDTO
>
listByUserIdsAndWxEnterpriseId
(
List
<
String
>
userIds
,
String
wxEnterpriseId
);
/**
/**
* 保存gic成员
*
* @param clerkDTO
* @return
*/
ServiceResponse
saveSyncStaffByGic
(
GicClerkDTO
clerkDTO
);
/**
* 获取成员头像
* 获取成员头像
*
*
* @param clerkCode
* @param clerkCode
...
@@ -141,15 +115,6 @@ public interface StaffApiService {
...
@@ -141,15 +115,6 @@ public interface StaffApiService {
StaffDTO
getWxStaffOne
(
String
wxEnterpriseId
);
StaffDTO
getWxStaffOne
(
String
wxEnterpriseId
);
/**
/**
* 获取超管
*
* @param wxEnterpriseId
* @return
*/
StaffDTO
getAndAddSupperAdmin
(
String
wxEnterpriseId
);
/**
* 是否隐私
* 是否隐私
*
*
* @param staffId 员工id
* @param staffId 员工id
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/WxEnterpriseApiService.java
View file @
7a2e471d
...
@@ -45,6 +45,8 @@ public interface WxEnterpriseApiService {
...
@@ -45,6 +45,8 @@ public interface WxEnterpriseApiService {
* @return
* @return
*/
*/
WxEnterpriseDTO
getOne
(
String
wxEnterpriseId
);
WxEnterpriseDTO
getOne
(
String
wxEnterpriseId
);
WxEnterpriseQwDTO
getQwInfo
(
String
wxEnterpriseId
);
/**
/**
* 根据corpId查询一条数据
* 根据corpId查询一条数据
...
...
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/controller/test/TestDataImportController.java
View file @
7a2e471d
...
@@ -41,77 +41,11 @@ public class TestDataImportController extends WebBaseController {
...
@@ -41,77 +41,11 @@ public class TestDataImportController extends WebBaseController {
private
static
final
Logger
logger
=
getLogger
(
TestDataImportController
.
class
);
private
static
final
Logger
logger
=
getLogger
(
TestDataImportController
.
class
);
@Autowired
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
@Autowired
private
MemberUnionidRelatedApiService
memberUnionidRelatedApiService
;
@Autowired
private
IMarketClueTaskApiService
iMarketClueTaskApiService
;
private
IMarketClueTaskApiService
iMarketClueTaskApiService
;
@Autowired
@Autowired
private
IMarketTaskMemberApiService
iMarketTaskMemberApiService
;
private
IMarketTaskMemberApiService
iMarketTaskMemberApiService
;
/**
* 导入会员好友
*
* @param qo
* @return
*/
@RequestMapping
(
"/friend-import"
)
public
HaobanResponse
importFriend
(
ImportMemberQo
qo
)
{
if
(
StringUtils
.
isAnyBlank
(
qo
.
getClerkCode
(),
qo
.
getClerkId
(),
qo
.
getDepartmentId
(),
qo
.
getEnterpriseId
(),
qo
.
getMemberId
()
,
qo
.
getPhoneNumber
(),
qo
.
getStoreId
(),
qo
.
getUnionid
(),
qo
.
getWxEnterpriseId
()))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
StaffDTO
staffDTO
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
qo
.
getWxUserId
(),
qo
.
getWxEnterpriseId
());
if
(
null
==
staffDTO
)
{
StaffDTO
staff
=
new
StaffDTO
();
staff
.
setPhoneNumber
(
qo
.
getPhoneNumber
());
staff
.
setWxUserId
(
qo
.
getWxUserId
());
staff
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
staff
.
setStaffName
(
qo
.
getClerkCode
());
staff
.
setSex
(
1
);
staff
.
setNationCode
(
"86"
);
staff
.
setActiveFlag
(
1
);
ServiceResponse
add
=
staffApiService
.
add
(
staff
,
qo
.
getDepartmentId
());
if
(
add
.
getCode
()
==
1
)
{
staffDTO
=
staffApiService
.
selectById
(
add
.
getResult
().
toString
());
}
}
StaffClerkRelationDTO
clerkRelationDTO
=
staffClerkRelationApiService
.
getOneByStoreIdAndStaffId
(
qo
.
getStoreId
(),
staffDTO
.
getStaffId
());
if
(
clerkRelationDTO
==
null
)
{
StaffClerkRelationDTO
staffClerkRelationDTO
=
new
StaffClerkRelationDTO
();
staffClerkRelationDTO
.
setStoreId
(
qo
.
getStoreId
());
staffClerkRelationDTO
.
setClerkId
(
qo
.
getClerkId
());
staffClerkRelationDTO
.
setClerkCode
(
qo
.
getClerkCode
());
staffClerkRelationDTO
.
setWxUserId
(
staffDTO
.
getWxUserId
());
staffClerkRelationDTO
.
setStaffId
(
staffDTO
.
getStaffId
());
staffClerkRelationDTO
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
staffClerkRelationDTO
.
setEnterpriseId
(
qo
.
getEnterpriseId
());
ServiceResponse
response
=
staffClerkRelationApiService
.
bindStaffClerk
(
staffClerkRelationDTO
,
"-1"
,
ChannelCodeEnum
.
ADMIN_BIND
.
getCode
());
}
//新增好友
ExternalUserDTO
dto
=
new
ExternalUserDTO
();
dto
.
setUnionId
(
qo
.
getUnionid
());
dto
.
setWxUserId
(
qo
.
getWxUserId
());
dto
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
dto
.
setMemberId
(
qo
.
getMemberId
());
dto
.
setExternalUserId
(
qo
.
getMemberId
());
dto
.
setClerkId
(
qo
.
getClerkId
());
dto
.
setStoreId
(
qo
.
getStoreId
());
dto
.
setEnterpriseId
(
qo
.
getEnterpriseId
());
dto
.
setName
(
"测试会员"
+
RandomUtil
.
getRandomString
(
5
));
dto
.
setStaffId
(
staffDTO
.
getStaffId
());
dto
.
setAddCreateTime
(
Long
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
).
toString
());
memberUnionidRelatedApiService
.
addExternal
(
dto
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
/**
* 处理任务
* 处理任务
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffDepartmentRelatedMapper.java
View file @
7a2e471d
...
@@ -32,8 +32,6 @@ public interface StaffDepartmentRelatedMapper {
...
@@ -32,8 +32,6 @@ public interface StaffDepartmentRelatedMapper {
TabHaobanStaffDepartmentRelated
getDepartmentIdAndStaffId
(
@Param
(
"departmentId"
)
String
departmentId
,
@Param
(
"staffId"
)
String
staffId
);
TabHaobanStaffDepartmentRelated
getDepartmentIdAndStaffId
(
@Param
(
"departmentId"
)
String
departmentId
,
@Param
(
"staffId"
)
String
staffId
);
int
countByDepartmentId
(
@Param
(
"departmentId"
)
String
departmentId
);
TabHaobanStaffDepartmentRelated
getDepartmentIdAndCode
(
@Param
(
"departmentId"
)
String
departmentId
,
@Param
(
"clerkCode"
)
String
code
);
TabHaobanStaffDepartmentRelated
getDepartmentIdAndCode
(
@Param
(
"departmentId"
)
String
departmentId
,
@Param
(
"clerkCode"
)
String
code
);
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentIdByKeyword
(
@Param
(
"departmentIds"
)
List
<
String
>
departmentIds
,
@Param
(
"keyword"
)
String
keyword
);
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentIdByKeyword
(
@Param
(
"departmentIds"
)
List
<
String
>
departmentIds
,
@Param
(
"keyword"
)
String
keyword
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
View file @
7a2e471d
...
@@ -42,8 +42,6 @@ public interface StaffMapper {
...
@@ -42,8 +42,6 @@ public interface StaffMapper {
TabHaobanStaff
selectByUserIdAndEnterpriseId
(
@Param
(
"userId"
)
String
userId
,
TabHaobanStaff
selectByUserIdAndEnterpriseId
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
TabHaobanStaff
selectSuperByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaff
>
listByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
TabHaobanStaff
>
listByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
TabHaobanStaff
>
listByUserIdsAndWxEnterpriseId
(
@Param
(
"userIds"
)
List
<
String
>
userIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaff
>
listByUserIdsAndWxEnterpriseId
(
@Param
(
"userIds"
)
List
<
String
>
userIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabHaobanWxEnterprise.java
View file @
7a2e471d
...
@@ -9,8 +9,6 @@ public class TabHaobanWxEnterprise implements Serializable {
...
@@ -9,8 +9,6 @@ public class TabHaobanWxEnterprise implements Serializable {
private
String
wxEnterpriseId
;
private
String
wxEnterpriseId
;
private
String
corpid
;
private
String
permanentCode
;
private
String
permanentCode
;
private
String
corpName
;
private
String
corpName
;
...
@@ -88,6 +86,25 @@ public class TabHaobanWxEnterprise implements Serializable {
...
@@ -88,6 +86,25 @@ public class TabHaobanWxEnterprise implements Serializable {
private
Integer
externalFlag
;
private
Integer
externalFlag
;
private
Integer
useridFlag
;
private
Integer
useridFlag
;
private
Integer
wxSecurityType
;
private
Integer
wxSecurityType
;
private
String
wxCorpid
;
private
String
openCorpid
;
public
String
getWxCorpid
()
{
return
wxCorpid
;
}
public
String
getOpenCorpid
()
{
return
openCorpid
;
}
public
void
setWxCorpid
(
String
wxCorpid
)
{
this
.
wxCorpid
=
wxCorpid
;
}
public
void
setOpenCorpid
(
String
openCorpid
)
{
this
.
openCorpid
=
openCorpid
;
}
public
Integer
getWxSecurityType
()
{
public
Integer
getWxSecurityType
()
{
return
wxSecurityType
;
return
wxSecurityType
;
...
@@ -113,14 +130,6 @@ public class TabHaobanWxEnterprise implements Serializable {
...
@@ -113,14 +130,6 @@ public class TabHaobanWxEnterprise implements Serializable {
this
.
wxEnterpriseId
=
wxEnterpriseId
==
null
?
null
:
wxEnterpriseId
.
trim
();
this
.
wxEnterpriseId
=
wxEnterpriseId
==
null
?
null
:
wxEnterpriseId
.
trim
();
}
}
public
String
getCorpid
()
{
return
corpid
;
}
public
void
setCorpid
(
String
corpid
)
{
this
.
corpid
=
corpid
==
null
?
null
:
corpid
.
trim
();
}
public
String
getPermanentCode
()
{
public
String
getPermanentCode
()
{
return
permanentCode
;
return
permanentCode
;
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffDepartmentRelatedService.java
View file @
7a2e471d
...
@@ -21,8 +21,6 @@ public interface StaffDepartmentRelatedService {
...
@@ -21,8 +21,6 @@ public interface StaffDepartmentRelatedService {
TabHaobanStaffDepartmentRelated
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
);
TabHaobanStaffDepartmentRelated
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
);
int
countByDepartmentId
(
String
departmentId
);
/**
/**
* 效率很低
* 效率很低
* @param departmentId
* @param departmentId
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseService.java
View file @
7a2e471d
...
@@ -37,9 +37,6 @@ public interface WxEnterpriseService {
...
@@ -37,9 +37,6 @@ public interface WxEnterpriseService {
int
unbind
(
String
wxEnterpriseId
);
int
unbind
(
String
wxEnterpriseId
);
TabHaobanWxEnterprise
getEnterpriseBycorpIdNoStatus
(
String
corpid
);
/**
/**
* 得到企业bycorp名称
* 得到企业bycorp名称
*
*
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/HandoverServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.commons.util.ToolUtil
;
...
@@ -8,13 +22,24 @@ import com.gic.haoban.common.utils.PageUtil;
...
@@ -8,13 +22,24 @@ import com.gic.haoban.common.utils.PageUtil;
import
com.gic.haoban.manage.api.dto.HandoverExternalDTO
;
import
com.gic.haoban.manage.api.dto.HandoverExternalDTO
;
import
com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO
;
import
com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.HandoverExternalMapper
;
import
com.gic.haoban.manage.service.dao.mapper.*
;
import
com.gic.haoban.manage.service.dao.mapper.HandoverStaffMapper
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.dao.mapper.HandoverTransferMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper
;
import
com.gic.haoban.manage.service.entity.TabHandoverExternal
;
import
com.gic.haoban.manage.service.entity.TabHandoverStaff
;
import
com.gic.haoban.manage.service.entity.TabHandoverTransfer
;
import
com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.service.HandoverService
;
import
com.gic.haoban.manage.service.service.HandoverService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.wechat.api.dto.qywx.QywxTransferCustomerInfoDTO
;
import
com.gic.wechat.api.dto.qywx.QywxTransferCustomerInfoDTO
;
import
com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO
;
import
com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
...
@@ -22,15 +47,6 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
...
@@ -22,15 +47,6 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
/**
* Created 2021/6/15.
* Created 2021/6/15.
...
@@ -44,56 +60,43 @@ public class HandoverServiceImpl implements HandoverService {
...
@@ -44,56 +60,43 @@ public class HandoverServiceImpl implements HandoverService {
@Autowired
@Autowired
private
HandoverStaffMapper
handoverStaffMapper
;
private
HandoverStaffMapper
handoverStaffMapper
;
@Autowired
@Autowired
private
HandoverExternalMapper
handoverExternalMapper
;
private
HandoverExternalMapper
handoverExternalMapper
;
@Autowired
@Autowired
private
HandoverTransferMapper
handoverTransferMapper
;
private
HandoverTransferMapper
handoverTransferMapper
;
@Autowired
@Autowired
private
StaffMapper
staffMapper
;
private
StaffMapper
staffMapper
;
@Autowired
@Autowired
private
TabHaobanExternalClerkRelatedMapper
externalClerkRelatedMapper
;
private
TabHaobanExternalClerkRelatedMapper
externalClerkRelatedMapper
;
@Autowired
@Autowired
private
QywxUserApiService
qywxUserApiService
;
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
Config
config
;
@Autowired
private
WxEnterpriseMapper
wxEnterpriseMapper
;
@Autowired
@Autowired
private
SecretSettingService
secretSettingService
;
private
SecretSettingService
secretSettingService
;
@Autowired
@Autowired
private
TabHaobanClerkMainStoreRelatedMapper
clerkMainStoreRelatedMapper
;
private
TabHaobanClerkMainStoreRelatedMapper
clerkMainStoreRelatedMapper
;
@Autowired
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
private
StaffClerkRelationService
staffClerkRelationService
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Override
@Override
public
boolean
saveHandover
(
String
wxEnterpriseId
,
List
<
QywxUnassignedInfoDTO
>
infoList
)
{
public
boolean
saveHandover
(
String
wxEnterpriseId
,
List
<
QywxUnassignedInfoDTO
>
infoList
)
{
logger
.
info
(
"saveHandover-保存离职基础数据:{}"
,
wxEnterpriseId
);
logger
.
info
(
"saveHandover-保存离职基础数据:{}"
,
wxEnterpriseId
);
TabHaobanWxEnterprise
wxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
infoList
))
{
if
(
CollectionUtils
.
isEmpty
(
infoList
))
{
logger
.
info
(
"没有要保存的数据,删除所有需要删除逇"
);
logger
.
info
(
"没有要保存的数据,删除所有需要删除逇"
);
delHandoverStaff
(
wxEnterpriseId
,
null
);
delHandoverStaff
(
wxEnterpriseId
,
null
);
return
false
;
return
false
;
}
}
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterprise
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
qwDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
wxEnterprise
));
logger
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
qwDTO
));
return
false
;
return
false
;
}
}
Map
<
String
,
List
<
QywxUnassignedInfoDTO
>>
handoverUserMap
=
infoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getHandoverUserid
()));
Map
<
String
,
List
<
QywxUnassignedInfoDTO
>>
handoverUserMap
=
infoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getHandoverUserid
()));
handoverUserMap
.
forEach
((
userId
,
list
)
->
{
handoverUserMap
.
forEach
((
userId
,
list
)
->
{
boolean
checkFlag
=
checkStaffOver
(
secretSetting
,
userId
,
wxEnterprise
.
get
Corpid
());
boolean
checkFlag
=
checkStaffOver
(
secretSetting
,
userId
,
qwDTO
.
getThird
Corpid
());
if
(
checkFlag
)
{
if
(
checkFlag
)
{
logger
.
info
(
"该用户存在,不需要离职基础:{},{}"
,
userId
,
wxEnterpriseId
);
logger
.
info
(
"该用户存在,不需要离职基础:{},{}"
,
userId
,
wxEnterpriseId
);
return
;
return
;
...
@@ -103,7 +106,7 @@ public class HandoverServiceImpl implements HandoverService {
...
@@ -103,7 +106,7 @@ public class HandoverServiceImpl implements HandoverService {
return
;
return
;
}
}
List
<
TabHandoverExternal
>
externalList
=
list
.
stream
().
map
(
dto
->
{
List
<
TabHandoverExternal
>
externalList
=
list
.
stream
().
map
(
dto
->
{
TabHandoverExternal
mid
=
getHandExternal
(
dto
,
wxEnterprise
,
handoverStaff
);
TabHandoverExternal
mid
=
getHandExternal
(
dto
,
qwDTO
.
getWxEnterpriseId
()
,
handoverStaff
);
mid
.
setStaffId
(
handoverStaff
.
getStaffId
());
mid
.
setStaffId
(
handoverStaff
.
getStaffId
());
handoverStaff
.
setDimissionTime
(
dto
.
getDimissionTimeDate
());
handoverStaff
.
setDimissionTime
(
dto
.
getDimissionTimeDate
());
mid
.
setStatusFlag
(
mid
.
getStatusFlag
()
!=
null
?
mid
.
getStatusFlag
()
:
1
);
mid
.
setStatusFlag
(
mid
.
getStatusFlag
()
!=
null
?
mid
.
getStatusFlag
()
:
1
);
...
@@ -212,16 +215,16 @@ public class HandoverServiceImpl implements HandoverService {
...
@@ -212,16 +215,16 @@ public class HandoverServiceImpl implements HandoverService {
* @param infoDTO
* @param infoDTO
* @return
* @return
*/
*/
private
TabHandoverExternal
getHandExternal
(
QywxUnassignedInfoDTO
infoDTO
,
TabHaobanWxEnterprise
wxEnterprise
,
TabHandoverStaff
handoverStaff
)
{
private
TabHandoverExternal
getHandExternal
(
QywxUnassignedInfoDTO
infoDTO
,
String
wxEnterpriseId
,
TabHandoverStaff
handoverStaff
)
{
TabHandoverExternal
handoverExternal
=
handoverExternalMapper
.
getByExternalUserIdAndStaffId
(
wxEnterprise
.
getWxEnterpriseId
()
,
handoverStaff
.
getStaffId
(),
infoDTO
.
getExternalUserid
());
TabHandoverExternal
handoverExternal
=
handoverExternalMapper
.
getByExternalUserIdAndStaffId
(
wxEnterprise
Id
,
handoverStaff
.
getStaffId
(),
infoDTO
.
getExternalUserid
());
if
(
null
!=
handoverExternal
)
{
if
(
null
!=
handoverExternal
)
{
return
handoverExternal
;
return
handoverExternal
;
}
}
TabHandoverExternal
mid
=
new
TabHandoverExternal
();
TabHandoverExternal
mid
=
new
TabHandoverExternal
();
mid
.
setExternalUserId
(
infoDTO
.
getExternalUserid
());
mid
.
setExternalUserId
(
infoDTO
.
getExternalUserid
());
mid
.
setWxEnterpriseId
(
wxEnterprise
.
getWxEnterpriseId
()
);
mid
.
setWxEnterpriseId
(
wxEnterprise
Id
);
mid
.
setHaobanFriendFlag
(
0
);
mid
.
setHaobanFriendFlag
(
0
);
TabHaobanExternalClerkRelated
externalClerkRelated
=
externalClerkRelatedMapper
.
getLastByExTernalUseridAndWxUserIdNoStatus
(
wxEnterprise
.
getWxEnterpriseId
()
,
infoDTO
.
getExternalUserid
(),
infoDTO
.
getHandoverUserid
());
TabHaobanExternalClerkRelated
externalClerkRelated
=
externalClerkRelatedMapper
.
getLastByExTernalUseridAndWxUserIdNoStatus
(
wxEnterprise
Id
,
infoDTO
.
getExternalUserid
(),
infoDTO
.
getHandoverUserid
());
if
(
null
==
externalClerkRelated
)
{
if
(
null
==
externalClerkRelated
)
{
mid
.
setExternalUserName
(
"企业微信客户"
);
mid
.
setExternalUserName
(
"企业微信客户"
);
mid
.
setRelationId
(
"-1"
);
mid
.
setRelationId
(
"-1"
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/SecretSettingServiceImpl.java
View file @
7a2e471d
...
@@ -69,14 +69,14 @@ public class SecretSettingServiceImpl implements SecretSettingService {
...
@@ -69,14 +69,14 @@ public class SecretSettingServiceImpl implements SecretSettingService {
}
}
//兼容好办助手和代开发
//兼容好办助手和代开发
TabSecretSetting
secretSetting
=
null
;
TabSecretSetting
secretSetting
=
null
;
if
(
secretType
==
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
())
{
if
(
secretType
==
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
())
{
secretSetting
=
secretSettingMapper
.
getSecretSetting
(
wxEnterpriseId
,
secretType
,
null
);
secretSetting
=
secretSettingMapper
.
getSecretSetting
(
wxEnterpriseId
,
secretType
,
null
);
if
(
secretSetting
==
null
)
{
if
(
secretSetting
==
null
)
{
secretSetting
=
secretSettingMapper
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
(),
null
);
secretSetting
=
secretSettingMapper
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
(),
null
);
}
}
}
else
{
}
else
{
secretSetting
=
secretSettingMapper
.
getSecretSetting
(
wxEnterpriseId
,
secretType
,
null
);
}
}
secretSetting
=
secretSettingMapper
.
getSecretSetting
(
wxEnterpriseId
,
secretType
,
null
);
return
EntityUtil
.
changeEntityByJSON
(
SecretSettingDTO
.
class
,
secretSetting
);
return
EntityUtil
.
changeEntityByJSON
(
SecretSettingDTO
.
class
,
secretSetting
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffClerkRelationServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.EntityUtil
;
...
@@ -8,7 +22,7 @@ import com.gic.haoban.base.api.common.BasePageInfo;
...
@@ -8,7 +22,7 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterprise
Qw
DTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO
;
import
com.gic.haoban.manage.api.enums.BindTypeEnum
;
import
com.gic.haoban.manage.api.enums.BindTypeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
...
@@ -19,18 +33,14 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMappe
...
@@ -19,18 +33,14 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMappe
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.StaffClerkBindLogService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
StaffClerkRelationServiceImpl
implements
StaffClerkRelationService
{
public
class
StaffClerkRelationServiceImpl
implements
StaffClerkRelationService
{
...
@@ -325,9 +335,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
...
@@ -325,9 +335,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
if
(
CollectionUtils
.
isEmpty
(
clerkList
))
{
if
(
CollectionUtils
.
isEmpty
(
clerkList
))
{
return
null
;
return
null
;
}
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
String
corpid
=
wxEnterpriseDTO
.
getCorpid
();
if
(
qwDTO
.
needOpenUserId3th
())
{
if
(
corpid
.
length
()
>
20
)
{
return
mapper
.
listWxOpenUserIdByClerkIds
(
clerkList
,
wxEnterpriseId
);
return
mapper
.
listWxOpenUserIdByClerkIds
(
clerkList
,
wxEnterpriseId
);
}
}
return
mapper
.
listWxUserIdByClerkIds
(
clerkList
,
wxEnterpriseId
);
return
mapper
.
listWxUserIdByClerkIds
(
clerkList
,
wxEnterpriseId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffDepartmentRelatedServiceImpl.java
View file @
7a2e471d
...
@@ -72,12 +72,6 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
...
@@ -72,12 +72,6 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
}
}
@Override
@Override
public
int
countByDepartmentId
(
String
departmentId
)
{
return
mapper
.
countByDepartmentId
(
departmentId
);
}
@Override
public
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentIdByKeyword
(
List
<
String
>
departmentIds
,
String
keyword
)
{
public
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentIdByKeyword
(
List
<
String
>
departmentIds
,
String
keyword
)
{
if
(
departmentIds
==
null
||
departmentIds
.
isEmpty
()){
if
(
departmentIds
==
null
||
departmentIds
.
isEmpty
()){
return
Collections
.
EMPTY_LIST
;
return
Collections
.
EMPTY_LIST
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseServiceImpl.java
View file @
7a2e471d
...
@@ -58,7 +58,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
...
@@ -58,7 +58,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
public
WxEnterpriseQwDTO
getQwInfo
(
String
wxEnterpriseId
)
{
public
WxEnterpriseQwDTO
getQwInfo
(
String
wxEnterpriseId
)
{
TabHaobanWxEnterprise
wxEnterprise
=
this
.
mapper
.
selectByPrimaryKey
(
wxEnterpriseId
)
;
TabHaobanWxEnterprise
wxEnterprise
=
this
.
mapper
.
selectByPrimaryKey
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qw
=
new
WxEnterpriseQwDTO
();
WxEnterpriseQwDTO
qw
=
new
WxEnterpriseQwDTO
();
qw
.
setCorpid
(
wxEnterprise
.
getCorpid
());
qw
.
setWxEnterpriseId
(
wxEnterpriseId
);
qw
.
setWxEnterpriseId
(
wxEnterpriseId
);
if
(
null
!=
wxEnterprise
.
getWxSecurityType
())
{
if
(
null
!=
wxEnterprise
.
getWxSecurityType
())
{
qw
.
setWxSecurityType
(
wxEnterprise
.
getWxSecurityType
());
qw
.
setWxSecurityType
(
wxEnterprise
.
getWxSecurityType
());
...
@@ -115,11 +114,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
...
@@ -115,11 +114,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
}
}
@Override
@Override
public
TabHaobanWxEnterprise
getEnterpriseBycorpIdNoStatus
(
String
corpId
)
{
return
this
.
mapper
.
getEnterpriseBycorpId
(
corpId
,
null
);
}
@Override
public
TabHaobanWxEnterprise
getEnterpriseByCorpName
(
String
corpName
)
{
public
TabHaobanWxEnterprise
getEnterpriseByCorpName
(
String
corpName
)
{
if
(
StringUtils
.
isBlank
(
corpName
))
{
if
(
StringUtils
.
isBlank
(
corpName
))
{
return
null
;
return
null
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/out/NoticeMessageApiServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
.
out
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
.
out
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Constant
;
import
com.gic.api.base.commons.Constant
;
...
@@ -7,7 +24,7 @@ import com.gic.api.base.commons.Page;
...
@@ -7,7 +24,7 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterprise
Qw
DTO
;
import
com.gic.haoban.manage.api.dto.notify.dto.NoticeMessageInfoDTO
;
import
com.gic.haoban.manage.api.dto.notify.dto.NoticeMessageInfoDTO
;
import
com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO
;
import
com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
...
@@ -25,22 +42,6 @@ import com.gic.haoban.manage.service.service.notify.NoticeMessageTemplateService
...
@@ -25,22 +42,6 @@ import com.gic.haoban.manage.service.service.notify.NoticeMessageTemplateService
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
/**
* Created 2021/12/17.
* Created 2021/12/17.
...
@@ -231,18 +232,15 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
...
@@ -231,18 +232,15 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
* @param messageTypeEnum
* @param messageTypeEnum
*/
*/
private
void
sendMessage
(
List
<
TemplateContentBO
>
contentList
,
String
wxEnterpriseId
,
String
wxUserId
,
NoticeMessageTypeEnum
messageTypeEnum
,
String
data
)
{
private
void
sendMessage
(
List
<
TemplateContentBO
>
contentList
,
String
wxEnterpriseId
,
String
wxUserId
,
NoticeMessageTypeEnum
messageTypeEnum
,
String
data
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
String
corpid
=
wxEnterpriseDTO
.
getCorpid
();
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
if
(
tabHaobanStaff
==
null
)
{
if
(
tabHaobanStaff
==
null
)
{
logger
.
error
(
"未查询到员工:wxUserId:{}"
,
wxUserId
);
logger
.
error
(
"未查询到员工:wxUserId:{}"
,
wxUserId
);
return
;
return
;
}
}
if
(
qwDTO
.
needOpenUserId3th
())
{
if
(
corpid
.
length
()
>
20
)
{
wxUserId
=
tabHaobanStaff
.
getWxOpenUseId
();
wxUserId
=
tabHaobanStaff
.
getWxOpenUseId
();
}
else
{
}
else
{
wxUserId
=
tabHaobanStaff
.
getWxUserId
();
wxUserId
=
tabHaobanStaff
.
getWxUserId
();
...
@@ -273,6 +271,6 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
...
@@ -273,6 +271,6 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
messageDTO
.
setPage
(
appUrl
);
messageDTO
.
setPage
(
appUrl
);
messageDTO
.
setTitle
(
messageTypeEnum
.
getName
());
messageDTO
.
setTitle
(
messageTypeEnum
.
getName
());
messageDTO
.
setItems
(
items
);
messageDTO
.
setItems
(
items
);
qywxSuiteApiService
.
sendMessage
(
wxEnterpriseDTO
.
getCorpid
()
,
config
.
getWxSuiteid
(),
messageDTO
);
qywxSuiteApiService
.
sendMessage
(
corpid
,
config
.
getWxSuiteid
(),
messageDTO
);
}
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DealSyncOperationApiServiceImpl.java
View file @
7a2e471d
...
@@ -528,15 +528,15 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
...
@@ -528,15 +528,15 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
@Override
@Override
public
String
dealQywxDepartment
(
String
taskId
,
String
wxEnterpriseId
)
{
public
String
dealQywxDepartment
(
String
taskId
,
String
wxEnterpriseId
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
qwDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret"
);
logger
.
info
(
"没有配置secret"
);
syncTaskService
.
updateTaskStatus
(
taskId
,
SyncTaskStatusEnum
.
exception_close
.
getVal
());
syncTaskService
.
updateTaskStatus
(
taskId
,
SyncTaskStatusEnum
.
exception_close
.
getVal
());
unlockTask
(
wxEnterpriseId
);
unlockTask
(
wxEnterpriseId
);
return
"没有配置secret"
;
return
"没有配置secret"
;
}
}
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
qywxDepartmentApiService
.
listSelfDepartment
(
wxEnterpriseDTO
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
1
);
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
qywxDepartmentApiService
.
listSelfDepartment
(
qwDTO
.
getThird
Corpid
(),
secretSetting
.
getSecretVal
(),
1
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"没有数据同步"
);
logger
.
info
(
"没有数据同步"
);
syncTaskService
.
updateTaskStatus
(
taskId
,
SyncTaskStatusEnum
.
exception_close
.
getVal
());
syncTaskService
.
updateTaskStatus
(
taskId
,
SyncTaskStatusEnum
.
exception_close
.
getVal
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentApiServiceImpl.java
View file @
7a2e471d
...
@@ -108,48 +108,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
...
@@ -108,48 +108,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
}
@Override
@Override
public
ServiceResponse
recycle
(
String
departmentId
)
{
ServiceResponse
hr
=
new
ServiceResponse
();
hr
.
setCode
(
1
);
List
<
TabHaobanDepartment
>
list
=
departmentService
.
listByParentId
(
departmentId
);
logger
.
info
(
"【部门删除】list.size={}"
,
list
.
size
());
if
(!
list
.
isEmpty
())
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"存在子部门,删除部门失败"
);
return
hr
;
}
List
<
TabHaobanStaffDepartmentRelated
>
staffList
=
staffDepartmentService
.
listByDepartmentId
(
departmentId
);
logger
.
info
(
"【部门删除】staffList.size={}"
,
staffList
.
size
());
if
(!
staffList
.
isEmpty
())
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"存在成员,删除部门失败"
);
return
hr
;
}
//调微信的新增接口
TabHaobanDepartment
department
=
departmentService
.
selectById
(
departmentId
);
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
department
.
getWxEnterpriseId
());
if
(
enterpriseDTO
!=
null
)
{
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CONTACT_SECRET
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"没有设置通讯录secret"
);
return
hr
;
}
JSONResponse
jp
=
qywxDepartmentApiService
.
deleteSelfDepartment
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
Integer
.
parseInt
(
department
.
getWxDepartmentId
()));
if
(
jp
.
getErrorCode
()
!=
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信删除部门失败"
);
return
hr
;
}
}
departmentService
.
recycle
(
departmentId
);
return
hr
;
}
@Override
public
ServiceResponse
wxCallBackrecycle
(
String
departmentId
)
{
public
ServiceResponse
wxCallBackrecycle
(
String
departmentId
)
{
ServiceResponse
hr
=
new
ServiceResponse
();
ServiceResponse
hr
=
new
ServiceResponse
();
hr
.
setCode
(
1
);
hr
.
setCode
(
1
);
...
@@ -179,47 +137,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
...
@@ -179,47 +137,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
}
@Override
@Override
public
ServiceResponse
repairRecycle
(
String
departmentId
,
String
parentId
)
{
ServiceResponse
hr
=
new
ServiceResponse
();
hr
.
setCode
(
0
);
TabHaobanDepartment
tab
=
departmentService
.
selectById
(
departmentId
);
//调微信的新增接口
String
wxDepartmentId
=
""
;
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
tab
.
getWxEnterpriseId
());
logger
.
info
(
"【部门新增】enterpriseDTO = {}"
,
JSON
.
toJSONString
(
enterpriseDTO
));
if
(
enterpriseDTO
!=
null
)
{
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
dto
=
new
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
();
dto
.
setCorpid
(
enterpriseDTO
.
getCorpid
());
dto
.
setName
(
tab
.
getDepartmentName
());
dto
.
setOrder
(
tab
.
getSort
());
TabHaobanDepartment
parent
=
departmentService
.
selectById
(
parentId
);
dto
.
setParentid
(
Integer
.
valueOf
(
parent
.
getWxDepartmentId
()));
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CONTACT_SECRET
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"没有设置通讯录secret"
);
return
hr
;
}
logger
.
info
(
"【部门新增】corpid() = {},siteId={},dto={}"
,
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
JSON
.
toJSONString
(
dto
));
JSONResponse
jp
=
qywxDepartmentApiService
.
createSelfDepartment
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
dto
);
logger
.
info
(
"【部门新增】jp = {}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
!=
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信新增部门失败"
);
return
hr
;
}
wxDepartmentId
=
jp
.
getResult
().
toString
();
tab
.
setWxDepartmentId
(
wxDepartmentId
);
tab
.
setParentDepartmentId
(
parentId
);
logger
.
info
(
"【部门新增】wxDepartmentId = {}"
,
wxDepartmentId
);
}
departmentService
.
repairRecycle
(
tab
);
return
hr
;
}
@Override
public
List
<
DepartmentDTO
>
listByDepartmentIds
(
List
<
String
>
departmentIds
,
public
List
<
DepartmentDTO
>
listByDepartmentIds
(
List
<
String
>
departmentIds
,
Integer
storeFlag
)
{
Integer
storeFlag
)
{
List
<
TabHaobanDepartment
>
list
=
departmentMapper
.
listByDepartmentIds
(
departmentIds
,
storeFlag
);
List
<
TabHaobanDepartment
>
list
=
departmentMapper
.
listByDepartmentIds
(
departmentIds
,
storeFlag
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/ExternalClerkRelatedApiServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
...
@@ -13,16 +32,30 @@ import com.gic.haoban.base.api.common.BasePageInfo;
...
@@ -13,16 +32,30 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon
;
import
com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.AlertMessageDTO
;
import
com.gic.haoban.manage.api.dto.ClerkStaffWxUserDTO
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedShortInfoDTO
;
import
com.gic.haoban.manage.api.dto.FriendMemberStatusDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.*
;
import
com.gic.haoban.manage.service.dao.mapper.ExternalUseridLogMapper
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.entity.MemberUnionidRelated
;
import
com.gic.haoban.manage.service.entity.TabExternalUseridLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO
;
import
com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO
;
import
com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo
;
import
com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.hm.WxUserAddLogService
;
import
com.gic.haoban.manage.service.service.hm.WxUserAddLogService
;
import
com.gic.member.api.service.MemberApiService
;
import
com.gic.member.api.service.MemberApiService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.mq.sdk.GicMQClient
;
...
@@ -31,20 +64,6 @@ import com.gic.wechat.api.dto.qywx.QywxNewExternalUseridDTO;
...
@@ -31,20 +64,6 @@ import com.gic.wechat.api.dto.qywx.QywxNewExternalUseridDTO;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
ExternalClerkRelatedApiServiceImpl
implements
ExternalClerkRelatedApiService
{
public
class
ExternalClerkRelatedApiServiceImpl
implements
ExternalClerkRelatedApiService
{
...
@@ -73,6 +92,8 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
...
@@ -73,6 +92,8 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
private
MemberApiService
memberApiService
;
private
MemberApiService
memberApiService
;
@Autowired
@Autowired
private
WxUserAddLogService
wxUserAddLogService
;
private
WxUserAddLogService
wxUserAddLogService
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
/**
/**
* 查询导购好友关联
* 查询导购好友关联
...
@@ -355,14 +376,12 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
...
@@ -355,14 +376,12 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
// 2个列表都为空查不了关系
// 2个列表都为空查不了关系
return
Collections
.
emptyMap
();
return
Collections
.
emptyMap
();
}
}
TabHaobanWxEnterprise
tabHaobanWxEnterprise
=
wxEnterriseMapper
.
selectByPrimaryKey
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
tabHaobanWxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
Collections
.
emptyMap
();
return
Collections
.
emptyMap
();
}
}
//新老企业兼容
String
corpid
=
tabHaobanWxEnterprise
.
getCorpid
();
List
<
MemberStaffRelExtDO
>
res
=
new
ArrayList
<>();
List
<
MemberStaffRelExtDO
>
res
=
new
ArrayList
<>();
if
(
corpid
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
res
=
staffClerkRelationMapper
.
listMemberStaffRelNew
(
memberIdList
,
clerkIdList
,
enterpriseId
);
res
=
staffClerkRelationMapper
.
listMemberStaffRelNew
(
memberIdList
,
clerkIdList
,
enterpriseId
);
}
else
{
}
else
{
res
=
staffClerkRelationMapper
.
listMemberStaffRel
(
memberIdList
,
clerkIdList
,
enterpriseId
);
res
=
staffClerkRelationMapper
.
listMemberStaffRel
(
memberIdList
,
clerkIdList
,
enterpriseId
);
...
@@ -413,7 +432,8 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
...
@@ -413,7 +432,8 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
}
}
RedisUtil
.
lock
(
lockKey
,
1L
,
TimeUnit
.
DAYS
,
0L
);
RedisUtil
.
lock
(
lockKey
,
1L
,
TimeUnit
.
DAYS
,
0L
);
try
{
try
{
updateNewExUserId
(
tabHaobanWxEnterprise
.
getWxEnterpriseId
(),
tabHaobanWxEnterprise
.
getCorpid
());
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
updateNewExUserId
(
tabHaobanWxEnterprise
.
getWxEnterpriseId
(),
qwDTO
.
getThirdCorpid
());
log
.
info
(
"企业外部联系人id end,wxEnterpriseId:{}"
,
wxEnterpriseId
);
log
.
info
(
"企业外部联系人id end,wxEnterpriseId:{}"
,
wxEnterpriseId
);
RedisUtil
.
unlock
(
lockKey
);
RedisUtil
.
unlock
(
lockKey
);
serviceResponse
.
setCode
(
HaoBanErrCodeCommon
.
ERR_1
.
getCode
());
serviceResponse
.
setCode
(
HaoBanErrCodeCommon
.
ERR_1
.
getCode
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/HandoverOperationApiServiceImpl.java
View file @
7a2e471d
...
@@ -99,9 +99,8 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -99,9 +99,8 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
@Override
@Override
public
void
dealQywxEnterpriseHandover
(
String
wxEnterpriseId
)
{
public
void
dealQywxEnterpriseHandover
(
String
wxEnterpriseId
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
logger
.
info
(
"拉取单个企业微信的离职成员:{}"
,
wxEnterpriseId
);
logger
.
info
(
"拉取单个企业微信的离职成员:{},{}"
,
wxEnterpriseId
,
JSONObject
.
toJSONString
(
wxEnterpriseDTO
));
List
<
QywxUnassignedInfoDTO
>
allQywxUnassigned
=
getAllQywxUnassigned
(
wxEnterpriseId
);
List
<
QywxUnassignedInfoDTO
>
allQywxUnassigned
=
getAllQywxUnassigned
(
wxEnterpriseDTO
);
logger
.
info
(
"处理离职成员数量:{},{}"
,
wxEnterpriseId
,
allQywxUnassigned
.
size
());
logger
.
info
(
"处理离职成员数量:{},{}"
,
wxEnterpriseId
,
allQywxUnassigned
.
size
());
handoverService
.
saveHandover
(
wxEnterpriseId
,
allQywxUnassigned
);
handoverService
.
saveHandover
(
wxEnterpriseId
,
allQywxUnassigned
);
}
}
...
@@ -111,13 +110,14 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -111,13 +110,14 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
* @param wxEnterpriseDTO
* @param wxEnterpriseDTO
* @return
* @return
*/
*/
private
List
<
QywxUnassignedInfoDTO
>
getAllQywxUnassigned
(
WxEnterpriseDTO
wxEnterpriseDTO
)
{
private
List
<
QywxUnassignedInfoDTO
>
getAllQywxUnassigned
(
String
wxEnterpriseId
)
{
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
List
<
QywxUnassignedInfoDTO
>
ret
=
new
ArrayList
<>();
List
<
QywxUnassignedInfoDTO
>
ret
=
new
ArrayList
<>();
QywxGetUnassignedListDTO
unassignedListDTO
=
null
;
QywxGetUnassignedListDTO
unassignedListDTO
=
null
;
String
cursor
=
null
;
String
cursor
=
null
;
do
{
do
{
//离职成员客户列表
//离职成员客户列表
unassignedListDTO
=
qywxUserApiService
.
getUnassignedList
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
cursor
);
unassignedListDTO
=
qywxUserApiService
.
getUnassignedList
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
cursor
);
cursor
=
unassignedListDTO
.
getNextCursor
();
cursor
=
unassignedListDTO
.
getNextCursor
();
if
(
CollectionUtils
.
isNotEmpty
(
unassignedListDTO
.
getInfo
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
unassignedListDTO
.
getInfo
()))
{
ret
.
addAll
(
unassignedListDTO
.
getInfo
());
ret
.
addAll
(
unassignedListDTO
.
getInfo
());
...
@@ -138,7 +138,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -138,7 +138,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
@Override
@Override
public
void
dealQywxEnterpriseHandoverResult
(
String
wxEnterpriseId
)
{
public
void
dealQywxEnterpriseHandoverResult
(
String
wxEnterpriseId
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
Date
date
=
DateUtils
.
addDays
(
new
Date
(),
-
3
);
Date
date
=
DateUtils
.
addDays
(
new
Date
(),
-
3
);
String
day
=
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd"
);
String
day
=
DateFormatUtils
.
format
(
date
,
"yyyy-MM-dd"
);
List
<
TabHandoverTransfer
>
transfers
=
handoverService
.
listTransferByWxEnterpriseId
(
wxEnterpriseId
,
day
);
List
<
TabHandoverTransfer
>
transfers
=
handoverService
.
listTransferByWxEnterpriseId
(
wxEnterpriseId
,
day
);
...
@@ -150,7 +150,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -150,7 +150,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
try
{
try
{
TabHaobanStaff
handover
=
staffService
.
selectById
(
dto
.
getHandoverStaffId
());
TabHaobanStaff
handover
=
staffService
.
selectById
(
dto
.
getHandoverStaffId
());
TabHaobanStaff
takeover
=
staffService
.
selectById
(
dto
.
getTakeoverStaffId
());
TabHaobanStaff
takeover
=
staffService
.
selectById
(
dto
.
getTakeoverStaffId
());
QywxTransferCustomerDTO
customerDTO
=
qywxUserApiService
.
transferResult
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
handover
.
getWxUserId
(),
takeover
.
getWxUserId
(),
true
);
QywxTransferCustomerDTO
customerDTO
=
qywxUserApiService
.
transferResult
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
handover
.
getWxUserId
(),
takeover
.
getWxUserId
(),
true
);
if
(
customerDTO
.
getErrcode
()
!=
0
)
{
if
(
customerDTO
.
getErrcode
()
!=
0
)
{
return
;
return
;
}
}
...
@@ -243,7 +243,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -243,7 +243,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
@Override
@Override
public
void
transferFriend
(
String
wxEnterpriseId
,
List
<
String
>
handoverExternalIds
,
String
disStaffId
,
String
storeId
)
{
public
void
transferFriend
(
String
wxEnterpriseId
,
List
<
String
>
handoverExternalIds
,
String
disStaffId
,
String
storeId
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectById
(
disStaffId
);
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectById
(
disStaffId
);
List
<
TabHandoverExternal
>
externalList
=
handoverService
.
listByIds
(
wxEnterpriseId
,
handoverExternalIds
);
List
<
TabHandoverExternal
>
externalList
=
handoverService
.
listByIds
(
wxEnterpriseId
,
handoverExternalIds
);
//分配人与客户的关联map
//分配人与客户的关联map
...
@@ -254,7 +254,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -254,7 +254,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
Map
<
String
,
List
<
String
>>
userByIdMap
=
externalList
.
stream
().
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getUserId
(),
Collectors
.
mapping
(
dto
->
dto
.
getHandoverExternalId
(),
Collectors
.
toList
())));
Map
<
String
,
List
<
String
>>
userByIdMap
=
externalList
.
stream
().
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getUserId
(),
Collectors
.
mapping
(
dto
->
dto
.
getHandoverExternalId
(),
Collectors
.
toList
())));
handoverStaffExternalMap
.
forEach
((
wxUserId
,
list
)
->
{
handoverStaffExternalMap
.
forEach
((
wxUserId
,
list
)
->
{
QywxTransferCustomerDTO
transferCustomerResp
=
qywxUserApiService
.
transferCustomer
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
wxUserId
,
tabHaobanStaff
.
getWxUserId
(),
list
);
QywxTransferCustomerDTO
transferCustomerResp
=
qywxUserApiService
.
transferCustomer
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
wxUserId
,
tabHaobanStaff
.
getWxUserId
(),
list
);
if
(
transferCustomerResp
.
getErrcode
()
!=
0
)
{
if
(
transferCustomerResp
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"转移异常"
);
logger
.
info
(
"转移异常"
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MaterialApiServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
...
@@ -11,6 +28,7 @@ import com.gic.haoban.manage.api.dto.BatchAddMaterialDTO;
...
@@ -11,6 +28,7 @@ import com.gic.haoban.manage.api.dto.BatchAddMaterialDTO;
import
com.gic.haoban.manage.api.dto.MaterialCategoryDTO
;
import
com.gic.haoban.manage.api.dto.MaterialCategoryDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.TabHaobanMaterial
;
import
com.gic.haoban.manage.service.entity.TabHaobanMaterial
;
...
@@ -23,17 +41,6 @@ import com.gic.haoban.manage.service.util.CommonUtil;
...
@@ -23,17 +41,6 @@ import com.gic.haoban.manage.service.util.CommonUtil;
import
com.gic.wechat.api.enums.QywxMediaTypeEnum
;
import
com.gic.wechat.api.enums.QywxMediaTypeEnum
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
MaterialApiServiceImpl
implements
MaterialApiService
{
public
class
MaterialApiServiceImpl
implements
MaterialApiService
{
...
@@ -103,12 +110,14 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -103,12 +110,14 @@ public class MaterialApiServiceImpl implements MaterialApiService {
@Override
@Override
public
void
insertMaterial
(
MaterialDTO
materialDTO
)
{
public
void
insertMaterial
(
MaterialDTO
materialDTO
)
{
Integer
type
=
materialDTO
.
getMaterialType
();
Integer
type
=
materialDTO
.
getMaterialType
();
String
wxEnterpriseId
=
materialDTO
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
type
==
null
)
{
if
(
type
==
null
)
{
logger
.
info
(
"type is null"
);
return
;
return
;
}
}
if
(
enterprise
==
null
)
{
String
wxEnterpriseId
=
materialDTO
.
getWxEnterpriseId
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
qwDTO
==
null
)
{
logger
.
info
(
"qwDTO is null"
);
return
;
return
;
}
}
QywxMediaTypeEnum
fileType
=
null
;
QywxMediaTypeEnum
fileType
=
null
;
...
@@ -132,7 +141,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -132,7 +141,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if
(
type
==
3
)
{
if
(
type
==
3
)
{
String
imgUrl
=
materialDTO
.
getImgUrl
();
String
imgUrl
=
materialDTO
.
getImgUrl
();
logger
.
info
(
"【上传图片】imgUrl={}"
,
imgUrl
);
logger
.
info
(
"【上传图片】imgUrl={}"
,
imgUrl
);
JSONResponse
response
=
qywxSuiteApiService
.
uploadImage
(
enterprise
.
getCorpid
()
,
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
imgUrl
));
JSONResponse
response
=
qywxSuiteApiService
.
uploadImage
(
qwDTO
.
getThirdCorpid
()
,
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
imgUrl
));
logger
.
info
(
"【上传图片返回】response={}"
,
JSON
.
toJSONString
(
response
));
logger
.
info
(
"【上传图片返回】response={}"
,
JSON
.
toJSONString
(
response
));
String
wxImgUrl
=
response
.
getResult
()
==
null
?
""
:
response
.
getResult
().
toString
();
String
wxImgUrl
=
response
.
getResult
()
==
null
?
""
:
response
.
getResult
().
toString
();
materialDTO
.
setWxImgUrl
(
wxImgUrl
);
materialDTO
.
setWxImgUrl
(
wxImgUrl
);
...
@@ -140,7 +149,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -140,7 +149,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if
(
fileType
!=
null
)
{
if
(
fileType
!=
null
)
{
String
[]
arr
=
url
.
split
(
"/"
);
String
[]
arr
=
url
.
split
(
"/"
);
int
count
=
arr
.
length
;
int
count
=
arr
.
length
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
enterprise
.
getCorpid
()
,
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
qwDTO
.
getThirdCorpid
()
,
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
if
(
jp
.
getErrorCode
()
==
0
)
{
if
(
jp
.
getErrorCode
()
==
0
)
{
materialDTO
.
setWxLastUploadTime
(
new
Date
());
materialDTO
.
setWxLastUploadTime
(
new
Date
());
materialDTO
.
setMediaId
(
jp
.
getResult
().
toString
());
materialDTO
.
setMediaId
(
jp
.
getResult
().
toString
());
...
@@ -167,11 +176,12 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -167,11 +176,12 @@ public class MaterialApiServiceImpl implements MaterialApiService {
String
materialId
=
materialDTO
.
getMaterialId
();
String
materialId
=
materialDTO
.
getMaterialId
();
MaterialDTO
old
=
materialService
.
selectMaterialById
(
materialId
);
MaterialDTO
old
=
materialService
.
selectMaterialById
(
materialId
);
String
wxEnterpriseId
=
old
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
old
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
type
==
null
)
{
if
(
type
==
null
)
{
return
;
return
;
}
}
if
(
enterprise
==
null
)
{
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
qwDTO
==
null
)
{
logger
.
info
(
"qwDTO is null"
);
return
;
return
;
}
}
QywxMediaTypeEnum
fileType
=
null
;
QywxMediaTypeEnum
fileType
=
null
;
...
@@ -196,7 +206,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -196,7 +206,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
String
imgUrl
=
materialDTO
.
getImgUrl
();
String
imgUrl
=
materialDTO
.
getImgUrl
();
String
oldImgUrl
=
materialDTO
.
getImgUrl
();
String
oldImgUrl
=
materialDTO
.
getImgUrl
();
if
(!
imgUrl
.
equals
(
oldImgUrl
))
{
if
(!
imgUrl
.
equals
(
oldImgUrl
))
{
JSONResponse
response
=
qywxSuiteApiService
.
uploadImage
(
enterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
imgUrl
));
JSONResponse
response
=
qywxSuiteApiService
.
uploadImage
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
imgUrl
));
String
wxImgUrl
=
response
.
getResult
()
==
null
?
""
:
response
.
getResult
().
toString
();
String
wxImgUrl
=
response
.
getResult
()
==
null
?
""
:
response
.
getResult
().
toString
();
materialDTO
.
setWxImgUrl
(
wxImgUrl
);
materialDTO
.
setWxImgUrl
(
wxImgUrl
);
}
}
...
@@ -204,7 +214,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -204,7 +214,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if
(
fileType
!=
null
&&
!
url
.
equals
(
oldUrl
))
{
if
(
fileType
!=
null
&&
!
url
.
equals
(
oldUrl
))
{
String
[]
arr
=
url
.
split
(
"/"
);
String
[]
arr
=
url
.
split
(
"/"
);
int
count
=
arr
.
length
;
int
count
=
arr
.
length
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
enterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
if
(
jp
.
getErrorCode
()
==
0
)
{
if
(
jp
.
getErrorCode
()
==
0
)
{
materialDTO
.
setWxLastUploadTime
(
new
Date
());
materialDTO
.
setWxLastUploadTime
(
new
Date
());
materialDTO
.
setMediaId
(
jp
.
getResult
().
toString
());
materialDTO
.
setMediaId
(
jp
.
getResult
().
toString
());
...
@@ -224,8 +234,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -224,8 +234,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return
""
;
return
""
;
}
}
String
wxEnterpriseId
=
old
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
old
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
enterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
logger
.
info
(
"qwDTO is null"
);
return
""
;
return
""
;
}
}
String
url
=
""
;
String
url
=
""
;
...
@@ -252,7 +263,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -252,7 +263,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
}
}
String
[]
arr
=
url
.
split
(
"/"
);
String
[]
arr
=
url
.
split
(
"/"
);
int
count
=
arr
.
length
;
int
count
=
arr
.
length
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
enterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
url
),
arr
[
count
-
1
],
fileType
.
getCode
());
if
(
jp
.
getErrorCode
()
==
0
)
{
if
(
jp
.
getErrorCode
()
==
0
)
{
old
.
setWxLastUploadTime
(
new
Date
());
old
.
setWxLastUploadTime
(
new
Date
());
old
.
setMediaId
(
jp
.
getResult
().
toString
());
old
.
setMediaId
(
jp
.
getResult
().
toString
());
...
@@ -381,8 +392,8 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -381,8 +392,8 @@ public class MaterialApiServiceImpl implements MaterialApiService {
public
void
batchInsertMaterial
(
BatchAddMaterialDTO
dto
)
{
public
void
batchInsertMaterial
(
BatchAddMaterialDTO
dto
)
{
// 构造素材实体类
// 构造素材实体类
BatchAddMaterialDTO
.
Material
material
=
dto
.
getMaterial
();
BatchAddMaterialDTO
.
Material
material
=
dto
.
getMaterial
();
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
material
.
getWxEnterpriseId
())
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
material
.
getWxEnterpriseId
())
;
if
(
enterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
;
return
;
}
}
List
<
BatchAddMaterialDTO
.
MaterialMedia
>
materialMediaList
=
dto
.
getMaterialMediaList
();
List
<
BatchAddMaterialDTO
.
MaterialMedia
>
materialMediaList
=
dto
.
getMaterialMediaList
();
...
@@ -409,7 +420,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -409,7 +420,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
materialDTO
.
setMaterialTitle
(
material
.
getMaterialTitle
());
materialDTO
.
setMaterialTitle
(
material
.
getMaterialTitle
());
}
}
materialDTO
.
setImgUrl
(
one
.
getMediaUrl
());
materialDTO
.
setImgUrl
(
one
.
getMediaUrl
());
String
mediaId
=
uploadMediaToWx
(
enterprise
.
get
Corpid
(),
one
.
getMediaUrl
());
String
mediaId
=
uploadMediaToWx
(
qwDTO
.
getThird
Corpid
(),
one
.
getMediaUrl
());
if
(
StringUtils
.
isNotEmpty
(
mediaId
))
{
if
(
StringUtils
.
isNotEmpty
(
mediaId
))
{
materialDTO
.
setWxLastUploadTime
(
new
Date
());
materialDTO
.
setWxLastUploadTime
(
new
Date
());
materialDTO
.
setMediaId
(
mediaId
);
materialDTO
.
setMediaId
(
mediaId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
7a2e471d
...
@@ -337,8 +337,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -337,8 +337,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log
.
info
(
"staff不存在:{},{}"
,
dto
.
getUnionid
(),
dto
.
getWxUserId
());
log
.
info
(
"staff不存在:{},{}"
,
dto
.
getUnionid
(),
dto
.
getWxUserId
());
return
;
return
;
}
}
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
DTO
==
null
)
{
if
(
qw
DTO
==
null
)
{
log
.
info
(
"未查询到企业:wxEnterpriseId:{}"
,
wxEnterpriseId
);
log
.
info
(
"未查询到企业:wxEnterpriseId:{}"
,
wxEnterpriseId
);
return
;
return
;
}
}
...
@@ -416,7 +416,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -416,7 +416,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
mainStoreRelated
==
null
)
{
if
(
mainStoreRelated
==
null
)
{
log
.
info
(
"【新增外部联系人】主门店为空:{}"
,
staffId
);
log
.
info
(
"【新增外部联系人】主门店为空:{}"
,
staffId
);
// 无主门店仅发送欢迎语
// 无主门店仅发送欢迎语
sendWelcome
(
dto
,
wxEnterprise
DTO
,
null
,
staffId
,
null
);
sendWelcome
(
dto
,
qw
DTO
,
null
,
staffId
,
null
);
return
;
return
;
}
}
staffClerkRelationDTO
=
staffClerkRelationService
.
getOneBindByStoreId
(
staffId
,
mainStoreRelated
.
getStoreId
());
staffClerkRelationDTO
=
staffClerkRelationService
.
getOneBindByStoreId
(
staffId
,
mainStoreRelated
.
getStoreId
());
...
@@ -510,7 +510,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -510,7 +510,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
addFriendByWelcome
(
dto
,
staffClerkRelationDTO
);
addFriendByWelcome
(
dto
,
staffClerkRelationDTO
);
return
""
;
return
""
;
}
}
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//新增导购和外部联系人关系
//新增导购和外部联系人关系
String
clerkId
=
staffClerkRelationDTO
.
getClerkId
();
String
clerkId
=
staffClerkRelationDTO
.
getClerkId
();
String
clerkCode
=
staffClerkRelationDTO
.
getClerkCode
();
String
clerkCode
=
staffClerkRelationDTO
.
getClerkCode
();
...
@@ -587,7 +587,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -587,7 +587,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
exsitDTO
.
setStatusFlag
(
1
);
exsitDTO
.
setStatusFlag
(
1
);
externalClerkRelatedService
.
update
(
exsitDTO
);
externalClerkRelatedService
.
update
(
exsitDTO
);
}
}
sendWelcome
(
dto
,
wxEnterprise
DTO
,
enterpriseId
,
staffId
,
clerkId
);
sendWelcome
(
dto
,
qw
DTO
,
enterpriseId
,
staffId
,
clerkId
);
//同步好友标签
//同步好友标签
pushTagSync
(
memberId
,
wxEnterpriseId
,
enterpriseId
);
pushTagSync
(
memberId
,
wxEnterpriseId
,
enterpriseId
);
//回调给会员,更新是否为企微好友
//回调给会员,更新是否为企微好友
...
@@ -608,10 +608,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -608,10 +608,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
relationKey
=
SecureUtil
.
md5
(
staffId
+
dto
.
getExternalUserid
());
String
relationKey
=
SecureUtil
.
md5
(
staffId
+
dto
.
getExternalUserid
());
String
wxEnterpriseId
=
staffClerkRelationDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
staffClerkRelationDTO
.
getWxEnterpriseId
();
String
enterpriseId
=
staffClerkRelationDTO
.
getEnterpriseId
();
String
enterpriseId
=
staffClerkRelationDTO
.
getEnterpriseId
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//发送欢迎语
//发送欢迎语
sendWelcome
(
dto
,
wxEnterpriseDTO
,
enterpriseId
,
staffId
,
clerkId
);
sendWelcome
(
dto
,
qwDTO
,
enterpriseId
,
staffId
,
clerkId
);
//保存好友关系
//保存好友关系
List
<
TabHaobanExternalClerkRelated
>
externalClerkRelateds
=
externalClerkRelatedService
.
listByExTernalUseridAndWxUserIdAllStatus
(
wxEnterpriseId
,
dto
.
getExternalUserid
(),
dto
.
getWxUserId
());
List
<
TabHaobanExternalClerkRelated
>
externalClerkRelateds
=
externalClerkRelatedService
.
listByExTernalUseridAndWxUserIdAllStatus
(
wxEnterpriseId
,
dto
.
getExternalUserid
(),
dto
.
getWxUserId
());
if
(
CollectionUtils
.
isEmpty
(
externalClerkRelateds
))
{
if
(
CollectionUtils
.
isEmpty
(
externalClerkRelateds
))
{
...
@@ -656,12 +655,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -656,12 +655,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param enterpriseId
* @param enterpriseId
* @param staffId
* @param staffId
*/
*/
private
void
sendWelcome
(
MemberUnionidRelatedDTO
dto
,
WxEnterpriseDTO
wxEnterpriseDTO
,
String
enterpriseId
,
String
staffId
,
String
clerkId
)
{
private
void
sendWelcome
(
MemberUnionidRelatedDTO
dto
,
WxEnterprise
Qw
DTO
wxEnterpriseDTO
,
String
enterpriseId
,
String
staffId
,
String
clerkId
)
{
log
.
info
(
"发送欢迎语:dto:{},staffId:{}"
,
JSONObject
.
toJSONString
(
dto
),
staffId
);
log
.
info
(
"发送欢迎语:dto:{},staffId:{}"
,
JSONObject
.
toJSONString
(
dto
),
staffId
);
String
welcomeCode
=
dto
.
getWelcomeCode
();
String
welcomeCode
=
dto
.
getWelcomeCode
();
String
state
=
dto
.
getState
();
String
state
=
dto
.
getState
();
String
wxEnterpriseId
=
wxEnterpriseDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
wxEnterpriseDTO
.
getWxEnterpriseId
();
String
corpid
=
wxEnterpriseDTO
.
getCorpid
();
if
(
StringUtils
.
isBlank
(
welcomeCode
))
{
if
(
StringUtils
.
isBlank
(
welcomeCode
))
{
log
.
error
(
"welcomeCode为空,请检查是否使用企微的欢迎语:{}"
,
wxEnterpriseId
);
log
.
error
(
"welcomeCode为空,请检查是否使用企微的欢迎语:{}"
,
wxEnterpriseId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
...
@@ -708,13 +706,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -708,13 +706,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
mediaList
.
forEach
(
one
->
{
mediaList
.
forEach
(
one
->
{
Integer
mediaType
=
one
.
getMediaType
();
Integer
mediaType
=
one
.
getMediaType
();
if
(
WelcomeMediaTypeEnum
.
IMAGE
.
getCode
().
equals
(
mediaType
))
{
if
(
WelcomeMediaTypeEnum
.
IMAGE
.
getCode
().
equals
(
mediaType
))
{
attachmentAddImage
(
attachments
,
one
,
wxEnterpriseDTO
);
attachmentAddImage
(
attachments
,
one
,
wxEnterpriseDTO
.
getThirdCorpid
()
);
}
}
if
(
WelcomeMediaTypeEnum
.
VIDEO
.
getCode
().
equals
(
mediaType
))
{
if
(
WelcomeMediaTypeEnum
.
VIDEO
.
getCode
().
equals
(
mediaType
))
{
attachmentAddVideo
(
attachments
,
one
,
wxEnterpriseDTO
);
attachmentAddVideo
(
attachments
,
one
,
wxEnterpriseDTO
.
getThirdCorpid
()
);
}
}
if
(
WelcomeMediaTypeEnum
.
FILE
.
getCode
().
equals
(
mediaType
))
{
if
(
WelcomeMediaTypeEnum
.
FILE
.
getCode
().
equals
(
mediaType
))
{
attachmentAddFile
(
attachments
,
one
,
wxEnterpriseDTO
);
attachmentAddFile
(
attachments
,
one
,
wxEnterpriseDTO
.
getThirdCorpid
()
);
}
}
if
(
WelcomeMediaTypeEnum
.
LINK
.
getCode
().
equals
(
mediaType
))
{
if
(
WelcomeMediaTypeEnum
.
LINK
.
getCode
().
equals
(
mediaType
))
{
attachmentAddLink
(
attachments
,
one
);
attachmentAddLink
(
attachments
,
one
);
...
@@ -726,7 +724,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -726,7 +724,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
attachmentAddParamProgram
(
attachments
,
enterpriseId
,
wxEnterpriseId
,
relationKey
);
attachmentAddParamProgram
(
attachments
,
enterpriseId
,
wxEnterpriseId
,
relationKey
);
}
}
if
(
WelcomeMediaTypeEnum
.
PARAM_QRCODE
.
getCode
().
equals
(
mediaType
))
{
if
(
WelcomeMediaTypeEnum
.
PARAM_QRCODE
.
getCode
().
equals
(
mediaType
))
{
attachmentAddParamQrCode
(
attachments
,
enterpriseId
,
clerkId
,
wxEnterpriseDTO
,
relationKey
);
attachmentAddParamQrCode
(
attachments
,
enterpriseId
,
clerkId
,
wxEnterpriseDTO
.
getThirdCorpid
()
,
relationKey
);
}
}
});
});
if
(
CollectionUtils
.
isNotEmpty
(
attachments
))
{
if
(
CollectionUtils
.
isNotEmpty
(
attachments
))
{
...
@@ -736,7 +734,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -736,7 +734,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log
.
info
(
"[sendWelcome] 发送欢迎语 params:{}"
,
JSON
.
toJSONString
(
qywxWelcomeMsgDTO
));
log
.
info
(
"[sendWelcome] 发送欢迎语 params:{}"
,
JSON
.
toJSONString
(
qywxWelcomeMsgDTO
));
if
(
dto
.
getSuiteid
().
equals
(
SELF_APP
))
{
if
(
dto
.
getSuiteid
().
equals
(
SELF_APP
))
{
//好办助手和代开发
//好办助手和代开发
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
dto
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
dto
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
qywxUserApiService
.
sendSelfWelcomeMsgByExternal
(
dto
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
qywxWelcomeMsgDTO
);
qywxUserApiService
.
sendSelfWelcomeMsgByExternal
(
dto
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
qywxWelcomeMsgDTO
);
}
else
{
}
else
{
qywxUserApiService
.
sendWelcomeMsgByExternal
(
dto
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxWelcomeMsgDTO
);
qywxUserApiService
.
sendWelcomeMsgByExternal
(
dto
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxWelcomeMsgDTO
);
...
@@ -765,11 +763,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -765,11 +763,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return
welcomeReferBo
;
return
welcomeReferBo
;
}
}
private
void
attachmentAddImage
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
WelcomeMediaBO
media
,
WxEnterpriseDTO
wxEnterpriseDTO
)
{
private
void
attachmentAddImage
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
WelcomeMediaBO
media
,
String
corpid
)
{
String
mediaUrl
=
media
.
getMediaUrl
();
String
mediaUrl
=
media
.
getMediaUrl
();
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
()
,
corpid
,
config
.
getWxSuiteid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
mediaUrl
),
CommonUtil
.
getFileByte
(
mediaUrl
),
arr
[
arr
.
length
-
1
],
arr
[
arr
.
length
-
1
],
...
@@ -782,11 +780,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -782,11 +780,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
}
}
private
void
attachmentAddVideo
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
WelcomeMediaBO
media
,
WxEnterpriseDTO
wxEnterpriseDTO
)
{
private
void
attachmentAddVideo
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
WelcomeMediaBO
media
,
String
corpid
)
{
String
mediaUrl
=
media
.
getMediaUrl
();
String
mediaUrl
=
media
.
getMediaUrl
();
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
()
,
corpid
,
config
.
getWxSuiteid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
mediaUrl
),
CommonUtil
.
getFileByte
(
mediaUrl
),
arr
[
arr
.
length
-
1
],
arr
[
arr
.
length
-
1
],
...
@@ -799,11 +797,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -799,11 +797,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
}
}
private
void
attachmentAddFile
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
WelcomeMediaBO
media
,
WxEnterpriseDTO
wxEnterpriseDTO
)
{
private
void
attachmentAddFile
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
WelcomeMediaBO
media
,
String
corpid
)
{
String
mediaUrl
=
media
.
getMediaUrl
();
String
mediaUrl
=
media
.
getMediaUrl
();
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
()
,
corpid
,
config
.
getWxSuiteid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
mediaUrl
),
CommonUtil
.
getFileByte
(
mediaUrl
),
arr
[
arr
.
length
-
1
],
arr
[
arr
.
length
-
1
],
...
@@ -862,7 +860,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -862,7 +860,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
private
void
attachmentAddParamQrCode
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
String
enterpriseId
,
String
clerkId
,
private
void
attachmentAddParamQrCode
(
List
<
QywxExternalMessageBaseDTO
>
attachments
,
String
enterpriseId
,
String
clerkId
,
WxEnterpriseDTO
wxEnterpriseDTO
,
String
relationKey
)
{
String
corpid
,
String
relationKey
)
{
if
(
StringUtils
.
isEmpty
(
enterpriseId
)
||
StringUtils
.
isEmpty
(
clerkId
))
{
if
(
StringUtils
.
isEmpty
(
enterpriseId
)
||
StringUtils
.
isEmpty
(
clerkId
))
{
log
.
info
(
"带参小程序无法发送"
);
log
.
info
(
"带参小程序无法发送"
);
return
;
return
;
...
@@ -876,7 +874,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -876,7 +874,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
downloadUrl
=
qRcodePic
.
getPicUploadResDTO
().
downloadUrl
;
String
downloadUrl
=
qRcodePic
.
getPicUploadResDTO
().
downloadUrl
;
String
[]
arr
=
downloadUrl
.
split
(
"/"
);
String
[]
arr
=
downloadUrl
.
split
(
"/"
);
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
()
,
corpid
,
config
.
getWxSuiteid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
downloadUrl
),
CommonUtil
.
getFileByte
(
downloadUrl
),
arr
[
arr
.
length
-
1
],
arr
[
arr
.
length
-
1
],
...
@@ -1026,31 +1024,28 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1026,31 +1024,28 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
@Override
public
String
add
(
String
wxEnterpriseId
,
String
selfExternalUserId
,
String
userId
,
String
storeId
)
{
public
String
add
(
String
wxEnterpriseId
,
String
selfExternalUserId
,
String
userId
,
String
storeId
)
{
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
""
;
return
""
;
}
}
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
);
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
return
""
;
return
""
;
}
}
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
)
{
if
(
null
==
secretSetting
)
{
log
.
info
(
"没有配置secret"
);
log
.
info
(
"没有配置secret"
);
return
""
;
return
""
;
}
}
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
wxEnterprise
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
selfExternalUserId
);
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
qwDTO
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
selfExternalUserId
);
ExternalUserPojo
pojo
=
getExternalUserPojo
(
unionIdJson
,
userId
,
wxEnterpriseId
);
ExternalUserPojo
pojo
=
getExternalUserPojo
(
unionIdJson
,
userId
,
wxEnterpriseId
);
String
unionId
=
pojo
.
getUnionId
();
String
unionId
=
pojo
.
getUnionId
();
String
name
=
pojo
.
getName
();
String
name
=
pojo
.
getName
();
String
createTime
=
pojo
.
getAddCreateTime
();
String
createTime
=
pojo
.
getAddCreateTime
();
MemberUnionidRelatedDTO
dto
=
new
MemberUnionidRelatedDTO
();
MemberUnionidRelatedDTO
dto
=
new
MemberUnionidRelatedDTO
();
String
externalUserId
=
getExternalUserId
(
wxEnterprise
,
userId
,
createTime
,
name
);
String
externalUserId
=
getExternalUserId
(
qwDTO
.
getThirdCorpid
()
,
userId
,
createTime
,
name
);
if
(
StringUtils
.
isBlank
(
externalUserId
))
{
if
(
StringUtils
.
isBlank
(
externalUserId
))
{
log
.
error
(
"请求外部联系人id失败,userId:{}"
,
userId
);
log
.
error
(
"请求外部联系人id失败,userId:{}"
,
userId
);
return
""
;
return
""
;
...
@@ -1187,9 +1182,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1187,9 +1182,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param name
* @param name
* @return
* @return
*/
*/
private
String
getExternalUserId
(
WxEnterpriseDTO
wxEnterprise
,
String
userId
,
String
createTime
,
String
name
)
{
private
String
getExternalUserId
(
String
corpid
,
String
userId
,
String
createTime
,
String
name
)
{
log
.
info
(
"新增外部联系人】corpid={},suiteId={},userId1={}"
,
wxEnterprise
.
getCorpid
()
,
config
.
getWxSuiteid
(),
userId
);
log
.
info
(
"新增外部联系人】corpid={},suiteId={},userId1={}"
,
corpid
,
config
.
getWxSuiteid
(),
userId
);
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
wxEnterprise
.
getCorpid
()
,
config
.
getWxSuiteid
(),
userId
);
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
corpid
,
config
.
getWxSuiteid
(),
userId
);
String
externalUserId
=
""
;
String
externalUserId
=
""
;
log
.
info
(
"【新增外部联系人】wxRes={}"
,
wxRes
);
log
.
info
(
"【新增外部联系人】wxRes={}"
,
wxRes
);
if
(
StringUtils
.
isBlank
(
wxRes
))
{
if
(
StringUtils
.
isBlank
(
wxRes
))
{
...
@@ -1199,7 +1194,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1199,7 +1194,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
JSONArray
jsonArr
=
JSON
.
parseArray
(
wxRes
);
JSONArray
jsonArr
=
JSON
.
parseArray
(
wxRes
);
String
wxName
=
""
;
String
wxName
=
""
;
for
(
Object
externalUserid
:
jsonArr
)
{
for
(
Object
externalUserid
:
jsonArr
)
{
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
getCorpid
()
,
config
.
getWxSuiteid
(),
externalUserid
.
toString
());
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
corpid
,
config
.
getWxSuiteid
(),
externalUserid
.
toString
());
log
.
info
(
"【新增外部联系人】uJ={}"
,
uJ
);
log
.
info
(
"【新增外部联系人】uJ={}"
,
uJ
);
if
(
StringUtils
.
isNotBlank
(
uJ
))
{
if
(
StringUtils
.
isNotBlank
(
uJ
))
{
JSONObject
jo
=
JSON
.
parseObject
(
uJ
);
JSONObject
jo
=
JSON
.
parseObject
(
uJ
);
...
@@ -1315,9 +1310,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1315,9 +1310,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
@Override
public
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
storeId
)
{
public
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
storeId
)
{
log
.
info
(
"【刷下好友】wxUserId={}"
,
wxUserId
);
log
.
info
(
"【刷下好友】wxUserId={}"
,
wxUserId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
List
<
MemberUnionidRelatedDTO
>
list
=
this
.
getByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
List
<
MemberUnionidRelatedDTO
>
list
=
this
.
getByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
List
<
String
>
externalUserIdList
=
list
.
stream
().
map
(
external
->
external
.
getExternalUserid
())
List
<
String
>
externalUserIdList
=
list
.
stream
().
map
(
external
->
external
.
getExternalUserid
())
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
...
@@ -1334,13 +1328,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1334,13 +1328,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
}
}
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
return
;
return
;
}
}
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
enterprise
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
qwDTO
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
log
.
info
(
"【刷下好友】res={}"
,
res
);
log
.
info
(
"【刷下好友】res={}"
,
res
);
if
(
StringUtils
.
isBlank
(
res
))
{
if
(
StringUtils
.
isBlank
(
res
))
{
return
;
return
;
...
@@ -1438,12 +1431,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1438,12 +1431,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
jp
.
setErrorMessage
(
"群发素材不存在, 群发创建失败"
);
jp
.
setErrorMessage
(
"群发素材不存在, 群发创建失败"
);
return
jp
;
return
jp
;
}
}
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//请求参数赋值
//请求参数赋值
qywxExternalMessageDTO
.
setChatType
(
"single"
);
qywxExternalMessageDTO
.
setChatType
(
"single"
);
qywxExternalMessageDTO
.
setExternalUserid
(
extendUserList
);
qywxExternalMessageDTO
.
setExternalUserid
(
extendUserList
);
String
corpid
=
enterprise
.
getCorpid
();
if
(
qwDTO
.
needOpenUserId3th
())
{
if
(
corpid
.
length
()
>
20
)
{
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
);
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
);
if
(
tabHaobanStaff
==
null
)
{
if
(
tabHaobanStaff
==
null
)
{
JSONResponse
jp
=
new
JSONResponse
();
JSONResponse
jp
=
new
JSONResponse
();
...
@@ -1457,7 +1449,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1457,7 +1449,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
qywxExternalMessageDTO
.
setAttachments
(
messageMaterialList
);
qywxExternalMessageDTO
.
setAttachments
(
messageMaterialList
);
//调接口执行创建群发
//调接口执行创建群发
return
qywxSuiteApiService
.
sendExternalMessage
(
corpid
,
config
.
getWxSuiteid
(),
qywxExternalMessageDTO
);
return
qywxSuiteApiService
.
sendExternalMessage
(
qwDTO
.
getThirdCorpid
()
,
config
.
getWxSuiteid
(),
qywxExternalMessageDTO
);
}
}
/**
/**
...
@@ -1523,11 +1515,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1523,11 +1515,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
*/
*/
@Override
@Override
public
JSONResponse
taskExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
)
{
public
JSONResponse
taskExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
)
{
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
enterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
null
;
return
null
;
}
}
return
qywxSuiteApiService
.
taskExternalMessage
(
enterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
wxMessageId
,
cursor
);
return
qywxSuiteApiService
.
taskExternalMessage
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
wxMessageId
,
cursor
);
}
}
/**
/**
...
@@ -1541,20 +1533,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1541,20 +1533,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
*/
*/
@Override
@Override
public
JSONResponse
resultExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
,
String
userId
)
{
public
JSONResponse
resultExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
,
String
userId
)
{
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
enterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
null
;
return
null
;
}
}
return
qywxSuiteApiService
.
resultExternalMessage
(
enterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
wxMessageId
,
cursor
,
userId
);
return
qywxSuiteApiService
.
resultExternalMessage
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
wxMessageId
,
cursor
,
userId
);
}
}
@Override
@Override
public
JSONResponse
getMessageStatus
(
String
wxEnterpriseId
,
String
wxMessageId
)
{
public
JSONResponse
getMessageStatus
(
String
wxEnterpriseId
,
String
wxMessageId
)
{
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
enterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
null
;
return
null
;
}
}
return
qywxSuiteApiService
.
resultExternalMessage
(
enterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
wxMessageId
);
return
qywxSuiteApiService
.
resultExternalMessage
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
wxMessageId
);
}
}
@Override
@Override
...
@@ -1590,14 +1582,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1590,14 +1582,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
public
List
<
String
>
listSelfExterialList
(
String
wxEnterpriseId
,
String
wxUserId
)
{
public
List
<
String
>
listSelfExterialList
(
String
wxEnterpriseId
,
String
wxUserId
)
{
try
{
try
{
log
.
info
(
"【查询自建应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
log
.
info
(
"【查询自建应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
return
list
;
return
list
;
}
}
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
enterprise
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
qwDTO
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
log
.
info
(
"【查询自建应用】res={}"
,
res
);
log
.
info
(
"【查询自建应用】res={}"
,
res
);
if
(
res
!=
null
&&
res
.
equals
(
"1"
))
{
if
(
res
!=
null
&&
res
.
equals
(
"1"
))
{
log
.
info
(
"代表需要重试"
);
log
.
info
(
"代表需要重试"
);
...
@@ -1623,15 +1615,15 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1623,15 +1615,15 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
@Override
public
List
<
String
>
listExterialList
(
String
wxEnterpriseId
,
String
wxUserId
)
{
public
List
<
String
>
listExterialList
(
String
wxEnterpriseId
,
String
wxUserId
)
{
log
.
info
(
"【获取第三方应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
log
.
info
(
"【获取第三方应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
WxEnterprise
DTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
String
corpid
=
enterprise
.
getCorpid
()
;
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
String
userId
=
""
;
String
userId
=
""
;
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
log
.
error
(
"员工为空,wxUserId:{}"
,
wxUserId
);
log
.
error
(
"员工为空,wxUserId:{}"
,
wxUserId
);
return
null
;
return
null
;
}
}
if
(
corpid
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
userId
=
staff
.
getWxOpenUseId
();
userId
=
staff
.
getWxOpenUseId
();
}
else
{
}
else
{
userId
=
staff
.
getWxUserId
();
userId
=
staff
.
getWxUserId
();
...
@@ -1659,17 +1651,17 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1659,17 +1651,17 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
@Override
public
ExternalUserDTO
getCorpSelfExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
public
ExternalUserDTO
getCorpSelfExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
log
.
info
(
"企业不存在"
);
log
.
info
(
"企业不存在"
);
return
null
;
return
null
;
}
}
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
)
{
if
(
null
==
secretSetting
)
{
log
.
info
(
"没有配置secret"
);
log
.
info
(
"没有配置secret"
);
return
null
;
return
null
;
}
}
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
wxEnterprise
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
externalUserId
);
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
qwDTO
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
unionIdJson
))
{
if
(
StringUtils
.
isBlank
(
unionIdJson
))
{
log
.
info
(
"好友不存在"
);
log
.
info
(
"好友不存在"
);
return
null
;
return
null
;
...
@@ -1684,8 +1676,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1684,8 +1676,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
@Override
public
ExternalUserDTO
getExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
public
ExternalUserDTO
getExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
log
.
info
(
"查询第三方:wxEnterpriseId:{},wxUserId:{},externalUserId:{}"
,
wxEnterpriseId
,
wxUserId
,
externalUserId
);
log
.
info
(
"查询第三方:wxEnterpriseId:{},wxUserId:{},externalUserId:{}"
,
wxEnterpriseId
,
wxUserId
,
externalUserId
);
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
log
.
info
(
"企业不存在"
);
log
.
info
(
"企业不存在"
);
return
null
;
return
null
;
}
}
...
@@ -1695,7 +1687,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -1695,7 +1687,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return
null
;
return
null
;
}
}
String
wxOpenUseId
=
tabHaobanStaff
.
getWxOpenUseId
();
String
wxOpenUseId
=
tabHaobanStaff
.
getWxOpenUseId
();
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
uJ
))
{
if
(
StringUtils
.
isBlank
(
uJ
))
{
log
.
info
(
"好友不存在"
);
log
.
info
(
"好友不存在"
);
return
null
;
return
null
;
...
@@ -2075,8 +2067,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -2075,8 +2067,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
return
;
return
;
}
}
String
corpid
=
tabHaobanWxEnterpris
.
getCorpid
();
String
wxEnterpriseId
=
tabHaobanWxEnterpris
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
tabHaobanWxEnterpris
.
getWxEnterpriseId
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
List
<
UnionidToExternalUseridDTO
>
unionidToExternalUseridDTOS
=
qywxUserApiService
.
unionidToExternalUserid3rd
(
unionid
,
openId
,
corpid
,
config
.
getWxSuiteid
());
List
<
UnionidToExternalUseridDTO
>
unionidToExternalUseridDTOS
=
qywxUserApiService
.
unionidToExternalUserid3rd
(
unionid
,
openId
,
corpid
,
config
.
getWxSuiteid
());
if
(
CollectionUtils
.
isEmpty
(
unionidToExternalUseridDTOS
))
{
if
(
CollectionUtils
.
isEmpty
(
unionidToExternalUseridDTOS
))
{
log
.
error
(
"请求unionidToExternalUserid3rd返回为空"
);
log
.
error
(
"请求unionidToExternalUserid3rd返回为空"
);
...
@@ -2314,12 +2307,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -2314,12 +2307,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @return
* @return
*/
*/
private
List
<
ExternalUserDTO
>
getExternalUseridInfoList
(
String
wxEnterpriseId
,
String
externalUserId
)
{
private
List
<
ExternalUserDTO
>
getExternalUseridInfoList
(
String
wxEnterpriseId
,
String
externalUserId
)
{
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
log
.
info
(
"企业不存在"
);
log
.
info
(
"企业不存在"
);
return
null
;
return
null
;
}
}
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
uJ
))
{
if
(
StringUtils
.
isBlank
(
uJ
))
{
log
.
info
(
"好友不存在"
);
log
.
info
(
"好友不存在"
);
return
null
;
return
null
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
7a2e471d
...
@@ -307,7 +307,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -307,7 +307,7 @@ public class MessageApiServiceImpl implements MessageApiService {
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
.
toString
());
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
.
toString
());
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETE_USER
.
getCode
()))
{
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETE_USER
.
getCode
()))
{
log
.
info
(
"成员同步删除,userid:{}"
,
userid
);
log
.
info
(
"成员同步删除,userid:{}"
,
userid
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret,wxEnterpriseId:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置secret,wxEnterpriseId:{}"
,
wxEnterpriseId
);
return
;
return
;
...
@@ -368,7 +368,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -368,7 +368,7 @@ public class MessageApiServiceImpl implements MessageApiService {
return
;
return
;
}
}
String
wxEnterpriseId
=
wxApplication
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
wxApplication
.
getWxEnterpriseId
();
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
return
;
return
;
...
@@ -462,7 +462,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -462,7 +462,7 @@ public class MessageApiServiceImpl implements MessageApiService {
log
.
info
(
"未查询到企业关联企业 wxEnt"
);
log
.
info
(
"未查询到企业关联企业 wxEnt"
);
return
;
return
;
}
}
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
return
;
return
;
...
@@ -499,15 +499,15 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -499,15 +499,15 @@ public class MessageApiServiceImpl implements MessageApiService {
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
return
false
;
}
}
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
())
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
relation
.
getWxEnterpriseId
())
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
log
.
info
(
"企业为空"
);
log
.
info
(
"企业为空"
);
return
false
;
return
false
;
}
}
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
relation
.
getStaffId
());
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
relation
.
getStaffId
());
String
corpid
=
wxEnterprise
.
getCorpid
()
;
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
String
wxUserId
=
""
;
String
wxUserId
=
""
;
if
(
corpid
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
wxUserId
=
staffDTO
.
getWxOpenUseId
();
wxUserId
=
staffDTO
.
getWxOpenUseId
();
}
else
{
}
else
{
wxUserId
=
staffDTO
.
getWxUserId
();
wxUserId
=
staffDTO
.
getWxUserId
();
...
@@ -584,8 +584,8 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -584,8 +584,8 @@ public class MessageApiServiceImpl implements MessageApiService {
String
title
=
jsonObject
.
getString
(
"title"
);
String
title
=
jsonObject
.
getString
(
"title"
);
String
content
=
jsonObject
.
getString
(
"content"
);
String
content
=
jsonObject
.
getString
(
"content"
);
String
memberName
=
jsonObject
.
getString
(
"memberName"
);
String
memberName
=
jsonObject
.
getString
(
"memberName"
);
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
log
.
info
(
"企业为空"
);
log
.
info
(
"企业为空"
);
return
;
return
;
}
}
...
@@ -602,21 +602,20 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -602,21 +602,20 @@ public class MessageApiServiceImpl implements MessageApiService {
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
title
);
messageDTO
.
setTitle
(
title
);
messageDTO
.
setItems
(
items
);
messageDTO
.
setItems
(
items
);
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
qywxSuiteApiService
.
sendMessage
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
}
}
@Override
@Override
public
String
getNewWxUserId
(
String
wxEnterpriseId
,
String
wxUserId
)
{
public
String
getNewWxUserId
(
String
wxEnterpriseId
,
String
wxUserId
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
DTO
==
null
)
{
if
(
qw
DTO
==
null
)
{
return
""
;
return
""
;
}
}
String
corpid
=
wxEnterpriseDTO
.
getCorpid
();
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
TabHaobanStaff
tabHaobanStaff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
if
(
tabHaobanStaff
==
null
)
{
if
(
tabHaobanStaff
==
null
)
{
return
""
;
return
""
;
}
}
return
corpid
.
length
()
>
20
?
tabHaobanStaff
.
getWxOpenUseId
()
:
tabHaobanStaff
.
getWxUserId
();
return
qwDTO
.
needOpenUserId3th
()
?
tabHaobanStaff
.
getWxOpenUseId
()
:
tabHaobanStaff
.
getWxUserId
();
}
}
...
@@ -695,7 +694,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -695,7 +694,7 @@ public class MessageApiServiceImpl implements MessageApiService {
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
.
toString
());
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
.
toString
());
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETE_USER
.
getCode
()))
{
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETE_USER
.
getCode
()))
{
log
.
info
(
"成员同步删除,userid:{}"
,
userid
);
log
.
info
(
"成员同步删除,userid:{}"
,
userid
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret,wxEnterpriseId:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置secret,wxEnterpriseId:{}"
,
wxEnterpriseId
);
return
;
return
;
...
@@ -756,7 +755,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -756,7 +755,7 @@ public class MessageApiServiceImpl implements MessageApiService {
return
;
return
;
}
}
String
wxEnterpriseId
=
wxApplication
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
wxApplication
.
getWxEnterpriseId
();
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
return
;
return
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MiniprogramSettingServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.TabMiniprogramSettingMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabMiniprogramSettingMapper
;
import
com.gic.haoban.manage.service.entity.TabMiniprogramSetting
;
import
com.gic.haoban.manage.service.entity.TabMiniprogramSetting
;
...
@@ -11,14 +21,6 @@ import com.gic.haoban.manage.service.service.WxEnterpriseService;
...
@@ -11,14 +21,6 @@ import com.gic.haoban.manage.service.service.WxEnterpriseService;
import
com.gic.haoban.manage.service.util.CommonUtil
;
import
com.gic.haoban.manage.service.util.CommonUtil
;
import
com.gic.wechat.api.enums.QywxMediaTypeEnum
;
import
com.gic.wechat.api.enums.QywxMediaTypeEnum
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
* Created 2021/4/16.
* Created 2021/4/16.
...
@@ -55,8 +57,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
...
@@ -55,8 +57,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
return
miniprogramSetting
;
return
miniprogramSetting
;
}
}
String
[]
arr
=
miniprogramSetting
.
getImageUrl
().
split
(
"/"
);
String
[]
arr
=
miniprogramSetting
.
getImageUrl
().
split
(
"/"
);
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
miniprogramSetting
.
getWxEnterpriseId
())
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
miniprogramSetting
.
getWxEnterpriseId
())
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
miniprogramSetting
.
getImageUrl
()),
arr
[
arr
.
length
-
1
],
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
miniprogramSetting
.
getImageUrl
()),
arr
[
arr
.
length
-
1
],
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
if
(
jp
.
getErrorCode
()
==
0
)
{
if
(
jp
.
getErrorCode
()
==
0
)
{
miniprogramSetting
.
setMediaTime
(
date
);
miniprogramSetting
.
setMediaTime
(
date
);
miniprogramSetting
.
setMediaId
(
jp
.
getResult
().
toString
());
miniprogramSetting
.
setMediaId
(
jp
.
getResult
().
toString
());
...
@@ -105,8 +107,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
...
@@ -105,8 +107,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
return
miniprogramSetting
;
return
miniprogramSetting
;
}
}
String
[]
arr
=
miniprogramSetting
.
getImageUrl
().
split
(
"/"
);
String
[]
arr
=
miniprogramSetting
.
getImageUrl
().
split
(
"/"
);
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
miniprogramSetting
.
getImageUrl
()),
arr
[
arr
.
length
-
1
],
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
miniprogramSetting
.
getImageUrl
()),
arr
[
arr
.
length
-
1
],
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
if
(
jp
.
getErrorCode
()
==
0
)
{
if
(
jp
.
getErrorCode
()
==
0
)
{
miniprogramSetting
.
setMediaTime
(
date
);
miniprogramSetting
.
setMediaTime
(
date
);
miniprogramSetting
.
setMediaId
(
jp
.
getResult
().
toString
());
miniprogramSetting
.
setMediaId
(
jp
.
getResult
().
toString
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/QywxTagApiServiceImpl.java
View file @
7a2e471d
...
@@ -91,12 +91,12 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -91,12 +91,12 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override
@Override
public
void
pullQywxTag
(
String
wxEnterpriseId
)
{
public
void
pullQywxTag
(
String
wxEnterpriseId
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
null
==
wxEnterprise
DTO
)
{
if
(
null
==
qw
DTO
)
{
logger
.
info
(
"企业标签所在企业不存在"
);
logger
.
info
(
"企业标签所在企业不存在"
);
return
;
return
;
}
}
QywxGetCorpTagListDTO
corpTagListResp
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
null
,
-
1
);
QywxGetCorpTagListDTO
corpTagListResp
=
qywxSuiteApiService
.
getCorpTagList
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
null
,
-
1
);
if
(
corpTagListResp
.
getErrcode
()
!=
0
)
{
if
(
corpTagListResp
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"企业微信标签有问题:{}"
,
wxEnterpriseId
);
logger
.
info
(
"企业微信标签有问题:{}"
,
wxEnterpriseId
);
return
;
return
;
...
@@ -111,9 +111,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -111,9 +111,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override
@Override
public
ServiceResponse
syncTagToQywx
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
public
ServiceResponse
syncTagToQywx
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
ServiceResponse
ret
=
new
ServiceResponse
();
ServiceResponse
ret
=
new
ServiceResponse
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//调用企业微信接口保存
//调用企业微信接口保存
QywxGetCorpTagListDTO
resp
=
this
.
saveQywxTag
(
wxEnterpriseDTO
,
infoDTO
,
items
);
QywxGetCorpTagListDTO
resp
=
this
.
saveQywxTag
(
qwDTO
.
getThirdCorpid
()
,
infoDTO
,
items
);
if
(
resp
.
getErrcode
()
!=
0
&&
CollectionUtils
.
isEmpty
(
resp
.
getTagGroup
()))
{
if
(
resp
.
getErrcode
()
!=
0
&&
CollectionUtils
.
isEmpty
(
resp
.
getTagGroup
()))
{
logger
.
info
(
"同步失败:{}"
,
JSONObject
.
toJSONString
(
resp
));
logger
.
info
(
"同步失败:{}"
,
JSONObject
.
toJSONString
(
resp
));
ret
.
setCode
(
resp
.
getErrcode
());
ret
.
setCode
(
resp
.
getErrcode
());
...
@@ -190,7 +190,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -190,7 +190,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
* @param items
* @param items
* @return
* @return
*/
*/
private
QywxGetCorpTagListDTO
saveQywxTag
(
WxEnterpriseDTO
wxEnterpriseDTO
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
private
QywxGetCorpTagListDTO
saveQywxTag
(
String
corpid
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
QywxTagGroupDTO
qywxTagGroupDTO
=
new
QywxTagGroupDTO
();
QywxTagGroupDTO
qywxTagGroupDTO
=
new
QywxTagGroupDTO
();
qywxTagGroupDTO
.
setGroupName
(
"GIC"
+
infoDTO
.
getQywxGroupName
());
qywxTagGroupDTO
.
setGroupName
(
"GIC"
+
infoDTO
.
getQywxGroupName
());
qywxTagGroupDTO
.
setOrder
(
infoDTO
.
getOrder
());
qywxTagGroupDTO
.
setOrder
(
infoDTO
.
getOrder
());
...
@@ -204,13 +204,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -204,13 +204,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
qywxTagGroupDTO
.
setTag
(
tagItems
);
qywxTagGroupDTO
.
setTag
(
tagItems
);
return
qywxSuiteApiService
.
saveCorpTag
(
wxEnterpriseDTO
.
getCorpid
()
,
config
.
getWxSuiteid
(),
qywxTagGroupDTO
);
return
qywxSuiteApiService
.
saveCorpTag
(
corpid
,
config
.
getWxSuiteid
(),
qywxTagGroupDTO
);
}
}
@Override
@Override
public
ServiceResponse
closeSync
(
String
wxEnterpriseId
,
String
memberTagId
)
{
public
ServiceResponse
closeSync
(
String
wxEnterpriseId
,
String
memberTagId
)
{
ServiceResponse
resp
=
new
ServiceResponse
();
ServiceResponse
resp
=
new
ServiceResponse
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
List
<
TabQywxTagRelation
>
tagRelations
=
qywxTagService
.
listQywxTagRelationByMemberTagId
(
wxEnterpriseId
,
memberTagId
);
List
<
TabQywxTagRelation
>
tagRelations
=
qywxTagService
.
listQywxTagRelationByMemberTagId
(
wxEnterpriseId
,
memberTagId
);
if
(
CollectionUtils
.
isEmpty
(
tagRelations
))
{
if
(
CollectionUtils
.
isEmpty
(
tagRelations
))
{
return
resp
;
return
resp
;
...
@@ -220,7 +220,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -220,7 +220,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagService
.
closeSync
(
wxEnterpriseId
,
memberTagId
);
qywxTagService
.
closeSync
(
wxEnterpriseId
,
memberTagId
);
List
<
String
>
delIds
=
new
ArrayList
<>();
List
<
String
>
delIds
=
new
ArrayList
<>();
delIds
.
add
(
tabQywxTag
.
getQywxGroupKey
());
delIds
.
add
(
tabQywxTag
.
getQywxGroupKey
());
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
delCorpTag
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
delIds
,
0
);
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
delCorpTag
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
delIds
,
0
);
logger
.
info
(
"关闭同步:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
logger
.
info
(
"关闭同步:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
...
@@ -234,7 +234,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -234,7 +234,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override
@Override
public
ServiceResponse
delGicTagItem
(
String
wxEnterpriseId
,
String
tagItemId
)
{
public
ServiceResponse
delGicTagItem
(
String
wxEnterpriseId
,
String
tagItemId
)
{
ServiceResponse
resp
=
new
ServiceResponse
();
ServiceResponse
resp
=
new
ServiceResponse
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
TabQywxTagRelation
qywxTagRelation
=
qywxTagService
.
getQywxTagRelationByTagItemId
(
wxEnterpriseId
,
tagItemId
);
TabQywxTagRelation
qywxTagRelation
=
qywxTagService
.
getQywxTagRelationByTagItemId
(
wxEnterpriseId
,
tagItemId
);
if
(
null
==
qywxTagRelation
)
{
if
(
null
==
qywxTagRelation
)
{
resp
.
setMessage
(
"没有同步,无需删除"
);
resp
.
setMessage
(
"没有同步,无需删除"
);
...
@@ -244,7 +244,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -244,7 +244,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
List
<
String
>
delIds
=
new
ArrayList
<>();
List
<
String
>
delIds
=
new
ArrayList
<>();
delIds
.
add
(
qywxTagItem
.
getQywxTagKey
());
delIds
.
add
(
qywxTagItem
.
getQywxTagKey
());
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
delCorpTag
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
delIds
,
1
);
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
delCorpTag
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
delIds
,
1
);
logger
.
info
(
"删除标签项:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
logger
.
info
(
"删除标签项:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
...
@@ -281,12 +281,14 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -281,12 +281,14 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger
.
error
(
"未找到对应关系,{}"
,
callbackDTO
.
getTagType
());
logger
.
error
(
"未找到对应关系,{}"
,
callbackDTO
.
getTagType
());
return
;
return
;
}
}
String
wxEnterpriseId
=
wxEnterpriseDto
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//标签组
//标签组
if
(
Objects
.
equals
(
relationTypeEnum
.
getTagType
(),
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getTagType
()))
{
if
(
Objects
.
equals
(
relationTypeEnum
.
getTagType
(),
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getTagType
()))
{
logger
.
info
(
"新增标签组无需操作:{}"
,
callbackDTO
.
getTagId
());
logger
.
info
(
"新增标签组无需操作:{}"
,
callbackDTO
.
getTagId
());
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
callbackDTO
.
getTagId
());
ids
.
add
(
callbackDTO
.
getTagId
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterpriseDto
.
get
Corpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"没有关联,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
logger
.
info
(
"没有关联,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
return
;
return
;
...
@@ -299,7 +301,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -299,7 +301,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//查找对应的标签组 如果标签组关联了
//查找对应的标签组 如果标签组关联了
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
callbackDTO
.
getTagId
());
ids
.
add
(
callbackDTO
.
getTagId
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterpriseDto
.
get
Corpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
());
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"查询失败,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
logger
.
info
(
"查询失败,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
return
;
return
;
...
@@ -390,6 +392,8 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -390,6 +392,8 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger
.
error
(
"未找到对应关系,{}"
,
callbackDTO
.
getTagType
());
logger
.
error
(
"未找到对应关系,{}"
,
callbackDTO
.
getTagType
());
return
;
return
;
}
}
String
wxEnterpriseId
=
wxEnterpriseDto
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//标签组
//标签组
if
(
Objects
.
equals
(
relationTypeEnum
.
getTagType
(),
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getTagType
()))
{
if
(
Objects
.
equals
(
relationTypeEnum
.
getTagType
(),
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getTagType
()))
{
//判断是否存在关联 存在需要同步回去
//判断是否存在关联 存在需要同步回去
...
@@ -404,7 +408,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -404,7 +408,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagDTO
.
setId
(
callbackDTO
.
getTagId
());
qywxTagDTO
.
setId
(
callbackDTO
.
getTagId
());
qywxTagDTO
.
setName
(
qywxGroupKey
.
getQywxGroupName
());
qywxTagDTO
.
setName
(
qywxGroupKey
.
getQywxGroupName
());
qywxTagDTO
.
setOrder
(
qywxGroupKey
.
getOrder
());
qywxTagDTO
.
setOrder
(
qywxGroupKey
.
getOrder
());
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
wxEnterpriseDto
.
get
Corpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
//标签项
//标签项
}
else
if
(
Objects
.
equals
(
relationTypeEnum
.
getTagType
(),
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getTagType
()))
{
}
else
if
(
Objects
.
equals
(
relationTypeEnum
.
getTagType
(),
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getTagType
()))
{
...
@@ -424,7 +428,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -424,7 +428,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagDTO
.
setId
(
callbackDTO
.
getTagId
());
qywxTagDTO
.
setId
(
callbackDTO
.
getTagId
());
qywxTagDTO
.
setName
(
qywxTagItem
.
getQywxTagName
());
qywxTagDTO
.
setName
(
qywxTagItem
.
getQywxTagName
());
qywxTagDTO
.
setOrder
(
qywxTagItem
.
getOrder
());
qywxTagDTO
.
setOrder
(
qywxTagItem
.
getOrder
());
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
wxEnterpriseDto
.
get
Corpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
}
}
}
}
...
@@ -444,10 +448,10 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -444,10 +448,10 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
Set
<
String
>
entQywxTagKeys
=
tagItemIds
.
stream
().
filter
(
tagItemId
->
syncTagFormat
.
getGicToQywxTagItemIdMap
().
containsKey
(
tagItemId
))
Set
<
String
>
entQywxTagKeys
=
tagItemIds
.
stream
().
filter
(
tagItemId
->
syncTagFormat
.
getGicToQywxTagItemIdMap
().
containsKey
(
tagItemId
))
.
map
(
tagItemId
->
syncTagFormat
.
getGicToQywxTagItemIdMap
().
get
(
tagItemId
)).
collect
(
Collectors
.
toSet
());
.
map
(
tagItemId
->
syncTagFormat
.
getGicToQywxTagItemIdMap
().
get
(
tagItemId
)).
collect
(
Collectors
.
toSet
());
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//查询外部联系人
//查询外部联系人
String
wxSuiteid
=
config
.
getWxSuiteid
();
String
wxSuiteid
=
config
.
getWxSuiteid
();
String
externalUseridInfo
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
get
Corpid
(),
wxSuiteid
,
externalUserId
);
String
externalUseridInfo
=
qywxUserApiService
.
getExternalUseridInfo
(
qwDTO
.
getThird
Corpid
(),
wxSuiteid
,
externalUserId
);
if
(
StringUtils
.
isBlank
(
externalUseridInfo
))
{
if
(
StringUtils
.
isBlank
(
externalUseridInfo
))
{
logger
.
info
(
"好友不存在"
);
logger
.
info
(
"好友不存在"
);
resp
.
setCode
(
3
);
resp
.
setCode
(
3
);
...
@@ -490,7 +494,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -490,7 +494,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}
}
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"corpid"
,
wxEnterprise
.
get
Corpid
());
jsonObject
.
put
(
"corpid"
,
qwDTO
.
getThird
Corpid
());
jsonObject
.
put
(
"suiteId"
,
wxSuiteid
);
jsonObject
.
put
(
"suiteId"
,
wxSuiteid
);
jsonObject
.
put
(
"wxUserId"
,
wxUserId
);
jsonObject
.
put
(
"wxUserId"
,
wxUserId
);
jsonObject
.
put
(
"externalUserId"
,
externalUserId
);
jsonObject
.
put
(
"externalUserId"
,
externalUserId
);
...
@@ -565,9 +569,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -565,9 +569,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//企业微信同步的标签key
//企业微信同步的标签key
Set
<
String
>
qywxTagKeys
=
syncTagFormatPojo
.
getQywxToGicTagItemIdMap
().
keySet
();
Set
<
String
>
qywxTagKeys
=
syncTagFormatPojo
.
getQywxToGicTagItemIdMap
().
keySet
();
WxEnterprise
DTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//查询外部联系人
//查询外部联系人
String
externalUseridInfo
=
qywxUserApiService
.
getExternalUseridInfo
(
enterpriseDTO
.
getCorpid
()
,
config
.
getWxSuiteid
(),
externalUserId
);
String
externalUseridInfo
=
qywxUserApiService
.
getExternalUseridInfo
(
qwDTO
.
getThirdCorpid
()
,
config
.
getWxSuiteid
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
externalUseridInfo
))
{
if
(
StringUtils
.
isBlank
(
externalUseridInfo
))
{
logger
.
info
(
"好友不存在"
);
logger
.
info
(
"好友不存在"
);
resp
.
setCode
(
2
);
resp
.
setCode
(
2
);
...
@@ -754,14 +758,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -754,14 +758,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
order
=
qywxTagItem
.
getOrder
();
order
=
qywxTagItem
.
getOrder
();
relationId
=
qywxTagItem
.
getQywxTagItemId
();
relationId
=
qywxTagItem
.
getQywxTagItemId
();
}
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//名称同步回去
//名称同步回去
QywxTagDTO
qywxTagDTO
=
new
QywxTagDTO
();
QywxTagDTO
qywxTagDTO
=
new
QywxTagDTO
();
qywxTagDTO
.
setId
(
renameQywxKey
);
qywxTagDTO
.
setId
(
renameQywxKey
);
qywxTagDTO
.
setName
(
name
);
qywxTagDTO
.
setName
(
name
);
qywxTagDTO
.
setOrder
(
order
);
qywxTagDTO
.
setOrder
(
order
);
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
logger
.
info
(
"同步名称:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
logger
.
info
(
"同步名称:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
...
@@ -841,10 +844,10 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
...
@@ -841,10 +844,10 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
return
ret
;
return
ret
;
}
}
ret
.
put
(
"名称(标签)"
,
tabQywxTag
.
getQywxGroupName
());
ret
.
put
(
"名称(标签)"
,
tabQywxTag
.
getQywxGroupName
());
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
relation
.
getWxEnterpriseId
())
;
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
tabQywxTag
.
getQywxGroupKey
());
ids
.
add
(
tabQywxTag
.
getQywxGroupKey
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterprise
.
get
Corpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"查询失败,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
logger
.
info
(
"查询失败,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
ret
.
put
(
"描述"
,
"查询失败:"
+
tagDetail
.
getErrmsg
());
ret
.
put
(
"描述"
,
"查询失败:"
+
tagDetail
.
getErrmsg
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.ClerkService
;
...
@@ -13,27 +28,48 @@ import com.gic.commons.util.GlobalInfo;
...
@@ -13,27 +28,48 @@ import com.gic.commons.util.GlobalInfo;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.commons.util.ImageUtil
;
import
com.gic.commons.util.ImageUtil
;
import
com.gic.enterprise.api.dto.EnterpriseSettingDTO
;
import
com.gic.enterprise.api.dto.EnterpriseSettingDTO
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.dto.StoreGroupDTO
;
import
com.gic.enterprise.api.dto.StoreGroupDTO
;
import
com.gic.enterprise.api.dto.StoreWidgetDTO
;
import
com.gic.enterprise.api.dto.StoreWidgetDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.enterprise.api.service.StoreWidgetService
;
import
com.gic.enterprise.api.service.StoreWidgetService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.RolesListUtils
;
import
com.gic.haoban.common.utils.RolesListUtils
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.common.utils.UuidUtil
;
import
com.gic.haoban.common.utils.UuidUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO
;
import
com.gic.haoban.manage.api.dto.StaffQrCodeDTO
;
import
com.gic.haoban.manage.api.dto.UserLoginLogDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffPrivacyUseLogService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.StoreRangeService
;
import
com.gic.haoban.manage.service.service.SyncErrorLogService
;
import
com.gic.haoban.manage.service.service.UserLoginLogService
;
import
com.gic.haoban.manage.service.service.WxApplicationService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
...
@@ -44,16 +80,8 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
...
@@ -44,16 +80,8 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
cn.hutool.core.collection.CollectionUtil
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
StaffApiServiceImpl
implements
StaffApiService
{
public
class
StaffApiServiceImpl
implements
StaffApiService
{
...
@@ -76,10 +104,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -76,10 +104,6 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired
@Autowired
private
ClerkService
clerkService
;
private
ClerkService
clerkService
;
@Autowired
@Autowired
private
com
.
gic
.
enterprise
.
api
.
service
.
DepartmentService
gicDepartmentService
;
@Autowired
private
StoreService
storeService
;
@Autowired
private
StoreGroupService
storeGroupService
;
private
StoreGroupService
storeGroupService
;
@Autowired
@Autowired
private
UserLoginLogService
userLoginLogService
;
private
UserLoginLogService
userLoginLogService
;
...
@@ -125,85 +149,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -125,85 +149,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
@Override
@Override
public
ServiceResponse
add
(
StaffDTO
staff
,
String
departmentIds
)
{
ServiceResponse
hr
=
new
ServiceResponse
();
hr
.
setCode
(
1
);
Integer
activeFlag
=
staff
.
getActiveFlag
();
staff
.
setActiveFlag
(
0
);
Integer
syncPostionFlag
=
staff
.
getSyncPostionFlag
();
if
(
syncPostionFlag
!=
null
&&
syncPostionFlag
==
1
)
{
staff
.
setExtendPostion
(
staff
.
getPostion
());
}
TabHaobanStaff
tab
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaff
.
class
,
staff
);
String
staffId
=
StringUtil
.
randomUUID
();
tab
.
setStaffId
(
staffId
);
//调接口获取
String
wxUserId
=
""
;
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
staff
.
getWxEnterpriseId
());
if
(
enterpriseDTO
!=
null
)
{
UserDTO
userDTO
=
new
UserDTO
();
userDTO
.
setCorpid
(
enterpriseDTO
.
getCorpid
());
String
[]
departmentIdArr
=
departmentIds
.
split
(
","
);
Integer
[]
wxDepartmentIdArrIntegers
=
new
Integer
[
departmentIdArr
.
length
];
int
index
=
0
;
for
(
String
string
:
departmentIdArr
)
{
TabHaobanDepartment
tabs
=
departmentService
.
selectById
(
string
);
wxDepartmentIdArrIntegers
[
index
]
=
Integer
.
parseInt
(
tabs
.
getWxDepartmentId
());
index
++;
}
userDTO
.
setDepartment
(
wxDepartmentIdArrIntegers
);
userDTO
.
setGender
(
staff
.
getSex
()
==
null
?
null
:
staff
.
getSex
().
toString
());
userDTO
.
setMobile
(
staff
.
getPhoneNumber
());
userDTO
.
setName
(
staff
.
getStaffName
());
userDTO
.
setUserid
(
staffId
);
userDTO
.
setAlias
(
staff
.
getNickName
());
userDTO
.
setExternal_position
(
tab
.
getExtendPostion
());
userDTO
.
setPosition
(
tab
.
getPostion
());
if
(
activeFlag
==
1
)
{
userDTO
.
setTo_invite
(
true
);
}
if
(
RedisUtil
.
getCache
(
"is-to-invite-send"
)
!=
null
)
{
userDTO
.
setTo_invite
(
false
);
}
logger
.
info
(
"【店员新增】userDTO = {}"
,
JSON
.
toJSONString
(
userDTO
));
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CONTACT_SECRET
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"没配置通讯录secret"
);
return
hr
;
}
JSONResponse
jp
=
qywxUserApiService
.
createSelfWorkWxUser
(
userDTO
,
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
());
logger
.
info
(
"【店员新增】jp = {}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
!=
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信新增失败:"
+
jp
.
getErrorCode
());
return
hr
;
}
staffService
.
add
(
tab
);
wxUserId
=
staffId
;
}
if
(
StringUtils
.
isNotBlank
(
wxUserId
))
{
String
[]
departmentIdArr
=
departmentIds
.
split
(
","
);
for
(
String
string
:
departmentIdArr
)
{
StaffDepartmentRelatedDTO
related
=
new
StaffDepartmentRelatedDTO
();
related
.
setDepartmentId
(
string
);
related
.
setNationCode
(
staff
.
getNationCode
());
related
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
related
.
setStaffId
(
staffId
);
related
.
setWxUserId
(
wxUserId
);
related
.
setStaffName
(
staff
.
getStaffName
());
related
.
setWxEnterpriseId
(
staff
.
getWxEnterpriseId
());
staffDepartmentRelatedService
.
add
(
related
);
}
}
else
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信端新增失败"
);
}
hr
.
setResult
(
staffId
);
return
hr
;
}
@Override
public
List
<
StaffDepartmentRelatedDTO
>
listStaffDepartmentByStaffId
(
String
staffId
)
{
public
List
<
StaffDepartmentRelatedDTO
>
listStaffDepartmentByStaffId
(
String
staffId
)
{
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staffId
);
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staffId
);
return
EntityUtil
.
changeEntityListByJSON
(
StaffDepartmentRelatedDTO
.
class
,
list
);
return
EntityUtil
.
changeEntityListByJSON
(
StaffDepartmentRelatedDTO
.
class
,
list
);
...
@@ -231,22 +176,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -231,22 +176,6 @@ public class StaffApiServiceImpl implements StaffApiService {
return
page
;
return
page
;
}
}
private
Set
<
String
>
filterByRelationFlag
(
Set
<
String
>
sourceStaffSet
,
Set
<
String
>
relationStaffSet
,
Integer
relationFlag
)
{
// 为空默认全部
if
(
Objects
.
isNull
(
relationFlag
))
{
return
sourceStaffSet
;
}
// 已关联 1 未关联 0
if
(
relationFlag
==
1
)
{
// 已关联用已关联id查询
return
relationStaffSet
;
}
// 未关联 0 , 取原集合与关联集合的-差集
sourceStaffSet
.
removeAll
(
relationStaffSet
);
// 差集处理成功返回
return
sourceStaffSet
;
}
@Override
@Override
public
List
<
StaffDTO
>
listByIds
(
List
<
String
>
staffIds
)
{
public
List
<
StaffDTO
>
listByIds
(
List
<
String
>
staffIds
)
{
if
(
CollectionUtil
.
isEmpty
(
staffIds
))
{
if
(
CollectionUtil
.
isEmpty
(
staffIds
))
{
...
@@ -262,57 +191,19 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -262,57 +191,19 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
@Override
@Override
public
void
del
(
String
staffDepartmentStaffRelatedId
)
{
}
@Override
public
void
cleanGicClerk
(
String
code
,
String
departmentId
)
{
if
(
true
)
{
return
;
}
if
(
StringUtils
.
isNotBlank
(
code
))
{
TabHaobanDepartment
department
=
departmentService
.
selectById
(
departmentId
);
String
enterpriseId
=
""
;
if
(
department
.
getIsStore
()
==
0
)
{
com
.
gic
.
enterprise
.
api
.
dto
.
DepartmentDTO
dto
=
gicDepartmentService
.
getDeptment
(
department
.
getRelatedId
());
if
(
dto
==
null
)
{
StoreGroupDTO
group
=
storeGroupService
.
getStoreGroupById
(
department
.
getRelatedId
());
if
(
group
!=
null
)
{
enterpriseId
=
group
.
getEnterpriseId
();
}
}
else
{
enterpriseId
=
dto
.
getEnterpriseId
();
}
}
else
{
StoreDTO
store
=
storeService
.
getStore
(
department
.
getRelatedId
());
enterpriseId
=
store
.
getEnterpriseId
();
}
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByCodeNoStatus
(
enterpriseId
,
code
);
if
(
clerkDTO
!=
null
)
{
if
(!
clerkDTO
.
getPhoneNumber
().
equals
(
"--"
)
&&
StringUtils
.
isNotBlank
(
clerkDTO
.
getPhoneNumber
()))
{
logger
.
info
(
"【员工修改】clerkDTO={}"
,
JSON
.
toJSONString
(
clerkDTO
));
clerkDTO
.
setPhoneNumber
(
"--"
);
clerkService
.
updateClerk
(
clerkDTO
);
}
}
}
}
@Override
public
ServiceResponse
getWxSaveNew
(
String
userId
,
String
wxEnterpriseId
)
{
public
ServiceResponse
getWxSaveNew
(
String
userId
,
String
wxEnterpriseId
)
{
ServiceResponse
res
=
new
ServiceResponse
();
ServiceResponse
res
=
new
ServiceResponse
();
WxEnterprise
DTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
null
==
enterprise
DTO
)
{
if
(
null
==
qw
DTO
)
{
logger
.
info
(
"企业不存在:{}:{}"
,
wxEnterpriseId
,
userId
);
logger
.
info
(
"企业不存在:{}:{}"
,
wxEnterpriseId
,
userId
);
res
.
setMessage
(
"企业不存在"
);
res
.
setMessage
(
"企业不存在"
);
res
.
setCode
(
2
);
res
.
setCode
(
2
);
return
res
;
return
res
;
}
}
String
corpid
=
enterpriseDTO
.
getCorpid
()
;
String
corpid
=
qwDTO
.
getDkCorpid
()
;
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
qwDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterprise
DTO
));
logger
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
qw
DTO
));
res
.
setMessage
(
"没有配置secret"
);
res
.
setMessage
(
"没有配置secret"
);
res
.
setCode
(
4
);
res
.
setCode
(
4
);
return
res
;
return
res
;
...
@@ -412,26 +303,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -412,26 +303,6 @@ public class StaffApiServiceImpl implements StaffApiService {
return
qywxNewUseridDTOS
.
get
(
0
).
getOpen_userid
();
return
qywxNewUseridDTOS
.
get
(
0
).
getOpen_userid
();
}
}
/**
* 获取wxuserid
*
* @param openUserId
* @param wxEnterpriseId wx企业标识
* @return {@link String }
* @author mozhu
* @date 2022-07-19 11:19:44
*/
private
String
getUserid
(
String
openUserId
,
String
wxEnterpriseId
)
{
TabHaobanWxApplication
tabHaobanWxApplication
=
wxApplicationService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
3
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
tabHaobanWxApplication
.
getWxEnterpriseId
(),
5
);
List
<
QywxNewUseridDTO
>
qywxNewUseridDTOS
=
qywxUserApiService
.
getSelfOpenuseridToUserid
(
tabHaobanWxApplication
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
tabHaobanWxApplication
.
getAgentId
(),
Collections
.
singletonList
(
openUserId
));
if
(
CollectionUtils
.
isEmpty
(
qywxNewUseridDTOS
))
{
return
""
;
}
return
qywxNewUseridDTOS
.
get
(
0
).
getUserid
();
}
private
String
[]
getNationCodeAndPhoneNumber
(
String
phoneNumber
)
{
private
String
[]
getNationCodeAndPhoneNumber
(
String
phoneNumber
)
{
String
[]
arr
=
new
String
[
2
];
String
[]
arr
=
new
String
[
2
];
if
(
StringUtils
.
isBlank
(
phoneNumber
))
{
if
(
StringUtils
.
isBlank
(
phoneNumber
))
{
...
@@ -707,170 +578,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -707,170 +578,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
@Override
@Override
public
int
countByDepartmentId
(
String
departmentId
)
{
return
staffDepartmentRelatedService
.
countByDepartmentId
(
departmentId
);
}
@Override
public
StaffDTO
selectSuperByWxEnterpriseId
(
String
wxEnterpriseId
)
{
TabHaobanStaff
tab
=
staffMapper
.
selectSuperByWxEnterpriseId
(
wxEnterpriseId
);
return
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
tab
);
}
@Override
public
void
addGicClerk
(
GicClerkDTO
clerkDTO
)
{
logger
.
info
(
"同步gic店员:{}"
,
JSONObject
.
toJSONString
(
clerkDTO
));
addClerkByGic
(
clerkDTO
);
}
@Override
public
void
syncGicClerk
(
String
fieldListString
)
{
if
(
true
)
{
return
;
}
}
private
void
addClerkByGic
(
GicClerkDTO
clerkDTO
)
{
String
gicStoreId
=
clerkDTO
.
getStoreId
();
String
code
=
clerkDTO
.
getClerkCode
();
String
staffName
=
clerkDTO
.
getClerkName
();
String
phoneNumber
=
clerkDTO
.
getPhoneNumber
();
String
nationcode
=
clerkDTO
.
getNationcode
();
Integer
sex
=
clerkDTO
.
getClerkGender
();
String
headPic
=
clerkDTO
.
getHeadImgUrl
();
Integer
status
=
clerkDTO
.
getStatus
();
if
(
status
==
null
)
{
status
=
1
;
}
String
postion
=
clerkDTO
.
getPostionName
();
String
enterpriseId
=
clerkDTO
.
getEnterpriseId
();
if
(
StringUtils
.
isBlank
(
gicStoreId
))
{
logger
.
info
(
"【店员同步】gicStoreId为空"
);
return
;
}
TabHaobanDepartment
department
=
departmentService
.
selectByRelatedId
(
gicStoreId
);
if
(
department
==
null
)
{
logger
.
info
(
"【店员同步】失败====department为空"
);
return
;
}
String
departmentId
=
department
.
getDepartmentId
();
String
wxEnterpriseId
=
department
.
getWxEnterpriseId
();
StaffDTO
staff
=
checkAndInitUser
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
staff
==
null
)
{
if
(
status
!=
1
)
{
return
;
}
staff
=
new
StaffDTO
();
staff
.
setWxEnterpriseId
(
wxEnterpriseId
);
staff
.
setClerkCode
(
code
);
staff
.
setActiveFlag
(
1
);
staff
.
setDepartmentIds
(
departmentId
);
staff
.
setHeadImg
(
headPic
);
staff
.
setNationCode
(
nationcode
);
staff
.
setPhoneNumber
(
phoneNumber
);
staff
.
setPostion
(
postion
);
staff
.
setSex
(
sex
);
staff
.
setStaffName
(
staffName
);
staff
.
setNickName
(
staffName
);
staff
.
setSyncPostionFlag
(
1
);
StaffDepartmentRelatedDTO
isCodeExist
=
this
.
getDepartmentIdAndCode
(
departmentId
,
code
);
logger
.
info
(
"【gic导购新增】isCodeExist={}"
,
JSON
.
toJSONString
(
isCodeExist
));
//如果这个code已经绑定了 先解绑
if
(
isCodeExist
!=
null
)
{
isCodeExist
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
isCodeExist
));
}
ServiceResponse
hr
=
this
.
add
(
staff
,
department
.
getDepartmentId
());
if
(
hr
.
getCode
()
==
1
)
{
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
hr
.
getResult
().
toString
());
logger
.
info
(
"【gic导购新增】staffRelated={}"
,
JSON
.
toJSONString
(
staffRelated
));
//绑定
if
(
staffRelated
!=
null
)
{
staffRelated
.
setClerkCode
(
code
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
}
}
else
{
String
staffId
=
staff
.
getStaffId
();
logger
.
info
(
"【员工修改】staff={},status={}"
,
JSON
.
toJSONString
(
staff
),
status
);
//删除
if
(
status
==
0
)
{
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
if
(
staffRelated
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
staffRelated
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
//修改
}
else
{
staff
.
setHeadImg
(
headPic
);
staff
.
setSex
(
sex
);
if
(
staff
.
getActiveFlag
()
!=
null
&&
staff
.
getActiveFlag
()
!=
1
)
{
staff
.
setStaffName
(
staffName
);
}
List
<
StaffDepartmentRelatedDTO
>
relatedList
=
this
.
listStaffDepartmentByStaffId
(
staffId
);
Map
<
String
,
StaffDepartmentRelatedDTO
>
map
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
relatedList
,
"departmentId"
);
String
departmentIds
=
""
;
if
(
map
.
get
(
departmentId
)
==
null
)
{
departmentIds
=
departmentId
;
}
for
(
StaffDepartmentRelatedDTO
staffDepartmentRelatedDTO
:
relatedList
)
{
departmentIds
+=
","
+
staffDepartmentRelatedDTO
.
getDepartmentId
();
}
if
(
departmentIds
.
startsWith
(
","
))
{
departmentIds
=
departmentIds
.
substring
(
1
);
}
if
(
map
.
get
(
departmentId
)
==
null
)
{
this
.
staffEditDeal
(
staff
,
departmentIds
);
}
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
StaffDepartmentRelatedDTO
isCodeExist
=
this
.
getDepartmentIdAndCode
(
departmentId
,
code
);
//如果这个人已经绑定了 先解绑
if
(
isCodeExist
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
isCodeExist
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
isCodeExist
));
}
//如果这个人是未绑定的 则绑定clerk
if
(
staffRelated
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
staffRelated
.
setClerkCode
(
code
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
this
.
staffEditDeal
(
staff
,
departmentIds
);
}
}
}
private
StaffDTO
checkAndInitUser
(
String
wxEnterpriseId
,
String
nationcode
,
String
phoneNumber
)
{
logger
.
info
(
"校验获取信息:{}"
,
phoneNumber
);
StaffDTO
staff
=
this
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
null
!=
staff
)
{
return
staff
;
}
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
null
==
enterpriseDTO
)
{
return
null
;
}
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
;
}
wxGetAdd
(
userId
,
wxEnterpriseId
);
return
this
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
);
}
@Override
public
StaffDepartmentRelatedDTO
getDepartmentIdAndCode
(
String
departmentId
,
String
code
)
{
public
StaffDepartmentRelatedDTO
getDepartmentIdAndCode
(
String
departmentId
,
String
code
)
{
return
EntityUtil
.
changeEntityByJSON
(
StaffDepartmentRelatedDTO
.
class
,
staffDepartmentRelatedMapper
.
getDepartmentIdAndCode
(
departmentId
,
code
));
return
EntityUtil
.
changeEntityByJSON
(
StaffDepartmentRelatedDTO
.
class
,
staffDepartmentRelatedMapper
.
getDepartmentIdAndCode
(
departmentId
,
code
));
}
}
...
@@ -932,139 +639,10 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -932,139 +639,10 @@ public class StaffApiServiceImpl implements StaffApiService {
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
Collections
.
EMPTY_LIST
;
return
Collections
.
EMPTY_LIST
;
}
}
/*for (StaffDTO staffDTO : list) {
List<String> departmentIds = new ArrayList<>();
List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffDTO.getStaffId());
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : relatedList) {
departmentIds.add(tabHaobanStaffDepartmentRelated.getDepartmentId());
}
List<DepartmentDTO> departmentList = departmentService.listByIds(departmentIds);
staffDTO.setDepartmentList(departmentList);
}*/
this
.
addDepartInfo
(
list
);
this
.
addDepartInfo
(
list
);
return
list
;
return
list
;
}
}
@Override
public
ServiceResponse
saveSyncStaffByGic
(
GicClerkDTO
clerkDTO
)
{
ServiceResponse
response
=
new
ServiceResponse
();
if
(
clerkDTO
==
null
)
{
response
.
setCode
(
0
);
response
.
setMessage
(
"参数错误"
);
return
response
;
}
if
(
StringUtils
.
isBlank
(
clerkDTO
.
getStoreId
()))
{
logger
.
info
(
"【店员同步】gicStoreId为空"
);
response
.
setCode
(
0
);
response
.
setMessage
(
"【店员同步】gicStoreId为空"
);
return
response
;
}
TabHaobanDepartment
department
=
departmentService
.
selectByRelatedId
(
clerkDTO
.
getStoreId
());
if
(
department
==
null
)
{
logger
.
info
(
"【店员同步】失败====department为空:{}"
,
clerkDTO
.
getStoreId
());
response
.
setCode
(
0
);
response
.
setMessage
(
"部门门店不存在"
);
return
response
;
}
String
departmentId
=
department
.
getDepartmentId
();
String
wxEnterpriseId
=
department
.
getWxEnterpriseId
();
StaffDTO
staff
=
checkAndInitUser
(
wxEnterpriseId
,
clerkDTO
.
getNationcode
(),
clerkDTO
.
getPhoneNumber
());
if
(
staff
==
null
)
{
if
(
clerkDTO
.
getStatus
()
!=
1
)
{
response
.
setCode
(
0
);
response
.
setMessage
(
"成员当前状态非正常"
+
clerkDTO
.
getStatus
());
return
response
;
}
staff
=
new
StaffDTO
();
staff
.
setWxEnterpriseId
(
wxEnterpriseId
);
staff
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
staff
.
setActiveFlag
(
1
);
staff
.
setDepartmentIds
(
departmentId
);
staff
.
setHeadImg
(
clerkDTO
.
getHeadImgUrl
());
staff
.
setNationCode
(
clerkDTO
.
getNationcode
());
staff
.
setPhoneNumber
(
clerkDTO
.
getPhoneNumber
());
staff
.
setPostion
(
clerkDTO
.
getPostionName
());
staff
.
setSex
(
clerkDTO
.
getClerkGender
());
staff
.
setStaffName
(
clerkDTO
.
getClerkName
());
staff
.
setNickName
(
clerkDTO
.
getClerkName
());
staff
.
setSyncPostionFlag
(
1
);
StaffDepartmentRelatedDTO
isCodeExist
=
this
.
getDepartmentIdAndCode
(
departmentId
,
clerkDTO
.
getClerkCode
());
logger
.
info
(
"【gic导购新增】isCodeExist={}"
,
JSON
.
toJSONString
(
isCodeExist
));
//如果这个code已经绑定了 先解绑
if
(
isCodeExist
!=
null
)
{
isCodeExist
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
isCodeExist
));
}
ServiceResponse
hr
=
this
.
add
(
staff
,
department
.
getDepartmentId
());
if
(
hr
.
getCode
()
==
1
)
{
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
hr
.
getResult
().
toString
());
logger
.
info
(
"【gic导购新增】staffRelated={}"
,
JSON
.
toJSONString
(
staffRelated
));
//绑定
if
(
staffRelated
!=
null
)
{
staffRelated
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
}
else
{
response
.
setCode
(
0
);
response
.
setMessage
(
hr
.
getMessage
());
return
response
;
}
}
else
{
String
staffId
=
staff
.
getStaffId
();
logger
.
info
(
"【员工修改】staff={},status={}"
,
JSON
.
toJSONString
(
staff
),
clerkDTO
.
getStatus
());
//删除
if
(
clerkDTO
.
getStatus
()
==
0
)
{
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
if
(
staffRelated
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
staffRelated
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
//修改
}
else
{
staff
.
setHeadImg
(
clerkDTO
.
getHeadImgUrl
());
staff
.
setSex
(
clerkDTO
.
getClerkGender
());
//staff.setPostion(postion);
// staff.setStaffName(staffName);
if
(
staff
.
getActiveFlag
()
!=
null
&&
staff
.
getActiveFlag
()
!=
1
)
{
staff
.
setStaffName
(
clerkDTO
.
getClerkName
());
}
List
<
StaffDepartmentRelatedDTO
>
relatedList
=
this
.
listStaffDepartmentByStaffId
(
staffId
);
Map
<
String
,
StaffDepartmentRelatedDTO
>
map
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
relatedList
,
"departmentId"
);
String
departmentIds
=
""
;
if
(
map
.
get
(
departmentId
)
==
null
)
{
departmentIds
=
departmentId
;
}
for
(
StaffDepartmentRelatedDTO
staffDepartmentRelatedDTO
:
relatedList
)
{
departmentIds
+=
","
+
staffDepartmentRelatedDTO
.
getDepartmentId
();
}
if
(
departmentIds
.
startsWith
(
","
))
{
departmentIds
=
departmentIds
.
substring
(
1
);
}
if
(
map
.
get
(
departmentId
)
==
null
)
{
this
.
staffEdit
(
staff
,
departmentIds
);
}
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
StaffDepartmentRelatedDTO
isCodeExist
=
this
.
getDepartmentIdAndCode
(
departmentId
,
clerkDTO
.
getClerkCode
());
//如果这个人已经绑定了 先解绑
if
(
isCodeExist
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
isCodeExist
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
isCodeExist
));
}
//如果这个人是未绑定的 则绑定clerk
if
(
staffRelated
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
staffRelated
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
this
.
staffEdit
(
staff
,
departmentIds
);
}
}
return
response
;
}
private
String
changeHeaderImageUrl
(
String
headImgUrl
)
{
private
String
changeHeaderImageUrl
(
String
headImgUrl
)
{
try
{
try
{
logger
.
info
(
"图片headImgUrl:{}"
,
headImgUrl
);
logger
.
info
(
"图片headImgUrl:{}"
,
headImgUrl
);
...
@@ -1104,13 +682,13 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1104,13 +682,13 @@ public class StaffApiServiceImpl implements StaffApiService {
resp
.
setResult
((
String
)
url
);
resp
.
setResult
((
String
)
url
);
return
resp
;
return
resp
;
}
}
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
relationDTO
.
getWxEnterpriseId
())
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
relationDTO
.
getWxEnterpriseId
())
;
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
qwDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
wxEnterprise
DTO
.
getWxEnterpriseId
());
logger
.
info
(
"没有配置secret:{}"
,
qw
DTO
.
getWxEnterpriseId
());
return
null
;
return
null
;
}
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterpriseDTO
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
relationDTO
.
getWxUserId
());
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
qwDTO
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
relationDTO
.
getWxUserId
());
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
RedisUtil
.
setCache
(
key
,
user
.
getQr_code
(),
2L
,
TimeUnit
.
DAYS
);
RedisUtil
.
setCache
(
key
,
user
.
getQr_code
(),
2L
,
TimeUnit
.
DAYS
);
resp
.
setResult
(
user
.
getQr_code
());
resp
.
setResult
(
user
.
getQr_code
());
...
@@ -1180,22 +758,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1180,22 +758,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
@Override
@Override
public
StaffDTO
getAndAddSupperAdmin
(
String
wxEnterpriseId
)
{
TabHaobanStaff
haobanStaff
=
staffMapper
.
selectSuperByWxEnterpriseId
(
wxEnterpriseId
);
if
(
haobanStaff
!=
null
)
{
return
EntityUtil
.
changeEntityNew
(
StaffDTO
.
class
,
haobanStaff
);
}
haobanStaff
=
new
TabHaobanStaff
();
haobanStaff
.
setStaffName
(
"超级管理员"
);
haobanStaff
.
setWxEnterpriseId
(
wxEnterpriseId
);
haobanStaff
.
setSuperManagerFlag
(
1
);
String
staffId
=
staffService
.
add
(
haobanStaff
);
haobanStaff
.
setStaffId
(
staffId
);
StaffDTO
staffDTO
=
EntityUtil
.
changeEntityNew
(
StaffDTO
.
class
,
haobanStaff
);
return
staffDTO
;
}
@Override
public
StaffPrivacyUseLogDTO
getStaffPrivacyByStaffId
(
String
staffId
)
{
public
StaffPrivacyUseLogDTO
getStaffPrivacyByStaffId
(
String
staffId
)
{
return
EntityUtil
.
changeEntity
(
StaffPrivacyUseLogDTO
.
class
,
staffPrivacyUseLogService
.
getByStaffId
(
staffId
));
return
EntityUtil
.
changeEntity
(
StaffPrivacyUseLogDTO
.
class
,
staffPrivacyUseLogService
.
getByStaffId
(
staffId
));
}
}
...
@@ -1224,15 +786,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1224,15 +786,6 @@ public class StaffApiServiceImpl implements StaffApiService {
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
Collections
.
EMPTY_LIST
;
return
Collections
.
EMPTY_LIST
;
}
}
/*for (StaffDTO staffDTO : list) {
List<String> departmentIds = new ArrayList<>();
List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffDTO.getStaffId());
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : relatedList) {
departmentIds.add(tabHaobanStaffDepartmentRelated.getDepartmentId());
}
List<DepartmentDTO> departmentList = departmentService.listByIds(departmentIds);
staffDTO.setDepartmentList(departmentList);
}*/
this
.
addDepartInfo
(
list
);
this
.
addDepartInfo
(
list
);
return
list
;
return
list
;
}
}
...
@@ -1286,13 +839,13 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1286,13 +839,13 @@ public class StaffApiServiceImpl implements StaffApiService {
String
staffId
=
staffClerkRelationDTO
.
getStaffId
();
String
staffId
=
staffClerkRelationDTO
.
getStaffId
();
String
wxEnterpriseId
=
staffClerkRelationDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
staffClerkRelationDTO
.
getWxEnterpriseId
();
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:wxEnterpriseId:{}"
,
wxEnterpriseId
);
logger
.
info
(
"没有配置secret:wxEnterpriseId:{}"
,
wxEnterpriseId
);
return
null
;
return
null
;
}
}
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
DTO
==
null
)
{
if
(
qw
DTO
==
null
)
{
logger
.
info
(
"企业不存在:wxEnterpriseId:{}"
,
wxEnterpriseId
);
logger
.
info
(
"企业不存在:wxEnterpriseId:{}"
,
wxEnterpriseId
);
return
null
;
return
null
;
}
}
...
@@ -1317,7 +870,7 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1317,7 +870,7 @@ public class StaffApiServiceImpl implements StaffApiService {
//获取微信信息
//获取微信信息
String
wxUserId
=
staff
.
getWxUserId
();
String
wxUserId
=
staff
.
getWxUserId
();
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterpriseDTO
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
qwDTO
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
if
(
null
==
user
)
{
if
(
null
==
user
)
{
logger
.
info
(
"企业微信用户不存在:wxEnterpriseId:{}:wxUserId:{}"
,
wxEnterpriseId
,
wxUserId
);
logger
.
info
(
"企业微信用户不存在:wxEnterpriseId:{}:wxUserId:{}"
,
wxEnterpriseId
,
wxUserId
);
return
staffQrCodeDTO
;
return
staffQrCodeDTO
;
...
@@ -1416,11 +969,6 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1416,11 +969,6 @@ public class StaffApiServiceImpl implements StaffApiService {
/**
/**
* 门店筛选器id企业端获取gic门店id列表
* 门店筛选器id企业端获取gic门店id列表
*
* @param clerkDTO 职员dto
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-06-01 11:08:41
*/
*/
private
List
<
String
>
getStoreIdList
(
ClerkDTO
clerkDTO
)
{
private
List
<
String
>
getStoreIdList
(
ClerkDTO
clerkDTO
)
{
String
clerkId
=
clerkDTO
.
getClerkId
();
String
clerkId
=
clerkDTO
.
getClerkId
();
...
@@ -1458,12 +1006,7 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -1458,12 +1006,7 @@ public class StaffApiServiceImpl implements StaffApiService {
/**
/**
* 获取门店筛选器门店ids
* 获取门店筛选器门店ids
*
* @param storeWidgetId
* @param enterpriseId
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-05-09 16:43:50
*/
*/
private
List
<
String
>
getStoreWidgetIdStoreIds
(
String
storeWidgetId
,
String
enterpriseId
)
{
private
List
<
String
>
getStoreWidgetIdStoreIds
(
String
storeWidgetId
,
String
enterpriseId
)
{
// 门店id列表
// 门店id列表
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffClerkRelationApiServiceImpl.java
View file @
7a2e471d
...
@@ -400,15 +400,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
...
@@ -400,15 +400,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
send
.
setUser
(
userIds
);
send
.
setUser
(
userIds
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
relationDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
relationDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
relationDTO
.
getWxEnterpriseId
());
logger
.
info
(
"没有配置secret:{}"
,
relationDTO
.
getWxEnterpriseId
());
response
.
setCode
(
3
);
response
.
setCode
(
3
);
response
.
setMessage
(
"企业微信配置异常"
);
response
.
setMessage
(
"企业微信配置异常"
);
return
response
;
return
response
;
}
}
WxEnterprise
DTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
relationDTO
.
getWxEnterpriseId
())
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
relationDTO
.
getWxEnterpriseId
())
;
String
configId
=
qywxUserApiService
.
getSelfExternalcontactByUserId
(
enterpriseDTO
.
getCorpid
()
,
secretSetting
.
getSecretVal
(),
send
);
String
configId
=
qywxUserApiService
.
getSelfExternalcontactByUserId
(
qwDTO
.
getDkCorpid
()
,
secretSetting
.
getSecretVal
(),
send
);
logger
.
info
(
"configId:{}"
,
configId
);
logger
.
info
(
"configId:{}"
,
configId
);
if
(
StringUtils
.
isBlank
(
configId
))
{
if
(
StringUtils
.
isBlank
(
configId
))
{
logger
.
info
(
"staff:{}"
,
configId
,
JSONObject
.
toJSONString
(
relationDTO
));
logger
.
info
(
"staff:{}"
,
configId
,
JSONObject
.
toJSONString
(
relationDTO
));
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffDepartmentRelatedApiServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
...
@@ -21,20 +37,12 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
...
@@ -21,20 +37,12 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.io.UnsupportedEncodingException
;
import
cn.hutool.core.collection.CollectionUtil
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
@Service
@Service
public
class
StaffDepartmentRelatedApiServiceImpl
implements
StaffDepartmentRelatedApiService
{
public
class
StaffDepartmentRelatedApiServiceImpl
implements
StaffDepartmentRelatedApiService
{
...
@@ -57,7 +65,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
...
@@ -57,7 +65,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Autowired
@Autowired
private
StaffApiService
staffApiService
;
private
StaffApiService
staffApiService
;
@Autowired
@Autowired
private
HmQrcodeApiService
hmQrcodeApi
Service
;
private
WxEnterpriseService
wxEnterprise
Service
;
@Override
@Override
public
List
<
StaffDepartmentRelatedDTO
>
listByDepartmentId
(
String
departmentId
)
{
public
List
<
StaffDepartmentRelatedDTO
>
listByDepartmentId
(
String
departmentId
)
{
...
@@ -146,21 +154,20 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
...
@@ -146,21 +154,20 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
if
(
clerkDTO
==
null
)
{
if
(
clerkDTO
==
null
)
{
return
map
;
return
map
;
}
}
TabHaobanWxEnterprise
wxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
relation
.
getWxEnterpriseId
())
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
relation
.
getWxEnterpriseId
())
;
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
relation
.
getStaffId
());
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
relation
.
getStaffId
());
if
(
staffDTO
==
null
)
{
if
(
staffDTO
==
null
)
{
return
map
;
return
map
;
}
}
String
corpid
=
wxEnterprise
.
getCorpid
();
String
wxUserId
=
""
;
String
wxUserId
=
""
;
if
(
corpid
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
wxUserId
=
staffDTO
.
getWxOpenUseId
();
wxUserId
=
staffDTO
.
getWxOpenUseId
();
}
else
{
}
else
{
wxUserId
=
staffDTO
.
getWxUserId
();
wxUserId
=
staffDTO
.
getWxUserId
();
}
}
map
.
put
(
"wxUserId"
,
wxUserId
);
map
.
put
(
"wxUserId"
,
wxUserId
);
map
.
put
(
"wxEnterpriseId"
,
wxEnterprise
.
getWxEnterpriseId
());
map
.
put
(
"wxEnterpriseId"
,
qwDTO
.
getWxEnterpriseId
());
map
.
put
(
"corpId"
,
wxEnterprise
.
get
Corpid
());
map
.
put
(
"corpId"
,
qwDTO
.
getThird
Corpid
());
map
.
put
(
"clerkName"
,
clerkDTO
.
getClerkName
());
map
.
put
(
"clerkName"
,
clerkDTO
.
getClerkName
());
return
map
;
return
map
;
}
}
...
@@ -171,17 +178,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
...
@@ -171,17 +178,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
if
(
staffDTO
==
null
)
{
if
(
staffDTO
==
null
)
{
return
map
;
return
map
;
}
}
TabHaobanWxEnterprise
tabHaobanWxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
staffDTO
.
getWxEnterpriseId
());
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
staffDTO
.
getWxEnterpriseId
())
;
String
corpid
=
tabHaobanWxEnterprise
.
getCorpid
();
String
wxUserId
=
""
;
String
wxUserId
=
""
;
if
(
corpid
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
wxUserId
=
staffDTO
.
getWxOpenUseId
();
wxUserId
=
staffDTO
.
getWxOpenUseId
();
}
else
{
}
else
{
wxUserId
=
staffDTO
.
getWxUserId
();
wxUserId
=
staffDTO
.
getWxUserId
();
}
}
map
.
put
(
"wxUserId"
,
wxUserId
);
map
.
put
(
"wxUserId"
,
wxUserId
);
map
.
put
(
"wxEnterpriseId"
,
tabHaobanWxEnterprise
.
getWxEnterpriseId
());
map
.
put
(
"wxEnterpriseId"
,
qwDTO
.
getWxEnterpriseId
());
map
.
put
(
"corpId"
,
tabHaobanWxEnterprise
.
get
Corpid
());
map
.
put
(
"corpId"
,
qwDTO
.
getThird
Corpid
());
map
.
put
(
"staffName"
,
staffDTO
.
getStaffName
());
map
.
put
(
"staffName"
,
staffDTO
.
getStaffName
());
return
map
;
return
map
;
}
}
...
@@ -201,22 +207,21 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
...
@@ -201,22 +207,21 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
jsonObject
.
put
(
"storeId"
,
storeId
);
jsonObject
.
put
(
"storeId"
,
storeId
);
String
data
=
jsonObject
.
toJSONString
();
String
data
=
jsonObject
.
toJSONString
();
String
pageUrl
=
this
.
getPageUrl
(
AppPageType
.
MY_RELATED_RECORD
.
getCode
(),
data
);
String
pageUrl
=
this
.
getPageUrl
(
AppPageType
.
MY_RELATED_RECORD
.
getCode
(),
data
);
TabHaobanWxEnterprise
tabHaobanWxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
staffDTO
.
getWxEnterpriseId
());
String
corpId
=
tabHaobanWxEnterprise
.
getCorpid
();
String
name
=
staffDTO
.
getStaffName
();
String
name
=
staffDTO
.
getStaffName
();
if
(
content
.
length
()
>
30
)
{
if
(
content
.
length
()
>
30
)
{
content
=
content
.
substring
(
0
,
26
);
content
=
content
.
substring
(
0
,
26
);
content
=
content
+
"..."
;
content
=
content
+
"..."
;
}
}
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
staffDTO
.
getWxEnterpriseId
())
;
String
wxUserId
=
""
;
String
wxUserId
=
""
;
if
(
corpId
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
wxUserId
=
staffDTO
.
getWxOpenUseId
();
wxUserId
=
staffDTO
.
getWxOpenUseId
();
}
else
{
}
else
{
wxUserId
=
staffDTO
.
getWxUserId
();
wxUserId
=
staffDTO
.
getWxUserId
();
}
}
//先发送下,试试
//先发送下,试试
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
List
<
ItemDTO
>
items
=
new
ArrayList
();
List
<
ItemDTO
>
items
=
new
ArrayList
<>
();
ItemDTO
dto1
=
new
ItemDTO
();
ItemDTO
dto1
=
new
ItemDTO
();
ItemDTO
dto2
=
new
ItemDTO
();
ItemDTO
dto2
=
new
ItemDTO
();
ItemDTO
dto3
=
new
ItemDTO
();
ItemDTO
dto3
=
new
ItemDTO
();
...
@@ -243,10 +248,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
...
@@ -243,10 +248,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
messageTitle
);
messageDTO
.
setTitle
(
messageTitle
);
messageDTO
.
setItems
(
items
);
messageDTO
.
setItems
(
items
);
logger
.
info
(
"发送参数为corpId============:{},suitId============:{},messageDTO============:{},"
,
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
JSONObject
.
toJSONString
(
messageDTO
));
logger
.
info
(
"发送参数为corpId============:{},suitId============:{},messageDTO============:{},"
,
corpId
,
config
.
getWxSuiteid
(),
JSONObject
.
toJSONString
(
messageDTO
));
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
corpId
,
config
.
getWxSuiteid
(),
messageDTO
);
logger
.
info
(
"发送===============》{}"
,
b
);
logger
.
info
(
"发送===============》{}"
,
b
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseApiServiceImpl.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Set
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.EntityUtil
;
...
@@ -7,27 +23,34 @@ import com.gic.enterprise.api.dto.EnterpriseDTO;
...
@@ -7,27 +23,34 @@ import com.gic.enterprise.api.dto.EnterpriseDTO;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.MiniprogramSettingDTO
;
import
com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO
;
import
com.gic.haoban.manage.api.dto.WelcomeDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.entity.TabMiniprogramSetting
;
import
com.gic.haoban.manage.service.entity.TabWelcome
;
import
com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO
;
import
com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.service.MiniprogramSettingService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.StaffPrivacyUseLogService
;
import
com.gic.haoban.manage.service.service.WxApplicationService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
@Service
public
class
WxEnterpriseApiServiceImpl
implements
WxEnterpriseApiService
{
public
class
WxEnterpriseApiServiceImpl
implements
WxEnterpriseApiService
{
...
@@ -52,6 +75,8 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
...
@@ -52,6 +75,8 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private
Config
config
;
private
Config
config
;
@Autowired
@Autowired
private
WxEnterpriseRelatedMapper
wxEnterpriseRelatedMapper
;
private
WxEnterpriseRelatedMapper
wxEnterpriseRelatedMapper
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
@Override
@Override
public
void
callbackReviceEnterprise
(
QywxCorpInfoSimpleDTO
dto
)
{
public
void
callbackReviceEnterprise
(
QywxCorpInfoSimpleDTO
dto
)
{
...
@@ -67,31 +92,39 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
...
@@ -67,31 +92,39 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
String
qywxMemberSuite
=
config
.
getQywxMemberSuite
();
String
qywxMemberSuite
=
config
.
getQywxMemberSuite
();
WxEnterpriseDTO
wxDTO
=
EntityUtil
.
changeEntityByJSON
(
WxEnterpriseDTO
.
class
,
dto
);
WxEnterpriseDTO
wxDTO
=
EntityUtil
.
changeEntityByJSON
(
WxEnterpriseDTO
.
class
,
dto
);
String
wxEnterpriseId
=
""
;
String
wxEnterpriseId
=
""
;
TabHaobanWxEnterprise
wxEnterprise
=
null
;
TabHaobanWxEnterprise
wxEnterprise
=
this
.
wxEnterpriseService
.
getEnterpriseBycorpId
(
corpid
);
// 调用企微接口
String
serviceCorpid
=
config
.
getCorpid
();
String
openCorpid
=
qywxUserApiService
.
toOpenCorpid
(
serviceCorpid
,
corpid
);
log
.
info
(
"查询企微id,入参={},返回={}"
,
corpid
,
openCorpid
);
if
(
StringUtils
.
isNotBlank
(
openCorpid
)
&&
!
openCorpid
.
equals
(
corpid
))
{
wxEnterprise
=
this
.
wxEnterpriseService
.
getEnterpriseBycorpId
(
openCorpid
);
log
.
info
(
"通过密文corpid查询={},{}"
,
openCorpid
,
wxEnterprise
!=
null
?
wxEnterprise
.
getWxEnterpriseId
():
null
);
}
// 获取授权好办小程序
// 获取授权好办小程序
wxEnterprise
=
this
.
wxEnterpriseService
.
getEnterpriseBycorpId
(
corpid
);
if
(
wxEnterprise
==
null
)
{
if
(
wxEnterprise
==
null
)
{
log
.
info
(
"通过corpid={}未查到记录"
,
corpid
);
log
.
info
(
"通过corpid={}未查到记录"
,
corpid
);
wxEnterprise
=
this
.
wxEnterpriseService
.
getEnterpriseByCorpName
(
corpName
);
wxEnterprise
=
this
.
wxEnterpriseService
.
getEnterpriseByCorpName
(
corpName
);
}
}
if
(
wxEnterprise
!=
null
)
{
if
(
wxEnterprise
!=
null
)
{
log
.
info
(
"查询wxEnterpriseId={}"
,
wxEnterprise
.
getWxEnterpriseId
());
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
();
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
new
WxEnterpriseDTO
();
WxEnterpriseDTO
wxEnterpriseDTO
=
new
WxEnterpriseDTO
();
wxEnterpriseDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
wxEnterpriseDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
wxEnterpriseDTO
.
setStatusFlag
(
1
);
wxEnterpriseDTO
.
setStatusFlag
(
1
);
wxEnterpriseDTO
.
setBindFlag
(
1
);
wxEnterpriseDTO
.
setBindFlag
(
1
);
// 如果corpid为空且是好办小程序,写入corpid
if
(
StringUtils
.
isNotBlank
(
openCorpid
))
{
this
.
setCorpid
(
corpid
,
openCorpid
,
wxEnterpriseDTO
);
}
wxEnterpriseService
.
update
(
wxEnterpriseDTO
);
wxEnterpriseService
.
update
(
wxEnterpriseDTO
);
}
else
{
}
else
{
// 如果不是好办,不需要写入corpid
if
(
StringUtils
.
isNotBlank
(
openCorpid
))
{
this
.
setCorpid
(
corpid
,
openCorpid
,
wxDTO
);
}
wxDTO
.
setWxSecurityType
(
2
);
wxEnterpriseId
=
wxEnterpriseService
.
add
(
wxDTO
);
wxEnterpriseId
=
wxEnterpriseService
.
add
(
wxDTO
);
}
}
/*if (StringUtils.isNotBlank(userId)) {
TabHaobanWxApplication
haobanWxApplication
=
wxApplicationService
.
selectBySiteIdAndWxEnterpriseId
(
siteId
,
wxEnterpriseId
);
staffApiService.wxGetAdd(userId, wxEnterpriseId);
}*/
TabHaobanWxApplication
haobanWxApplication
=
wxApplicationService
.
selectBySiteIdAndWxEnterpriseId
(
siteId
,
wxEnterpriseId
);
if
(
haobanWxApplication
==
null
)
{
if
(
haobanWxApplication
==
null
)
{
log
.
info
(
"新增应用,suiteid={}"
,
siteId
);
log
.
info
(
"新增应用,suiteid={}"
,
siteId
);
haobanWxApplication
=
new
TabHaobanWxApplication
();
haobanWxApplication
=
new
TabHaobanWxApplication
();
...
@@ -151,6 +184,16 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
...
@@ -151,6 +184,16 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
log
.
info
(
"企业微信授权处理完成"
);
log
.
info
(
"企业微信授权处理完成"
);
}
}
private
void
setCorpid
(
String
corpid
,
String
openCorpid
,
WxEnterpriseDTO
wxEnterpriseDTO
)
{
if
(
openCorpid
.
equals
(
corpid
))
{
// 密文
wxEnterpriseDTO
.
setOpenCorpid
(
openCorpid
);
}
else
{
wxEnterpriseDTO
.
setOpenCorpid
(
openCorpid
);
wxEnterpriseDTO
.
setWxCorpid
(
corpid
);
}
}
@Override
@Override
public
com
.
gic
.
api
.
base
.
commons
.
Page
<
YwWxEnterpriseDTO
>
list
(
BasePageInfo
pageInfo
,
String
keyword
,
public
com
.
gic
.
api
.
base
.
commons
.
Page
<
YwWxEnterpriseDTO
>
list
(
BasePageInfo
pageInfo
,
String
keyword
,
List
<
String
>
enterpriseIds
,
Integer
gicContactFlag
,
String
version
,
List
<
String
>
enterpriseIdsNotIn
,
List
<
String
>
enterpriseIds
,
Integer
gicContactFlag
,
String
version
,
List
<
String
>
enterpriseIdsNotIn
,
...
@@ -211,6 +254,11 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
...
@@ -211,6 +254,11 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
WxEnterpriseDTO
wxDTO
=
EntityUtil
.
changeEntityByJSON
(
WxEnterpriseDTO
.
class
,
tab
);
WxEnterpriseDTO
wxDTO
=
EntityUtil
.
changeEntityByJSON
(
WxEnterpriseDTO
.
class
,
tab
);
return
wxDTO
;
return
wxDTO
;
}
}
@Override
public
WxEnterpriseQwDTO
getQwInfo
(
String
wxEnterpriseId
)
{
return
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
}
@Override
@Override
public
WxEnterpriseDTO
getEnterpriseBycorpId
(
String
corpId
)
{
public
WxEnterpriseDTO
getEnterpriseBycorpId
(
String
corpId
)
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmLinkApiServiceImpl.java
View file @
7a2e471d
...
@@ -30,6 +30,7 @@ import com.gic.enterprise.api.dto.StoreDTO;
...
@@ -30,6 +30,7 @@ import com.gic.enterprise.api.dto.StoreDTO;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.common.utils.DingUtils
;
import
com.gic.haoban.common.utils.DingUtils
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO
;
...
@@ -381,7 +382,8 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
...
@@ -381,7 +382,8 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
String
dthmKey
=
this
.
keyDataService
.
saveDataForLink
(
enterpriseId
,
bo
);
String
dthmKey
=
this
.
keyDataService
.
saveDataForLink
(
enterpriseId
,
bo
);
remarkMap
.
put
(
"dthmKey"
,
dthmKey
);
remarkMap
.
put
(
"dthmKey"
,
dthmKey
);
if
(
null
!=
dthmKey
)
{
if
(
null
!=
dthmKey
)
{
ServiceResponse
<
String
>
addResp
=
this
.
addQrcode
(
hm
,
dthmKey
,
wxEnterpriseDTO
.
getCorpid
(),
retDTO
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
ServiceResponse
<
String
>
addResp
=
this
.
addQrcode
(
hm
,
dthmKey
,
qwDTO
.
getThirdCorpid
(),
retDTO
);
if
(!
addResp
.
isSuccess
())
{
if
(!
addResp
.
isSuccess
())
{
remarkMap
.
put
(
"sm"
,
"创建动态活码失败,取单人活码"
);
remarkMap
.
put
(
"sm"
,
"创建动态活码失败,取单人活码"
);
if
(
StringUtils
.
isBlank
(
hm
.
getWxQrcode
()))
{
if
(
StringUtils
.
isBlank
(
hm
.
getWxQrcode
()))
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
View file @
7a2e471d
...
@@ -14,6 +14,7 @@ import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
...
@@ -14,6 +14,7 @@ import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmClerkDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmClerkDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmQrcodeDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmQrcodeDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO
;
...
@@ -112,12 +113,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -112,12 +113,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ServiceResponse
add
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
public
ServiceResponse
add
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
DTO
==
null
)
{
if
(
qw
DTO
==
null
)
{
logger
.
error
(
"未查询到微信企业"
);
logger
.
error
(
"未查询到微信企业"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
}
}
hmQrcodeQDTO
.
setHmId
(
UniqueIdUtils
.
uniqueLong
());
hmQrcodeQDTO
.
setHmId
(
UniqueIdUtils
.
uniqueLong
());
Integer
hmType
=
hmQrcodeQDTO
.
getHmType
();
Integer
hmType
=
hmQrcodeQDTO
.
getHmType
();
Long
hmId
=
hmQrcodeQDTO
.
getHmId
();
Long
hmId
=
hmQrcodeQDTO
.
getHmId
();
...
@@ -142,7 +142,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -142,7 +142,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
String
corpid
=
wxEnterpriseDTO
.
getCorpid
()
;
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
,
wxEnterpriseId
);
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
...
@@ -276,8 +276,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -276,8 +276,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ServiceResponse
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
public
ServiceResponse
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
DTO
==
null
)
{
if
(
qw
DTO
==
null
)
{
logger
.
error
(
"未查询到微信企业"
);
logger
.
error
(
"未查询到微信企业"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
}
}
...
@@ -304,7 +304,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -304,7 +304,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
}
}
qywxExternalcontactDTO
.
setUser
(
userIds
);
qywxExternalcontactDTO
.
setUser
(
userIds
);
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
updateContactWay
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
qywxExternalcontactDTO
);
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
updateContactWay
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
qywxExternalcontactDTO
);
if
(
qywxResponseDTO
.
getErrcode
()
!=
0
)
{
if
(
qywxResponseDTO
.
getErrcode
()
!=
0
)
{
logger
.
error
(
"更新企微活码失败"
);
logger
.
error
(
"更新企微活码失败"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_0
.
getCode
()),
qywxResponseDTO
.
getErrmsg
());
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_0
.
getCode
()),
qywxResponseDTO
.
getErrmsg
());
...
@@ -656,8 +656,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -656,8 +656,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
String
wxConfigId
=
hmQrcodeBO
.
getWxConfigId
();
String
wxConfigId
=
hmQrcodeBO
.
getWxConfigId
();
if
(
StringUtils
.
isNotBlank
(
wxConfigId
))
{
if
(
StringUtils
.
isNotBlank
(
wxConfigId
))
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
hmQrcodeBO
.
getWxEnterpriseId
())
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
hmQrcodeBO
.
getWxEnterpriseId
())
;
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
delContactWay
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
wxConfigId
);
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
delContactWay
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
wxConfigId
);
int
errcode
=
qywxResponseDTO
.
getErrcode
();
int
errcode
=
qywxResponseDTO
.
getErrcode
();
if
(
errcode
!=
0
)
{
if
(
errcode
!=
0
)
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
qywxResponseDTO
.
getErrmsg
());
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
qywxResponseDTO
.
getErrmsg
());
...
@@ -741,8 +741,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -741,8 +741,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger
.
info
(
"该企业未与gic关联,无需开启:enterpriseId:{},wxEnterpriseId:{}"
,
enterpriseId
,
wxEnterpriseId
);
logger
.
info
(
"该企业未与gic关联,无需开启:enterpriseId:{},wxEnterpriseId:{}"
,
enterpriseId
,
wxEnterpriseId
);
continue
;
continue
;
}
}
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//企微已经开启联系我
//企微已经开启联系我
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
());
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
());
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
,
enterpriseId
);
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
logger
.
error
(
"无导购关联数据"
);
logger
.
error
(
"无导购关联数据"
);
...
@@ -785,10 +786,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -785,10 +786,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Override
@Override
public
void
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
public
void
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
//查询出所有正常的导购
//查询出所有正常的导购
//企微已经开启联系我
//企微已经开启联系我
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
());
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
());
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
,
enterpriseId
);
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
logger
.
error
(
"无导购关联数据"
);
logger
.
error
(
"无导购关联数据"
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/QywxDeptSyncOperation.java
View file @
7a2e471d
...
@@ -18,7 +18,6 @@ import com.gic.haoban.base.api.common.Constant;
...
@@ -18,7 +18,6 @@ import com.gic.haoban.base.api.common.Constant;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
...
@@ -161,8 +160,7 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
...
@@ -161,8 +160,7 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
@Override
@Override
public
void
dealSuccess
(
String
taskId
,
String
dataId
,
String
enterpriseId
,
String
wxEnterpriseId
)
{
public
void
dealSuccess
(
String
taskId
,
String
dataId
,
String
enterpriseId
,
String
wxEnterpriseId
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:{},{}"
,
taskId
,
wxEnterpriseId
);
logger
.
info
(
"没有配置secret:{},{}"
,
taskId
,
wxEnterpriseId
);
return
;
return
;
...
@@ -174,10 +172,10 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
...
@@ -174,10 +172,10 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
List
<
UserDTO
>
list
=
null
;
List
<
UserDTO
>
list
=
null
;
WxEnterpriseQwDTO
wxInfo
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
wxInfo
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxInfo
.
getWxSecurityType
()==
4
)
{
if
(
wxInfo
.
getWxSecurityType
()==
4
)
{
list
=
this
.
qywxUserApiService
.
listDepartmentUser
(
wx
EnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
dataId
,
1
)
;
list
=
this
.
qywxUserApiService
.
listDepartmentUser
(
wx
Info
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
dataId
,
1
)
;
logger
.
info
(
"从(第三方)获取通讯录={}"
,
JSON
.
toJSONString
(
list
))
;
logger
.
info
(
"从(第三方)获取通讯录={}"
,
JSON
.
toJSONString
(
list
))
;
}
else
{
}
else
{
list
=
this
.
qywxUserApiService
.
listSelfDepartmentUser
(
wx
EnterpriseDTO
.
get
Corpid
(),
secretSetting
.
getSecretVal
(),
dataId
,
1
);
list
=
this
.
qywxUserApiService
.
listSelfDepartmentUser
(
wx
Info
.
getDk
Corpid
(),
secretSetting
.
getSecretVal
(),
dataId
,
1
);
logger
.
info
(
"从(代开)获取通讯录={}"
,
JSON
.
toJSONString
(
list
))
;
logger
.
info
(
"从(代开)获取通讯录={}"
,
JSON
.
toJSONString
(
list
))
;
}
}
if
(
null
==
list
)
{
if
(
null
==
list
)
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/QywxStaffSyncOperation.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
service
.
task
;
package
com
.
gic
.
haoban
.
manage
.
service
.
task
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
import
com.gic.haoban.manage.api.enums.SyncTaskStatusEnum
;
import
com.gic.haoban.manage.api.enums.SyncTaskStatusEnum
;
...
@@ -13,26 +26,13 @@ import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
...
@@ -13,26 +26,13 @@ import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncTask
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncTask
;
import
com.gic.haoban.manage.service.service.PreDealService
;
import
com.gic.haoban.manage.service.service.PreDealService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.SyncTaskService
;
import
com.gic.haoban.manage.service.service.SyncTaskService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.QywxNewUseridDTO
;
import
com.gic.wechat.api.dto.qywx.QywxNewUseridDTO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 企微通讯录同步
* 企微通讯录同步
...
@@ -129,7 +129,8 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
...
@@ -129,7 +129,8 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
dealSyncOperationApiService
.
unlockTask
(
wxEnterpriseId
);
dealSyncOperationApiService
.
unlockTask
(
wxEnterpriseId
);
dealSyncOperationApiService
.
cleanDiffrence
(
wxEnterpriseId
,
taskId
);
dealSyncOperationApiService
.
cleanDiffrence
(
wxEnterpriseId
,
taskId
);
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
corpid
=
wxEnterpriseDTO
.
getCorpid
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
Integer
externalFlag
=
wxEnterpriseDTO
.
getExternalFlag
();
Integer
externalFlag
=
wxEnterpriseDTO
.
getExternalFlag
();
logger
.
info
(
"同步通讯录完成,批量处理wx_open_user_id,corpid:{},externalFlag:{}"
,
corpid
,
externalFlag
);
logger
.
info
(
"同步通讯录完成,批量处理wx_open_user_id,corpid:{},externalFlag:{}"
,
corpid
,
externalFlag
);
if
(
corpid
.
length
()
>
20
||
externalFlag
==
1
)
{
if
(
corpid
.
length
()
>
20
||
externalFlag
==
1
)
{
...
...
haoban-manage3-service/src/main/resources/mapper/StaffDepartmentRelatedMapper.xml
View file @
7a2e471d
...
@@ -261,13 +261,6 @@
...
@@ -261,13 +261,6 @@
and status_flag = 1
and status_flag = 1
</select>
</select>
<select
id=
"countByDepartmentId"
resultType=
"java.lang.Integer"
parameterType=
"java.lang.String"
>
select count(1)
from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"getDepartmentIdAndCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
<select
id=
"getDepartmentIdAndCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/StaffMapper.xml
View file @
7a2e471d
...
@@ -354,15 +354,6 @@
...
@@ -354,15 +354,6 @@
and status_flag = 1 limit 1
and status_flag = 1 limit 1
</select>
</select>
<select
id=
"selectSuperByWxEnterpriseId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId}
and super_manager_flag = 1
</select>
<select
id=
"listByUserIdsAndWxEnterpriseId"
resultMap=
"BaseResultMap"
>
<select
id=
"listByUserIdsAndWxEnterpriseId"
resultMap=
"BaseResultMap"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/WxEnterpriseMapper.xml
View file @
7a2e471d
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
<mapper
namespace=
"com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper"
>
<mapper
namespace=
"com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise"
>
<id
column=
"wx_enterprise_id"
property=
"wxEnterpriseId"
jdbcType=
"VARCHAR"
/>
<id
column=
"wx_enterprise_id"
property=
"wxEnterpriseId"
jdbcType=
"VARCHAR"
/>
<result
column=
"corpid"
property=
"corpid"
jdbcType=
"VARCHAR"
/>
<result
column=
"permanent_code"
property=
"permanentCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"permanent_code"
property=
"permanentCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"corp_name"
property=
"corpName"
jdbcType=
"VARCHAR"
/>
<result
column=
"corp_name"
property=
"corpName"
jdbcType=
"VARCHAR"
/>
<result
column=
"corp_type"
property=
"corpType"
jdbcType=
"VARCHAR"
/>
<result
column=
"corp_type"
property=
"corpType"
jdbcType=
"VARCHAR"
/>
...
@@ -41,6 +40,8 @@
...
@@ -41,6 +40,8 @@
<result
column=
"external_flag"
property=
"externalFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"external_flag"
property=
"externalFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"userid_flag"
property=
"useridFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"userid_flag"
property=
"useridFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"wx_security_type"
property=
"wxSecurityType"
/>
<result
column=
"wx_security_type"
property=
"wxSecurityType"
/>
<result
column=
"wx_corpid"
property=
"wxCorpid"
/>
<result
column=
"open_corpid"
property=
"openOorpid"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
...
@@ -48,7 +49,7 @@
...
@@ -48,7 +49,7 @@
corp_user_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, corp_scale,
corp_user_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, corp_scale,
corp_industry, corp_sub_industry, location, auth_info, agent, agentid, appid, name,
corp_industry, corp_sub_industry, location, auth_info, agent, agentid, appid, name,
square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key,wx_secret_key_last_time,member_secret_last_time,contact_secret_last_time
square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key,wx_secret_key_last_time,member_secret_last_time,contact_secret_last_time
,member_secret,contact_secret,agree_external_userid_flag,agree_external_userid_time,external_flag,userid_flag ,wx_security_type
,member_secret,contact_secret,agree_external_userid_flag,agree_external_userid_time,external_flag,userid_flag ,wx_security_type
, wx_corpid , open_corpid
</sql>
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
select
...
@@ -68,9 +69,6 @@
...
@@ -68,9 +69,6 @@
<if
test=
"wxEnterpriseId != null"
>
<if
test=
"wxEnterpriseId != null"
>
wx_enterprise_id,
wx_enterprise_id,
</if>
</if>
<if
test=
"corpid != null"
>
corpid,
</if>
<if
test=
"permanentCode != null"
>
<if
test=
"permanentCode != null"
>
permanent_code,
permanent_code,
</if>
</if>
...
@@ -167,14 +165,17 @@
...
@@ -167,14 +165,17 @@
<if
test=
"useridFlag != null"
>
<if
test=
"useridFlag != null"
>
userid_flag,
userid_flag,
</if>
</if>
<if
test=
"null != wxCorpid"
>
wx_corpid ,
</if>
<if
test=
"null != openCorpid"
>
open_corpid ,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"wxEnterpriseId != null"
>
<if
test=
"wxEnterpriseId != null"
>
#{wxEnterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"corpid != null"
>
#{corpid,jdbcType=VARCHAR},
</if>
<if
test=
"permanentCode != null"
>
<if
test=
"permanentCode != null"
>
#{permanentCode,jdbcType=VARCHAR},
#{permanentCode,jdbcType=VARCHAR},
</if>
</if>
...
@@ -269,16 +270,20 @@
...
@@ -269,16 +270,20 @@
#{externalFlag,jdbcType=INTEGER},
#{externalFlag,jdbcType=INTEGER},
</if>
</if>
<if
test=
"useridFlag != null"
>
<if
test=
"useridFlag != null"
>
#{useridFlag}
#{useridFlag}
,
</if>
</if>
<if
test=
"null != wxCorpid"
>
${wxCorpid} ,
</if>
<if
test=
"null != openCorpid"
>
${openCorpid} ,
</if>
</trim>
</trim>
</insert>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise"
>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise"
>
update tab_haoban_wx_enterprise
update tab_haoban_wx_enterprise
<set>
<set>
<if
test=
"corpid != null"
>
corpid = #{corpid,jdbcType=VARCHAR},
</if>
<if
test=
"permanentCode != null"
>
<if
test=
"permanentCode != null"
>
permanent_code = #{permanentCode,jdbcType=VARCHAR},
permanent_code = #{permanentCode,jdbcType=VARCHAR},
</if>
</if>
...
@@ -387,6 +392,12 @@
...
@@ -387,6 +392,12 @@
<if
test=
"useridFlag != null"
>
<if
test=
"useridFlag != null"
>
userid_flag = #{useridFlag}
userid_flag = #{useridFlag}
</if>
</if>
<if
test=
"null != wxCorpid"
>
wx_corpid = #{wxCorpid}
</if>
<if
test=
"null != openCorpid"
>
open_corpid = #{openCorpid}
</if>
</set>
</set>
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</update>
</update>
...
@@ -433,13 +444,6 @@
...
@@ -433,13 +444,6 @@
order by create_time desc
order by create_time desc
</select>
</select>
<select
id=
"listDelBycorpId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_wx_enterprise
where status_flag = 0 and corpid= #{corpId}
</select>
<select
id=
"listAll"
resultMap=
"BaseResultMap"
>
<select
id=
"listAll"
resultMap=
"BaseResultMap"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
...
@@ -464,7 +468,7 @@
...
@@ -464,7 +468,7 @@
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from tab_haoban_wx_enterprise
from tab_haoban_wx_enterprise
where corpid= #{corpId}
where corpid= #{corpId}
or wx_corpid = #{corpId} or open_corpid = #{corpid}
<if
test=
"statusFlag != null"
>
<if
test=
"statusFlag != null"
>
and status_flag = #{statusFlag}
and status_flag = #{statusFlag}
</if>
</if>
...
...
haoban-manage3-service/src/test/java/HmLinkTest.java
View file @
7a2e471d
...
@@ -6,12 +6,16 @@ import java.util.List;
...
@@ -6,12 +6,16 @@ import java.util.List;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.haoban.common.utils.DingUtils
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO
;
...
@@ -22,6 +26,7 @@ import com.gic.haoban.manage.api.service.hm.HmLinkVisitLogApiService;
...
@@ -22,6 +26,7 @@ import com.gic.haoban.manage.api.service.hm.HmLinkVisitLogApiService;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
import
com.gic.haoban.manage.service.service.hm.HmLinkStoreService
;
import
com.gic.haoban.manage.service.service.hm.HmLinkStoreService
;
import
com.gic.haoban.manage.service.util.QwFriendLimitCountUtil
;
import
com.gic.haoban.manage.service.util.QwFriendLimitCountUtil
;
import
com.gic.redis.data.util.RedisUtil
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
...
@@ -40,9 +45,52 @@ public class HmLinkTest {
...
@@ -40,9 +45,52 @@ public class HmLinkTest {
@Autowired
@Autowired
private
HmQrcodeApiService
hmQrcodeApiService
;
private
HmQrcodeApiService
hmQrcodeApiService
;
volatile
int
x
=
0
;
@Test
@Test
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
,
InterruptedException
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
// TODO Auto-generated method stub
while
(
true
)
{
String
ipKey
=
"hmadd:limit:ip"
;
int
ipLimitCount
=
300
;
RRateLimiter
rateLimiter
=
RedisUtil
.
getRedisClient
().
getRateLimiter
(
ipKey
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
ipLimitCount
,
1
,
RateIntervalUnit
.
SECONDS
);
if
(
rateLimiter
.
tryAcquire
())
{
System
.
err
.
println
(
x
++);
}
else
{
System
.
err
.
println
(
"**************"
);
String
msg
=
"活码调用次数告警【ip】"
;
DingUtils
.
send
(
msg
,
false
);
}
try
{
Thread
.
sleep
(
10
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
}).
start
();
}
System
.
in
.
read
();
/*RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("hm:limit:xx");
/*RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("hm:limit:xx");
rateLimiter.trySetRate(RateType.OVERALL, 10, 1, RateIntervalUnit.SECONDS);
rateLimiter.trySetRate(RateType.OVERALL, 10, 1, RateIntervalUnit.SECONDS);
...
@@ -55,7 +103,7 @@ public class HmLinkTest {
...
@@ -55,7 +103,7 @@ public class HmLinkTest {
for(int i=0;i<100;i++)
for(int i=0;i<100;i++)
System.out.println(rateLimiter.tryAcquire());
System.out.println(rateLimiter.tryAcquire());
System.out.println("----" + (System.currentTimeMillis() - start));*/
System.out.println("----" + (System.currentTimeMillis() - start));*/
/*
HmQrcodeListQDTO qdto =new HmQrcodeListQDTO();
HmQrcodeListQDTO qdto =new HmQrcodeListQDTO();
qdto.setClerkSelect("1");
qdto.setClerkSelect("1");
qdto.setStoreSelect("sele");
qdto.setStoreSelect("sele");
...
@@ -67,7 +115,7 @@ public class HmLinkTest {
...
@@ -67,7 +115,7 @@ public class HmLinkTest {
List<String> storeids = Arrays.asList("11");
List<String> storeids = Arrays.asList("11");
qdto.setStoreId(storeids);
qdto.setStoreId(storeids);
this.hmQrcodeApiService.listHmIdForIndex(qdto) ;
this.hmQrcodeApiService.listHmIdForIndex(qdto) ;
System
.
in
.
read
();
System.in.read();
*/
}
}
@Test
@Test
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/AdminController.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -9,7 +20,7 @@ import com.gic.haoban.common.utils.HaobanResponse;
...
@@ -9,7 +20,7 @@ import com.gic.haoban.common.utils.HaobanResponse;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterprise
Qw
DTO
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.WxApplicationApiService
;
import
com.gic.haoban.manage.api.service.WxApplicationApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
...
@@ -17,16 +28,6 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
...
@@ -17,16 +28,6 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import
com.gic.haoban.manage.web.vo.AdminRoleVO
;
import
com.gic.haoban.manage.web.vo.AdminRoleVO
;
import
com.gic.haoban.manage.web.vo.AdminVO
;
import
com.gic.haoban.manage.web.vo.AdminVO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RestController
public
class
AdminController
extends
WebBaseController
{
public
class
AdminController
extends
WebBaseController
{
...
@@ -35,20 +36,17 @@ public class AdminController extends WebBaseController {
...
@@ -35,20 +36,17 @@ public class AdminController extends WebBaseController {
private
QywxSuiteApiService
qywxSuiteApiService
;
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
@Autowired
private
StaffApiService
staffApiService
;
private
StaffApiService
staffApiService
;
@Autowired
@Autowired
private
WxApplicationApiService
wxApplicationApiService
;
private
WxApplicationApiService
wxApplicationApiService
;
@Autowired
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@RequestMapping
(
"admin-list"
)
@RequestMapping
(
"admin-list"
)
public
HaobanResponse
adminList
()
{
public
HaobanResponse
adminList
()
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
corpid
=
application
.
getCorpid
();
String
corpid
=
enterprise
.
getCorpid
();
logger
.
info
(
"【管理员查询】corpid={},siteId={},agentId={}"
,
corpid
,
application
.
getSiteId
(),
application
.
getAgentId
());
logger
.
info
(
"【管理员查询】corpid={},siteId={},agentId={}"
,
corpid
,
application
.
getSiteId
(),
application
.
getAgentId
());
String
adminList
=
qywxSuiteApiService
.
getAdminList
(
corpid
,
application
.
getSiteId
(),
Integer
.
parseInt
(
application
.
getAgentId
()));
String
adminList
=
qywxSuiteApiService
.
getAdminList
(
corpid
,
application
.
getSiteId
(),
Integer
.
parseInt
(
application
.
getAgentId
()));
logger
.
info
(
"【管理员查询】userIds={}"
,
JSON
.
toJSONString
(
adminList
));
logger
.
info
(
"【管理员查询】userIds={}"
,
JSON
.
toJSONString
(
adminList
));
...
@@ -60,10 +58,11 @@ public class AdminController extends WebBaseController {
...
@@ -60,10 +58,11 @@ public class AdminController extends WebBaseController {
openUserIds
.
add
(
json
.
getString
(
"userid"
));
openUserIds
.
add
(
json
.
getString
(
"userid"
));
}
}
}
}
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
List
<
StaffDTO
>
list
=
new
ArrayList
<>();
List
<
StaffDTO
>
list
=
new
ArrayList
<>();
List
<
AdminVO
>
resultList
=
new
ArrayList
<>();
List
<
AdminVO
>
resultList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
openUserIds
))
{
if
(
CollectionUtils
.
isNotEmpty
(
openUserIds
))
{
if
(
corpid
.
length
()
>
20
)
{
if
(
qwDTO
.
needOpenUserId3th
()
)
{
logger
.
info
(
"OpenUserIds"
);
logger
.
info
(
"OpenUserIds"
);
list
=
staffApiService
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
list
=
staffApiService
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
}
else
{
}
else
{
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
7a2e471d
...
@@ -176,7 +176,7 @@ public class ApplicationController extends WebBaseController {
...
@@ -176,7 +176,7 @@ public class ApplicationController extends WebBaseController {
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
)
{
if
(
enterpriseDTO
!=
null
)
{
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
(),
null
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
(),
null
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
log
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
...
@@ -209,7 +209,7 @@ public class ApplicationController extends WebBaseController {
...
@@ -209,7 +209,7 @@ public class ApplicationController extends WebBaseController {
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
)
{
if
(
enterpriseDTO
!=
null
)
{
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
(),
null
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
(),
null
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret"
);
log
.
info
(
"没有配置secret"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
...
@@ -250,7 +250,7 @@ public class ApplicationController extends WebBaseController {
...
@@ -250,7 +250,7 @@ public class ApplicationController extends WebBaseController {
applicationDTO
.
setAgentName
(
dto
.
getAgentName
());
applicationDTO
.
setAgentName
(
dto
.
getAgentName
());
applicationDTO
.
setSiteId
(
dto
.
getSuiteId
());
applicationDTO
.
setSiteId
(
dto
.
getSuiteId
());
wxApplicationApiService
.
addSuite
(
applicationDTO
);
wxApplicationApiService
.
addSuite
(
applicationDTO
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HEL
P
.
getVal
(),
null
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_AP
P
.
getVal
(),
null
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
log
.
info
(
"没有配置secret:{}"
,
JSONObject
.
toJSONString
(
enterpriseDTO
));
return
;
return
;
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/DepartmentContoller.java
View file @
7a2e471d
...
@@ -291,116 +291,6 @@ public class DepartmentContoller extends WebBaseController {
...
@@ -291,116 +291,6 @@ public class DepartmentContoller extends WebBaseController {
}
}
@RequestMapping
(
"department-repair"
)
public
HaobanResponse
departmentRepair
(
String
departmentId
,
String
parentId
)
{
DepartmentDTO
dto
=
departmentApiService
.
selectById
(
departmentId
);
if
(
dto
==
null
||
dto
.
getStatusFlag
()
==
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10003
);
}
departmentApiService
.
repairRecycle
(
departmentId
,
parentId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
private
void
handerStoreClerk
(
String
departmentId
,
String
storeId
)
{
logger
.
info
(
"【处理门店下导购】storeId={},departmentId={}"
,
storeId
,
departmentId
);
StoreDTO
store
=
storeService
.
getStore
(
storeId
);
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectById
(
departmentId
);
if
(
departmentDTO
==
null
)
{
logger
.
info
(
"【处理门店下导购】部门为空"
);
return
;
}
String
wxEnterpriseId
=
departmentDTO
.
getWxEnterpriseId
();
if
(
store
!=
null
)
{
String
enterpriseId
=
store
.
getEnterpriseId
();
List
<
ClerkListDTO
>
list
=
clerkService
.
getClerkByStoreId
(
store
.
getEnterpriseId
(),
storeId
);
logger
.
info
(
"【处理门店下导购】list={}"
,
JSON
.
toJSONString
(
list
));
for
(
ClerkListDTO
clerkListDTO
:
list
)
{
try
{
String
nationcode
=
clerkListDTO
.
getNationcode
();
if
(
StringUtils
.
isNotBlank
(
nationcode
)
&&
nationcode
.
startsWith
(
"+"
))
{
nationcode
=
nationcode
.
replace
(
"+"
,
""
);
}
String
phoneNumber
=
clerkListDTO
.
getPhoneNumber
();
if
(
StringUtils
.
isBlank
(
phoneNumber
))
{
continue
;
}
String
clerkCode
=
clerkListDTO
.
getClerkCode
();
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
staff
==
null
)
{
staff
=
new
StaffDTO
();
staff
.
setNationCode
(
nationcode
);
staff
.
setActiveFlag
(
1
);
staff
.
setDepartmentIds
(
departmentId
);
staff
.
setBindFlag
(
1
);
staff
.
setClerkCode
(
clerkCode
);
staff
.
setNickName
(
clerkListDTO
.
getClerkName
());
staff
.
setStaffName
(
clerkListDTO
.
getClerkName
());
staff
.
setPostion
(
clerkListDTO
.
getPositionName
());
staff
.
setWxEnterpriseId
(
wxEnterpriseId
);
staff
.
setPhoneNumber
(
phoneNumber
);
try
{
staff
.
setSex
(
clerkListDTO
.
getClerkGender
()
==
null
?
null
:
Integer
.
parseInt
(
clerkListDTO
.
getClerkGender
()));
}
catch
(
Exception
e
)
{
logger
.
info
(
"【同步店员】设置性别错误sex={}"
,
clerkListDTO
.
getClerkGender
());
}
staff
.
setSyncPostionFlag
(
1
);
ServiceResponse
hr
=
staffApiService
.
add
(
staff
,
departmentId
);
if
(
hr
.
getCode
()
==
1
)
{
StaffDepartmentRelatedDTO
staffRelated
=
staffApiService
.
getDepartmentIdAndStaffId
(
departmentId
,
hr
.
getResult
().
toString
());
StaffDepartmentRelatedDTO
isCodeExist
=
staffApiService
.
getDepartmentIdAndCode
(
departmentId
,
clerkCode
);
if
(
staffRelated
!=
null
&&
isCodeExist
==
null
)
{
staffRelated
.
setClerkCode
(
clerkCode
);
staffDepartmentRelatedApiService
.
updateById
(
staffRelated
);
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByCodeNoStatus
(
enterpriseId
,
clerkCode
);
if
(
clerkDTO
!=
null
&&
(!
clerkDTO
.
getClerkName
().
equals
(
staff
.
getStaffName
())
||
!
staff
.
getPhoneNumber
().
equals
(
clerkDTO
.
getPhoneNumber
())))
{
logger
.
info
(
"【员工修改】clerkDTO={}"
,
JSON
.
toJSONString
(
clerkDTO
));
clerkDTO
.
setClerkName
(
staff
.
getStaffName
());
clerkDTO
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
clerkService
.
updateClerk
(
clerkDTO
);
}
}
}
}
else
{
String
staffId
=
staff
.
getStaffId
();
List
<
StaffDepartmentRelatedDTO
>
relatedList
=
staffApiService
.
listStaffDepartmentByStaffId
(
staffId
);
String
departmentIds
=
departmentId
;
for
(
StaffDepartmentRelatedDTO
staffDepartmentRelatedDTO
:
relatedList
)
{
departmentIds
+=
","
+
staffDepartmentRelatedDTO
.
getDepartmentId
();
}
Map
<
String
,
StaffDepartmentRelatedDTO
>
map
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
relatedList
,
"departmentId"
);
if
(
map
.
get
(
departmentId
)
==
null
)
{
staffApiService
.
staffEdit
(
staff
,
departmentIds
);
}
StaffDepartmentRelatedDTO
staffRelated
=
staffApiService
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
//如果这个人是未绑定的 则绑定clerk
StaffDepartmentRelatedDTO
isCodeExist
=
staffApiService
.
getDepartmentIdAndCode
(
departmentId
,
clerkCode
);
if
(
StringUtils
.
isBlank
(
staffRelated
.
getClerkCode
())
&&
isCodeExist
==
null
)
{
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByCodeNoStatus
(
enterpriseId
,
clerkCode
);
if
(
clerkDTO
!=
null
&&
(!
clerkDTO
.
getClerkName
().
equals
(
staff
.
getStaffName
())
||
!
staff
.
getPhoneNumber
().
equals
(
clerkDTO
.
getPhoneNumber
())))
{
logger
.
info
(
"【员工修改】clerkDTO={}"
,
JSON
.
toJSONString
(
clerkDTO
));
clerkDTO
.
setClerkName
(
staff
.
getStaffName
());
clerkDTO
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
clerkService
.
updateClerk
(
clerkDTO
);
}
staffRelated
.
setClerkCode
(
clerkCode
);
staffDepartmentRelatedApiService
.
updateById
(
staffRelated
);
}
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"同步失败"
);
}
}
}
else
{
logger
.
info
(
"【处理门店下导购】门店为空"
);
}
}
@RequestMapping
(
"department-cache"
)
@RequestMapping
(
"department-cache"
)
public
HaobanResponse
departmentCache
(
String
wxEnterpriseId
)
{
public
HaobanResponse
departmentCache
(
String
wxEnterpriseId
)
{
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
7a2e471d
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
...
@@ -18,30 +38,36 @@ import com.gic.haoban.common.utils.AuthWebRequestUtil;
...
@@ -18,30 +38,36 @@ import com.gic.haoban.common.utils.AuthWebRequestUtil;
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.PageUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.EnterpriseDetailDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkInfoDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.HaobanUserApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.WxApplicationApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.StaffEditJsonQO
;
import
com.gic.haoban.manage.web.qo.StaffEditJsonQO
;
import
com.gic.haoban.manage.web.vo.ClerkInfoVo
;
import
com.gic.haoban.manage.web.vo.ClerkInfoVo
;
import
com.gic.haoban.manage.web.vo.StaffExportVO
;
import
com.gic.haoban.manage.web.vo.StaffExportVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
cn.hutool.core.collection.CollectionUtil
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
@RestController
...
@@ -73,8 +99,6 @@ public class StaffController extends WebBaseController {
...
@@ -73,8 +99,6 @@ public class StaffController extends WebBaseController {
@Autowired
@Autowired
private
ClerkMainStoreRelatedApiService
clerkMainStoreRelatedApiService
;
private
ClerkMainStoreRelatedApiService
clerkMainStoreRelatedApiService
;
@Autowired
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
HaobanUserApiService
haobanUserApiService
;
private
HaobanUserApiService
haobanUserApiService
;
@Autowired
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
private
DealSyncOperationApiService
dealSyncOperationApiService
;
...
@@ -88,28 +112,6 @@ public class StaffController extends WebBaseController {
...
@@ -88,28 +112,6 @@ public class StaffController extends WebBaseController {
return
this
.
success
(
null
)
;
return
this
.
success
(
null
)
;
}
}
@RequestMapping
(
"staff-add"
)
public
HaobanResponse
staffAdd
(
StaffDTO
staffDTO
,
String
departmentIds
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
staffName
=
staffDTO
.
getStaffName
();
String
phoneNumber
=
staffDTO
.
getPhoneNumber
();
String
nationcode
=
staffDTO
.
getNationCode
();
staffDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
if
(
StringUtils
.
isBlank
(
staffName
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10004
);
}
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
staff
!=
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10005
);
}
ServiceResponse
hr
=
staffApiService
.
add
(
staffDTO
,
departmentIds
);
if
(
hr
.
getCode
()
==
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_DEFINE
,
hr
.
getMessage
(),
null
,
hr
.
getMessage
());
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"staff-sel"
)
@RequestMapping
(
"staff-sel"
)
public
HaobanResponse
staffSel
(
String
staffId
)
{
public
HaobanResponse
staffSel
(
String
staffId
)
{
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
...
@@ -159,44 +161,6 @@ public class StaffController extends WebBaseController {
...
@@ -159,44 +161,6 @@ public class StaffController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
PageUtil
.
getPageInfo
(
page
));
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
PageUtil
.
getPageInfo
(
page
));
}
}
@RequestMapping
(
"staff-del"
)
public
HaobanResponse
staffDel
(
String
staffDepartmentStaffRelatedId
)
{
StaffDepartmentRelatedDTO
related
=
staffDepartmentRelatedApiService
.
getByStaffDepartmentRelatedId
(
staffDepartmentStaffRelatedId
);
if
(
related
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_8
);
}
DepartmentDTO
department
=
departmentApiService
.
selectById
(
related
.
getDepartmentId
());
if
(
department
.
getTempFlag
()
!=
null
&&
department
.
getTempFlag
()
==
1
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10014
);
}
staffApiService
.
del
(
staffDepartmentStaffRelatedId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"staff-batch-del"
)
public
HaobanResponse
staffBatchDel
(
String
staffDepartmentRelatedIds
)
{
if
(
StringUtils
.
isBlank
(
staffDepartmentRelatedIds
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
String
[]
staffArr
=
staffDepartmentRelatedIds
.
split
(
","
);
int
size
=
staffArr
.
length
;
for
(
String
string
:
staffArr
)
{
StaffDepartmentRelatedDTO
related
=
staffDepartmentRelatedApiService
.
getByStaffDepartmentRelatedId
(
string
);
if
(
related
==
null
)
{
continue
;
}
DepartmentDTO
department
=
departmentApiService
.
selectById
(
related
.
getDepartmentId
());
if
(
department
.
getTempFlag
()
!=
null
&&
department
.
getTempFlag
()
==
1
)
{
if
(
size
==
1
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10014
);
}
continue
;
}
staffApiService
.
del
(
string
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"staff-edit"
)
@RequestMapping
(
"staff-edit"
)
public
HaobanResponse
staffEdit
(
StaffDTO
staffDTO
,
String
departmentIds
)
{
public
HaobanResponse
staffEdit
(
StaffDTO
staffDTO
,
String
departmentIds
)
{
String
staffId
=
staffDTO
.
getStaffId
();
String
staffId
=
staffDTO
.
getStaffId
();
...
@@ -231,12 +195,9 @@ public class StaffController extends WebBaseController {
...
@@ -231,12 +195,9 @@ public class StaffController extends WebBaseController {
userArr
.
add
(
userId
);
userArr
.
add
(
userId
);
}
}
}
}
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
1
);
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
1
);
if
(
enterpriseDTO
!=
null
)
{
if
(
application
!=
null
)
{
if
(
application
!=
null
)
{
qywxUserApiService
.
inviteUser
(
application
.
getCorpid
(),
application
.
getSiteId
(),
userArr
);
qywxUserApiService
.
inviteUser
(
enterpriseDTO
.
getCorpid
(),
application
.
getSiteId
(),
userArr
);
}
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseController.java
View file @
7a2e471d
...
@@ -154,7 +154,8 @@ public class WxEnterpriseController extends WebBaseController {
...
@@ -154,7 +154,8 @@ public class WxEnterpriseController extends WebBaseController {
if
(
wxEnterpriseDTO
==
null
)
{
if
(
wxEnterpriseDTO
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
}
QywxCorpInfoDTO
dto
=
qywxTokenManageService
.
getCorpInfo
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
());
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
QywxCorpInfoDTO
dto
=
qywxTokenManageService
.
getCorpInfo
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
());
if
(
dto
==
null
)
{
if
(
dto
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
}
...
@@ -286,7 +287,7 @@ public class WxEnterpriseController extends WebBaseController {
...
@@ -286,7 +287,7 @@ public class WxEnterpriseController extends WebBaseController {
if
(
CollectionUtils
.
isEmpty
(
secretTypeList
))
{
if
(
CollectionUtils
.
isEmpty
(
secretTypeList
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
}
if
((
secretTypeList
.
contains
(
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
())
||
secretTypeList
.
contains
(
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
()))
if
((
secretTypeList
.
contains
(
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
()))
&&
secretTypeList
.
contains
(
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
()))
{
&&
secretTypeList
.
contains
(
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
()))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
else
{
}
else
{
...
@@ -297,47 +298,6 @@ public class WxEnterpriseController extends WebBaseController {
...
@@ -297,47 +298,6 @@ public class WxEnterpriseController extends WebBaseController {
/**
/**
* 微信企业绑定接口绑定通讯录key
* 微信企业绑定接口绑定通讯录key
*
*
* @param contactSecret
* @return
*/
@RequestMapping
(
"wx-enterprise-contact-secret-set"
)
public
HaobanResponse
wxEnterpriseSecretSet
(
String
contactSecret
)
{
if
(
StringUtils
.
isBlank
(
contactSecret
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
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
,
getWxUserId
(
wxEnterpriseId
,
login
));
logger
.
info
(
"【保存联系人key】user={}"
,
JSON
.
toJSONString
(
user
));
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_SECRET
.
getVal
(),
null
);
if
(
null
==
secretSetting
)
{
secretSetting
=
new
SecretSettingDTO
();
}
secretSetting
.
setSecretType
(
SecretTypeEnum
.
CONTACT_SECRET
.
getVal
());
secretSetting
.
setSecretName
(
SecretTypeEnum
.
CONTACT_SECRET
.
getName
());
secretSetting
.
setWxEnterpriseId
(
wxEnterpriseId
);
secretSetting
.
setEnterpriseId
(
"-1"
);
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
);
}
}
/**
* 微信企业绑定接口绑定通讯录key
*
* @param wxSecretKey
* @param wxSecretKey
* @return
* @return
*/
*/
...
@@ -348,12 +308,12 @@ public class WxEnterpriseController extends WebBaseController {
...
@@ -348,12 +308,12 @@ public class WxEnterpriseController extends WebBaseController {
}
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterprise
DTO
wxEnterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
==
null
)
{
if
(
qwDTO
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
}
wxSecretKey
=
wxSecretKey
.
trim
();
wxSecretKey
=
wxSecretKey
.
trim
();
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
wxEnterprise
.
get
Corpid
(),
wxSecretKey
,
getWxUserId
(
wxEnterpriseId
,
login
));
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
qwDTO
.
getThird
Corpid
(),
wxSecretKey
,
getWxUserId
(
wxEnterpriseId
,
login
));
logger
.
info
(
"【保存联系人key】res={}"
,
res
);
logger
.
info
(
"【保存联系人key】res={}"
,
res
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
(),
null
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
(),
null
);
if
(
null
==
secretSetting
)
{
if
(
null
==
secretSetting
)
{
...
@@ -394,7 +354,8 @@ public class WxEnterpriseController extends WebBaseController {
...
@@ -394,7 +354,8 @@ public class WxEnterpriseController extends WebBaseController {
if
(
StringUtils
.
isBlank
(
secretId
))
{
if
(
StringUtils
.
isBlank
(
secretId
))
{
secretSetting
=
new
SecretSettingDTO
();
secretSetting
=
new
SecretSettingDTO
();
}
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterprise
.
getCorpid
(),
memberSecret
,
getWxUserId
(
wxEnterpriseId
,
login
));
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
qwDTO
.
getMemberCorpid
(),
memberSecret
,
getWxUserId
(
wxEnterpriseId
,
login
));
secretSetting
.
setSecretType
(
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
());
secretSetting
.
setSecretType
(
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
());
secretSetting
.
setSecretName
(
secretName
);
secretSetting
.
setSecretName
(
secretName
);
secretSetting
.
setEnterpriseId
(
enterpriseId
);
secretSetting
.
setEnterpriseId
(
enterpriseId
);
...
@@ -425,53 +386,6 @@ public class WxEnterpriseController extends WebBaseController {
...
@@ -425,53 +386,6 @@ public class WxEnterpriseController extends WebBaseController {
}
}
/**
/**
* 微信企业绑定接口绑定通讯录key(好办助手)
*
* @param contactSecret
* @param memberSecret
* @return
*/
@RequestMapping
(
"wx-enterprise-haoban-secret-set"
)
public
HaobanResponse
wxEnterpriseHaobanSecretSet
(
String
contactSecret
,
String
memberSecret
)
{
if
(
StringUtils
.
isNotBlank
(
memberSecret
))
{
contactSecret
=
memberSecret
;
}
if
(
StringUtils
.
isAnyBlank
(
contactSecret
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
String
wxEnterpriseId
=
""
;
WebLoginDTO
login
=
AuthWebRequestUtil
.
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
,
getWxUserId
(
wxEnterpriseId
,
login
));
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
);
secretSetting
.
setEnterpriseId
(
"-1"
);
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
);
}
}
/**
* 企微相关密钥列表
* 企微相关密钥列表
*
*
* @return
* @return
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
7a2e471d
...
@@ -80,12 +80,8 @@ public class ClerkController extends WebBaseController {
...
@@ -80,12 +80,8 @@ public class ClerkController extends WebBaseController {
private
AuditSettingApiService
auditSettingApiService
;
private
AuditSettingApiService
auditSettingApiService
;
@Autowired
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
private
DealSyncOperationApiService
dealSyncOperationApiService
;
@Autowired
@Autowired
private
ExternalClerkRelatedApiService
externalClerkRelatedApiService
;
private
ExternalClerkRelatedApiService
externalClerkRelatedApiService
;
@Autowired
private
OperationSettingApiService
operationSettingApiService
;
@Autowired
@Autowired
private
CustomerApiService
customerApiService
;
private
CustomerApiService
customerApiService
;
@Autowired
@Autowired
...
@@ -1238,13 +1234,13 @@ public class ClerkController extends WebBaseController {
...
@@ -1238,13 +1234,13 @@ public class ClerkController extends WebBaseController {
if
(
StringUtils
.
isNotBlank
(
wxOpenId
))
{
if
(
StringUtils
.
isNotBlank
(
wxOpenId
))
{
return
RestResponse
.
successResult
(
wxOpenId
);
return
RestResponse
.
successResult
(
wxOpenId
);
}
}
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
wxEnterprise
DTO
==
null
)
{
if
(
qw
DTO
==
null
)
{
int
code
=
HaoBanErrCode
.
ERR_400002
.
getCode
();
int
code
=
HaoBanErrCode
.
ERR_400002
.
getCode
();
return
RestResponse
.
failure
(
String
.
valueOf
(
code
),
HaoBanErrCode
.
ERR_400002
.
getMsg
());
return
RestResponse
.
failure
(
String
.
valueOf
(
code
),
HaoBanErrCode
.
ERR_400002
.
getMsg
());
}
}
String
wxUserId
=
staffDTO
.
getWxUserId
();
String
wxUserId
=
staffDTO
.
getWxUserId
();
String
openid
=
qywxUserApiService
.
getSelfOpenIdByUserId
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
String
openid
=
qywxUserApiService
.
getSelfOpenIdByUserId
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
if
(
StringUtils
.
isBlank
(
openid
))
{
if
(
StringUtils
.
isBlank
(
openid
))
{
int
code
=
HaoBanErrCode
.
ERR_600003
.
getCode
();
int
code
=
HaoBanErrCode
.
ERR_600003
.
getCode
();
return
RestResponse
.
failure
(
String
.
valueOf
(
code
),
HaoBanErrCode
.
ERR_600003
.
getMsg
());
return
RestResponse
.
failure
(
String
.
valueOf
(
code
),
HaoBanErrCode
.
ERR_600003
.
getMsg
());
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseInfoController.java
View file @
7a2e471d
...
@@ -172,8 +172,8 @@ public class WxEnterpriseInfoController extends WebBaseController {
...
@@ -172,8 +172,8 @@ public class WxEnterpriseInfoController extends WebBaseController {
}
}
String
wxEnterpriseId
=
loginStaff
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
loginStaff
.
getWxEnterpriseId
();
WxEnterprise
DTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
)
;
WxEnterprise
QwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
String
accesstoken
=
qywxCorpApiService
.
getCorpAccessToken
(
wxEnterpriseDTO
.
get
Corpid
(),
config
.
getWxSuiteid
());
String
accesstoken
=
qywxCorpApiService
.
getCorpAccessToken
(
qwDTO
.
getThird
Corpid
(),
config
.
getWxSuiteid
());
WellDoneLoginInfoVO
wellDoneLoginInfoVo
=
new
WellDoneLoginInfoVO
();
WellDoneLoginInfoVO
wellDoneLoginInfoVo
=
new
WellDoneLoginInfoVO
();
wellDoneLoginInfoVo
.
setAccessToken
(
accesstoken
);
wellDoneLoginInfoVo
.
setAccessToken
(
accesstoken
);
wellDoneLoginInfoVo
.
setStaffId
(
staffId
);
wellDoneLoginInfoVo
.
setStaffId
(
staffId
);
...
@@ -342,9 +342,10 @@ public class WxEnterpriseInfoController extends WebBaseController {
...
@@ -342,9 +342,10 @@ public class WxEnterpriseInfoController extends WebBaseController {
logger
.
info
(
"该企业不存在wxEnterpriseId={}"
,
wxEnterpriseId
);
logger
.
info
(
"该企业不存在wxEnterpriseId={}"
,
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400002
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400002
);
}
}
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseApiService
.
getQwInfo
(
wxEnterpriseId
)
;
MemberLoginQo
user
=
new
MemberLoginQo
();
MemberLoginQo
user
=
new
MemberLoginQo
();
if
(
StringUtils
.
isBlank
(
qo
.
getUserId
()))
{
if
(
StringUtils
.
isBlank
(
qo
.
getUserId
()))
{
user
=
getUserByCode
(
enterpriseDTO
,
qo
.
getCode
(),
qo
.
getGicEnterpriseId
());
user
=
getUserByCode
(
wxEnterpriseId
,
qwDTO
.
getThirdCorpid
()
,
qo
.
getCode
(),
qo
.
getGicEnterpriseId
());
if
(
user
==
null
)
{
if
(
user
==
null
)
{
logger
.
info
(
"登录失败,从微信获取用户信息失败"
);
logger
.
info
(
"登录失败,从微信获取用户信息失败"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
...
@@ -355,10 +356,6 @@ public class WxEnterpriseInfoController extends WebBaseController {
...
@@ -355,10 +356,6 @@ public class WxEnterpriseInfoController extends WebBaseController {
logger
.
info
(
"该企业不存在corpid={},{}"
,
user
.
getCorpId
(),
wxApplicationDTO
.
getWxEnterpriseId
());
logger
.
info
(
"该企业不存在corpid={},{}"
,
user
.
getCorpId
(),
wxApplicationDTO
.
getWxEnterpriseId
());
return
resultResponse
(
HaoBanErrCode
.
ERR_400002
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400002
);
}
}
if
(!
wxEnterpriseDTO
.
getCorpid
().
equals
(
enterpriseDTO
.
getCorpid
()))
{
logger
.
info
(
"{},{}"
,
wxEnterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getCorpid
());
return
resultResponse
(
HaoBanErrCode
.
ERR_500003
,
wxEnterpriseDTO
.
getCorpid
());
}
}
else
{
}
else
{
user
.
setUserId
(
qo
.
getUserId
());
user
.
setUserId
(
qo
.
getUserId
());
}
}
...
@@ -416,13 +413,13 @@ public class WxEnterpriseInfoController extends WebBaseController {
...
@@ -416,13 +413,13 @@ public class WxEnterpriseInfoController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
user
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
user
);
}
}
private
MemberLoginQo
getUserByCode
(
WxEnterpriseDTO
enterpriseDTO
,
String
code
,
String
enterpriseId
)
{
private
MemberLoginQo
getUserByCode
(
String
wxEnterpriseId
,
String
corpid
,
String
code
,
String
enterpriseId
)
{
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
()
,
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
(),
enterpriseId
);
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
(),
enterpriseId
);
if
(
null
==
secretSetting
||
StringUtils
.
isBlank
(
secretSetting
.
getSecretVal
()))
{
if
(
null
==
secretSetting
||
StringUtils
.
isBlank
(
secretSetting
.
getSecretVal
()))
{
logger
.
info
(
"MEMBER_WAPPsecret没有配置{},{}"
,
enterpriseDTO
.
getWxEnterpriseId
()
,
enterpriseId
);
logger
.
info
(
"MEMBER_WAPPsecret没有配置{},{}"
,
wxEnterpriseId
,
enterpriseId
);
return
null
;
return
null
;
}
}
String
userDTOJson
=
qywxUserApiService
.
getUserByCode
(
enterpriseDTO
.
getCorpid
()
,
secretSetting
.
getSecretVal
(),
code
);
String
userDTOJson
=
qywxUserApiService
.
getUserByCode
(
corpid
,
secretSetting
.
getSecretVal
(),
code
);
logger
.
info
(
"会员微信登录信息=============>{}"
,
userDTOJson
);
logger
.
info
(
"会员微信登录信息=============>{}"
,
userDTOJson
);
return
JSON
.
parseObject
(
userDTOJson
,
MemberLoginQo
.
class
);
return
JSON
.
parseObject
(
userDTOJson
,
MemberLoginQo
.
class
);
}
}
...
...
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