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
a4af1381
Commit
a4af1381
authored
Sep 01, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:代码优化
parent
3b9cdcb8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
73 deletions
+35
-73
StaffClerkRelationApiService.java
...oban/manage/api/service/StaffClerkRelationApiService.java
+3
-5
StaffClerkRelationService.java
...ban/manage/service/service/StaffClerkRelationService.java
+2
-13
StaffClerkRelationServiceImpl.java
...e/service/service/impl/StaffClerkRelationServiceImpl.java
+6
-26
StoreRangeServiceImpl.java
...an/manage/service/service/impl/StoreRangeServiceImpl.java
+2
-4
StaffClerkRelationApiServiceImpl.java
...ce/service/out/impl/StaffClerkRelationApiServiceImpl.java
+22
-25
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffClerkRelationApiService.java
View file @
a4af1381
...
...
@@ -10,8 +10,6 @@ import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.ibatis.annotations.Param
;
public
interface
StaffClerkRelationApiService
{
/**
* 绑定日志
...
...
@@ -37,7 +35,7 @@ public interface StaffClerkRelationApiService {
*
* @return
*/
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chanelCode
);
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chan
n
elCode
);
StaffClerkRelationDTO
getByCodeAndEnterpriseId
(
String
clerkCode
,
String
enterpriseId
);
...
...
@@ -45,9 +43,9 @@ public interface StaffClerkRelationApiService {
* 审核绑定
* @param staffClerkRelation
* @param optStaffId
* @param chanelCode
* @param chan
n
elCode
*/
void
delAndInsert
(
StaffClerkRelationDTO
staffClerkRelation
,
String
optStaffId
,
int
chanelCode
);
void
delAndInsert
(
StaffClerkRelationDTO
staffClerkRelation
,
String
optStaffId
,
int
chan
n
elCode
);
/**
* 解绑
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffClerkRelationService.java
View file @
a4af1381
...
...
@@ -4,7 +4,6 @@ import com.gic.api.base.commons.Page;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -30,17 +29,7 @@ public interface StaffClerkRelationService {
* @param storeIds
* @return
*/
boolean
delBindByStoreIds
(
String
wxEnterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
);
/**
* 删除绑定
*
* @param wxEnterpriseId 可以不传
* @param enterpriseId
* @param storeIds 解除除了这些门店之外的绑定的门店
* @return
*/
boolean
delBindNotInStoreIds
(
String
wxEnterpriseId
,
String
enterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
);
boolean
delBindByStoreIds
(
String
wxEnterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
channelCode
);
/**
* 绑定
...
...
@@ -48,7 +37,7 @@ public interface StaffClerkRelationService {
* @param dto
* @return
*/
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
chanelCode
);
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
chan
n
elCode
);
/**
* 根据clerkId 更新数据
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffClerkRelationServiceImpl.java
View file @
a4af1381
...
...
@@ -94,7 +94,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
@Override
public
boolean
delBindByStoreIds
(
String
wxEnterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
)
{
public
boolean
delBindByStoreIds
(
String
wxEnterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chan
n
elCode
)
{
if
(
CollectionUtils
.
isEmpty
(
storeIds
))
{
logger
.
info
(
"没有传门店列表:{}"
,
wxEnterpriseId
);
return
true
;
...
...
@@ -112,37 +112,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
List
<
String
>
need
=
needUnbind
.
stream
().
map
(
tab
->
tab
.
getStaffClerkRelationId
()).
collect
(
Collectors
.
toList
());
//放入队列
staffClerkBindLogService
.
pushToMqBatch
(
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chanelCode
,
need
);
staffClerkBindLogService
.
pushToMqBatch
(
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chan
n
elCode
,
need
);
for
(
TabHaobanStaffClerkRelation
clerkRelation
:
needUnbind
)
{
//废弃活码
hmClerkRelationApiService
.
delByClerkId
(
clerkRelation
.
getClerkId
(),
clerkRelation
.
getEnterpriseId
(),
wxEnterpriseId
,
chanelCode
);
hmClerkRelationApiService
.
delByClerkId
(
clerkRelation
.
getClerkId
(),
clerkRelation
.
getEnterpriseId
(),
wxEnterpriseId
,
chan
n
elCode
);
}
return
true
;
}
@Override
public
boolean
delBindNotInStoreIds
(
String
wxEnterpriseId
,
String
enterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
)
{
if
(
CollectionUtils
.
isEmpty
(
storeIds
))
{
logger
.
info
(
"没有传门店列表:{}"
,
wxEnterpriseId
);
return
true
;
}
List
<
TabHaobanStaffClerkRelation
>
needUnbind
=
mapper
.
listBindNotInStoreIds
(
wxEnterpriseId
,
enterpriseId
,
storeIds
);
if
(
CollectionUtils
.
isEmpty
(
needUnbind
))
{
logger
.
info
(
"没有门店绑定了需要解绑的:{}"
,
wxEnterpriseId
);
}
Set
<
String
>
needDelStoreIds
=
needUnbind
.
stream
().
map
(
tab
->
tab
.
getStoreId
()).
collect
(
Collectors
.
toSet
());
//清除绑定
mapper
.
delByStoreIds
(
needDelStoreIds
);
List
<
String
>
need
=
needUnbind
.
stream
().
map
(
tab
->
tab
.
getStaffClerkRelationId
()).
collect
(
Collectors
.
toList
());
//放入队列
staffClerkBindLogService
.
pushToMqBatch
(
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chanelCode
,
need
);
return
true
;
}
@Override
public
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
chanelCode
)
{
public
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
channelCode
)
{
Date
now
=
new
Date
();
dto
.
setStaffClerkRelationId
(
ToolUtil
.
randomUUID
());
dto
.
setStatusFlag
(
1
);
...
...
@@ -157,7 +137,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
String
wxEnterpriseId
=
dto
.
getWxEnterpriseId
();
clerkMainStoreRelatedService
.
getMainStoreByStaffId
(
staffId
,
wxEnterpriseId
);
//推入日志
staffClerkBindLogService
.
pushToMq
(
staffId
,
optStaffId
,
BindTypeEnum
.
BIND
.
getVal
(),
chanelCode
,
dto
.
getStaffClerkRelationId
());
staffClerkBindLogService
.
pushToMq
(
staffId
,
optStaffId
,
BindTypeEnum
.
BIND
.
getVal
(),
chan
n
elCode
,
dto
.
getStaffClerkRelationId
());
// 绑定自动创建活码
HmQrcodeQDTO
hmQrcodeQDTO
=
new
HmQrcodeQDTO
();
...
...
@@ -168,7 +148,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
hmQrcodeQDTO
.
setPassFlag
(
1
);
hmQrcodeQDTO
.
setStoreId
(
dto
.
getStoreId
());
hmQrcodeQDTO
.
setClerkIdList
(
Collections
.
singletonList
(
dto
.
getClerkId
()));
hmQrcodeQDTO
.
setInvokingType
(
chanelCode
);
hmQrcodeQDTO
.
setInvokingType
(
chan
n
elCode
);
hmQrcodeApiService
.
add
(
hmQrcodeQDTO
);
}
return
s
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StoreRangeServiceImpl.java
View file @
a4af1381
...
...
@@ -112,6 +112,7 @@ public class StoreRangeServiceImpl implements StoreRangeService {
return
true
;
}
String
enterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
String
wxEnterpriseId
=
list
.
get
(
0
).
getWxEnterpriseId
();
//更新前绑定门店列表
List
<
TabStoreRelation
>
storeRelations
=
tabHaobanStoreRelationMapper
.
listStoreRange
(
enterpriseId
);
Map
<
String
,
Set
<
String
>>
oldStoreIdByMap
=
storeRelations
.
stream
().
collect
(
Collectors
.
groupingBy
(
TabStoreRelation:
:
getWxEnterpriseId
,
Collectors
.
mapping
(
dto
->
dto
.
getStoreId
(),
Collectors
.
toSet
())));
...
...
@@ -155,7 +156,7 @@ public class StoreRangeServiceImpl implements StoreRangeService {
}
});
//这些门店解除绑定
staffClerkRelationService
.
delBindByStoreIds
(
null
,
needUnBindStoreIds
,
optStaffId
,
channelCode
);
staffClerkRelationService
.
delBindByStoreIds
(
wxEnterpriseId
,
needUnBindStoreIds
,
optStaffId
,
channelCode
);
//批量处理关联关系
dealStoreRelation
(
list
,
enterpriseId
,
needUnBindStoreIds
,
needAddStoreIds
);
return
true
;
...
...
@@ -217,9 +218,6 @@ public class StoreRangeServiceImpl implements StoreRangeService {
Map
<
String
,
Set
<
String
>>
ret
=
new
HashMap
<>();
Set
<
String
>
wxEnterpriseIds
=
new
HashSet
<>();
// //更新前绑定门店列表
// List<TabStoreRelation> storeRelations = tabHaobanStoreRelationMapper.listStoreRange(enterpriseId);
// Map<String, Set<String>> oldStoreIdBywxEnterpriseMap = storeRelations.stream().collect(Collectors.groupingBy(TabStoreRelation::getWxEnterpriseId, Collectors.mapping(dto -> dto.getStoreId(), Collectors.toSet())));
if
(
oldStoreIdBywxEnterpriseMap
!=
null
&&
oldStoreIdBywxEnterpriseMap
.
size
()
>
0
)
{
wxEnterpriseIds
.
addAll
(
oldStoreIdBywxEnterpriseMap
.
keySet
());
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffClerkRelationApiServiceImpl.java
View file @
a4af1381
...
...
@@ -73,8 +73,6 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
SecretSettingService
secretSettingService
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
HmClerkRelationApiService
hmClerkRelationApiService
;
...
...
@@ -168,7 +166,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chanelCode
)
{
public
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chan
n
elCode
)
{
logger
.
info
(
"绑定clerk:{}"
,
JSONObject
.
toJSONString
(
staffClerkRelationDTO
));
ServiceResponse
<
Object
>
response
=
new
ServiceResponse
<>();
StaffClerkRelationDTO
relationDTO
=
staffClerkRelationService
.
getBindByClerkId
(
staffClerkRelationDTO
.
getClerkId
(),
staffClerkRelationDTO
.
getWxEnterpriseId
());
...
...
@@ -199,7 +197,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return
response
;
}
String
relationId
=
staffClerkRelationService
.
bind
(
staffClerkRelationDTO
,
optStaffId
,
chanelCode
);
String
relationId
=
staffClerkRelationService
.
bind
(
staffClerkRelationDTO
,
optStaffId
,
chan
n
elCode
);
response
.
setResult
(
relationId
);
return
response
;
}
...
...
@@ -231,7 +229,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
public
List
<
StaffClerkRelationDTO
>
listByStoreId
(
String
storeId
)
{
List
<
TabHaobanStaffClerkRelation
>
list
=
tabHaobanStaffClerkRelationMapper
.
listByStoreId
(
storeId
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
return
new
ArrayList
<
StaffClerkRelationDTO
>();
return
new
ArrayList
<>();
}
List
<
StaffClerkRelationDTO
>
result
=
EntityUtil
.
changeEntityListByJSON
(
StaffClerkRelationDTO
.
class
,
list
);
return
result
;
...
...
@@ -271,14 +269,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public
void
delAndInsert
(
StaffClerkRelationDTO
staffClerkRelation
,
String
optStaffId
,
int
chanelCode
)
{
public
void
delAndInsert
(
StaffClerkRelationDTO
staffClerkRelation
,
String
optStaffId
,
int
chan
n
elCode
)
{
if
(
StringUtils
.
isNotBlank
(
staffClerkRelation
.
getStaffClerkRelationId
()))
{
TabHaobanStaffClerkRelation
oldStaffClerkRelation
=
tabHaobanStaffClerkRelationMapper
.
selectByPrimaryKey
(
staffClerkRelation
.
getStaffClerkRelationId
());
tabHaobanStaffClerkRelationMapper
.
delByPrimaryKey
(
staffClerkRelation
.
getStaffClerkRelationId
());
staffClerkBindLogService
.
pushToMq
(
oldStaffClerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chanelCode
,
staffClerkRelation
.
getStaffClerkRelationId
());
staffClerkBindLogService
.
pushToMq
(
oldStaffClerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chan
n
elCode
,
staffClerkRelation
.
getStaffClerkRelationId
());
clerkMainStoreRelatedService
.
delMainStore
(
oldStaffClerkRelation
.
getStaffId
(),
oldStaffClerkRelation
.
getStoreId
(),
oldStaffClerkRelation
.
getWxEnterpriseId
());
}
staffClerkRelationService
.
bind
(
staffClerkRelation
,
optStaffId
,
chanelCode
);
staffClerkRelationService
.
bind
(
staffClerkRelation
,
optStaffId
,
chan
n
elCode
);
}
@Override
...
...
@@ -288,6 +286,21 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
delSetMainStore
(
staffClerkRelation
,
ChannelCodeEnum
.
AUDIT_UNBIND
.
getCode
());
}
private
void
delSetMainStore
(
TabHaobanStaffClerkRelation
staffClerkRelation
,
Integer
channelCode
)
{
if
(
staffClerkRelation
==
null
)
{
logger
.
info
(
"staffClerkRelation为空"
);
return
;
}
String
staffId
=
staffClerkRelation
.
getStaffId
();
String
wxEnterpriseId
=
staffClerkRelation
.
getWxEnterpriseId
();
String
clerkId
=
staffClerkRelation
.
getClerkId
();
externalClerkRelatedService
.
delByClerkIdAndStaffId
(
clerkId
,
staffId
);
//删除主门店
clerkMainStoreRelatedService
.
delMainStore
(
staffId
,
staffClerkRelation
.
getStoreId
(),
wxEnterpriseId
);
//废弃活码
hmClerkRelationApiService
.
delByClerkId
(
clerkId
,
staffClerkRelation
.
getEnterpriseId
(),
wxEnterpriseId
,
channelCode
);
}
@Override
public
List
<
StaffClerkRelationDTO
>
listByEnterpriseIdAndStaffid
(
String
enterpriseId
,
String
staffid
)
{
List
<
TabHaobanStaffClerkRelation
>
list
=
tabHaobanStaffClerkRelationMapper
.
listByEnterpriseIdAndStaffid
(
enterpriseId
,
staffid
);
...
...
@@ -367,21 +380,6 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService
.
pushToMq
(
staffId
,
optStaffId
,
optType
,
channelCode
,
relationId
);
}
private
void
delSetMainStore
(
TabHaobanStaffClerkRelation
staffClerkRelation
,
Integer
channelCode
)
{
if
(
staffClerkRelation
==
null
)
{
logger
.
info
(
"staffClerkRelation为空"
);
return
;
}
String
staffId
=
staffClerkRelation
.
getStaffId
();
String
wxEnterpriseId
=
staffClerkRelation
.
getWxEnterpriseId
();
String
clerkId
=
staffClerkRelation
.
getClerkId
();
externalClerkRelatedService
.
delByClerkIdAndStaffId
(
clerkId
,
staffId
);
//删除主门店
clerkMainStoreRelatedService
.
delMainStore
(
staffId
,
staffClerkRelation
.
getStoreId
(),
wxEnterpriseId
);
//废弃活码
hmClerkRelationApiService
.
delByClerkId
(
clerkId
,
staffClerkRelation
.
getEnterpriseId
(),
wxEnterpriseId
,
channelCode
);
}
@Override
public
ServiceResponse
<
String
>
getClerkMemberChatConfig
(
String
clerkId
)
{
ServiceResponse
response
=
new
ServiceResponse
();
...
...
@@ -516,8 +514,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public
int
getCanAddHmCount
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
)
{
int
count
=
this
.
hmQrcodeService
.
getCanAddCount
(
wxEnterpriseId
,
enterpriseId
,
clerkId
);
return
count
;
return
this
.
hmQrcodeService
.
getCanAddCount
(
wxEnterpriseId
,
enterpriseId
,
clerkId
);
}
@Override
...
...
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