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
1
Merge Requests
1
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
b86635dc
Commit
b86635dc
authored
Jul 06, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:解绑废弃活码
parent
2fa1b294
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
65 deletions
+81
-65
HmQrcodeServiceImpl.java
...n/manage/service/service/hm/impl/HmQrcodeServiceImpl.java
+0
-3
StaffClerkRelationServiceImpl.java
...e/service/service/impl/StaffClerkRelationServiceImpl.java
+8
-25
HmQrcodeApiServiceImpl.java
...e/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
+73
-37
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/hm/impl/HmQrcodeServiceImpl.java
View file @
b86635dc
...
...
@@ -13,7 +13,6 @@ import com.github.pagehelper.PageHelper;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -43,7 +42,6 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
insert
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
hmQrcodeQDTO
.
setCreateTime
(
new
Date
());
hmQrcodeQDTO
.
setUpdateTime
(
new
Date
());
...
...
@@ -51,7 +49,6 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
hmQrcodeQDTO
.
setUpdateTime
(
new
Date
());
return
this
.
tabHaobanHmQrcodeMapper
.
update
(
EntityUtil
.
changeEntity
(
TabHaobanHmQrcode
.
class
,
hmQrcodeQDTO
));
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffClerkRelationServiceImpl.java
View file @
b86635dc
...
...
@@ -10,6 +10,7 @@ import com.gic.haoban.common.utils.StringUtil;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.enums.BindTypeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanMemberClerkChatConfigMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
...
...
@@ -50,6 +51,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Autowired
private
TabHaobanMemberClerkChatConfigMapper
memberClerkChatConfigMapper
;
@Autowired
private
HmQrcodeApiService
hmQrcodeApiService
;
@Override
public
List
<
StaffClerkRelationDTO
>
listBindCode
(
String
enterpriseId
,
Set
<
String
>
clerkCodeList
)
{
return
EntityUtil
.
changeEntityListByJSON
(
StaffClerkRelationDTO
.
class
,
mapper
.
listBindCode
(
enterpriseId
,
clerkCodeList
));
...
...
@@ -75,6 +79,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
if
(
b
)
{
//推入日志
staffClerkBindLogService
.
pushToMq
(
clerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chanelCode
,
clerkRelation
.
getStaffClerkRelationId
());
//废弃活码
hmQrcodeApiService
.
delByClerkId
(
clerkId
,
clerkRelation
.
getEnterpriseId
());
}
return
b
;
}
...
...
@@ -120,30 +127,6 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
return
true
;
}
private
void
delSetMainStore
(
TabHaobanStaffClerkRelation
staffClerkRelation
)
{
if
(
staffClerkRelation
==
null
)
{
logger
.
info
(
"staffClerkRelation为空"
);
return
;
}
String
staffId
=
staffClerkRelation
.
getStaffId
();
String
wxEnterpriseId
=
staffClerkRelation
.
getWxEnterpriseId
();
//删除主门店 设置新主门店 删除好友关系
clerkMainStoreRelatedService
.
delMainStore
(
staffId
,
staffClerkRelation
.
getStoreId
(),
wxEnterpriseId
);
}
private
void
setMainStore
(
StaffClerkRelationDTO
staffClerkRelation
)
{
if
(
staffClerkRelation
==
null
)
{
logger
.
info
(
"staffClerkRelation为空"
);
return
;
}
String
staffId
=
staffClerkRelation
.
getStaffId
();
String
wxEnterpriseId
=
staffClerkRelation
.
getWxEnterpriseId
();
List
<
StaffClerkRelationDTO
>
list
=
this
.
listByStaffId
(
wxEnterpriseId
,
staffId
);
if
(
list
!=
null
&&
list
.
size
()
==
1
)
{
clerkMainStoreRelatedService
.
setMainStore
(
staffId
,
staffClerkRelation
.
getStoreId
(),
wxEnterpriseId
);
}
}
@Override
public
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
chanelCode
)
{
dto
.
setStaffClerkRelationId
(
ToolUtil
.
randomUUID
());
...
...
@@ -157,7 +140,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
clerkMainStoreRelatedService
.
getMainStoreByStaffId
(
staffId
,
dto
.
getWxEnterpriseId
());
//推入日志
staffClerkBindLogService
.
pushToMq
(
staffId
,
optStaffId
,
BindTypeEnum
.
BIND
.
getVal
(),
chanelCode
,
dto
.
getStaffClerkRelationId
());
//绑定自动创建活码
//
TODO: 2022/7/6
绑定自动创建活码
}
return
s
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
View file @
b86635dc
...
...
@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.out.impl.hm;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.PageResult2
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
...
...
@@ -28,6 +30,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -55,8 +58,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
private
HmClerkRelationService
hmClerkRelationService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StoreService
storeService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
add
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
...
...
@@ -72,18 +78,16 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
else
{
hmQrcodeQDTO
.
setHmCode
(
"HM02"
+
hmId
);
}
List
<
String
>
clerkIdList
=
setStoreClerk
(
hmQrcodeQDTO
,
wxEnterpriseId
,
hmId
,
hmType
);
//生成活码
QywxExternalcontactDTO
qywxExternalcontactDTO
=
new
QywxExternalcontactDTO
();
qywxExternalcontactDTO
.
setType
(
hmQrcodeQDTO
.
getHmType
());
qywxExternalcontactDTO
.
setScene
(
2
);
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
List
<
String
>
clerkIdList
=
hmQrcodeQDTO
.
getClerkIdList
();
//多人活码
if
(
hmType
==
2
)
{
insertHmClerkRelation
(
hmQrcodeQDTO
,
wxEnterpriseId
,
hmId
,
clerkIdList
);
}
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
);
qywxExternalcontactDTO
.
setUser
(
userIds
);
QywxExternalcontactResultDTO
qywxExternalcontactResultDTO
=
qywxUserApiService
.
addContactWay
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxExternalcontactDTO
);
...
...
@@ -94,6 +98,69 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return
hmQrcodeService
.
insert
(
hmQrcodeQDTO
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterpriseDTO
==
null
)
{
logger
.
error
(
"未查询到微信企业"
);
return
0
;
}
Long
hmId
=
hmQrcodeQDTO
.
getHmId
();
Integer
hmType
=
hmQrcodeQDTO
.
getHmType
();
List
<
String
>
clerkIdList
=
setStoreClerk
(
hmQrcodeQDTO
,
wxEnterpriseId
,
hmId
,
hmType
);
//更新活码
QywxExternalcontactDTO
qywxExternalcontactDTO
=
new
QywxExternalcontactDTO
();
qywxExternalcontactDTO
.
setType
(
hmQrcodeQDTO
.
getHmType
());
qywxExternalcontactDTO
.
setScene
(
2
);
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
);
qywxExternalcontactDTO
.
setUser
(
userIds
);
boolean
flag
=
qywxUserApiService
.
updateContactWay
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxExternalcontactDTO
);
if
(!
flag
)
{
logger
.
error
(
"更新企微活码失败"
);
return
0
;
}
return
hmQrcodeService
.
update
(
hmQrcodeQDTO
);
}
/**
* 设置门店和导购
* @param hmQrcodeQDTO
* @param wxEnterpriseId
* @param hmId
* @param hmType
* @return
*/
private
List
<
String
>
setStoreClerk
(
HmQrcodeQDTO
hmQrcodeQDTO
,
String
wxEnterpriseId
,
Long
hmId
,
Integer
hmType
)
{
List
<
String
>
clerkIdList
=
hmQrcodeQDTO
.
getClerkIdList
();
String
storeId
=
hmQrcodeQDTO
.
getStoreId
();
StoreDTO
storeDTO
=
storeService
.
getStore
(
storeId
);
if
(
storeDTO
!=
null
)
{
storeDTO
.
setStoreCode
(
storeDTO
.
getStoreCode
());
storeDTO
.
setStoreName
(
storeDTO
.
getStoreName
());
}
//多人活码
if
(
hmType
==
2
)
{
insertHmClerkRelation
(
hmQrcodeQDTO
,
wxEnterpriseId
,
hmId
,
clerkIdList
);
}
else
{
String
clerkId
=
clerkIdList
.
get
(
0
);
hmQrcodeQDTO
.
setClerkId
(
clerkId
);
ClerkDTO
clerkDTO
=
clerkService
.
getclerkById
(
clerkId
);
if
(
clerkDTO
!=
null
)
{
hmQrcodeQDTO
.
setClerkName
(
clerkDTO
.
getClerkName
());
hmQrcodeQDTO
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
}
}
return
clerkIdList
;
}
/**
* 多人活码关联关系
* @param hmQrcodeQDTO
...
...
@@ -126,37 +193,6 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
@Override
public
int
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterpriseDTO
==
null
)
{
logger
.
error
(
"未查询到微信企业"
);
return
0
;
}
Long
hmId
=
hmQrcodeQDTO
.
getHmId
();
Integer
hmType
=
hmQrcodeQDTO
.
getHmType
();
List
<
String
>
clerkIdList
=
hmQrcodeQDTO
.
getClerkIdList
();
if
(
hmType
==
2
)
{
hmClerkRelationService
.
deleteByHmId
(
hmId
);
insertHmClerkRelation
(
hmQrcodeQDTO
,
wxEnterpriseId
,
hmId
,
clerkIdList
);
}
QywxExternalcontactDTO
qywxExternalcontactDTO
=
new
QywxExternalcontactDTO
();
qywxExternalcontactDTO
.
setType
(
hmQrcodeQDTO
.
getHmType
());
qywxExternalcontactDTO
.
setScene
(
2
);
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
);
qywxExternalcontactDTO
.
setUser
(
userIds
);
boolean
flag
=
qywxUserApiService
.
updateContactWay
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxExternalcontactDTO
);
if
(!
flag
)
{
logger
.
error
(
"更新企微活码失败"
);
return
0
;
}
return
hmQrcodeService
.
update
(
hmQrcodeQDTO
);
}
@Override
public
PageResult2
<
HmQrcodeListDTO
>
queryListByPage
(
HmQrcodeListQDTO
hmQrcodeListQDTO
)
{
return
PageUtil
.
getPageInfo
(
hmQrcodeService
.
queryByPage
(
hmQrcodeListQDTO
));
}
...
...
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