Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 87c0e3a0
authored
Dec 09, 2020
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改标签组相关bug;增加标签删除自动解除标签与客户绑定得关系;欢迎语返回素材url;
1 parent
d29645a4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
151 additions
and
195 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMsgTlpController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTagGroupController.java
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeMsgTlp.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTagGroupService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMsgTlpServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeMsgTlpMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMsgTlpController.java
View file @
87c0e3a
...
@@ -63,7 +63,7 @@ public class WeMsgTlpController extends BaseController
...
@@ -63,7 +63,7 @@ public class WeMsgTlpController extends BaseController
* 新增欢迎语模板
* 新增欢迎语模板
*/
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tlp:add')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:tlp:add')"
)
@Log
(
title
=
"欢迎语模板"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"
新增
欢迎语模板"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
public
AjaxResult
add
(
@RequestBody
WeMsgTlp
weMsgTlp
)
public
AjaxResult
add
(
@RequestBody
WeMsgTlp
weMsgTlp
)
{
{
...
@@ -74,7 +74,7 @@ public class WeMsgTlpController extends BaseController
...
@@ -74,7 +74,7 @@ public class WeMsgTlpController extends BaseController
* 修改欢迎语模板
* 修改欢迎语模板
*/
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tlp:edit')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:tlp:edit')"
)
@Log
(
title
=
"欢迎语模板"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"
修改
欢迎语模板"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@PutMapping
public
AjaxResult
edit
(
@RequestBody
WeMsgTlp
weMsgTlp
)
public
AjaxResult
edit
(
@RequestBody
WeMsgTlp
weMsgTlp
)
{
{
...
@@ -85,7 +85,7 @@ public class WeMsgTlpController extends BaseController
...
@@ -85,7 +85,7 @@ public class WeMsgTlpController extends BaseController
* 删除欢迎语模板
* 删除欢迎语模板
*/
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tlp:remove')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:tlp:remove')"
)
@Log
(
title
=
"欢迎语模板"
,
businessType
=
BusinessType
.
DELETE
)
@Log
(
title
=
"
删除
欢迎语模板"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
{
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTagGroupController.java
View file @
87c0e3a
...
@@ -44,19 +44,7 @@ public class WeTagGroupController extends BaseController
...
@@ -44,19 +44,7 @@ public class WeTagGroupController extends BaseController
public
TableDataInfo
list
(
WeTagGroup
weTagGroup
)
public
TableDataInfo
list
(
WeTagGroup
weTagGroup
)
{
{
startPage
();
startPage
();
synchWeTags
();
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
//异步同步一下标签库,解决标签不同步问题
Threads
.
SINGLE_THREAD_POOL
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
SecurityContextHolder
.
setContext
(
securityContext
);
weTagGroupService
.
synchWeTags
();
}
});
return
getDataTable
(
return
getDataTable
(
weTagGroupService
.
selectWeTagGroupList
(
weTagGroup
)
weTagGroupService
.
selectWeTagGroupList
(
weTagGroup
)
);
);
...
@@ -109,7 +97,16 @@ public class WeTagGroupController extends BaseController
...
@@ -109,7 +97,16 @@ public class WeTagGroupController extends BaseController
@GetMapping
(
"/synchWeTags"
)
@GetMapping
(
"/synchWeTags"
)
public
AjaxResult
synchWeTags
(){
public
AjaxResult
synchWeTags
(){
weTagGroupService
.
synchWeTags
();
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
//异步同步一下标签库,解决标签不同步问题
Threads
.
SINGLE_THREAD_POOL
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
SecurityContextHolder
.
setContext
(
securityContext
);
weTagGroupService
.
synchWeTags
();
}
});
return
AjaxResult
.
success
(
WeConstans
.
SYNCH_TIP
);
return
AjaxResult
.
success
(
WeConstans
.
SYNCH_TIP
);
}
}
...
...
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
View file @
87c0e3a
package
com
.
linkwechat
.
common
.
constant
;
package
com
.
linkwechat
.
common
.
constant
;
import
org.elasticsearch.common.xcontent.XContentBuilder
;
import
org.elasticsearch.common.xcontent.XContentFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -269,38 +267,38 @@ public class WeConstans {
...
@@ -269,38 +267,38 @@ public class WeConstans {
}
}
}
}
//
public
static
XContentBuilder
getFinanceTextMapping
()
throws
IOException
{
//
public static XContentBuilder getFinanceTextMapping() throws IOException {
// 创建 会话文本Mapping
//
// 创建 会话文本Mapping
XContentBuilder
xContentBuilder
=
XContentFactory
.
jsonBuilder
()
//
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.
startObject
()
//
.startObject()
.
startObject
(
"properties"
)
//
.startObject("properties")
.
startObject
(
"msgid"
)
//
.startObject("msgid")
.
field
(
"type"
,
"keyword"
)
//
.field("type", "keyword")
.
endObject
()
//
.endObject()
.
startObject
(
"action"
)
//
.startObject("action")
.
field
(
"type"
,
"keyword"
)
//
.field("type", "keyword")
.
endObject
()
//
.endObject()
.
startObject
(
"from"
)
//
.startObject("from")
.
field
(
"type"
,
"keyword"
)
//
.field("type", "keyword")
.
endObject
()
//
.endObject()
.
startObject
(
"tolist"
)
//
.startObject("tolist")
.
field
(
"type"
,
"text"
)
//
.field("type", "text")
.
endObject
()
//
.endObject()
.
startObject
(
"roomid"
)
//
.startObject("roomid")
.
field
(
"type"
,
"keyword"
)
//
.field("type", "keyword")
.
endObject
()
//
.endObject()
.
startObject
(
"msgtime"
)
//
.startObject("msgtime")
.
field
(
"type"
,
"long"
)
//
.field("type", "long")
.
endObject
()
//
.endObject()
.
startObject
(
"msgtype"
)
//
.startObject("msgtype")
.
field
(
"type"
,
"keyword"
)
//
.field("type", "keyword")
.
endObject
()
//
.endObject()
.
startObject
(
"content"
)
//
.startObject("content")
.
field
(
"type"
,
"text"
)
//
.field("type", "text")
.
endObject
()
//
.endObject()
.
endObject
()
//
.endObject()
.
endObject
();
//
.endObject();
return
xContentBuilder
;
//
return xContentBuilder;
}
//
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeMsgTlp.java
View file @
87c0e3a
...
@@ -37,6 +37,8 @@ public class WeMsgTlp extends BaseEntity
...
@@ -37,6 +37,8 @@ public class WeMsgTlp extends BaseEntity
/** 欢迎语模板使用范围 */
/** 欢迎语模板使用范围 */
private
List
<
WeMsgTlpScope
>
weMsgTlpScopes
;
private
List
<
WeMsgTlpScope
>
weMsgTlpScopes
;
private
String
materialUrl
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTagGroupService.java
View file @
87c0e3a
...
@@ -60,6 +60,7 @@ public interface IWeTagGroupService extends IService<WeTagGroup>
...
@@ -60,6 +60,7 @@ public interface IWeTagGroupService extends IService<WeTagGroup>
/**
/**
* 来自微信端批量保存或者更新标签组和标签
* 来自微信端批量保存或者更新标签组和标签
* @param tagGroup
* @param tagGroup
* @param isSync
*/
*/
public
void
batchSaveOrUpdateTagGroupAndTag
(
List
<
WeCropGroupTagDto
>
tagGroup
);
public
void
batchSaveOrUpdateTagGroupAndTag
(
List
<
WeCropGroupTagDto
>
tagGroup
,
Boolean
isSync
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMsgTlpServiceImpl.java
View file @
87c0e3a
...
@@ -5,6 +5,7 @@ import java.util.stream.Collectors;
...
@@ -5,6 +5,7 @@ import java.util.stream.Collectors;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.wecom.domain.WeMsgTlpScope
;
import
com.linkwechat.wecom.domain.WeMsgTlpScope
;
import
com.linkwechat.wecom.service.IWeMsgTlpScopeService
;
import
com.linkwechat.wecom.service.IWeMsgTlpScopeService
;
...
@@ -61,33 +62,32 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService
...
@@ -61,33 +62,32 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
public
int
insertWeMsgTlp
(
WeMsgTlp
weMsgTlp
)
public
int
insertWeMsgTlp
(
WeMsgTlp
weMsgTlp
)
{
{
weMsgTlp
.
setCreateBy
(
SecurityUtils
.
getUsername
());
int
returnCode
=
weMsgTlpMapper
.
insertWeMsgTlp
(
weMsgTlp
);
if
(
returnCode
>
0
){
return
weMsgTlpMapper
.
insertWeMsgTlp
(
weMsgTlp
);
List
<
WeMsgTlpScope
>
weMsgTlpScopess
=
weMsgTlp
.
getWeMsgTlpScopes
();
if
(
CollectionUtil
.
isNotEmpty
(
weMsgTlpScopess
)
){
// if(returnCode>0
){
// List<WeMsgTlpScope> weMsgTlpScopess = weMsgTlp.getWeMsgTlpScopes();
List
<
WeMsgTlpScope
>
weMsgTlpScopes
=
weMsgTlp
.
getWeMsgTlpScopes
().
stream
().
filter
(
c
->
c
.
getUseUserId
()
!=
null
).
collect
(
Collectors
.
toList
());
// if(CollectionUtil.isNotEmpty(weMsgTlpScopess)){
if
(
CollectionUtil
.
isNotEmpty
(
weMsgTlpScopes
)){
//
// List<WeMsgTlpScope> weMsgTlpScopes=weMsgTlp.getWeMsgTlpScopes().stream().filter(c -> c.getUseUserId() != null).collect(Collectors.toList());
weMsgTlpScopes
.
forEach
(
v
->
{
// if(CollectionUtil.isNotEmpty(weMsgTlpScopes))
{
v
.
setMsgTlpId
(
weMsgTlp
.
getId
());
//
v
.
setId
(
SnowFlakeUtil
.
nextId
());
// weMsgTlpScopes.forEach(v->{
}
);
// v.setMsgTlpId(weMsgTlp.getId()
);
// v.setId(SnowFlakeUtil.nextId());
iWeMsgTlpScopeService
.
batchInsetWeMsgTlpScope
(
weMsgTlpScopes
);
// }
);
}
//
// iWeMsgTlpScopeService.batchInsetWeMsgTlpScope(weMsgTlpScopes);
}
//
}
//
// }
// }
}
return
returnCode
;
//
return returnCode;
}
}
/**
/**
...
@@ -97,22 +97,21 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService
...
@@ -97,22 +97,21 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
public
int
updateWeMsgTlp
(
WeMsgTlp
weMsgTlp
)
public
int
updateWeMsgTlp
(
WeMsgTlp
weMsgTlp
)
{
{
int
returnCode
=
weMsgTlpMapper
.
updateWeMsgTlp
(
weMsgTlp
);
//
int returnCode = weMsgTlpMapper.updateWeMsgTlp(weMsgTlp);
//
if
(
returnCode
>
0
){
//
if(returnCode>0){
iWeMsgTlpScopeService
.
batchRemoveWeMsgTlpScopesByMsgTlpIds
(
ListUtil
.
toList
(
weMsgTlp
.
getId
()));
//
iWeMsgTlpScopeService.batchRemoveWeMsgTlpScopesByMsgTlpIds(ListUtil.toList(weMsgTlp.getId()));
List
<
WeMsgTlpScope
>
weMsgTlpScopes
=
weMsgTlp
.
getWeMsgTlpScopes
().
stream
().
filter
(
c
->
c
.
getUseUserId
()
!=
null
).
collect
(
Collectors
.
toList
());
//
List<WeMsgTlpScope> weMsgTlpScopes = weMsgTlp.getWeMsgTlpScopes().stream().filter(c -> c.getUseUserId() != null).collect(Collectors.toList());
//
if
(
CollectionUtil
.
isNotEmpty
(
weMsgTlpScopes
)){
//
if(CollectionUtil.isNotEmpty(weMsgTlpScopes)){
weMsgTlpScopes
.
stream
().
forEach
(
v
->
v
.
setMsgTlpId
(
weMsgTlp
.
getId
()));
//
weMsgTlpScopes.stream().forEach(v->v.setMsgTlpId(weMsgTlp.getId()));
iWeMsgTlpScopeService
.
batchInsetWeMsgTlpScope
(
weMsgTlpScopes
);
//
iWeMsgTlpScopeService.batchInsetWeMsgTlpScope(weMsgTlpScopes);
}
//
}
//
}
//
}
return
weMsgTlpMapper
.
updateWeMsgTlp
(
weMsgTlp
);
return
weMsgTlpMapper
.
updateWeMsgTlp
(
weMsgTlp
);
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
View file @
87c0e3a
...
@@ -4,24 +4,16 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -4,24 +4,16 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.constant.UserConstants
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.bean.BeanUtils
;
import
com.linkwechat.wecom.client.WeCropTagClient
;
import
com.linkwechat.wecom.client.WeCropTagClient
;
import
com.linkwechat.wecom.domain.WeGroup
;
import
com.linkwechat.wecom.domain.WeTag
;
import
com.linkwechat.wecom.domain.WeTag
;
import
com.linkwechat.wecom.domain.WeTagGroup
;
import
com.linkwechat.wecom.domain.WeTagGroup
;
import
com.linkwechat.wecom.domain.dto.tag.*
;
import
com.linkwechat.wecom.domain.dto.tag.*
;
import
com.linkwechat.wecom.mapper.WeTagGroupMapper
;
import
com.linkwechat.wecom.mapper.WeTagGroupMapper
;
import
com.linkwechat.wecom.mapper.WeTagMapper
;
import
com.linkwechat.wecom.service.IWeTagGroupService
;
import
com.linkwechat.wecom.service.IWeTagGroupService
;
import
com.linkwechat.wecom.service.IWeTagService
;
import
com.linkwechat.wecom.service.IWeTagService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -32,9 +24,7 @@ import java.util.ArrayList;
...
@@ -32,9 +24,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
* 标签组Service业务层处理
* 标签组Service业务层处理
...
@@ -92,7 +82,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -92,7 +82,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
WeCropGropTagDtlDto
weCropGropTagDtlDto
=
weCropTagClient
.
addCorpTag
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
));
WeCropGropTagDtlDto
weCropGropTagDtlDto
=
weCropTagClient
.
addCorpTag
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
));
if
(
weCropGropTagDtlDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
if
(
weCropGropTagDtlDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
this
.
batchSaveOrUpdateTagGroupAndTag
(
ListUtil
.
toList
(
weCropGropTagDtlDto
.
getTag_group
()));
this
.
batchSaveOrUpdateTagGroupAndTag
(
ListUtil
.
toList
(
weCropGropTagDtlDto
.
getTag_group
())
,
false
);
}
}
}
}
...
@@ -116,6 +106,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -116,6 +106,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
//获取新增的集合
//获取新增的集合
if
(
CollectionUtil
.
isNotEmpty
(
weTags
))
{
if
(
CollectionUtil
.
isNotEmpty
(
weTags
))
{
List
<
WeTag
>
filterWeTags
=
weTags
.
stream
().
filter
(
v
->
StringUtils
.
isEmpty
(
v
.
getTagId
())).
collect
(
Collectors
.
toList
());
List
<
WeTag
>
filterWeTags
=
weTags
.
stream
().
filter
(
v
->
StringUtils
.
isEmpty
(
v
.
getTagId
())).
collect
(
Collectors
.
toList
());
//同步新增标签到微信端
//同步新增标签到微信端
if
(
CollectionUtil
.
isNotEmpty
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
).
getTag
())){
if
(
CollectionUtil
.
isNotEmpty
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
).
getTag
())){
WeCropGropTagDtlDto
WeCropGropTagDtlDto
...
@@ -134,7 +125,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -134,7 +125,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
//获取需要删除的数据
//获取需要删除的数据
List
<
WeTag
>
removeWeTags
=
iWeTagService
.
list
(
new
LambdaQueryWrapper
<
WeTag
>().
notIn
(
WeTag:
:
getTagId
,
List
<
WeTag
>
removeWeTags
=
iWeTagService
.
list
(
new
LambdaQueryWrapper
<
WeTag
>().
notIn
(
WeTag:
:
getTagId
,
weTags
.
stream
().
map
(
WeTag:
:
getTagId
).
collect
(
Collectors
.
toList
())).
eq
(
WeTag:
:
getGroupId
,
weTagGroup
.
getGroupId
())
weTags
.
stream
().
map
(
WeTag:
:
getTagId
).
collect
(
Collectors
.
toList
())).
eq
(
WeTag:
:
getGroupId
,
weTagGroup
.
getGroupId
())
.
eq
(
WeTag:
:
getStatus
,
Constants
.
NORMAL_CODE
));
.
eq
(
WeTag:
:
getStatus
,
Constants
.
NORMAL_CODE
));
...
@@ -207,7 +198,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -207,7 +198,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getAllCorpTagList
();
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getAllCorpTagList
();
if
(
weCropGroupTagListDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
if
(
weCropGroupTagListDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
this
.
batchSaveOrUpdateTagGroupAndTag
(
weCropGroupTagListDto
.
getTag_group
());
this
.
batchSaveOrUpdateTagGroupAndTag
(
weCropGroupTagListDto
.
getTag_group
()
,
true
);
}
}
}
}
...
@@ -216,10 +207,11 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -216,10 +207,11 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
/**
/**
* 来自微信端批量保存或者更新标签组和标签
* 来自微信端批量保存或者更新标签组和标签
* @param tagGroup
* @param tagGroup
* @param isSync 是否同步
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
batchSaveOrUpdateTagGroupAndTag
(
List
<
WeCropGroupTagDto
>
tagGroup
)
{
public
void
batchSaveOrUpdateTagGroupAndTag
(
List
<
WeCropGroupTagDto
>
tagGroup
,
Boolean
isSync
)
{
List
<
WeTagGroup
>
weTagGroups
=
new
ArrayList
<>();
List
<
WeTagGroup
>
weTagGroups
=
new
ArrayList
<>();
...
@@ -252,14 +244,17 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -252,14 +244,17 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
//先逻辑删除不存在得组
//先逻辑删除不存在得组
if
(
CollectionUtil
.
isNotEmpty
(
weTagGroups
)){
if
(
CollectionUtil
.
isNotEmpty
(
weTagGroups
)){
List
<
WeTagGroup
>
noExist
if
(
isSync
){
=
this
.
list
(
new
LambdaQueryWrapper
<
WeTagGroup
>().
notIn
(
WeTagGroup:
:
getGroupId
,
weTagGroups
.
stream
().
map
(
WeTagGroup:
:
getGroupId
).
collect
(
Collectors
.
toList
())));
List
<
WeTagGroup
>
noExist
//企业微信端删除得标签
=
this
.
list
(
new
LambdaQueryWrapper
<
WeTagGroup
>().
notIn
(
WeTagGroup:
:
getGroupId
,
weTagGroups
.
stream
().
map
(
WeTagGroup:
:
getGroupId
).
collect
(
Collectors
.
toList
())));
if
(
CollectionUtil
.
isNotEmpty
(
noExist
)){
//企业微信端删除得标签
noExist
.
stream
().
forEach
(
k
->
k
.
setStatus
(
Constants
.
DELETE_CODE
));
if
(
CollectionUtil
.
isNotEmpty
(
noExist
)){
this
.
updateBatchById
(
noExist
);
noExist
.
stream
().
forEach
(
k
->
k
.
setStatus
(
Constants
.
DELETE_CODE
));
this
.
updateBatchById
(
noExist
);
}
}
}
this
.
saveOrUpdateBatch
(
weTagGroups
);
this
.
saveOrUpdateBatch
(
weTagGroups
);
List
<
WeTag
>
weTags
=
List
<
WeTag
>
weTags
=
...
@@ -267,18 +262,42 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
...
@@ -267,18 +262,42 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
List
<
WeTag
>
noExistWeTags
if
(
isSync
){
=
iWeTagService
.
list
(
new
LambdaQueryWrapper
<
WeTag
>().
notIn
(
WeTag:
:
getTagId
,
weTags
.
stream
().
map
(
WeTag:
:
getTagId
).
collect
(
Collectors
.
toList
())));
if
(
CollectionUtil
.
isNotEmpty
(
noExistWeTags
)){
List
<
WeTag
>
noExistWeTags
noExistWeTags
.
stream
().
forEach
(
k
->
k
.
setStatus
(
Constants
.
DELETE_CODE
));
=
iWeTagService
.
list
(
new
LambdaQueryWrapper
<
WeTag
>().
notIn
(
WeTag:
:
getTagId
,
weTags
.
stream
().
map
(
WeTag:
:
getTagId
).
collect
(
Collectors
.
toList
())));
iWeTagService
.
updateBatchById
(
noExistWeTags
);
if
(
CollectionUtil
.
isNotEmpty
(
noExistWeTags
)){
noExistWeTags
.
stream
().
forEach
(
k
->
k
.
setStatus
(
Constants
.
DELETE_CODE
));
iWeTagService
.
updateBatchById
(
noExistWeTags
);
}
}
}
iWeTagService
.
saveOrUpdateBatch
(
weTags
);
iWeTagService
.
saveOrUpdateBatch
(
weTags
);
}
}
}
else
{
//不存在删除所有标签组,以标签
if
(
isSync
){
List
<
WeTagGroup
>
weTagGroupList
=
this
.
list
(
new
LambdaQueryWrapper
<
WeTagGroup
>().
eq
(
WeTagGroup:
:
getStatus
,
Constants
.
NORMAL_CODE
));
if
(
CollectionUtil
.
isNotEmpty
(
weTagGroupList
)){
weTagGroupList
.
stream
().
forEach
(
k
->
k
.
setStatus
(
Constants
.
DELETE_CODE
));
this
.
updateBatchById
(
weTagGroupList
);
}
List
<
WeTag
>
weTags
=
iWeTagService
.
list
(
new
LambdaQueryWrapper
<
WeTag
>().
eq
(
WeTag:
:
getStatus
,
Constants
.
NORMAL_CODE
));
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
weTags
.
stream
().
forEach
(
k
->
k
.
setStatus
(
Constants
.
DELETE_CODE
));
iWeTagService
.
updateBatchById
(
weTags
);
}
}
}
}
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
87c0e3a
...
@@ -112,80 +112,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -112,80 +112,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND wt.tag_id=#{tagIds}
AND wt.tag_id=#{tagIds}
</if>
</if>
</if>
</if>
</where>
</where>
ORDER BY wfcr.create_time DESC
ORDER BY wfcr.create_time DESC
<!-- SELECT-->
<!-- wc.external_userid,-->
<!-- wc.`name`,-->
<!-- wc.avatar,-->
<!-- wc.type,-->
<!-- wc.gender,-->
<!-- wc.unionid,-->
<!-- wc.birthday,-->
<!-- wc.corp_name,-->
<!-- wc.corp_full_name,-->
<!-- wc.position,-->
<!-- wfcr.id as wfcrId,-->
<!-- wfcr.user_id,-->
<!-- wfcr.remark,-->
<!-- wfcr.description,-->
<!-- wfcr.create_time,-->
<!-- wfcr.remark_corp_name,-->
<!-- wfcr.oper_userid,-->
<!-- wfcr.add_way,-->
<!-- wfcr.state,-->
<!-- wfcr.status,-->
<!-- wu.user_name,-->
<!-- wfcrf.flower_customer_rel_id,-->
<!-- wt.tag_id,-->
<!-- wt.`name` as tagName,-->
<!-- (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department-->
<!-- FROM-->
<!-- we_customer wc-->
<!-- LEFT JOIN we_flower_customer_rel wfcr ON wc.external_userid=wfcr.external_userid-->
<!-- LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id-->
<!-- LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id-->
<!-- INNER JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id-->
<!-- <where>-->
<!-- <if test="name != null and name !=''">-->
<!-- AND wc.name like concat('%', #{name}, '%')-->
<!-- </if>-->
<!-- <if test="userIds != null and userIds !=''">-->
<!-- <if test="userIds.indexOf(',') != -1">-->
<!-- and wfcr.user_id in-->
<!-- <foreach item="item" index="index" collection="userIds.split(',')" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="userIds.indexOf(',') == -1">-->
<!-- and wfcr.user_id=#{userIds}-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="tagIds != null and tagIds !=''">-->
<!-- <if test="tagIds.indexOf(',') != -1">-->
<!-- and wt.tag_id in-->
<!-- <foreach item="item" index="index" collection="tagIds.split(',')" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="tagIds.indexOf(',') == -1">-->
<!-- and wt.tag_id=#{tagIds}-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="beginTime != null and beginTime != ''"><!– 开始时间检索 –>-->
<!-- AND date_format(wfcr.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')-->
<!-- </if>-->
<!-- <if test="endTime != null and endTime != ''"><!– 结束时间检索 –>-->
<!-- AND date_format(wfcr.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')-->
<!-- </if>-->
<!-- <if test="status != null and status !=''">-->
<!-- AND wfcr.status = #{status}-->
<!-- </if>-->
<!-- </where>-->
</select>
</select>
...
@@ -197,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -197,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
FROM
we_flower_customer_tag_rel wfcrf
we_flower_customer_tag_rel wfcrf
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
where wfcrf.flower_customer_rel_id=#{id}
where w
t.status=0 and w
fcrf.flower_customer_rel_id=#{id}
</select>
</select>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeMsgTlpMapper.xml
View file @
87c0e3a
...
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"welcomeMsgTplType"
column=
"welcome_msg_tpl_type"
/>
<result
property=
"welcomeMsgTplType"
column=
"welcome_msg_tpl_type"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"materialUrl"
column=
"material_url"
/>
</resultMap>
</resultMap>
<sql
id=
"selectWeMsgTlpVo"
>
<sql
id=
"selectWeMsgTlpVo"
>
...
@@ -19,14 +20,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -19,14 +20,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
</sql>
<select
id=
"selectWeMsgTlpList"
parameterType=
"WeMsgTlp"
resultMap=
"WeMsgTlpResult"
>
<select
id=
"selectWeMsgTlpList"
parameterType=
"WeMsgTlp"
resultMap=
"WeMsgTlpResult"
>
<include
refid=
"selectWeMsgTlpVo"
/>
SELECT
wmt.id,
wmt.welcome_msg,
wmt.media_id,
wmt.del_flag,
wmt.welcome_msg_tpl_type,
wmt.create_by,
wmt.create_time,
wm.material_url
FROM
we_msg_tlp wmt
INNER JOIN we_material wm ON wmt.media_id=wm.id
<where>
<where>
<if
test=
"welcomeMsg != null and welcomeMsg != ''"
>
and welcome_msg like CONCAT('%',#{welcomeMsg,jdbcType=VARCHAR},'%')
</if>
<if
test=
"welcomeMsg != null and welcomeMsg != ''"
>
and wmt.welcome_msg like CONCAT('%',#{welcomeMsg,jdbcType=VARCHAR},'%')
</if>
<if
test=
"mediaId != null "
>
and media_id = #{mediaId}
</if>
<if
test=
"welcomeMsgTplType != null "
>
and welcome_msg_tpl_type = #{welcomeMsgTplType}
</if>
<if
test=
"delFlag != null "
>
and del_flag = #{delFlag}
</if>
</where>
</where>
</select>
</select>
<select
id=
"selectWeMsgTlpById"
parameterType=
"Long"
resultMap=
"WeMsgTlpResult"
>
<select
id=
"selectWeMsgTlpById"
parameterType=
"Long"
resultMap=
"WeMsgTlpResult"
>
<include
refid=
"selectWeMsgTlpVo"
/>
<include
refid=
"selectWeMsgTlpVo"
/>
...
@@ -41,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -41,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"mediaId != null"
>
media_id,
</if>
<if
test=
"mediaId != null"
>
media_id,
</if>
<if
test=
"delFlag != null"
>
del_flag,
</if>
<if
test=
"delFlag != null"
>
del_flag,
</if>
<if
test=
"welcomeMsgTplType != null"
>
welcome_msg_tpl_type,
</if>
<if
test=
"welcomeMsgTplType != null"
>
welcome_msg_tpl_type,
</if>
<if
test=
"createBy != null "
>
create_by,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"id != null"
>
#{id},
</if>
...
@@ -48,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -48,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"mediaId != null"
>
#{mediaId},
</if>
<if
test=
"mediaId != null"
>
#{mediaId},
</if>
<if
test=
"delFlag != null"
>
#{delFlag},
</if>
<if
test=
"delFlag != null"
>
#{delFlag},
</if>
<if
test=
"welcomeMsgTplType != null"
>
#{welcomeMsgTplType},
</if>
<if
test=
"welcomeMsgTplType != null"
>
#{welcomeMsgTplType},
</if>
<if
test=
"createBy != null "
>
#{createBy},
</if>
</trim>
</trim>
</insert>
</insert>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment