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 047c1e0a
authored
Mar 17, 2021
by
YaoYuHang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
社群运营 - 群SOP - 空素材insert SQL问题修复
1 parent
7075f283
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
33 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeKeywordGroupTaskMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCommunityKeywordToGroupServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupSopServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePresTagGroupTaskServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeKeywordGroupTaskMapper.xml
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeKeywordGroupTaskMapper.java
View file @
047c1e0
...
@@ -42,14 +42,6 @@ public interface WeKeywordGroupTaskMapper extends BaseMapper<WeKeywordGroupTask>
...
@@ -42,14 +42,6 @@ public interface WeKeywordGroupTaskMapper extends BaseMapper<WeKeywordGroupTask>
WeKeywordGroupTaskVo
getTaskById
(
Long
taskId
);
WeKeywordGroupTaskVo
getTaskById
(
Long
taskId
);
/**
/**
* 根据id列表批量删除任务
*
* @param ids id列表
* @return 删除行数
*/
int
batchRemoveTaskByIds
(
Long
[]
ids
);
/**
* 根据任务id获取对应所有的群聊名称
* 根据任务id获取对应所有的群聊名称
*
*
* @param taskId 任务id
* @param taskId 任务id
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCommunityKeywordToGroupServiceImpl.java
View file @
047c1e0
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.domain.WeKeywordGroupTaskKeyword
;
import
com.linkwechat.wecom.domain.WeKeywordGroupTaskKeyword
;
import
com.linkwechat.wecom.domain.WeKeywordGroupTask
;
import
com.linkwechat.wecom.domain.WeKeywordGroupTask
;
import
com.linkwechat.wecom.domain.WeGroupCode
;
import
com.linkwechat.wecom.domain.WeGroupCode
;
...
@@ -96,9 +97,13 @@ public class WeCommunityKeywordToGroupServiceImpl extends ServiceImpl<WeKeywordG
...
@@ -96,9 +97,13 @@ public class WeCommunityKeywordToGroupServiceImpl extends ServiceImpl<WeKeywordG
public
int
addTask
(
WeKeywordGroupTask
task
,
String
[]
keywords
)
{
public
int
addTask
(
WeKeywordGroupTask
task
,
String
[]
keywords
)
{
if
(
this
.
save
(
task
))
{
if
(
this
.
save
(
task
))
{
// 构建关键词对象并存储
// 构建关键词对象并存储
List
<
WeKeywordGroupTaskKeyword
>
weKeywordGroupTaskKeywordList
=
Arrays
.
stream
(
keywords
)
List
<
WeKeywordGroupTaskKeyword
>
taskKeywordList
=
Arrays
.
map
(
word
->
new
WeKeywordGroupTaskKeyword
(
task
.
getTaskId
(),
word
)).
collect
(
Collectors
.
toList
());
.
stream
(
keywords
)
taskKwMapper
.
batchBindsTaskKeyword
(
weKeywordGroupTaskKeywordList
);
.
map
(
word
->
new
WeKeywordGroupTaskKeyword
(
task
.
getTaskId
(),
word
))
.
collect
(
Collectors
.
toList
());
if
(
StringUtils
.
isNotEmpty
(
taskKeywordList
))
{
taskKwMapper
.
batchBindsTaskKeyword
(
taskKeywordList
);
}
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -120,9 +125,13 @@ public class WeCommunityKeywordToGroupServiceImpl extends ServiceImpl<WeKeywordG
...
@@ -120,9 +125,13 @@ public class WeCommunityKeywordToGroupServiceImpl extends ServiceImpl<WeKeywordG
taskKwQueryWrapper
.
eq
(
"task_id"
,
task
.
getTaskId
());
taskKwQueryWrapper
.
eq
(
"task_id"
,
task
.
getTaskId
());
taskKwMapper
.
delete
(
taskKwQueryWrapper
);
taskKwMapper
.
delete
(
taskKwQueryWrapper
);
// 再重新插入新的关键词
// 再重新插入新的关键词
List
<
WeKeywordGroupTaskKeyword
>
weKeywordGroupTaskKeywordList
=
Arrays
.
stream
(
keywords
)
List
<
WeKeywordGroupTaskKeyword
>
taskKeywordList
=
Arrays
.
map
(
word
->
new
WeKeywordGroupTaskKeyword
(
task
.
getTaskId
(),
word
)).
collect
(
Collectors
.
toList
());
.
stream
(
keywords
)
taskKwMapper
.
batchBindsTaskKeyword
(
weKeywordGroupTaskKeywordList
);
.
map
(
word
->
new
WeKeywordGroupTaskKeyword
(
task
.
getTaskId
(),
word
))
.
collect
(
Collectors
.
toList
());
if
(
StringUtils
.
isNotEmpty
(
taskKeywordList
))
{
taskKwMapper
.
batchBindsTaskKeyword
(
taskKeywordList
);
}
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -141,7 +150,9 @@ public class WeCommunityKeywordToGroupServiceImpl extends ServiceImpl<WeKeywordG
...
@@ -141,7 +150,9 @@ public class WeCommunityKeywordToGroupServiceImpl extends ServiceImpl<WeKeywordG
QueryWrapper
<
WeKeywordGroupTaskKeyword
>
taskKwQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
WeKeywordGroupTaskKeyword
>
taskKwQueryWrapper
=
new
QueryWrapper
<>();
taskKwQueryWrapper
.
in
(
"task_id"
,
Arrays
.
asList
(
ids
));
taskKwQueryWrapper
.
in
(
"task_id"
,
Arrays
.
asList
(
ids
));
taskKwMapper
.
delete
(
taskKwQueryWrapper
);
taskKwMapper
.
delete
(
taskKwQueryWrapper
);
return
taskMapper
.
batchRemoveTaskByIds
(
ids
);
QueryWrapper
<
WeKeywordGroupTask
>
taskQueryWrapper
=
new
QueryWrapper
<>();
taskKwQueryWrapper
.
in
(
"task_id"
,
Arrays
.
asList
(
ids
));
return
taskMapper
.
delete
(
taskQueryWrapper
);
}
}
/**
/**
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupSopServiceImpl.java
View file @
047c1e0
...
@@ -80,19 +80,21 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
...
@@ -80,19 +80,21 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
* @param weGroupSop 新增所用数据
* @param weGroupSop 新增所用数据
* @param groupIdList 选中的群聊id
* @param groupIdList 选中的群聊id
* @param materialIdList 素材
* @param materialIdList 素材
* @param pic
List
手动上传的图片URL
* @param pic
UrlList
手动上传的图片URL
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
@Transactional
public
int
addGroupSop
(
WeGroupSop
weGroupSop
,
List
<
String
>
groupIdList
,
List
<
Long
>
materialIdList
,
List
<
String
>
picList
)
{
public
int
addGroupSop
(
WeGroupSop
weGroupSop
,
List
<
String
>
groupIdList
,
List
<
Long
>
materialIdList
,
List
<
String
>
pic
Url
List
)
{
if
(
this
.
save
(
weGroupSop
))
{
if
(
this
.
save
(
weGroupSop
))
{
Long
ruleId
=
weGroupSop
.
getRuleId
();
Long
ruleId
=
weGroupSop
.
getRuleId
();
// 保存群聊及素材关联
// 保存群聊及素材关联
this
.
saveChatAndMaterialBinds
(
ruleId
,
groupIdList
,
materialIdList
);
this
.
saveChatAndMaterialBinds
(
ruleId
,
groupIdList
,
materialIdList
);
// 保存手动上传的图片素材
// 保存手动上传的图片素材
List
<
WeGroupSopPic
>
sopPicList
=
picList
.
stream
().
map
(
e
->
new
WeGroupSopPic
(
ruleId
,
e
)).
collect
(
Collectors
.
toList
());
List
<
WeGroupSopPic
>
sopPicList
=
picUrlList
.
stream
().
map
(
picUrl
->
new
WeGroupSopPic
(
ruleId
,
picUrl
)).
collect
(
Collectors
.
toList
());
if
(
StringUtils
.
isNotEmpty
(
sopPicList
))
{
sopPicMapper
.
batchSopPic
(
sopPicList
);
sopPicMapper
.
batchSopPic
(
sopPicList
);
}
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -104,12 +106,12 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
...
@@ -104,12 +106,12 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
* @param weGroupSop 更新所用数据
* @param weGroupSop 更新所用数据
* @param groupIdList 选中的群聊id
* @param groupIdList 选中的群聊id
* @param materialIdList 素材
* @param materialIdList 素材
* @param pic
List
手动上传的图片URL
* @param pic
UrlList
手动上传的图片URL
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
@Transactional
public
int
updateGroupSop
(
WeGroupSop
weGroupSop
,
List
<
String
>
groupIdList
,
List
<
Long
>
materialIdList
,
List
<
String
>
picList
)
{
public
int
updateGroupSop
(
WeGroupSop
weGroupSop
,
List
<
String
>
groupIdList
,
List
<
Long
>
materialIdList
,
List
<
String
>
pic
Url
List
)
{
if
(
this
.
updateById
(
weGroupSop
))
{
if
(
this
.
updateById
(
weGroupSop
))
{
Long
ruleId
=
weGroupSop
.
getRuleId
();
Long
ruleId
=
weGroupSop
.
getRuleId
();
// 先删除旧数据
// 先删除旧数据
...
@@ -121,8 +123,10 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
...
@@ -121,8 +123,10 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
sopPicMapper
.
delete
(
queryWrapper
.
eq
(
"rule_id"
,
ruleId
));
sopPicMapper
.
delete
(
queryWrapper
.
eq
(
"rule_id"
,
ruleId
));
// 保留新上传的图片
// 保留新上传的图片
List
<
WeGroupSopPic
>
sopPicList
=
picList
.
stream
().
map
(
e
->
new
WeGroupSopPic
(
ruleId
,
e
)).
collect
(
Collectors
.
toList
());
List
<
WeGroupSopPic
>
sopPicList
=
picUrlList
.
stream
().
map
(
picUrl
->
new
WeGroupSopPic
(
ruleId
,
picUrl
)).
collect
(
Collectors
.
toList
());
if
(
StringUtils
.
isNotEmpty
(
sopPicList
))
{
sopPicMapper
.
batchSopPic
(
sopPicList
);
sopPicMapper
.
batchSopPic
(
sopPicList
);
}
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -166,7 +170,6 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
...
@@ -166,7 +170,6 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
return
groupSopMapper
.
isRuleNameUnique
(
ruleName
)
==
0
;
return
groupSopMapper
.
isRuleNameUnique
(
ruleName
)
==
0
;
}
}
/**
/**
* 根据关联条件查询该sop所关联的群聊及素材对象,并将其放入WeGroupSopVo相应属性中用于前端使用
* 根据关联条件查询该sop所关联的群聊及素材对象,并将其放入WeGroupSopVo相应属性中用于前端使用
*
*
...
@@ -241,7 +244,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
...
@@ -241,7 +244,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
QueryWrapper
<
WeGroupSopPic
>
picQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
WeGroupSopPic
>
picQueryWrapper
=
new
QueryWrapper
<>();
picQueryWrapper
.
eq
(
"rule_id"
,
ruleId
);
picQueryWrapper
.
eq
(
"rule_id"
,
ruleId
);
List
<
WeGroupSopPic
>
sopPicList
=
sopPicMapper
.
selectList
(
picQueryWrapper
);
List
<
WeGroupSopPic
>
sopPicList
=
sopPicMapper
.
selectList
(
picQueryWrapper
);
List
<
String
>
picList
=
sopPicList
.
stream
().
map
(
WeGroupSopPic:
:
getPicUrl
).
collect
(
Collectors
.
toList
());
List
<
String
>
pic
Url
List
=
sopPicList
.
stream
().
map
(
WeGroupSopPic:
:
getPicUrl
).
collect
(
Collectors
.
toList
());
sopVo
.
setPicList
(
picList
);
sopVo
.
setPicList
(
pic
Url
List
);
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePresTagGroupTaskServiceImpl.java
View file @
047c1e0
...
@@ -173,8 +173,6 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
...
@@ -173,8 +173,6 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
taskTagMapper
.
batchBindsTaskTags
(
wePresTagGroupTaskTagList
);
taskTagMapper
.
batchBindsTaskTags
(
wePresTagGroupTaskTagList
);
}
}
// 更新范围
// 先解除旧的员工绑定信息
// 先解除旧的员工绑定信息
QueryWrapper
<
WePresTagGroupTaskScope
>
taskScopeQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
WePresTagGroupTaskScope
>
taskScopeQueryWrapper
=
new
QueryWrapper
<>();
taskScopeQueryWrapper
.
eq
(
"task_id"
,
taskId
);
taskScopeQueryWrapper
.
eq
(
"task_id"
,
taskId
);
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeKeywordGroupTaskMapper.xml
View file @
047c1e0
...
@@ -69,13 +69,6 @@
...
@@ -69,13 +69,6 @@
WHERE wkg.task_id = #{taskId}
WHERE wkg.task_id = #{taskId}
</select>
</select>
<delete
id=
"batchRemoveTaskByIds"
>
delete from we_keyword_group where task_id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<select
id=
"checkNameUnique"
parameterType=
"String"
resultType=
"int"
>
<select
id=
"checkNameUnique"
parameterType=
"String"
resultType=
"int"
>
select count(1) from we_keyword_group where task_name = #{taskName}
select count(1) from we_keyword_group where task_name = #{taskName}
</select>
</select>
...
...
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