Commit baa9ca91 by leejoker

Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev

2 parents 4a009667 d97b5f86
spring.cloud.nacos.config.server-addr=${NACOS_SERVER:119.45.28.29:10848}
spring.cloud.nacos.config.namespace=627a666a-76b2-42ad-a1b0-70a12d2c73fd
spring.application.name=link-wechat
spring.cloud.nacos.config.file-extension=yaml
\ No newline at end of file \ No newline at end of file
#spring.cloud.nacos.config.server-addr=
#spring.cloud.nacos.config.namespace=
#spring.application.name=
#spring.cloud.nacos.config.file-extension=
\ No newline at end of file \ No newline at end of file
...@@ -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
......
...@@ -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);
} }
/** /**
......
...@@ -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 picList 手动上传的图片URL * @param picUrlList 手动上传的图片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> picUrlList) {
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());
sopPicMapper.batchSopPic(sopPicList); if (StringUtils.isNotEmpty(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 picList 手动上传的图片URL * @param picUrlList 手动上传的图片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> picUrlList) {
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());
sopPicMapper.batchSopPic(sopPicList); if (StringUtils.isNotEmpty(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> picUrlList = sopPicList.stream().map(WeGroupSopPic::getPicUrl).collect(Collectors.toList());
sopVo.setPicList(picList); sopVo.setPicList(picUrlList);
} }
} }
...@@ -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);
......
...@@ -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>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!