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
0935869c
Commit
0935869c
authored
Dec 21, 2021
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:增加微信userid转换
parent
c9d7d331
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
212 additions
and
110 deletions
+212
-110
StaffDTO.java
...src/main/java/com/gic/haoban/manage/api/dto/StaffDTO.java
+10
-0
MessageApiService.java
.../com/gic/haoban/manage/api/service/MessageApiService.java
+0
-8
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+23
-2
StaffMapper.java
...com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
+53
-22
TabHaobanStaff.java
.../com/gic/haoban/manage/service/entity/TabHaobanStaff.java
+11
-1
StaffService.java
...a/com/gic/haoban/manage/service/service/StaffService.java
+34
-9
StaffServiceImpl.java
.../haoban/manage/service/service/impl/StaffServiceImpl.java
+18
-9
DealSyncOperationApiServiceImpl.java
...ice/service/out/impl/DealSyncOperationApiServiceImpl.java
+0
-3
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+0
-4
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+13
-5
QywxClerkSyncOperation.java
...ic/haoban/manage/service/task/QywxClerkSyncOperation.java
+28
-32
StaffMapper.xml
...manage3-service/src/main/resources/mapper/StaffMapper.xml
+0
-0
AdminController.java
...com/gic/haoban/manage/web/controller/AdminController.java
+17
-14
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+5
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/StaffDTO.java
View file @
0935869c
...
...
@@ -92,6 +92,8 @@ public class StaffDTO implements Serializable {
*/
private
Integer
relationFlag
;
private
String
wxOpenUseId
;
public
String
getClerkId
()
{
return
clerkId
;
}
...
...
@@ -318,4 +320,12 @@ public class StaffDTO implements Serializable {
public
void
setRelationFlag
(
Integer
relationFlag
)
{
this
.
relationFlag
=
relationFlag
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MessageApiService.java
View file @
0935869c
...
...
@@ -24,14 +24,6 @@ public interface MessageApiService {
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
);
/**
* 队列消费gic推送数据
*
* @param param
*/
@Deprecated
void
dealGicMessage
(
String
param
);
/**
* 队列消费企业微信推送数据
* @param param
*/
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
0935869c
...
...
@@ -40,8 +40,6 @@ public interface StaffApiService {
void
staffEdit
(
StaffDTO
staffDTO
,
String
departmentIds
);
void
syscGicClerk
(
String
fieldListString
);
StaffDTO
selectByUserIdAndEnterpriseId
(
String
userId
,
String
wxEnterpriseId
);
StaffDepartmentRelatedDTO
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
);
...
...
@@ -123,4 +121,27 @@ public interface StaffApiService {
* @date 2021-12-16 19:53:48
*/
StaffPrivacyUseLogDTO
getStaffPrivacyByStaffId
(
String
staffId
);
/**
* 用户id wx企业id列表
*
* @param wxEnterpriseId wx企业标识
* @return {@link List<String> }
* @author mozhu
* @date 2021-12-21 17:05:33
*/
List
<
StaffDTO
>
listUserIdByWxEnterpriseId
(
String
wxEnterpriseId
);
/**
* 通过开放用户id和wx企业id列表
*
* @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识
* @return {@link List<StaffDTO> }
* @author mozhu
* @date 2021-12-21 17:23:36
*/
List
<
StaffDTO
>
listByOpenUserIdsAndWxEnterpriseId
(
List
<
String
>
openUserIds
,
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffMapper.java
View file @
0935869c
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.ibatis.annotations.Param
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.github.pagehelper.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
public
interface
StaffMapper
{
int
deleteByPrimaryKey
(
String
staffId
);
int
insert
(
TabHaobanStaff
record
);
int
insertSelective
(
TabHaobanStaff
record
);
TabHaobanStaff
selectByPrimaryKey
(
String
staffId
);
int
updateByPrimaryKeySelective
(
TabHaobanStaff
record
);
int
updateByPrimaryKey
(
TabHaobanStaff
record
);
TabHaobanStaff
selectByNationcodeAndPhoneNumber
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"nationCode"
)
String
nationcode
,
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
TabHaobanStaff
>
listByIds
(
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
TabHaobanStaff
selectByNationcodeAndPhoneNumber
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"nationCode"
)
String
nationcode
,
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
TabHaobanStaff
>
listByWxUserId
(
@Param
(
"wxUserId"
)
String
wxUserId
);
List
<
TabHaobanStaff
>
list
ByIds
(
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
List
<
TabHaobanStaff
>
list
LikeName
(
@Param
(
"staffName"
)
String
staffName
);
List
<
TabHaobanStaff
>
listByWxUserId
(
@Param
(
"wxUserId"
)
String
wxUserI
d
);
Page
<
TabHaobanStaff
>
pageStaff
(
@Param
(
"staffIds"
)
Set
<
String
>
staffIds
,
@Param
(
"activeFlag"
)
Integer
activeFlag
,
@Param
(
"keyword"
)
String
keywor
d
);
List
<
TabHaobanStaff
>
listLikeName
(
@Param
(
"staffName"
)
String
staffName
);
TabHaobanStaff
selectByUserIdAndEnterpriseId
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
Page
<
TabHaobanStaff
>
pageStaff
(
@Param
(
"staffIds"
)
Set
<
String
>
staffIds
,
@Param
(
"activeFlag"
)
Integer
activeFlag
,
@Param
(
"keyword"
)
String
keywor
d
);
TabHaobanStaff
selectSuperByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseI
d
);
TabHaobanStaff
selectByUserIdAndEnterpriseId
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaff
>
listByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
TabHaobanStaff
selectSuperByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaff
>
listByUserIdsAndWxEnterpriseId
(
@Param
(
"userIds"
)
List
<
String
>
userIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaff
>
listByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
int
cleanStaff
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
List
<
TabHaobanStaff
>
listByUserIdsAndWxEnterpriseId
(
@Param
(
"userIds"
)
List
<
String
>
userIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
TabHaobanStaff
getWxStaffByOne
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
public
int
cleanStaff
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
List
<
String
>
listUserStaffId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
TabHaobanStaff
getWxStaffByOne
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaff
>
listNoStatusStaffIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
public
List
<
String
>
listUserStaffId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
TabHaobanStaff
getNoStatusByWxUserIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"wxUserId"
)
String
wxUserId
);
public
List
<
TabHaobanStaff
>
listNoStatusStaffIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffIds"
)
List
<
String
>
staffIds
);
/**
* 通过开放用户id和wx企业id列表
*
* @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识
* @return {@link List<TabHaobanStaff> }
* @author mozhu
* @date 2021-12-21 16:35:35
*/
List
<
TabHaobanStaff
>
listByOpenUserIdsAndWxEnterpriseId
(
@Param
(
"openUserIds"
)
List
<
String
>
openUserIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
public
TabHaobanStaff
getNoStatusByWxUserIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"wxUserId"
)
String
wxUserId
);
/**
* 用户id wx企业id列表
*
* @param wxEnterpriseId wx企业标识
* @return {@link List<String> }
* @author mozhu
* @date 2021-12-21 17:05:58
*/
List
<
TabHaobanStaff
>
listUserIdByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
/**
* 更新开放用户id,用户id
*
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id
* @param wxOpenUseId 开放的用户id
* @return int
* @author mozhu
* @date 2021-12-21 17:17:51
*/
int
updateOpenUserIdsByUserId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"wxUserId"
)
String
wxUserId
,
@Param
(
"wxOpenUseId"
)
String
wxOpenUseId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabHaobanStaff.java
View file @
0935869c
...
...
@@ -4,6 +4,9 @@ import java.io.Serializable;
import
java.util.Date
;
public
class
TabHaobanStaff
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
staffId
;
private
String
wxUserId
;
...
...
@@ -40,7 +43,7 @@ public class TabHaobanStaff implements Serializable {
private
Integer
superManagerFlag
;
private
static
final
long
serialVersionUID
=
1L
;
private
String
wxOpenUseId
;
public
String
getStaffId
()
{
return
staffId
;
...
...
@@ -186,5 +189,11 @@ public class TabHaobanStaff implements Serializable {
this
.
superManagerFlag
=
superManagerFlag
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffService.java
View file @
0935869c
package
com
.
gic
.
haoban
.
manage
.
service
.
service
;
import
java.util.List
;
import
java.util.Set
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.github.pagehelper.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
public
interface
StaffService
{
TabHaobanStaff
selectById
(
String
staffId
);
TabHaobanStaff
selectByNationcodeAndPhoneNumber
(
String
wxEnterpriseId
,
String
nationcode
,
String
phoneNumber
);
TabHaobanStaff
selectByNationcodeAndPhoneNumber
(
String
wxEnterpriseId
,
String
nationcode
,
String
phoneNumber
);
String
add
(
TabHaobanStaff
tab
);
...
...
@@ -28,20 +27,22 @@ public interface StaffService {
/**
* 清楚微信信息
*
* @param wxEnterpriseId
* @return
*/
public
int
cleanStaff
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
int
cleanStaff
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
TabHaobanStaff
getWxStaffByOne
(
String
wxEnterpriseId
);
TabHaobanStaff
getWxStaffByOne
(
String
wxEnterpriseId
);
/**
* 获取需要删除的staff列表
*
* @param wxEnterpriseId
* @param staffIds
* @return
*/
public
List
<
String
>
listDelUserStaffId
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
List
<
String
>
listDelUserStaffId
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
/**
* 获取无状态的staff列表
...
...
@@ -50,6 +51,30 @@ public interface StaffService {
* @param staffIds
* @return
*/
public
List
<
TabHaobanStaff
>
listNoStatusByStaffIds
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
List
<
TabHaobanStaff
>
listNoStatusByStaffIds
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
/**
* 通过开放用户id和wx企业id列表
*
* @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识
* @return {@link List<StaffDTO> }
* @author mozhu
* @date 2021-12-21 16:32:50
*/
List
<
StaffDTO
>
listByOpenUserIdsAndWxEnterpriseId
(
List
<
String
>
openUserIds
,
String
wxEnterpriseId
);
/**
* 更新开放用户id,用户id
*
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id
* @param wxOpenUseId wx开放使用id
* @return int
* @author mozhu
* @date 2021-12-21 17:19:33
*/
int
updateOpenUserIdsByUserId
(
String
wxEnterpriseId
,
String
wxUserId
,
String
wxOpenUseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffServiceImpl.java
View file @
0935869c
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
...
...
@@ -16,6 +8,13 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import
com.gic.haoban.manage.service.service.MemberUnionRelatedService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.github.pagehelper.Page
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
@Service
public
class
StaffServiceImpl
implements
StaffService
{
...
...
@@ -100,11 +99,21 @@ public class StaffServiceImpl implements StaffService {
@Override
public
List
<
String
>
listDelUserStaffId
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
)
{
return
mapper
.
listUserStaffId
(
wxEnterpriseId
,
staffIds
);
return
mapper
.
listUserStaffId
(
wxEnterpriseId
,
staffIds
);
}
@Override
public
List
<
TabHaobanStaff
>
listNoStatusByStaffIds
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
)
{
return
mapper
.
listNoStatusStaffIds
(
wxEnterpriseId
,
staffIds
);
}
@Override
public
List
<
StaffDTO
>
listByOpenUserIdsAndWxEnterpriseId
(
List
<
String
>
openUserIds
,
String
wxEnterpriseId
)
{
return
EntityUtil
.
changeEntityListByJSON
(
StaffDTO
.
class
,
mapper
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
));
}
@Override
public
int
updateOpenUserIdsByUserId
(
String
wxEnterpriseId
,
String
wxUserId
,
String
wxOpenUseId
)
{
return
mapper
.
updateOpenUserIdsByUserId
(
wxEnterpriseId
,
wxUserId
,
wxOpenUseId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DealSyncOperationApiServiceImpl.java
View file @
0935869c
...
...
@@ -119,7 +119,6 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
store
.
getVal
()))
{
logger
.
info
(
"门店处理:{}"
,
params
);
operationMap
.
get
(
"storeSyncOperation"
).
dealSingleByMq
(
dealParamMqDTO
,
dataPre
);
//成员处理
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
clerk
.
getVal
()))
{
logger
.
info
(
"店员处理:{}"
,
params
);
...
...
@@ -142,14 +141,12 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
friend_merge
.
getVal
()))
{
operationMap
.
get
(
"friendMergeSyncOperation"
).
dealSingleByMq
(
dealParamMqDTO
,
dataPre
);
logger
.
info
(
"好友合并处理:{}"
,
params
);
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
tag
.
getVal
()))
{
operationMap
.
get
(
"friendTagSyncOperation"
).
dealSingleByMq
(
dealParamMqDTO
,
dataPre
);
logger
.
info
(
"会员标签处理:{}"
,
params
);
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
tag_member
.
getVal
()))
{
operationMap
.
get
(
"friendMemberTagSyncOperation"
).
dealSingleByMq
(
dealParamMqDTO
,
dataPre
);
logger
.
info
(
"会员标签处理标签项:{}"
,
params
);
}
else
{
logger
.
info
(
"不是正常数据:{}"
,
params
);
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
0935869c
...
...
@@ -115,10 +115,6 @@ public class MessageApiServiceImpl implements MessageApiService {
}
@Override
public
void
dealGicMessage
(
String
param
)
{
}
@Override
public
void
dealWxMessage
(
String
param
)
{
if
(
true
)
{
log
.
info
(
"不出发更新企业微信变更"
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
0935869c
...
...
@@ -25,6 +25,7 @@ import com.gic.haoban.manage.api.dto.*;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
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.StaffMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
...
...
@@ -99,6 +100,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private
SecretSettingService
secretSettingService
;
@Autowired
private
StaffPrivacyUseLogService
staffPrivacyUseLogService
;
@Autowired
private
Config
config
;
@Override
public
StaffDTO
selectById
(
String
staffId
)
{
...
...
@@ -903,11 +906,6 @@ public class StaffApiServiceImpl implements StaffApiService {
staffEditDeal
(
staffDTO
,
departmentIds
,
false
);
}
@Override
public
void
syscGicClerk
(
String
fieldListString
)
{
// TODO Auto-generated method stub
}
@Override
public
StaffDTO
selectByUserIdAndEnterpriseId
(
String
userId
,
String
wxEnterpriseId
)
{
...
...
@@ -1475,4 +1473,14 @@ public class StaffApiServiceImpl implements StaffApiService {
return
EntityUtil
.
changeEntity
(
StaffPrivacyUseLogDTO
.
class
,
staffPrivacyUseLogService
.
getByStaffId
(
staffId
));
}
@Override
public
List
<
StaffDTO
>
listUserIdByWxEnterpriseId
(
String
wxEnterpriseId
)
{
return
EntityUtil
.
changeEntityListNew
(
StaffDTO
.
class
,
staffMapper
.
listUserIdByWxEnterpriseId
(
wxEnterpriseId
));
}
@Override
public
List
<
StaffDTO
>
listByOpenUserIdsAndWxEnterpriseId
(
List
<
String
>
openUserIds
,
String
wxEnterpriseId
)
{
return
EntityUtil
.
changeEntityListNew
(
StaffDTO
.
class
,
staffMapper
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
));
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/QywxClerkSyncOperation.java
View file @
0935869c
package
com
.
gic
.
haoban
.
manage
.
service
.
task
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.
GicClerk
DTO
;
import
com.gic.haoban.manage.api.dto.
Staff
DTO
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
import
com.gic.haoban.manage.api.enums.PreDealTypeEnum
;
import
com.gic.haoban.manage.api.enums.SyncTaskStatusEnum
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncTask
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.PreDealService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.SyncTaskService
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang.StringUtils
;
import
com.gic.wechat.api.dto.qywx.QywxNewUseridDTO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* Created 2020/4/13.
*
...
...
@@ -37,44 +36,34 @@ public class QywxClerkSyncOperation implements BaseSyncOperation {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
QywxClerkSyncOperation
.
class
);
@Autowired
private
DepartmentService
departmentService
;
@Autowired
private
StoreGroupService
storeGroupService
;
@Autowired
private
PreDealService
preDealService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
SyncTaskService
syncTaskService
;
@Autowired
private
StoreService
storeService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
Config
config
;
@Autowired
private
StaffService
staffService
;
@Override
public
void
dealSingleByMq
(
DealParamMqDTO
dealParamMqDTO
,
TabHaobanPreDealLog
dataPre
)
{
logger
.
info
(
"微信成员处理:{}"
,
JSONObject
.
toJSONString
(
dealParamMqDTO
));
boolean
dealFlag
=
true
;
String
reason
=
""
;
String
reason
=
""
;
//处理clerk
try
{
ServiceResponse
response
=
staffApiService
.
getWxSaveNew
(
dealParamMqDTO
.
getData
(),
dataPre
.
getWxEnterpriseId
());
if
(
response
.
getCode
()
!=
1
)
{
dealFlag
=
false
;
reason
=
response
.
getMessage
();
if
(
response
.
getCode
()
!=
1
)
{
dealFlag
=
false
;
reason
=
response
.
getMessage
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -125,16 +114,23 @@ public class QywxClerkSyncOperation implements BaseSyncOperation {
String
key
=
"haoban_sync_clerk_task_"
+
taskId
;
RedisUtil
.
lock
(
key
,
3L
);
TabHaobanSyncTask
syncTask
=
syncTaskService
.
getSyncTask
(
taskId
);
String
wxEnterpriseId
=
syncTask
.
getWxEnterpriseId
();
//同步成功 进入门店处理
if
(
syncTask
.
getStatusFlag
().
equals
(
SyncTaskStatusEnum
.
clerk_sync
.
getVal
()))
{
int
errCount
=
preDealService
.
countByTaskId
(
taskId
,
-
1
,
PreDealStatusEnum
.
exception
.
getVal
());
if
(
errCount
>
0
)
{
syncTaskService
.
updateTaskStatus
(
taskId
,
SyncTaskStatusEnum
.
exception_compute
.
getVal
());
dealSyncOperationApiService
.
unlockTask
(
syncTask
.
getWxEnterpriseId
()
);
dealSyncOperationApiService
.
unlockTask
(
wxEnterpriseId
);
}
else
{
syncTaskService
.
updateTaskStatus
(
taskId
,
SyncTaskStatusEnum
.
compute
.
getVal
());
dealSyncOperationApiService
.
unlockTask
(
syncTask
.
getWxEnterpriseId
());
dealSyncOperationApiService
.
cleanDiffrence
(
syncTask
.
getWxEnterpriseId
(),
taskId
);
dealSyncOperationApiService
.
unlockTask
(
wxEnterpriseId
);
dealSyncOperationApiService
.
cleanDiffrence
(
wxEnterpriseId
,
taskId
);
//批量处理wx_user_id to wx_open_user_id
List
<
StaffDTO
>
staffDTOS
=
staffApiService
.
listUserIdByWxEnterpriseId
(
wxEnterpriseId
);
List
<
QywxNewUseridDTO
>
qywxNewUseridDTOS
=
qywxUserApiService
.
useridToOpenuserid
(
config
.
getCorpid
(),
config
.
getWxSuiteid
(),
Arrays
.
toString
(
staffDTOS
.
stream
().
map
(
StaffDTO:
:
getWxUserId
).
toArray
()));
for
(
QywxNewUseridDTO
qywxNewUseridDTO
:
qywxNewUseridDTOS
)
{
staffService
.
updateOpenUserIdsByUserId
(
wxEnterpriseId
,
qywxNewUseridDTO
.
getUserid
(),
qywxNewUseridDTO
.
getOpen_userid
());
}
}
}
RedisUtil
.
unlock
(
key
);
...
...
haoban-manage3-service/src/main/resources/mapper/StaffMapper.xml
View file @
0935869c
This diff is collapsed.
Click to expand it.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/AdminController.java
View file @
0935869c
...
...
@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
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.web.auth.AuthRequestUtil
;
...
...
@@ -14,6 +13,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import
com.gic.haoban.manage.web.vo.AdminRoleVO
;
import
com.gic.haoban.manage.web.vo.AdminVO
;
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
;
...
...
@@ -25,14 +25,12 @@ import java.util.ArrayList;
import
java.util.List
;
@RestController
public
class
AdminController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AdminController
.
class
);
public
class
AdminController
extends
WebBaseController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AdminController
.
class
);
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
WxApplicationApiService
wxApplicationApiService
;
...
...
@@ -46,21 +44,26 @@ public class AdminController extends WebBaseController{
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
logger
.
info
(
"【管理员查询】corpid={},siteId={},agentId={}"
,
enterprise
.
getCorpid
(),
application
.
getSiteId
(),
application
.
getAgentId
());
String
adminList
=
qywxSuiteApiService
.
getAdminList
(
enterprise
.
getCorpid
(),
application
.
getSiteId
(),
Integer
.
parseInt
(
application
.
getAgentId
()));
logger
.
info
(
"【管理员查询】userIds={}"
,
JSON
.
toJSONString
(
adminList
));
List
<
String
>
userIds
=
new
ArrayList
<
String
>();
if
(
StringUtils
.
isNotBlank
(
adminList
)){
String
corpid
=
enterprise
.
getCorpid
();
logger
.
info
(
"【管理员查询】corpid={},siteId={},agentId={}"
,
corpid
,
application
.
getSiteId
(),
application
.
getAgentId
());
String
adminList
=
qywxSuiteApiService
.
getAdminList
(
corpid
,
application
.
getSiteId
(),
Integer
.
parseInt
(
application
.
getAgentId
()));
logger
.
info
(
"【管理员查询】userIds={}"
,
JSON
.
toJSONString
(
adminList
));
List
<
String
>
openUserIds
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
adminList
))
{
JSONArray
jsonArr
=
JSON
.
parseArray
(
adminList
);
for
(
Object
object
:
jsonArr
)
{
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
object
));
u
serIds
.
add
(
json
.
getString
(
"userid"
));
openU
serIds
.
add
(
json
.
getString
(
"userid"
));
}
}
List
<
StaffDTO
>
list
=
new
ArrayList
<>();
List
<
AdminVO
>
resultList
=
new
ArrayList
<>();
if
(!
userIds
.
isEmpty
()){
list
=
staffApiService
.
listByUserIdsAndWxEnterpriseId
(
userIds
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
openUserIds
))
{
if
(
corpid
.
length
()
>
20
)
{
list
=
staffApiService
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
}
else
{
list
=
staffApiService
.
listByUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
}
for
(
StaffDTO
staffDTO
:
list
)
{
AdminVO
vo
=
new
AdminVO
();
vo
.
setRoleId
(
staffDTO
.
getStaffId
());
...
...
@@ -78,7 +81,7 @@ public class AdminController extends WebBaseController{
resultList
.
add
(
vo
);
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resultList
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resultList
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
0935869c
...
...
@@ -249,8 +249,12 @@ public class ApplicationController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_0
,
this
.
qywxUserApiService
.
getExternalUseridByUnionid
(
corpid
,
suiteid
,
unionid
));
}
/**
* 通讯录同步
*
* @return
*/
@RequestMapping
(
"sync-qywx"
)
@IgnoreLogin
public
Object
syncQywx
()
{
LoginDTO
login
=
(
LoginDTO
)
AuthRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
...
...
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