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
34984a5f
Commit
34984a5f
authored
Jul 13, 2022
by
songyinghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 关联欢迎语统一方法
parent
42cd5437
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
13 deletions
+55
-13
WelcomeRelationServiceImpl.java
...e/service/service/hm/impl/WelcomeRelationServiceImpl.java
+22
-12
HmQrcodeApiServiceImpl.java
...e/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
+1
-1
HmPageServiceTest.java
haoban-manage3-service/src/test/java/HmPageServiceTest.java
+32
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/hm/impl/WelcomeRelationServiceImpl.java
View file @
34984a5f
...
@@ -62,7 +62,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
...
@@ -62,7 +62,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
public
HmWelcomeRelationBO
queryWelcomeRelation
(
String
referId
,
Integer
status
)
{
public
HmWelcomeRelationBO
queryWelcomeRelation
(
String
referId
,
Integer
status
)
{
String
welcomeRelationCacheKey
=
WELCOME_RELATION_KEY
+
referId
;
String
welcomeRelationCacheKey
=
WELCOME_RELATION_KEY
+
referId
;
HmWelcomeRelationBO
cache
=
RedisUtil
.
getCache
(
welcomeRelationCacheKey
,
HmWelcomeRelationBO
.
class
);
HmWelcomeRelationBO
cache
=
RedisUtil
.
getCache
(
welcomeRelationCacheKey
,
HmWelcomeRelationBO
.
class
);
if
(
cache
!=
null
){
if
(
cache
!=
null
)
{
return
cache
;
return
cache
;
}
}
List
<
TabHaobanWelcomeTemplateRelation
>
welcomeTemplateRelations
=
welcomeTemplateRelationMapper
.
queryWelTemplateRelation
(
null
,
referId
,
status
);
List
<
TabHaobanWelcomeTemplateRelation
>
welcomeTemplateRelations
=
welcomeTemplateRelationMapper
.
queryWelTemplateRelation
(
null
,
referId
,
status
);
...
@@ -133,6 +133,13 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
...
@@ -133,6 +133,13 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
Boolean
saveHmWelcomeRelation
(
HmWelcomeRelationBO
hmWelcomeRelationBO
)
{
public
Boolean
saveHmWelcomeRelation
(
HmWelcomeRelationBO
hmWelcomeRelationBO
)
{
log
.
info
(
"[saveHmWelcomeRelation] params:{}"
,
JSON
.
toJSONString
(
hmWelcomeRelationBO
));
log
.
info
(
"[saveHmWelcomeRelation] params:{}"
,
JSON
.
toJSONString
(
hmWelcomeRelationBO
));
if
(
StringUtils
.
isAnyBlank
(
hmWelcomeRelationBO
.
getWelcomeId
(),
hmWelcomeRelationBO
.
getReferId
(),
hmWelcomeRelationBO
.
getEnterpriseId
(),
hmWelcomeRelationBO
.
getWxEnterpriseId
(),
hmWelcomeRelationBO
.
getReferName
()))
{
return
Boolean
.
FALSE
;
}
if
(
hmWelcomeRelationBO
.
getType
()
==
null
)
{
return
Boolean
.
FALSE
;
}
TabHaobanWelcomeTemplateRelation
welcomeTemplateRelation
=
new
TabHaobanWelcomeTemplateRelation
();
TabHaobanWelcomeTemplateRelation
welcomeTemplateRelation
=
new
TabHaobanWelcomeTemplateRelation
();
welcomeTemplateRelation
.
setRelationId
(
UniqueIdUtils
.
uniqueLong
());
welcomeTemplateRelation
.
setRelationId
(
UniqueIdUtils
.
uniqueLong
());
welcomeTemplateRelation
.
setEnterpriseId
(
hmWelcomeRelationBO
.
getEnterpriseId
());
welcomeTemplateRelation
.
setEnterpriseId
(
hmWelcomeRelationBO
.
getEnterpriseId
());
...
@@ -152,7 +159,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
...
@@ -152,7 +159,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
/**
/**
* 删除关联关系
* 删除关联关系
*
*
* @param
hmWelcomeRelationBO
* @param hmWelcomeRelationBO
* @return
* @return
*/
*/
@Override
@Override
...
@@ -162,22 +169,25 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
...
@@ -162,22 +169,25 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
// 取消该referId已有的引用
// 取消该referId已有的引用
List
<
TabHaobanWelcomeTemplateRelation
>
tabHaobanWelcomeTemplateRelations
=
List
<
TabHaobanWelcomeTemplateRelation
>
tabHaobanWelcomeTemplateRelations
=
welcomeTemplateRelationMapper
.
queryWelTemplateRelation
(
null
,
hmWelcomeRelationBO
.
getReferId
(),
WelcomeRelationStatusEnum
.
ENABLE
.
getCode
());
welcomeTemplateRelationMapper
.
queryWelTemplateRelation
(
null
,
hmWelcomeRelationBO
.
getReferId
(),
WelcomeRelationStatusEnum
.
ENABLE
.
getCode
());
TabHaobanWelcomeTemplateRelation
welcomeTemplateRelation
=
tabHaobanWelcomeTemplateRelations
.
get
(
0
);
if
(
CollectionUtils
.
isNotEmpty
(
tabHaobanWelcomeTemplateRelations
))
{
if
(
StringUtils
.
equals
(
welcomeTemplateRelation
.
getReferId
(),
hmWelcomeRelationBO
.
getReferId
())){
TabHaobanWelcomeTemplateRelation
welcomeTemplateRelation
=
tabHaobanWelcomeTemplateRelations
.
get
(
0
);
return
Boolean
.
TRUE
;
if
(
StringUtils
.
equals
(
welcomeTemplateRelation
.
getWelcomeId
(),
hmWelcomeRelationBO
.
getWelcomeId
()))
{
return
Boolean
.
TRUE
;
}
welcomeTemplateRelation
.
setUpdateTime
(
new
Date
());
welcomeTemplateRelation
.
setStatus
(
WelcomeRelationStatusEnum
.
DISABLE
.
getCode
());
welcomeTemplateRelationMapper
.
updateByPrimaryKeySelective
(
welcomeTemplateRelation
);
// 定义
this
.
removeWelcomeRelationCache
(
welcomeTemplateRelation
.
getReferId
());
}
}
welcomeTemplateRelation
.
setUpdateTime
(
new
Date
());
if
(
StringUtils
.
isNotBlank
(
hmWelcomeRelationBO
.
getWelcomeId
()))
{
welcomeTemplateRelation
.
setStatus
(
WelcomeRelationStatusEnum
.
ENABLE
.
getCode
());
welcomeTemplateRelationMapper
.
updateByPrimaryKeySelective
(
welcomeTemplateRelation
);
// 定义
this
.
removeWelcomeRelationCache
(
welcomeTemplateRelation
.
getReferId
());
if
(
StringUtils
.
isNotBlank
(
welcomeTemplateRelation
.
getWelcomeId
()))
{
return
this
.
saveHmWelcomeRelation
(
hmWelcomeRelationBO
);
return
this
.
saveHmWelcomeRelation
(
hmWelcomeRelationBO
);
}
}
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
private
void
removeWelcomeRelationCache
(
String
referId
){
private
void
removeWelcomeRelationCache
(
String
referId
)
{
String
welcomeRelationCacheKey
=
WELCOME_RELATION_KEY
+
referId
;
String
welcomeRelationCacheKey
=
WELCOME_RELATION_KEY
+
referId
;
RedisUtil
.
delCache
(
welcomeRelationCacheKey
);
RedisUtil
.
delCache
(
welcomeRelationCacheKey
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
View file @
34984a5f
...
@@ -142,7 +142,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -142,7 +142,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
int
saveResult
=
hmQrcodeService
.
insert
(
hmQrcodeQDTO
);
int
saveResult
=
hmQrcodeService
.
insert
(
hmQrcodeQDTO
);
if
(
saveResult
==
1
)
{
if
(
saveResult
==
1
)
{
// save welcome relation
// save welcome relation
this
.
sav
eWelcomeRelation
(
hmQrcodeQDTO
);
this
.
updat
eWelcomeRelation
(
hmQrcodeQDTO
);
}
}
setLoggerContext
(
hmQrcodeQDTO
.
getEnterpriseId
(),
wxEnterpriseId
,
hmQrcodeQDTO
.
getCreatorId
(),
hmQrcodeQDTO
.
getCreatorName
());
setLoggerContext
(
hmQrcodeQDTO
.
getEnterpriseId
(),
wxEnterpriseId
,
hmQrcodeQDTO
.
getCreatorId
(),
hmQrcodeQDTO
.
getCreatorName
());
GicLogRecordEvaluationContext
.
putAttribute
(
"logContent"
,
"【"
+
hmId
+
"-"
+
hmQrcodeQDTO
.
getName
()
+
"】"
);
GicLogRecordEvaluationContext
.
putAttribute
(
"logContent"
,
"【"
+
hmId
+
"-"
+
hmQrcodeQDTO
.
getName
()
+
"】"
);
...
...
haoban-manage3-service/src/test/java/HmPageServiceTest.java
View file @
34984a5f
...
@@ -8,9 +8,12 @@ import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
...
@@ -8,9 +8,12 @@ import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import
com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO
;
import
com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.api.service.hm.HmGroupApiService
;
import
com.gic.haoban.manage.api.service.hm.HmGroupApiService
;
import
com.gic.haoban.manage.api.service.hm.HmPageApiService
;
import
com.gic.haoban.manage.api.service.hm.HmPageApiService
;
import
com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO
;
import
com.gic.haoban.manage.service.service.hm.WelcomeRelationService
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -69,4 +72,33 @@ public class HmPageServiceTest {
...
@@ -69,4 +72,33 @@ public class HmPageServiceTest {
System
.
out
.
println
(
JSON
.
toJSONString
(
pageServiceResponse
));
System
.
out
.
println
(
JSON
.
toJSONString
(
pageServiceResponse
));
}
}
@Autowired
private
WelcomeRelationService
welcomeRelationService
;
@Test
public
void
saveWelcomeRelation
(){
HmWelcomeRelationBO
welcomeRelationBo
=
new
HmWelcomeRelationBO
();
welcomeRelationBo
.
setEnterpriseId
(
"1231321312312"
);
welcomeRelationBo
.
setWxEnterpriseId
(
"31312312312"
);
welcomeRelationBo
.
setReferId
(
"313131"
);
welcomeRelationBo
.
setReferCode
(
"HM1312312312"
);
welcomeRelationBo
.
setReferName
(
"活码名称"
);
welcomeRelationBo
.
setType
(
HmWelcomeReferType
.
HM
.
getCode
());
welcomeRelationService
.
saveHmWelcomeRelation
(
welcomeRelationBo
);
}
@Test
public
void
updateWelcomeRelationTest
(){
HmWelcomeRelationBO
welcomeRelationBo
=
new
HmWelcomeRelationBO
();
welcomeRelationBo
.
setEnterpriseId
(
"1231321312312"
);
welcomeRelationBo
.
setWxEnterpriseId
(
"31312312312"
);
welcomeRelationBo
.
setReferId
(
"313131"
);
welcomeRelationBo
.
setReferCode
(
"HM1312312dada"
);
welcomeRelationBo
.
setReferName
(
"活码名称"
);
welcomeRelationBo
.
setType
(
HmWelcomeReferType
.
HM
.
getCode
());
welcomeRelationService
.
updateWelcomeRelation
(
welcomeRelationBo
);
}
}
}
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