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
b426ea21
Commit
b426ea21
authored
Sep 05, 2023
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
离职继承
parent
9c1203b0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
32 deletions
+29
-32
HandoverService.java
...om/gic/haoban/manage/service/service/HandoverService.java
+2
-0
HandoverServiceImpl.java
...oban/manage/service/service/impl/HandoverServiceImpl.java
+1
-16
HandoverOperationApiServiceImpl.java
...ice/service/out/impl/HandoverOperationApiServiceImpl.java
+23
-6
ChatTest.java
haoban-manage3-service/src/test/java/ChatTest.java
+3
-10
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/HandoverService.java
View file @
b426ea21
...
@@ -121,4 +121,6 @@ public interface HandoverService {
...
@@ -121,4 +121,6 @@ public interface HandoverService {
*/
*/
public
List
<
HandoverStaffFriendCountDTO
>
listFriendCountByWxStaffIds
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
public
List
<
HandoverStaffFriendCountDTO
>
listFriendCountByWxStaffIds
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
Boolean
filterHandoverStaff
(
String
wxEnterpriseId
,
String
wxUserId
);
Boolean
filterHandoverStaff
(
String
wxEnterpriseId
,
String
wxUserId
);
public
void
delHandoverStaff
(
String
wxEnterpriseId
,
List
<
String
>
wxUserIds
)
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/HandoverServiceImpl.java
View file @
b426ea21
...
@@ -85,7 +85,6 @@ public class HandoverServiceImpl implements HandoverService {
...
@@ -85,7 +85,6 @@ public class HandoverServiceImpl implements HandoverService {
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
infoList
))
{
if
(
CollectionUtils
.
isEmpty
(
infoList
))
{
logger
.
info
(
"没有要保存的数据,删除所有需要删除逇"
);
logger
.
info
(
"没有要保存的数据,删除所有需要删除逇"
);
// delHandoverStaff(wxEnterpriseId, null);
return
false
;
return
false
;
}
}
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
qwDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
qwDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
CUSTOMIZED_APP
.
getVal
());
...
@@ -127,20 +126,6 @@ public class HandoverServiceImpl implements HandoverService {
...
@@ -127,20 +126,6 @@ public class HandoverServiceImpl implements HandoverService {
handoverExternalMapper
.
insertBatch
(
needAdd
);
handoverExternalMapper
.
insertBatch
(
needAdd
);
}
}
});
});
//删除不需要的staff数据
/*List<TabHandoverStaff> handoverStaffList = handoverStaffMapper.listByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isEmpty(handoverStaffList)) {
logger.info("没有新数据,无需删除");
return true;
}
Set<String> hasWxUserIds = handoverStaffList.stream().map(dto -> dto.getHandoverUserId()).collect(Collectors.toSet());
Sets.SetView<String> needDelUserIds = Sets.difference(hasWxUserIds, handoverUserMap.keySet());
if (CollectionUtils.isEmpty(needDelUserIds)) {
logger.info("没有新数据,无需删除2");
return true;
}
logger.info("删除数据");
delHandoverStaff(wxEnterpriseId, new ArrayList<>(needDelUserIds));*/
return
false
;
return
false
;
}
}
...
@@ -158,7 +143,7 @@ public class HandoverServiceImpl implements HandoverService {
...
@@ -158,7 +143,7 @@ public class HandoverServiceImpl implements HandoverService {
* @param wxEnterpriseId
* @param wxEnterpriseId
* @param wxUserIds
* @param wxUserIds
*/
*/
p
rivate
void
delHandoverStaff
(
String
wxEnterpriseId
,
List
<
String
>
wxUserIds
)
{
p
ublic
void
delHandoverStaff
(
String
wxEnterpriseId
,
List
<
String
>
wxUserIds
)
{
handoverStaffMapper
.
delByUserIds
(
wxEnterpriseId
,
wxUserIds
);
handoverStaffMapper
.
delByUserIds
(
wxEnterpriseId
,
wxUserIds
);
handoverExternalMapper
.
delNoTransferExternal
(
wxUserIds
,
wxEnterpriseId
);
handoverExternalMapper
.
delNoTransferExternal
(
wxUserIds
,
wxEnterpriseId
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/HandoverOperationApiServiceImpl.java
View file @
b426ea21
...
@@ -10,6 +10,7 @@ import com.gic.haoban.manage.api.dto.*;
...
@@ -10,6 +10,7 @@ import com.gic.haoban.manage.api.dto.*;
import
com.gic.haoban.manage.api.service.HandoverOperationApiService
;
import
com.gic.haoban.manage.api.service.HandoverOperationApiService
;
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.HandoverStaffMapper
;
import
com.gic.haoban.manage.service.entity.TabHandoverExternal
;
import
com.gic.haoban.manage.service.entity.TabHandoverExternal
;
import
com.gic.haoban.manage.service.entity.TabHandoverStaff
;
import
com.gic.haoban.manage.service.entity.TabHandoverStaff
;
import
com.gic.haoban.manage.service.entity.TabHandoverTransfer
;
import
com.gic.haoban.manage.service.entity.TabHandoverTransfer
;
...
@@ -23,6 +24,7 @@ import com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO;
...
@@ -23,6 +24,7 @@ import com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO;
import
com.gic.wechat.api.dto.qywx.response.QywxGetUnassignedListDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxGetUnassignedListDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxTransferCustomerDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxTransferCustomerDTO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
...
@@ -53,7 +55,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -53,7 +55,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
@Autowired
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
@Autowired
private
Config
config
;
private
HandoverStaffMapper
handoverStaffMapper
;
@Autowired
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
@Autowired
...
@@ -100,10 +102,11 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -100,10 +102,11 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
private
List
<
QywxUnassignedInfoDTO
>
getAllQywxUnassigned
(
String
wxEnterpriseId
)
{
private
List
<
QywxUnassignedInfoDTO
>
getAllQywxUnassigned
(
String
wxEnterpriseId
)
{
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
//这里改成LinkedList,避免使用ArrayList导致频繁扩容,从而减少内存的浪费
//这里改成LinkedList,避免使用ArrayList导致频繁扩容,从而减少内存的浪费
List
<
QywxUnassignedInfoDTO
>
ret
=
new
LinkedList
<>();
List
<
QywxUnassignedInfoDTO
>
ret
List
=
new
LinkedList
<>();
QywxGetUnassignedListDTO
unassignedListDTO
=
null
;
QywxGetUnassignedListDTO
unassignedListDTO
=
null
;
String
cursor
=
null
;
String
cursor
=
null
;
Map
<
String
,
Boolean
>
map
=
new
HashMap
<>()
;
Map
<
String
,
Boolean
>
map
=
new
HashMap
<>()
;
Set
<
String
>
leaveStaffSet
=
new
HashSet
<>()
;
do
{
do
{
//离职成员客户列表
//离职成员客户列表
unassignedListDTO
=
qywxUserApiService
.
getUnassignedList
(
qwDTO
.
getThirdCorpid
(),
qwDTO
.
getSelf3thSecret
(),
cursor
,
qwDTO
.
isSelf
(),
qwDTO
.
getUrlHost
());
unassignedListDTO
=
qywxUserApiService
.
getUnassignedList
(
qwDTO
.
getThirdCorpid
(),
qwDTO
.
getSelf3thSecret
(),
cursor
,
qwDTO
.
isSelf
(),
qwDTO
.
getUrlHost
());
...
@@ -116,20 +119,34 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
...
@@ -116,20 +119,34 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
String
handoverUserid
=
dto
.
getHandoverUserid
();
String
handoverUserid
=
dto
.
getHandoverUserid
();
Boolean
flag
=
map
.
get
(
handoverUserid
)
;
Boolean
flag
=
map
.
get
(
handoverUserid
)
;
if
(
null
==
flag
)
{
if
(
null
==
flag
)
{
leaveStaffSet
.
add
(
handoverUserid
)
;
flag
=
handoverService
.
filterHandoverStaff
(
wxEnterpriseId
,
handoverUserid
)
;
flag
=
handoverService
.
filterHandoverStaff
(
wxEnterpriseId
,
handoverUserid
)
;
map
.
put
(
handoverUserid
,
flag
)
;
map
.
put
(
handoverUserid
,
flag
)
;
}
}
if
(
flag
)
{
if
(
flag
)
{
ret
.
add
(
dto
);
ret
List
.
add
(
dto
);
}
}
}
}
}
}
}
while
(
StringUtils
.
isNotBlank
(
cursor
)
&&
unassignedListDTO
.
getErrcode
()
==
0
);
}
while
(
StringUtils
.
isNotBlank
(
cursor
)
&&
unassignedListDTO
.
getErrcode
()
==
0
);
if
(
CollectionUtils
.
isEmpty
(
ret
))
{
return
ret
;
//删除不需要的staff数据
List
<
TabHandoverStaff
>
handoverStaffList
=
handoverStaffMapper
.
listByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
handoverStaffList
)
&&
CollectionUtils
.
isNotEmpty
(
leaveStaffSet
))
{
Set
<
String
>
hasWxUserIds
=
handoverStaffList
.
stream
().
map
(
dto
->
dto
.
getHandoverUserId
()).
collect
(
Collectors
.
toSet
());
Sets
.
SetView
<
String
>
needDelUserIds
=
Sets
.
difference
(
hasWxUserIds
,
leaveStaffSet
);
if
(
CollectionUtils
.
isNotEmpty
(
needDelUserIds
))
{
logger
.
info
(
"需要删除的离职人={}"
,
needDelUserIds
);
this
.
handoverService
.
delHandoverStaff
(
wxEnterpriseId
,
new
ArrayList
<>(
needDelUserIds
));
}
}
if
(
CollectionUtils
.
isEmpty
(
retList
))
{
logger
.
info
(
"无待处理的离职继承数"
);
return
retList
;
}
}
logger
.
info
(
"无待处理的离职继承数={}"
,
retList
.
size
());
//去重
//去重
return
ret
.
stream
().
collect
(
return
ret
List
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
dto
->
{
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
dto
->
{
return
dto
.
getExternalUserid
()
+
dto
.
getHandoverUserid
();
return
dto
.
getExternalUserid
()
+
dto
.
getHandoverUserid
();
...
...
haoban-manage3-service/src/test/java/ChatTest.java
View file @
b426ea21
...
@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.dto.chat.GroupChatPlanDTO;
...
@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.dto.chat.GroupChatPlanDTO;
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.dto.notify.qdto.NotifyMessageBatchQDTO
;
import
com.gic.haoban.manage.api.dto.notify.qdto.NotifyMessageBatchQDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.service.HandoverOperationApiService
;
import
com.gic.haoban.manage.api.service.QywxTagApiService
;
import
com.gic.haoban.manage.api.service.QywxTagApiService
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
...
@@ -33,19 +34,11 @@ public class ChatTest {
...
@@ -33,19 +34,11 @@ public class ChatTest {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ChatTest
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ChatTest
.
class
);
@Autowired
@Autowired
private
GroupChatPlanService
groupChatPlan
Service
;
private
HandoverOperationApiService
handoverOperationApi
Service
;
@Test
@Test
public
void
test
()
{
public
void
test
()
{
String
str
=
"{\"name\":\"测试\",\"remark\":\"测试\",\"expireDays\":\"2\",\"sendType\":1,\"sendTime\":\"\",\"chatContent\":\"[{\\\"img\\\":\\\"https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/jhdm/marketing_common-edc68cbf153846928c0ac28e2b2aa92f.jpg\\\",\\\"relation_id\\\":\\\"510923843246776342\\\",\\\"type\\\":2},{\\\"img\\\":\\\"https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/jhdm/marketing_common-3acc9bc9bbe8416e8aefe459b23eea5e.jpg\\\",\\\"relation_id\\\":\\\"510923843246776342\\\",\\\"type\\\":2},{\\\"content\\\":\\\"莎啦啦啦🐮\\\",\\\"relation_id\\\":\\\"510923843246776342\\\",\\\"type\\\":1}]\",\"staffIdList\":\"36067cdee7ba4ff6adc7551b34cc2005\",\"requestProject\":\"haoban-manage-web\"}"
;
this
.
handoverOperationApiService
.
dealQywxEnterpriseHandover
(
"ca66a01b79474c40b3e7c7f93daf1a3b"
)
;
GroupChatPlanDTO
groupChatPlanDTO
=
JSONObject
.
parseObject
(
str
,
GroupChatPlanDTO
.
class
);
groupChatPlanDTO
.
setWxEnterpriseId
(
"ca66a01b79474c40b3e7c7f93daf1a3b"
);
groupChatPlanDTO
.
setEnterpriseId
(
"ff8080815dacd3a2015dacd3ef5c0000"
);
groupChatPlanDTO
.
setCreatorId
(
"fefd1c81641711e69d0818c58a146fd2"
);
groupChatPlanDTO
.
setCreatorName
(
"达摩管理员"
);
groupChatPlanDTO
.
setMaterialFrom
(
2
);
groupChatPlanService
.
save
(
groupChatPlanDTO
);
}
}
@Test
@Test
...
...
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