Commit 6cf9a8f4 by YaoYuHang Committed by yaoyuhang

fix:

	新建群活码时code_url字段报错问题
	新建新客自动拉群时无法正确生成员工活码问题
	群SOP列表页面排序规则
	员工活码isJoinConfirmFriends字段与数据库不一致问题
	企业群发查询外部联系人列表bug
	其他问题

enhance:
    基础字段添加
	SOP业务去除了关键词表,优化了查询速度
	群活码改为由后端生成,支持更换活码头像
1 parent 3c532b67
Showing 53 changed files with 617 additions and 766 deletions
...@@ -64,11 +64,13 @@ public class WeCommunityGroupSopController extends BaseController { ...@@ -64,11 +64,13 @@ public class WeCommunityGroupSopController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:add')") // @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:add')")
@PostMapping(path = "/") @PostMapping(path = "/")
public AjaxResult addGroupSop(@Validated @RequestBody WeGroupSopDto groupSopDto) { public AjaxResult addGroupSop(@Validated @RequestBody WeGroupSopDto groupSopDto) {
if (!groupSopService.isRuleNameUnique(groupSopDto.getRuleName())) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
WeGroupSop weGroupSop = new WeGroupSop(); WeGroupSop weGroupSop = new WeGroupSop();
BeanUtils.copyProperties(groupSopDto, weGroupSop); BeanUtils.copyProperties(groupSopDto, weGroupSop);
if (groupSopService.isNameOccupied(weGroupSop)) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
weGroupSop.setCreateBy(SecurityUtils.getUsername()); weGroupSop.setCreateBy(SecurityUtils.getUsername());
// 群聊id列表 // 群聊id列表
List<String> groupIdList = groupSopDto.getChatIdList(); List<String> groupIdList = groupSopDto.getChatIdList();
...@@ -116,14 +118,15 @@ public class WeCommunityGroupSopController extends BaseController { ...@@ -116,14 +118,15 @@ public class WeCommunityGroupSopController extends BaseController {
if (null == groupSopService.getGroupSopById(ruleId)) { if (null == groupSopService.getGroupSopById(ruleId)) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在");
} }
WeGroupSop weGroupSop = new WeGroupSop();
weGroupSop.setRuleId(ruleId);
BeanUtils.copyProperties(groupSopDto, weGroupSop);
// 校验规则名是否可用 // 校验规则名是否可用
WeGroupSopVo original = groupSopService.getGroupSopById(ruleId); if (groupSopService.isNameOccupied(weGroupSop)) {
if (!groupSopDto.getRuleName().equals(original.getRuleName()) && !groupSopService.isRuleNameUnique(groupSopDto.getRuleName())) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在"); return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
} }
WeGroupSop weGroupSop = new WeGroupSop();
BeanUtils.copyProperties(groupSopDto, weGroupSop);
weGroupSop.setRuleId(ruleId);
weGroupSop.setUpdateBy(SecurityUtils.getUsername()); weGroupSop.setUpdateBy(SecurityUtils.getUsername());
// 群聊id列表 // 群聊id列表
List<String> groupIdList = groupSopDto.getChatIdList(); List<String> groupIdList = groupSopDto.getChatIdList();
......
...@@ -6,7 +6,7 @@ import com.linkwechat.common.core.domain.entity.SysUser; ...@@ -6,7 +6,7 @@ import com.linkwechat.common.core.domain.entity.SysUser;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.CommunityTaskType; import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.system.service.ISysUserService; import com.linkwechat.system.service.ISysUserService;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo; import com.linkwechat.wecom.domain.WeKeywordGroupTask;
import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService; import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService;
import com.linkwechat.wecom.service.IWeGroupSopService; import com.linkwechat.wecom.service.IWeGroupSopService;
import com.linkwechat.wecom.service.IWePresTagGroupTaskService; import com.linkwechat.wecom.service.IWePresTagGroupTaskService;
...@@ -106,7 +106,6 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -106,7 +106,6 @@ public class WeCommunityH5Controller extends BaseController {
} }
/** /**
* 用于支持H5页面的名称和关键字检索 * 用于支持H5页面的名称和关键字检索
* *
...@@ -116,7 +115,7 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -116,7 +115,7 @@ public class WeCommunityH5Controller extends BaseController {
@GetMapping(path = "/filter") @GetMapping(path = "/filter")
public TableDataInfo filter(@RequestParam("word") String word) { public TableDataInfo filter(@RequestParam("word") String word) {
startPage(); startPage();
List<WeKeywordGroupTaskVo> taskList = keywordToGroupService.filterByNameOrKeyword(word); List<WeKeywordGroupTask> taskList = keywordToGroupService.filterByNameOrKeyword(word);
return getDataTable(taskList); return getDataTable(taskList);
} }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.WeKeywordGroupTask; import com.linkwechat.wecom.domain.WeKeywordGroupTask;
import com.linkwechat.wecom.domain.dto.WeKeywordGroupTaskDto;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo;
import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService; import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService;
import com.linkwechat.wecom.service.IWeGroupCodeService; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 关键词拉群controller * 关键词拉群controller
*/ */
@Api(tags = "关键词拉群")
@RestController @RestController
@RequestMapping(value = "/wecom/communityKeywordGroup") @RequestMapping(value = "/wecom/communityKeywordGroup")
public class WeCommunityKeywordGroupController extends BaseController { public class WeCommunityKeywordGroupController extends BaseController {
@Autowired @Autowired
private IWeCommunityKeywordToGroupService keywordToGroupService; private IWeCommunityKeywordToGroupService service;
@Autowired
private IWeGroupCodeService groupCodeService;
/** /**
* 根据过滤条件获取关键词拉群任务列表 * 根据过滤条件获取关键词拉群任务列表
*
* @param taskName 任务名称
* @param createBy 创建人
* @param keyword 关键词
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 列表数据
*/ */
@ApiOperation(value = "获取关键词拉群任务列表")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:list')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:list')")
@GetMapping(path = "/list") @GetMapping(path = "/list")
public TableDataInfo<List<WeKeywordGroupTaskVo>> list( public TableDataInfo<List<WeKeywordGroupTask>> list(WeKeywordGroupTask task) {
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "createBy", required = false) String createBy,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime
) {
startPage(); startPage();
List<WeKeywordGroupTaskVo> taskList = keywordToGroupService List<WeKeywordGroupTask> taskList = service.getTaskList(task);
.getTaskList(taskName, createBy, keyword, beginTime, endTime);
return getDataTable(taskList); return getDataTable(taskList);
} }
...@@ -61,35 +46,43 @@ public class WeCommunityKeywordGroupController extends BaseController { ...@@ -61,35 +46,43 @@ public class WeCommunityKeywordGroupController extends BaseController {
* @param taskId 任务id * @param taskId 任务id
* @return 任务详情 * @return 任务详情
*/ */
@ApiOperation(value = "获取任务详情")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')")
@GetMapping(path = "/{taskId}") @GetMapping(path = "/{taskId}")
public AjaxResult getTask(@PathVariable("taskId") Long taskId) { public AjaxResult getTask(@ApiParam("任务id") @PathVariable("taskId") Long taskId) {
return AjaxResult.success(keywordToGroupService.getTaskById(taskId)); return AjaxResult.success(service.getTaskById(taskId));
} }
/** /**
* 添加新任务 * 添加新任务
* *
* @param keywordToGroupDto 添加任务所需的数据 * @param task 添加任务所需的数据
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "添加新任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')")
@PostMapping(path = "/") @PostMapping(path = "/")
public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTaskDto keywordToGroupDto) { public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTask task) {
return toAjax(keywordToGroupService.addTask(keywordToGroupDto)); if (service.isNameOccupied(task)) {
return AjaxResult.error("关键词拉群任务名称"+ task.getTaskName() +"已存在");
}
task.setCreateBy(SecurityUtils.getUsername());
task.setCreateTime(new Date());
return toAjax(service.addTask(task));
} }
/** /**
* 根据id及更新数据对指定任务进行更新 * 根据id及更新数据对指定任务进行更新
*
* @param taskId 任务id
* @param keywordToGroupDto 更新所需数据
* @return 结果
*/ */
@ApiOperation(value = "更新任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')")
@PutMapping(path = "/{taskId}") @PutMapping("/{taskId}")
public AjaxResult updateTask(@PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTaskDto keywordToGroupDto) { public AjaxResult updateTask(
return toAjax(keywordToGroupService.updateTask(taskId, keywordToGroupDto)); @ApiParam("任务id") @PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTask task) {
task.setTaskId(taskId);
task.setUpdateBy(SecurityUtils.getUsername());
task.setUpdateTime(new Date());
return toAjax(service.updateTask(task));
} }
/** /**
...@@ -98,10 +91,11 @@ public class WeCommunityKeywordGroupController extends BaseController { ...@@ -98,10 +91,11 @@ public class WeCommunityKeywordGroupController extends BaseController {
* @param ids id列表 * @param ids id列表
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "批量删除任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')")
@DeleteMapping(path = "/{ids}") @DeleteMapping(path = "/{ids}")
public AjaxResult batchDeleteTask(@PathVariable("ids") Long[] ids) { public AjaxResult batchDeleteTask(@ApiParam("待删除任务id数组") @PathVariable("ids") Long[] ids) {
return toAjax(keywordToGroupService.batchRemoveTaskByIds(ids)); return toAjax(service.batchRemoveTaskByIds(ids));
} }
} }
...@@ -10,6 +10,7 @@ import com.linkwechat.common.enums.BusinessType; ...@@ -10,6 +10,7 @@ import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto; import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo; import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
...@@ -28,9 +29,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -28,9 +29,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Optional;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -83,7 +83,6 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -83,7 +83,6 @@ public class WeCommunityNewGroupController extends BaseController {
exc.printStackTrace(); exc.printStackTrace();
} }
}); });
return;
} }
/** /**
...@@ -98,34 +97,19 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -98,34 +97,19 @@ public class WeCommunityNewGroupController extends BaseController {
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER) @Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch") @GetMapping("/downloadBatch")
public void downloadBatch(Long[] ids, HttpServletRequest request, HttpServletResponse response) { public void downloadBatch(Long[] ids, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, String>> fileList = weCommunityNewGroupService
.selectWeCommunityNewGroupByIds(Arrays.asList(ids))
.stream()
.map(e -> {
WeEmpleCode code = weEmpleCodeService.getById(e.getEmplCodeId());
Map<String, String> fileMap = new HashMap<>();
fileMap.put("fileName", code.getUseUserName() + "-" + code.getScenario()+".jpg");
fileMap.put("url", code.getQrCode());
return fileMap;
})
.collect(Collectors.toList());
try { try {
List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupByIds(Arrays.asList(ids)); FileUtils.batchDownloadFile(fileList, response.getOutputStream());
//zip输出流
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
if (CollectionUtil.isNotEmpty(weCommunityNewGroupVos)) {
for (WeCommunityNewGroupVo communityNewGroupVo : weCommunityNewGroupVos) {
// 获取改新客拉群对应员工活码的二维码
WeEmpleCode empleCode = weEmpleCodeService.selectWeEmpleCodeById(communityNewGroupVo.getEmplCodeId());
String qrCode = empleCode.getQrCode();
if (StringUtils.isEmpty(qrCode)) {
continue;
}
URL url = new URL(qrCode);
// 二维码名称使用场景
String fileName = empleCode.getScenario() + ".png";
zos.putNextEntry(new ZipEntry(fileName));
InputStream fis = url.openConnection().getInputStream();
byte[] buffer = new byte[1024];
int r = 0;
while ((r = fis.read(buffer)) != -1) {
zos.write(buffer, 0, r);
}
fis.close();
}
}
//关闭zip输出流
zos.flush();
zos.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -137,13 +121,9 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -137,13 +121,9 @@ public class WeCommunityNewGroupController extends BaseController {
@ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET") @ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET")
// @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')") // @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo<List<WeCommunityNewGroupVo>> list( public TableDataInfo<List<WeCommunityNewGroupVo>> list(WeCommunityNewGroup weCommunityNewGroup) {
@RequestParam(value = "emplCodeName", required = false) String emplCodeName,
@RequestParam(value = "createBy", required = false) String createBy,
@RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime) {
startPage(); startPage();
List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(emplCodeName, createBy, beginTime, endTime); List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(weCommunityNewGroup);
return getDataTable(communityNewGroupVos); return getDataTable(communityNewGroupVos);
} }
......
...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.constant.HttpStatus; import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
...@@ -53,23 +54,26 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -53,23 +54,26 @@ public class WeCommunityPresTagGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')")
@PostMapping @PostMapping
public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) { public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
// 检测任务名是否可用 if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
if (!taskService.checkTaskNameUnique(wePresTagGroupTaskDto.getTaskName())) {
return AjaxResult.error("任务名已存在");
}
if (null == groupCodeService.selectWeGroupCodeById(wePresTagGroupTaskDto.getGroupCodeId())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
} }
// 创建新任务并保存
WePresTagGroupTask task = new WePresTagGroupTask(); WePresTagGroupTask task = new WePresTagGroupTask();
BeanUtils.copyProperties(wePresTagGroupTaskDto, task); BeanUtils.copyProperties(wePresTagGroupTaskDto, task);
// 检测任务名是否可用
if (taskService.isNameOccupied(task)) {
return AjaxResult.error("任务名已存在");
}
task.setCreateBy(SecurityUtils.getUsername()); task.setCreateBy(SecurityUtils.getUsername());
List<String> tagList = wePresTagGroupTaskDto.getTagList(); List<String> tagList = wePresTagGroupTaskDto.getTagList();
List<String> scopeList = wePresTagGroupTaskDto.getScopeList(); List<String> scopeList = wePresTagGroupTaskDto.getScopeList();
int affectedRows = taskService.add(task, tagList, scopeList); int affectedRows = taskService.add(task, tagList, scopeList);
if (affectedRows > 0) { if (affectedRows > 0) {
// 若保存成功,则进行异步消息推送 boolean hasScope = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getScopeList());
taskService.sendMessage(task); boolean hasTag = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getTagList());
List<String> externalIds = taskService
.selectExternalUserIds(task.getTaskId(), hasScope, hasTag, wePresTagGroupTaskDto.getSendScope(),
wePresTagGroupTaskDto.getCusBeginTime(), wePresTagGroupTaskDto.getCusEndTime());
taskService.sendMessage(task, externalIds);
} }
return toAjax(affectedRows); return toAjax(affectedRows);
} }
...@@ -93,15 +97,7 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -93,15 +97,7 @@ public class WeCommunityPresTagGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')")
@PutMapping(path = "/{id}") @PutMapping(path = "/{id}")
public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) { public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
// 检测任务名是否可用 if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
WePresTagGroupTaskVo original = taskService.getTaskById(id);
// 判断名称是否发生变化
boolean newName = wePresTagGroupTaskDto.getTaskName().equals(original.getTaskName());
// 新名称不能已存在
if (!taskService.checkTaskNameUnique(wePresTagGroupTaskDto.getTaskName()) && !newName) {
return AjaxResult.error("任务名已存在");
}
if (null == groupCodeService.selectWeGroupCodeById(wePresTagGroupTaskDto.getGroupCodeId())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
} }
return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto)); return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto));
......
...@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
...@@ -23,9 +24,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -23,9 +24,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -154,38 +153,19 @@ public class WeEmpleCodeController extends BaseController { ...@@ -154,38 +153,19 @@ public class WeEmpleCodeController extends BaseController {
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER) @Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch") @GetMapping("/downloadBatch")
public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response){ public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response){
List<String> idList = Arrays.stream(Optional.ofNullable(ids).orElse("").split(",")) List<Map<String, String>> fileList = Arrays
.filter(StringUtils::isNotEmpty).collect(Collectors.toList()); .stream(Optional.ofNullable(ids).orElse("").split(","))
.filter(StringUtils::isNotEmpty)
.map(id -> {
WeEmpleCode code = weEmpleCodeService.getById(id);
Map<String, String> fileMap = new HashMap<>();
fileMap.put("fileName", code.getUseUserName() + "-" + code.getScenario()+".jpg");
fileMap.put("url", code.getQrCode());
return fileMap;})
.collect(Collectors.toList());
try { try {
//通过员工活码id查询活码数据 FileUtils.batchDownloadFile(fileList, response.getOutputStream());
List<WeEmpleCode> weEmpleCodeLsit = weEmpleCodeService.selectWeEmpleCodeByIds(idList); } catch (Exception e) {
//zip输出流
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
if (CollectionUtil.isNotEmpty(weEmpleCodeLsit)){
for (WeEmpleCode weEmpleCode : weEmpleCodeLsit){
String qrCode = weEmpleCode.getQrCode();
if (StringUtils.isEmpty(qrCode)){
continue;
}
URL url = new URL(qrCode);
//每个二维码名称
String fileName = weEmpleCode.getUseUserName()+"-"+weEmpleCode.getScenario()+".jpg";
zos.putNextEntry(new ZipEntry(fileName));
InputStream fis = url.openConnection().getInputStream();
byte[] buffer = new byte[1024];
int r = 0;
while ((r = fis.read(buffer)) != -1) {
zos.write(buffer, 0, r);
}
fis.close();
}
}
//关闭zip输出流
zos.flush();
zos.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -196,7 +176,7 @@ public class WeEmpleCodeController extends BaseController { ...@@ -196,7 +176,7 @@ public class WeEmpleCodeController extends BaseController {
public void download(String id, HttpServletRequest request, HttpServletResponse response){ public void download(String id, HttpServletRequest request, HttpServletResponse response){
WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id)); WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id));
if (StringUtils.isEmpty(weEmpleCode.getQrCode())){ if (StringUtils.isEmpty(weEmpleCode.getQrCode())){
return; throw new CustomException("活码不存在");
}else { }else {
try { try {
FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream()); FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream());
......
...@@ -265,6 +265,11 @@ ...@@ -265,6 +265,11 @@
<artifactId>jsqlparser</artifactId> <artifactId>jsqlparser</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -43,5 +44,6 @@ public class WeCommunityNewGroup extends BaseEntity { ...@@ -43,5 +44,6 @@ public class WeCommunityNewGroup extends BaseEntity {
/** /**
* 0 未删除 1 已删除 * 0 未删除 1 已删除
*/ */
private int delFlag = 0; @TableLogic
private int delFlag;
} }
...@@ -107,9 +107,4 @@ public class WeEmpleCode extends BaseEntity { ...@@ -107,9 +107,4 @@ public class WeEmpleCode extends BaseEntity {
*/ */
@TableField(exist = false) @TableField(exist = false)
private String mobile; private String mobile;
/**
* 客户添加时是否需要经过确认自动成为好友 1:是 0:否
*/
private Integer isJoinConfirmFriends;
} }
...@@ -27,7 +27,7 @@ public class WeEmpleCodeUseScop ...@@ -27,7 +27,7 @@ public class WeEmpleCodeUseScop
/** $column.columnComment */ /** $column.columnComment */
@TableId @TableId
private Long id; private Long id = SnowFlakeUtil.nextId();
/** 员工活码id */ /** 员工活码id */
@ApiModelProperty("员工活码id") @ApiModelProperty("员工活码id")
......
...@@ -2,13 +2,17 @@ package com.linkwechat.wecom.domain; ...@@ -2,13 +2,17 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
...@@ -33,59 +37,70 @@ public class WeGroupCode extends BaseEntity { ...@@ -33,59 +37,70 @@ public class WeGroupCode extends BaseEntity {
/** /**
* 活码URL * 活码URL
*/ */
@ApiModelProperty(value = "活码URL")
private String codeUrl; private String codeUrl;
/** /**
* 二维码的uuid
*/
private String uuid;
/**
* 活码头像 * 活码头像
*/ */
private String activityHeadUrl; @ApiModelProperty(value = "活码头像URL")
private String avatarUrl;
/** /**
* 活码名称 * 活码名称
*/ */
@NotNull(message = "活码名称不能为空") @ApiModelProperty(value = "活码名称")
@Size(max = 60, message = "活码名称最大长度为60个字符")
@NotBlank(message = "活码名称不能为空")
private String activityName; private String activityName;
/** /**
* 活码描述 * 活码描述
*/ */
@NotNull(message = "活码描述不能为空") @ApiModelProperty(value = "活码描述")
@Size(max = 60, message = "活码描述最大长度为60个字符")
private String activityDesc; private String activityDesc;
/** /**
* 场景 * 场景
*/ */
@ApiModelProperty(value = "场景")
@Size(max = 60, message = "场景最大长度为60个字符")
// @NotBlank(message = "场景不能为空")
private String activityScene; private String activityScene;
/** /**
* 加群引导语 * 加群引导语
*/ */
@ApiModelProperty(value = "加群引导语")
@Size(max = 100, message = "加群引导语最大长度为60个字符")
private String guide; private String guide;
/** /**
* 进群是否提示:1:是;0:否; * 进群是否提示:1:是;0:否;
*/ */
private Long joinGroupIsTip; private Long showTip;
/** /**
* 进群提示语 * 进群提示语
*/ */
@ApiModelProperty(value = "进群提示语")
@Size(max = 100, message = "进群提示语最大长度为60个字符")
private String tipMsg; private String tipMsg;
/** /**
* 客服二维码 * 客服二维码
*/ */
@ApiModelProperty(value = "客服二维码")
@Size(max = 100, message = "客服二维码提示语最大长度为60个字符")
private String customerServerQrCode; private String customerServerQrCode;
/** /**
* 0:正常;2:删除; * 0:正常; 1:删除;
*/ */
private Long delFlag; @JsonIgnore
@TableLogic(value = "0", delval = "1")
private Long delFlag = 0L;
/** /**
* 可用实际码数量 * 可用实际码数量
...@@ -111,4 +126,11 @@ public class WeGroupCode extends BaseEntity { ...@@ -111,4 +126,11 @@ public class WeGroupCode extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private List<WeGroupCodeActual> actualList; private List<WeGroupCodeActual> actualList;
/**
* 实际码id列表,用于前端绑定实际群活码
*/
@JsonIgnore
@TableField(exist = false)
private List<Long> actualIdList;
} }
...@@ -5,10 +5,12 @@ import java.util.Date; ...@@ -5,10 +5,12 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -19,10 +21,11 @@ import javax.validation.constraints.NotNull; ...@@ -19,10 +21,11 @@ import javax.validation.constraints.NotNull;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
@EqualsAndHashCode(callSuper = true)
@ApiModel @ApiModel
@Data @Data
@TableName("we_group_code_actual") @TableName("we_group_code_actual")
public class WeGroupCodeActual public class WeGroupCodeActual extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
...@@ -48,4 +49,10 @@ public class WeGroupSop extends BaseEntity { ...@@ -48,4 +49,10 @@ public class WeGroupSop extends BaseEntity {
@TableField(value = "end_time") @TableField(value = "end_time")
private String stopExeTime; private String stopExeTime;
/**
* 逻辑删除字段
*/
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.wecom.domain.vo.WeGroupCodeVo;
import lombok.Builder; import io.swagger.annotations.ApiModel;
import lombok.Data; import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode; import lombok.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/** /**
* 社区运营 - 关键词拉群任务实体 * 社区运营 - 关键词拉群任务实体
*/ */
@Data @Data
@Builder
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("we_keyword_group") @TableName("we_keyword_group")
@ApiModel("关键词拉群模型")
public class WeKeywordGroupTask extends BaseEntity { public class WeKeywordGroupTask extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@ApiModelProperty("id")
@TableId @TableId
private Long taskId = SnowFlakeUtil.nextId(); private Long taskId;
/** /**
* 任务名称 * 任务名称
*/ */
@ApiModelProperty(value = "任务名称", required = true)
@Size(max = 100, message = "任务名最大长度100")
@NotNull(message = "任务名不能为空")
private String taskName; private String taskName;
/** /**
* 群活码id * 群活码id
*/ */
@ApiModelProperty(value = "群活码id", required = true)
@NotNull(message = "群活码不能为空")
private Long groupCodeId; private Long groupCodeId;
/** /**
* 加群引导语 * 加群引导语
*/ */
@ApiModelProperty(value = "加群引导语", required = true)
@Size(max = 255, message = "引导语过长,最大长度255")
@NotNull(message = "引导语不可为空")
private String welcomeMsg; private String welcomeMsg;
/**
* 关键词
*/
@ApiModelProperty(value = "关键词", required = true)
@Size(max = 255, message = "关键词长度过长。最大长度255")
@NotNull(message = "关键词不可为空")
private String keywords;
/**
* 逻辑删除
*/
@ApiModelProperty(hidden = true)
@JsonIgnore
@TableLogic
private Integer delFlag;
/**
* 群活码信息
*/
@ApiModelProperty(value = "群活码信息")
@TableField(exist = false)
private WeGroupCodeVo groupCodeInfo;
/**
* 实际群聊名称
*/
@ApiModelProperty(value = "实际群聊名称字符串")
@TableField(exist = false)
private String groupNameList;
} }
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 社区运营 - 关键词拉群任务关键词实体
*/
@Data
@NoArgsConstructor
@TableName("we_keyword_group_kw")
public class WeKeywordGroupTaskKeyword {
/**
* 关键词拉群任务id
*/
private Long taskId;
/**
* 关键词
*/
private String keyword;
public WeKeywordGroupTaskKeyword(Long taskId, String keyword) {
this.taskId =taskId;
this.keyword = keyword;
}
}
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -66,4 +67,9 @@ public class WePresTagGroupTask extends BaseEntity { ...@@ -66,4 +67,9 @@ public class WePresTagGroupTask extends BaseEntity {
*/ */
private String msgid; private String msgid;
/**
* 逻辑删除字段
*/
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -40,7 +41,6 @@ public class WeCommunityNewGroupDto { ...@@ -40,7 +41,6 @@ public class WeCommunityNewGroupDto {
/** /**
* 标签id列表 * 标签id列表
*/ */
@NotNull(message = "标签不能为空")
private List<String> tagList; private List<String> tagList;
/** /**
......
...@@ -2,7 +2,9 @@ package com.linkwechat.wecom.domain.dto; ...@@ -2,7 +2,9 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
/** /**
...@@ -13,7 +15,8 @@ public class WeGroupSopDto { ...@@ -13,7 +15,8 @@ public class WeGroupSopDto {
/** /**
* 规则名 * 规则名
*/ */
@NotNull(message = "规则名不可为空") @Size(max = 64, message = "规则名称不可超过64字符")
@NotBlank(message = "规则名不可为空")
private String ruleName; private String ruleName;
/** /**
...@@ -25,13 +28,15 @@ public class WeGroupSopDto { ...@@ -25,13 +28,15 @@ public class WeGroupSopDto {
/** /**
* 内容标题 * 内容标题
*/ */
@NotNull(message = "标题不可为空") @Size(max = 64, message = "标题不可超过64字符")
@NotBlank(message = "标题不可为空")
private String title; private String title;
/** /**
* 消息内容 * 消息内容
*/ */
@NotNull(message = "内容不可为空") @Size(max = 255, message = "标题不可超过255字符")
@NotBlank(message = "内容不可为空")
private String content; private String content;
/** /**
......
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 社区运营 - 关键词拉群Dto
*/
@Data
public class WeKeywordGroupTaskDto {
/**
* 任务名
*/
@NotNull(message = "任务名不能为空")
private String taskName;
/**
* 群活码id
*/
@NotNull(message = "群活码不能为空")
private Long groupCodeId;
/**
* 加群引导语
*/
@NotNull(message = "引导语不可为空")
private String welcomeMsg;
/**
* 关键词
*/
@NotNull(message = "关键词不可为空")
private String keywords;
}
...@@ -3,7 +3,9 @@ package com.linkwechat.wecom.domain.dto; ...@@ -3,7 +3,9 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
/** /**
...@@ -28,7 +30,8 @@ public class WePresTagGroupTaskDto { ...@@ -28,7 +30,8 @@ public class WePresTagGroupTaskDto {
/** /**
* 加群引导语 * 加群引导语
*/ */
@NotNull(message = "引导语不能为空") @Size(max = 64, message = "引导与不能超过64字符")
@NotBlank(message = "引导语不能为空")
private String welcomeMsg; private String welcomeMsg;
/** /**
...@@ -50,7 +53,6 @@ public class WePresTagGroupTaskDto { ...@@ -50,7 +53,6 @@ public class WePresTagGroupTaskDto {
/** /**
* 发送范围 0: 全部客户 1:部分客户 * 发送范围 0: 全部客户 1:部分客户
*/ */
@NotNull(message = "发送范围不能为空")
private Integer sendScope; private Integer sendScope;
/** /**
......
...@@ -19,7 +19,5 @@ public class WeGroupCodeVo { ...@@ -19,7 +19,5 @@ public class WeGroupCodeVo {
private Long id; private Long id;
private String uuid;
private String codeUrl; private String codeUrl;
} }
\ No newline at end of file \ No newline at end of file
package com.linkwechat.wecom.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.wecom.domain.WeKeywordGroupTaskKeyword;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 社区运营 - 关键词拉群任务VO
*/
@Data
public class WeKeywordGroupTaskVo {
/**
* id
*/
private Long taskId;
/**
* 任务名
*/
private String taskName;
/**
* 群活码id
*/
@JsonIgnore
private Long groupCodeId;
/**
* 群活码信息
*/
@TableField(exist = false)
private WeGroupCodeVo groupCodeInfo;
/**
* 关键词
*/
@TableField(exist = false)
private List<WeKeywordGroupTaskKeyword> keywordList;
/**
* 实际群聊(仅群聊名称)
*/
@TableField(exist = false)
private List<String> groupNameList;
/**
* 加群引导语
*/
private String welcomeMsg;
/**
* 创建者
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String updateTime;
}
...@@ -50,12 +50,6 @@ public class WePresTagGroupTaskVo { ...@@ -50,12 +50,6 @@ public class WePresTagGroupTaskVo {
@JsonIgnore @JsonIgnore
private String codeUrl; private String codeUrl;
/**
* 群活码uuid
*/
@JsonIgnore
private String CodeUuid;
@TableField(exist = false) @TableField(exist = false)
private WeGroupCodeVo groupCodeInfo; private WeGroupCodeVo groupCodeInfo;
...@@ -132,7 +126,7 @@ public class WePresTagGroupTaskVo { ...@@ -132,7 +126,7 @@ public class WePresTagGroupTaskVo {
* 设置群活码信息 * 设置群活码信息
*/ */
public void fillGroupCodeVo() { public void fillGroupCodeVo() {
WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(), this.getCodeUuid(), this.getCodeUrl()); WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(),this.getCodeUrl());
this.setGroupCodeInfo(groupCodeVo); this.setGroupCodeInfo(groupCodeVo);
} }
} }
...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatContactMapping; import com.linkwechat.wecom.domain.WeChatContactMapping;
import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
...@@ -12,6 +13,7 @@ import java.util.List; ...@@ -12,6 +13,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-12-27 * @date 2020-12-27
*/ */
@Mapper
public interface WeChatContactMappingMapper extends BaseMapper<WeChatContactMapping> { public interface WeChatContactMappingMapper extends BaseMapper<WeChatContactMapping> {
/** /**
* 查询聊天关系映射 * 查询聊天关系映射
......
...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCommunityNewGroup; import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo; import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -15,7 +16,7 @@ import java.util.Optional; ...@@ -15,7 +16,7 @@ import java.util.Optional;
* @author kewen * @author kewen
* @date 2021-02-19 * @date 2021-02-19
*/ */
@Repository @Mapper
public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGroup> { public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGroup> {
/** /**
...@@ -27,9 +28,9 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou ...@@ -27,9 +28,9 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @param endTime 结束时间 * @param endTime 结束时间
* @return {WeCommunityNewGroupVo}s 列表 * @return {WeCommunityNewGroupVo}s 列表
*/ */
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("emplCodeName") String emplCodeName, @Param("createBy") String createBy // List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("emplCodeName") String emplCodeName, @Param("createBy") String createBy
, @Param("beginTime") String beginTime, @Param("endTime") String endTime); // , @Param("beginTime") String beginTime, @Param("endTime") String endTime);
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup weCommunityNewGroup);
/** /**
* 获取新客自动拉群详细信息 * 获取新客自动拉群详细信息
* *
...@@ -60,12 +61,4 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou ...@@ -60,12 +61,4 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @return 结果 * @return 结果
*/ */
int removeWeCommunityNewGroupByEmplCodeId(@Param("emplCodeId") Long emplCodeId); int removeWeCommunityNewGroupByEmplCodeId(@Param("emplCodeId") Long emplCodeId);
/**
* 通过群活码id逻辑删除对应新客拉群信息
* @param groupCodeId 群活码id
* @return 结果
*/
int removeWeCommunityNewGroupByGroupCodeId(@Param("groupCodeId") Long groupCodeId);
} }
...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto; import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -14,7 +15,7 @@ import java.util.List; ...@@ -14,7 +15,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Repository @Mapper
public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
{ {
/** /**
...@@ -23,14 +24,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -23,14 +24,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param id 员工活码ID * @param id 员工活码ID
* @return 员工活码 * @return 员工活码
*/ */
public WeEmpleCode selectWeEmpleCodeById(Long id); WeEmpleCode selectWeEmpleCodeById(Long id);
/** /**
* 批量查询员工活码根据id * 批量查询员工活码根据id
* @param ids * @param ids
* @return * @return
*/ */
public List<WeEmpleCode> selectWeEmpleCodeByIds(@Param("ids") List<String> ids); List<WeEmpleCode> selectWeEmpleCodeByIds(@Param("ids") List<String> ids);
/** /**
* 查询员工活码列表 * 查询员工活码列表
...@@ -38,7 +39,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -38,7 +39,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 员工活码集合 * @return 员工活码集合
*/ */
public List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode); List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode);
/** /**
* 新增员工活码 * 新增员工活码
...@@ -46,7 +47,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -46,7 +47,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public int insertWeEmpleCode(WeEmpleCode weEmpleCode); int insertWeEmpleCode(WeEmpleCode weEmpleCode);
/** /**
* 修改员工活码 * 修改员工活码
...@@ -54,7 +55,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -54,7 +55,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public int updateWeEmpleCode(WeEmpleCode weEmpleCode); int updateWeEmpleCode(WeEmpleCode weEmpleCode);
/** /**
* 删除员工活码 * 删除员工活码
...@@ -62,7 +63,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -62,7 +63,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param id 员工活码ID * @param id 员工活码ID
* @return 结果 * @return 结果
*/ */
public int deleteWeEmpleCodeById(Long id); int deleteWeEmpleCodeById(Long id);
/** /**
* 批量删除员工活码 * 批量删除员工活码
...@@ -70,7 +71,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -70,7 +71,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteWeEmpleCodeByIds(Long[] ids); int deleteWeEmpleCodeByIds(Long[] ids);
/** /**
...@@ -79,14 +80,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -79,14 +80,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids); int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids);
/** /**
* 通过活动场景获取客户欢迎语 * 通过活动场景获取客户欢迎语
* @param scenario 活动场景 * @param scenario 活动场景
* @return * @return
*/ */
public WeEmpleCodeDto selectWelcomeMsgByScenario(@Param("scenario") String scenario, @Param("userId") String userId); WeEmpleCodeDto selectWelcomeMsgByScenario(@Param("scenario") String scenario, @Param("userId") String userId);
/** /**
* 通过state定位员工活码 * 通过state定位员工活码
......
...@@ -76,7 +76,7 @@ public interface WeGroupCodeActualMapper extends BaseMapper<WeGroupCodeActual> { ...@@ -76,7 +76,7 @@ public interface WeGroupCodeActualMapper extends BaseMapper<WeGroupCodeActual> {
* @param groupCodeId 群活码id * @param groupCodeId 群活码id
* @return 结果 * @return 结果
*/ */
List<WeGroupCodeActual> selectActualListByGroupCodeId(Long groupCodeId); List<WeGroupCodeActual> selectActualList(Long groupCodeId);
/** /**
* 通过群活码id删除实际码 * 通过群活码id删除实际码
......
...@@ -15,17 +15,7 @@ import org.springframework.stereotype.Repository; ...@@ -15,17 +15,7 @@ import org.springframework.stereotype.Repository;
* @date 2020-10-07 * @date 2020-10-07
*/ */
@Mapper @Mapper
@Repository public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> {
public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
{
/**
* 查询客户群活码
*
* @param id 客户群活码ID
* @return 客户群活码
*/
WeGroupCode selectWeGroupCodeById(Long id);
/** /**
* 查询客户群活码列表 * 查询客户群活码列表
* *
...@@ -35,13 +25,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> ...@@ -35,13 +25,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode); List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode);
/** /**
* 根据群活码id查询群活码列表
* @param ids id列表
* @return 结果
*/
List<WeGroupCode> selectWeGroupCodeListByIds(List<String> ids);
/**
* 新增客户群活码 * 新增客户群活码
* *
* @param weGroupCode 客户群活码 * @param weGroupCode 客户群活码
...@@ -58,37 +41,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> ...@@ -58,37 +41,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
int updateWeGroupCode(WeGroupCode weGroupCode); int updateWeGroupCode(WeGroupCode weGroupCode);
/** /**
* 删除客户群活码
*
* @param id 客户群活码ID
* @return 结果
*/
int deleteWeGroupCodeById(Long id);
/**
* 批量删除客户群活码
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteWeGroupCodeByIds(Long[] ids);
/**
* 检测活码名称是否唯一
* @param activityName 活码名称
* @return 结果
*/
int checkActivityNameUnique(String activityName);
/**
* 根据 uuid获取群活码
*
* @param uuid uuid
* @return 结果
*/
WeGroupCode getWeGroupByUuid(String uuid);
/**
* 根据群活码id获取对应所有群聊信息 * 根据群活码id获取对应所有群聊信息
* @param groupCodeId 群活码id * @param groupCodeId 群活码id
* @return 结果 * @return 结果
......
...@@ -49,14 +49,6 @@ public interface WeGroupSopMapper extends BaseMapper<WeGroupSop> { ...@@ -49,14 +49,6 @@ public interface WeGroupSopMapper extends BaseMapper<WeGroupSop> {
int batchRemoveWeGroupSopByIds(Long[] ruleIds); int batchRemoveWeGroupSopByIds(Long[] ruleIds);
/** /**
* 校验规则名是否已存在
*
* @param ruleName 规则名
* @return 结果
*/
int isRuleNameUnique(String ruleName);
/**
* 通过规则id获取其所有素材id * 通过规则id获取其所有素材id
* *
* @param ruleId sop规则id * @param ruleId sop规则id
......
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeKeywordGroupTaskKeyword;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 关键词拉群 关键词mapper
*/
@Mapper
@Repository
public interface WeKeywordGroupTaskKwMapper extends BaseMapper<WeKeywordGroupTaskKeyword> {
/**
* 批量绑定关键词拉群任务与关键词关联
* @param taskKeywordList 待绑定对象
* @return 结果
*/
int batchBindsTaskKeyword(List<WeKeywordGroupTaskKeyword> taskKeywordList);
}
...@@ -2,10 +2,7 @@ package com.linkwechat.wecom.mapper; ...@@ -2,10 +2,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeKeywordGroupTask; import com.linkwechat.wecom.domain.WeKeywordGroupTask;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -13,49 +10,21 @@ import java.util.List; ...@@ -13,49 +10,21 @@ import java.util.List;
* 关键词拉群mapper * 关键词拉群mapper
*/ */
@Mapper @Mapper
@Repository
public interface WeKeywordGroupTaskMapper extends BaseMapper<WeKeywordGroupTask> { public interface WeKeywordGroupTaskMapper extends BaseMapper<WeKeywordGroupTask> {
/** /**
* 根据过滤条件获取关键词拉群任务列表 * 根据过滤条件获取关键词拉群任务列表
* * @param task 查询信息
* @param taskName 任务名称
* @param createBy 创建人
* @param keyword 关键词
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 列表数据
*/
List<WeKeywordGroupTaskVo> getTaskList(
@Param("taskName") String taskName,
@Param("createBy") String createBy,
@Param("keyword") String keyword,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime
);
/**
* 根据id获取任务性情
*
* @param taskId 任务id
* @return 结果 * @return 结果
*/ */
WeKeywordGroupTaskVo getTaskById(Long taskId); List<WeKeywordGroupTask> getTaskList(WeKeywordGroupTask task);
/** /**
* 根据任务id获取对应所有的群聊名称 * 根据id获取任务性情
* *
* @param taskId 任务id * @param taskId 任务id
* @return 结果 * @return 结果
*/ */
List<String> getGroupNameListByTaskId(Long taskId); WeKeywordGroupTask getTaskById(Long taskId);
/**
* 校验名称是否唯一
*
* @param taskName 任务名
* @return 结果
*/
int checkNameUnique(String taskName);
/** /**
* 通过名称或者关键词进行过滤 * 通过名称或者关键词进行过滤
...@@ -63,5 +32,5 @@ public interface WeKeywordGroupTaskMapper extends BaseMapper<WeKeywordGroupTask> ...@@ -63,5 +32,5 @@ public interface WeKeywordGroupTaskMapper extends BaseMapper<WeKeywordGroupTask>
* @param word 过滤字段 * @param word 过滤字段
* @return 结果 * @return 结果
*/ */
List<WeKeywordGroupTaskVo> filterByNameOrKeyword(String word); List<WeKeywordGroupTask> filterByNameOrKeyword(String word);
} }
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo; import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WePresTagGroupTask; import com.linkwechat.wecom.domain.WePresTagGroupTask;
import org.springframework.stereotype.Repository; import org.springframework.security.core.parameters.P;
import java.util.List; import java.util.List;
/** /**
* 老客户标签建群相关Mapper接口 * 老客户标签建群相关Mapper接口
*/ */
@Repository @Mapper
public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> { public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> {
/** /**
...@@ -54,14 +55,6 @@ public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> ...@@ -54,14 +55,6 @@ public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask>
); );
/** /**
* 检测任务名是否已被占用
*
* @param taskName 任务名
* @return 是否被占用
*/
int checkTaskNameUnique(String taskName);
/**
* 获取某员工的任务 * 获取某员工的任务
* *
* @param emplId 员工id * @param emplId 员工id
...@@ -70,4 +63,19 @@ public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> ...@@ -70,4 +63,19 @@ public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask>
*/ */
List<WePresTagGroupTaskVo> getTaskListByEmplId(@Param("emplId") String emplId, @Param("isDone") boolean isDone); List<WePresTagGroupTaskVo> getTaskListByEmplId(@Param("emplId") String emplId, @Param("isDone") boolean isDone);
/**
* 根据task获取员工信息
* @param task
* @return
*/
List<String> selectStaffList(WePresTagGroupTask task);
List<String> selectExternalUserIds(
@Param("taskId") Long taskId,
@Param("hasScope") boolean hasScope,
@Param("hasTag") boolean hasTag,
@Param("gender") Integer gender,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime
);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.linkwechat.wecom.domain.dto.WeKeywordGroupTaskDto; import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo; import com.linkwechat.wecom.domain.WeKeywordGroupTask;
import java.util.List; import java.util.List;
/** /**
* 社区运营 - 关键词拉群任务Service * 社区运营 - 关键词拉群任务Service
*/ */
public interface IWeCommunityKeywordToGroupService { public interface IWeCommunityKeywordToGroupService extends IService<WeKeywordGroupTask> {
/** /**
* 根据过滤条件获取关键词拉群任务列表 * 根据过滤条件获取关键词拉群任务列表
* * @param task 查询信息
* @param taskName 任务名称 * @return 结果
* @param createBy 创建人
* @param keyword 关键词
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 列表数据
*/ */
List<WeKeywordGroupTaskVo> getTaskList(String taskName, String createBy, String keyword, String beginTime, String endTime); List<WeKeywordGroupTask> getTaskList(WeKeywordGroupTask task);
/** /**
* 根据id获取任务性情 * 根据id获取任务性情
...@@ -28,23 +23,22 @@ public interface IWeCommunityKeywordToGroupService { ...@@ -28,23 +23,22 @@ public interface IWeCommunityKeywordToGroupService {
* @param taskId 任务id * @param taskId 任务id
* @return 结果 * @return 结果
*/ */
WeKeywordGroupTaskVo getTaskById(Long taskId); WeKeywordGroupTask getTaskById(Long taskId);
/** /**
* 创建新任务 * 创建新任务
* *
* @param taskDto 任务信息 * @param task 任务信息
* @return 结果 * @return 结果
*/ */
int addTask(WeKeywordGroupTaskDto taskDto); int addTask(WeKeywordGroupTask task);
/** /**
* 对指定任务进行更新 * 对指定任务进行更新
* @param taskId 待更新任务的id * @param task 任务信息
* @param taskDto 任务信息
* @return 结果 * @return 结果
*/ */
int updateTask(Long taskId, WeKeywordGroupTaskDto taskDto); int updateTask(WeKeywordGroupTask task);
/** /**
* 根据id列表批量删除任务 * 根据id列表批量删除任务
...@@ -57,11 +51,10 @@ public interface IWeCommunityKeywordToGroupService { ...@@ -57,11 +51,10 @@ public interface IWeCommunityKeywordToGroupService {
/** /**
* 检测任务名是否唯一 * 检测任务名是否唯一
* *
* @param taskName 任务名 * @param task 任务信息
* @return 结果 * @return 结果
*/ */
boolean taskNameIsUnique(String taskName); boolean isNameOccupied(WeKeywordGroupTask task);
/** /**
* 通过名称或者关键词进行过滤 * 通过名称或者关键词进行过滤
...@@ -69,5 +62,5 @@ public interface IWeCommunityKeywordToGroupService { ...@@ -69,5 +62,5 @@ public interface IWeCommunityKeywordToGroupService {
* @param word 过滤字段 * @param word 过滤字段
* @return 结果 * @return 结果
*/ */
List<WeKeywordGroupTaskVo> filterByNameOrKeyword(String word); List<WeKeywordGroupTask> filterByNameOrKeyword(String word);
} }
...@@ -27,9 +27,10 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou ...@@ -27,9 +27,10 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/** /**
* 查询新客自动拉群列表 * 查询新客自动拉群列表
* *
* @param weCommunityNewGroup 新科拉群过滤条件
* @return {@link WeCommunityNewGroupVo}s * @return {@link WeCommunityNewGroupVo}s
*/ */
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(String emplCodeName, String createBy, String beginTime, String endTime); List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup weCommunityNewGroup);
/** /**
* 获取新客自动拉群详细信息 * 获取新客自动拉群详细信息
......
...@@ -22,14 +22,14 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode> ...@@ -22,14 +22,14 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode>
* @param id 员工活码ID * @param id 员工活码ID
* @return 员工活码 * @return 员工活码
*/ */
public WeEmpleCode selectWeEmpleCodeById(Long id); WeEmpleCode selectWeEmpleCodeById(Long id);
/** /**
* 批量查询员工活码 * 批量查询员工活码
* @param ids 员工活码ID * @param ids 员工活码ID
* @return * @return
*/ */
public List<WeEmpleCode> selectWeEmpleCodeByIds(List<String> ids); List<WeEmpleCode> selectWeEmpleCodeByIds(List<String> ids);
/** /**
* 查询员工活码列表 * 查询员工活码列表
...@@ -37,7 +37,7 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode> ...@@ -37,7 +37,7 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 员工活码集合 * @return 员工活码集合
*/ */
public List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode); List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode);
/** /**
* 新增员工活码 * 新增员工活码
...@@ -45,7 +45,7 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode> ...@@ -45,7 +45,7 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public void insertWeEmpleCode(WeEmpleCode weEmpleCode); void insertWeEmpleCode(WeEmpleCode weEmpleCode);
/** /**
* 修改员工活码 * 修改员工活码
...@@ -53,7 +53,7 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode> ...@@ -53,7 +53,7 @@ public interface IWeEmpleCodeService extends IService<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public void updateWeEmpleCode(WeEmpleCode weEmpleCode); void updateWeEmpleCode(WeEmpleCode weEmpleCode);
// /** // /**
// * 批量删除员工活码 // * 批量删除员工活码
......
...@@ -14,13 +14,6 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -14,13 +14,6 @@ import org.springframework.web.multipart.MultipartFile;
* @date 2020-10-07 * @date 2020-10-07
*/ */
public interface IWeGroupCodeService extends IService<WeGroupCode> { public interface IWeGroupCodeService extends IService<WeGroupCode> {
/**
* 查询客户群活码
*
* @param id 客户群活码ID
* @return 客户群活码
*/
WeGroupCode selectWeGroupCodeById(Long id);
/** /**
* 根据群活码id查询实际码列表 * 根据群活码id查询实际码列表
...@@ -28,7 +21,7 @@ public interface IWeGroupCodeService extends IService<WeGroupCode> { ...@@ -28,7 +21,7 @@ public interface IWeGroupCodeService extends IService<WeGroupCode> {
* @param groupCodeId 群活码id * @param groupCodeId 群活码id
* @return 结果 * @return 结果
*/ */
List<WeGroupCodeActual> selectActualListByGroupCodeId(Long groupCodeId); List<WeGroupCodeActual> selectActualList(Long groupCodeId);
/** /**
* 查询客户群活码列表 * 查询客户群活码列表
...@@ -39,18 +32,9 @@ public interface IWeGroupCodeService extends IService<WeGroupCode> { ...@@ -39,18 +32,9 @@ public interface IWeGroupCodeService extends IService<WeGroupCode> {
List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode); List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode);
/** /**
* 根据群活码id查询群活码列表
*
* @param ids id列表
* @return 结果
*/
List<WeGroupCode> selectWeGroupCodeListByIds(List<String> ids);
/**
* 新增客户群活码 * 新增客户群活码
* *
* @param weGroupCode 客户群活码 * @param weGroupCode 客户群活码
* @return 结果
*/ */
void insertWeGroupCode(WeGroupCode weGroupCode); void insertWeGroupCode(WeGroupCode weGroupCode);
...@@ -79,23 +63,16 @@ public interface IWeGroupCodeService extends IService<WeGroupCode> { ...@@ -79,23 +63,16 @@ public interface IWeGroupCodeService extends IService<WeGroupCode> {
int deleteWeGroupCodeById(Long id); int deleteWeGroupCodeById(Long id);
/** /**
* 检测活码名称是否唯一 * 检测活码名称是否被占用
* *
* @param weGroupCode 活码对象 * @param weGroupCode 活码对象
* @return 结果 * @return 结果
*/ */
boolean checkActivityNameUnique(WeGroupCode weGroupCode); boolean isNameOccupied(WeGroupCode weGroupCode);
/**
* 根据 uuid获取群活码
*
* @param uuid uuid
* @return 结果
*/
WeGroupCode getWeGroupByUuid(String uuid);
/** /**
* 通过员工活码获取群活码,用于新客自动拉群。 * 通过员工活码获取群活码,用于新客自动拉群。
*
* @param state 员工活码state * @param state 员工活码state
* @return 群活码URL * @return 群活码URL
*/ */
......
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.linkwechat.wecom.domain.WeGroup; import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeGroupSop; import com.linkwechat.wecom.domain.WeGroupSop;
import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo; import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo;
import com.linkwechat.wecom.domain.vo.WeGroupSopVo; import com.linkwechat.wecom.domain.vo.WeGroupSopVo;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo;
import java.util.List; import java.util.List;
/** /**
* 社区运营 群sop service接口 * 社区运营 群sop service接口
*/ */
public interface IWeGroupSopService { public interface IWeGroupSopService extends IService<WeGroupSop> {
/** /**
* 通过规则id获取sop规则 * 通过规则id获取sop规则
...@@ -65,15 +64,8 @@ public interface IWeGroupSopService { ...@@ -65,15 +64,8 @@ public interface IWeGroupSopService {
int batchRemoveGroupSopByIds(Long[] ids); int batchRemoveGroupSopByIds(Long[] ids);
/** /**
* 校验规则名是否唯一
*
* @param ruleName 规则名
* @return 是否唯一
*/
boolean isRuleNameUnique(String ruleName);
/**
* 根据员工id获取对应的sop任务列表 * 根据员工id获取对应的sop任务列表
*
* @param emplId 员工id * @param emplId 员工id
* @param isDone 已完成还是待处理 * @param isDone 已完成还是待处理
* @return 结果 * @return 结果
...@@ -99,7 +91,16 @@ public interface IWeGroupSopService { ...@@ -99,7 +91,16 @@ public interface IWeGroupSopService {
/** /**
* 向指定的群聊进行sop企微消息推送 * 向指定的群聊进行sop企微消息推送
*
* @param groupIdList 群聊id列表 * @param groupIdList 群聊id列表
*/ */
void sendMessage(List<String> groupIdList); void sendMessage(List<String> groupIdList);
/**
* 规则名是否已被占用
*
* @param groupSop 规则信息
* @return 是否被占用
*/
boolean isNameOccupied(WeGroupSop groupSop);
} }
...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.dto.WePresTagGroupTaskDto; ...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.dto.WePresTagGroupTaskDto;
import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo; import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo; import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskStatVo; import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskStatVo;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -16,6 +17,7 @@ public interface IWePresTagGroupTaskService { ...@@ -16,6 +17,7 @@ public interface IWePresTagGroupTaskService {
/** /**
* 添加新标签建群任务 * 添加新标签建群任务
*
* @param task 建群任务本体信息 * @param task 建群任务本体信息
* @param tagIdList 标签列表 * @param tagIdList 标签列表
* @param emplIdList 员工列表 * @param emplIdList 员工列表
...@@ -53,6 +55,7 @@ public interface IWePresTagGroupTaskService { ...@@ -53,6 +55,7 @@ public interface IWePresTagGroupTaskService {
/** /**
* 更新老客户标签建群任务 * 更新老客户标签建群任务
*
* @param taskId 待更新任务id * @param taskId 待更新任务id
* @param wePresTagGroupTaskDto 更新数据 * @param wePresTagGroupTaskDto 更新数据
* @return 更新条数 * @return 更新条数
...@@ -60,14 +63,6 @@ public interface IWePresTagGroupTaskService { ...@@ -60,14 +63,6 @@ public interface IWePresTagGroupTaskService {
int updateTask(Long taskId, WePresTagGroupTaskDto wePresTagGroupTaskDto); int updateTask(Long taskId, WePresTagGroupTaskDto wePresTagGroupTaskDto);
/** /**
* 检测任务名是否已存在
*
* @param taskName 任务名
* @return 结果
*/
boolean checkTaskNameUnique(String taskName);
/**
* 通过老客标签建群id获取其统计信息 * 通过老客标签建群id获取其统计信息
* *
* @param taskId 任务id * @param taskId 任务id
...@@ -112,7 +107,25 @@ public interface IWePresTagGroupTaskService { ...@@ -112,7 +107,25 @@ public interface IWePresTagGroupTaskService {
/** /**
* 根据标签建群任务信息发送消息 * 根据标签建群任务信息发送消息
*
* @param task 标签建群任务 * @param task 标签建群任务
*/ */
void sendMessage(WePresTagGroupTask task); void sendMessage(WePresTagGroupTask task, List<String> externalIds);
/**
* 任务名是否已占用
*
* @param task 任务信息
* @return 名称是否占用
*/
boolean isNameOccupied(WePresTagGroupTask task);
List<String> selectExternalUserIds(
Long taskId,
boolean hasScope,
boolean hasTag,
Integer gender,
String beginTime,
String endTime
);
} }
...@@ -69,8 +69,8 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -69,8 +69,8 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
public int add(WeCommunityNewGroupDto communityNewGroupDto) { public int add(WeCommunityNewGroupDto communityNewGroupDto) {
//检查群活码是否存在 //检查群活码是否存在
WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId()); WeGroupCode weGroupCode = weGroupCodeMapper.selectById(communityNewGroupDto.getGroupCodeId());
if (null == weGroupCode) { if (!Optional.ofNullable(weGroupCode).isPresent()) {
throw new WeComException("群活码不存在!"); throw new WeComException("群活码不存在!");
} }
...@@ -85,8 +85,11 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -85,8 +85,11 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
// 保存员工活码信息 // 保存员工活码信息
if (weEmpleCodeMapper.insertWeEmpleCode(weEmpleCode) > 0) { if (weEmpleCodeMapper.insertWeEmpleCode(weEmpleCode) > 0) {
if (StringUtils.isNotEmpty(weEmpleCode.getWeEmpleCodeTags())) {
// 批量保存员工活码标签 // 批量保存员工活码标签
empleCodeTagMapper.batchInsetWeEmpleCodeTag(weEmpleCode.getWeEmpleCodeTags()); empleCodeTagMapper.batchInsetWeEmpleCodeTag(weEmpleCode.getWeEmpleCodeTags());
}
// 批量保存活码使用员工 // 批量保存活码使用员工
empleCodeUseScopMapper.batchInsetWeEmpleCodeUseScop(weEmpleCode.getWeEmpleCodeUseScops()); empleCodeUseScopMapper.batchInsetWeEmpleCodeUseScop(weEmpleCode.getWeEmpleCodeUseScops());
...@@ -108,15 +111,12 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -108,15 +111,12 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
/** /**
* 查询新客自动拉群列表 * 查询新客自动拉群列表
* *
* @param emplCodeName 员工活码名称 * @param weCommunityNewGroup 新科拉群过滤条件
* @param createBy 创建者
* @param beginTime 开始时间
* @param endTime 结束时间
* @return {@link WeCommunityNewGroupVo}s * @return {@link WeCommunityNewGroupVo}s
*/ */
@Override @Override
public List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(String emplCodeName, String createBy, String beginTime, String endTime) { public List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup weCommunityNewGroup) {
List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupMapper.selectWeCommunityNewGroupList(emplCodeName, createBy, beginTime, endTime); List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupMapper.selectWeCommunityNewGroupList(weCommunityNewGroup);
if (StringUtils.isNotEmpty(communityNewGroupVos)) { if (StringUtils.isNotEmpty(communityNewGroupVos)) {
communityNewGroupVos.forEach(this::getCompleteEmplCodeInfo); communityNewGroupVos.forEach(this::getCompleteEmplCodeInfo);
} }
...@@ -152,7 +152,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -152,7 +152,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
throw new WeComException("新客拉群信息不存在!"); throw new WeComException("新客拉群信息不存在!");
} }
// 检查群活码是否存在 // 检查群活码是否存在
WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId()); WeGroupCode weGroupCode = weGroupCodeMapper.selectById(communityNewGroupDto.getGroupCodeId());
if (null == weGroupCode) { if (null == weGroupCode) {
throw new WeComException("群活码不存在!"); throw new WeComException("群活码不存在!");
} }
...@@ -219,7 +219,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -219,7 +219,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
weEmpleCode.setSkipVerify(communityNewGroupDto.getSkipVerify()); weEmpleCode.setSkipVerify(communityNewGroupDto.getSkipVerify());
// 欢迎语 // 欢迎语
weEmpleCode.setWelcomeMsg(communityNewGroupDto.getWelcomeMsg()); weEmpleCode.setWelcomeMsg(communityNewGroupDto.getWelcomeMsg());
// state,用于区分客户具体是通过哪个「联系我」添加,最大30个字符。使用id作为值即可,使用uuid则会超长。 // state,用于区分客户具体是通过哪个「联系我」添加,最大30个字符。使用id作为值即可。
weEmpleCode.setState(weEmpleCode.getId().toString()); weEmpleCode.setState(weEmpleCode.getId().toString());
// 活动场景,使用键入的活码名称 // 活动场景,使用键入的活码名称
...@@ -233,6 +233,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -233,6 +233,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
/** /**
* 设置员工活码的标签列表和员工列表 * 设置员工活码的标签列表和员工列表
*
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @param communityNewGroupDto 新客拉群信息 * @param communityNewGroupDto 新客拉群信息
*/ */
...@@ -253,6 +254,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -253,6 +254,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
// 获取活码标签 // 获取活码标签
List<String> tagIdList = communityNewGroupDto.getTagList(); List<String> tagIdList = communityNewGroupDto.getTagList();
if (StringUtils.isNotEmpty(tagIdList)) {
LambdaQueryWrapper<WeTag> tagQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WeTag> tagQueryWrapper = new LambdaQueryWrapper<>();
tagQueryWrapper.in(WeTag::getTagId, tagIdList); tagQueryWrapper.in(WeTag::getTagId, tagIdList);
List<WeTag> weTagList = weTagMapper.selectList(tagQueryWrapper); List<WeTag> weTagList = weTagMapper.selectList(tagQueryWrapper);
...@@ -265,6 +267,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -265,6 +267,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
}).collect(Collectors.toList()); }).collect(Collectors.toList());
weEmpleCode.setWeEmpleCodeTags(weEmpleCodeTagList); weEmpleCode.setWeEmpleCodeTags(weEmpleCodeTagList);
} }
}
/** /**
* 获取完整的新客自动拉群相关信息 * 获取完整的新客自动拉群相关信息
...@@ -282,13 +285,12 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -282,13 +285,12 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
}); });
// 设置群活码信息 // 设置群活码信息
WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(vo.getGroupCodeId()); WeGroupCode weGroupCode = weGroupCodeMapper.selectById(vo.getGroupCodeId());
Optional.ofNullable(weGroupCode).ifPresent(e -> { Optional.ofNullable(weGroupCode).ifPresent(e -> {
WeGroupCodeVo groupCodeVo = WeGroupCodeVo WeGroupCodeVo groupCodeVo = WeGroupCodeVo
.builder() .builder()
.id(e.getId()) .id(e.getId())
.codeUrl(e.getCodeUrl()) .codeUrl(e.getCodeUrl())
.uuid(e.getUuid())
.build(); .build();
BeanUtils.copyProperties(e, groupCodeVo); BeanUtils.copyProperties(e, groupCodeVo);
vo.setGroupCodeInfo(groupCodeVo); vo.setGroupCodeInfo(groupCodeVo);
......
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.io.IOException;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.QREncode;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.WeGroupCodeActual; import com.linkwechat.wecom.domain.WeGroupCodeActual;
import com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper; import com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper;
import com.linkwechat.wecom.mapper.WeGroupCodeActualMapper; import com.linkwechat.wecom.mapper.WeGroupCodeActualMapper;
import com.linkwechat.wecom.service.IWeGroupCodeActualService; import com.linkwechat.wecom.service.IWeGroupCodeActualService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeGroupCodeMapper; import com.linkwechat.wecom.mapper.WeGroupCodeMapper;
import com.linkwechat.wecom.domain.WeGroupCode; import com.linkwechat.wecom.domain.WeGroupCode;
import com.linkwechat.wecom.service.IWeGroupCodeService; import com.linkwechat.wecom.service.IWeGroupCodeService;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
...@@ -23,33 +32,18 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -23,33 +32,18 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2020-10-07 * @date 2020-10-07
*/ */
@Service @Service
public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGroupCode> implements IWeGroupCodeService public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper, WeGroupCode> implements IWeGroupCodeService {
{
@Autowired private final IWeGroupCodeActualService iWeGroupCodeActualService;
private IWeGroupCodeActualService iWeGroupCodeActualService;
@Autowired private final WeGroupCodeActualMapper actualCodeMapper;
private WeGroupCodeMapper weGroupCodeMapper;
@Autowired private final WeCommunityNewGroupMapper communityNewGroupMapper;
private WeGroupCodeActualMapper weGroupCodeActualMapper;
@Autowired public WeGroupCodeServiceImpl(IWeGroupCodeActualService iWeGroupCodeActualService, WeGroupCodeActualMapper actualCodeMapper, WeCommunityNewGroupMapper communityNewGroupMapper) {
private WeCommunityNewGroupMapper communityNewGroupMapper; this.iWeGroupCodeActualService = iWeGroupCodeActualService;
this.actualCodeMapper = actualCodeMapper;
/** this.communityNewGroupMapper = communityNewGroupMapper;
* 查询客户群活码
*
* @param id 客户群活码ID
* @return 客户群活码
*/
@Override
public WeGroupCode selectWeGroupCodeById(Long id)
{
// 获取群活码
return weGroupCodeMapper.selectWeGroupCodeById(id);
} }
/** /**
...@@ -59,8 +53,8 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou ...@@ -59,8 +53,8 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou
* @return 结果 * @return 结果
*/ */
@Override @Override
public List<WeGroupCodeActual> selectActualListByGroupCodeId(Long groupCodeId) { public List<WeGroupCodeActual> selectActualList(Long groupCodeId) {
return weGroupCodeActualMapper.selectActualListByGroupCodeId(groupCodeId); return actualCodeMapper.selectActualList(groupCodeId);
} }
/** /**
...@@ -70,37 +64,24 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou ...@@ -70,37 +64,24 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou
* @return 客户群活码 * @return 客户群活码
*/ */
@Override @Override
public List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode) public List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode) {
{ List<WeGroupCode> weGroupCodeList = baseMapper.selectWeGroupCodeList(weGroupCode);
List<WeGroupCode> weGroupCodeList = weGroupCodeMapper.selectWeGroupCodeList(weGroupCode); for (WeGroupCode item : weGroupCodeList) {
for (WeGroupCode item: weGroupCodeList) { List<WeGroupCodeActual> actualList = actualCodeMapper.selectActualList(item.getId());
List<WeGroupCodeActual> actualList = weGroupCodeActualMapper.selectActualListByGroupCodeId(item.getId());
item.setActualList(actualList); item.setActualList(actualList);
} }
return weGroupCodeList; return weGroupCodeList;
} }
/** /**
* 根据群活码id查询群活码列表
*
* @param ids id列表
* @return 结果
*/
@Override
public List<WeGroupCode> selectWeGroupCodeListByIds(List<String> ids) {
return weGroupCodeMapper.selectWeGroupCodeListByIds(ids);
}
/**
* 新增客户群活码 * 新增客户群活码
* *
* @param weGroupCode 客户群活码 * @param weGroupCode 客户群活码
*/ */
@Override @Override
public void insertWeGroupCode(WeGroupCode weGroupCode) public void insertWeGroupCode(WeGroupCode weGroupCode) {
{
try { try {
weGroupCodeMapper.insertWeGroupCode(weGroupCode); baseMapper.insertWeGroupCode(weGroupCode);
} catch (Exception e) { } catch (Exception e) {
throw new WeComException(e.getMessage()); throw new WeComException(e.getMessage());
} }
...@@ -114,17 +95,14 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou ...@@ -114,17 +95,14 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateWeGroupCode(WeGroupCode weGroupCode) @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
{ public int updateWeGroupCode(WeGroupCode weGroupCode) {
int rows = weGroupCodeMapper.updateWeGroupCode(weGroupCode); // 更新实际码
// 同时更新对应的实际码
if (rows > 0) {
List<WeGroupCodeActual> actualList = weGroupCode.getActualList(); List<WeGroupCodeActual> actualList = weGroupCode.getActualList();
if(CollectionUtil.isNotEmpty(actualList)){ if (CollectionUtil.isNotEmpty(actualList)) {
iWeGroupCodeActualService.updateBatchById(actualList); iWeGroupCodeActualService.updateBatchById(actualList);
} }
} return baseMapper.updateById(weGroupCode);
return rows;
} }
/** /**
...@@ -134,10 +112,13 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou ...@@ -134,10 +112,13 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteWeGroupCodeByIds(Long[] ids) @Transactional(rollbackFor = Exception.class)
{ public int deleteWeGroupCodeByIds(Long[] ids) {
weGroupCodeActualMapper.deleteActualListByGroupCodeIds(ids); // 删除新客拉群信息,防止出现新科拉群没有群活码可用
return weGroupCodeMapper.deleteWeGroupCodeByIds(ids); LambdaUpdateWrapper<WeGroupCodeActual> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(WeGroupCodeActual::getGroupCodeId, Arrays.asList(ids)).set(WeGroupCodeActual::getDelFlag, 1);
actualCodeMapper.update(null, updateWrapper);
return removeByIds(Arrays.asList(ids)) ? 1 : 0;
} }
/** /**
...@@ -147,44 +128,39 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou ...@@ -147,44 +128,39 @@ public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGrou
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int deleteWeGroupCodeById(Long id) public int deleteWeGroupCodeById(Long id) {
{
// 需要删除新客拉群信息 // 需要删除新客拉群信息
communityNewGroupMapper.removeWeCommunityNewGroupByGroupCodeId(id); LambdaUpdateWrapper<WeCommunityNewGroup> updateWrapper = new LambdaUpdateWrapper<>();
return weGroupCodeMapper.deleteWeGroupCodeById(id); updateWrapper.eq(WeCommunityNewGroup::getGroupCodeId, id).set(WeCommunityNewGroup::getDelFlag, 1);
communityNewGroupMapper.update(null, updateWrapper);
// 删除群活码
return baseMapper.deleteById(id);
} }
/** /**
* 检测活码名称是否唯一 * 检测活码名称是否被占用
* *
* @param weGroupCode 活码对象 * @param weGroupCode 活码对象
* @return 结果 * @return 结果
*/ */
@Override @Override
public boolean checkActivityNameUnique(WeGroupCode weGroupCode) { public boolean isNameOccupied(WeGroupCode weGroupCode) {
int rows = weGroupCodeMapper.checkActivityNameUnique(weGroupCode.getActivityName()); Long currentId = Optional.ofNullable(weGroupCode.getId()).orElse(-1L);
return rows == 0; LambdaQueryWrapper<WeGroupCode> queryWrapper = new LambdaQueryWrapper<>();
} queryWrapper.eq(WeGroupCode::getActivityName, weGroupCode.getActivityName()).eq(WeGroupCode::getDelFlag, 0);
List<WeGroupCode> res = baseMapper.selectList(queryWrapper);
/** return !res.isEmpty() && !currentId.equals(res.get(0).getId());
* 根据 uuid获取群活码
*
* @param uuid uuid
* @return 结果
*/
@Override
public WeGroupCode getWeGroupByUuid(String uuid) {
return weGroupCodeMapper.getWeGroupByUuid(uuid);
} }
/** /**
* 通过员工活码获取群活码,用于新客自动拉群。 * 通过员工活码获取群活码,用于新客自动拉群。
*
* @param state 员工活码state * @param state 员工活码state
* @return 群活码URL * @return 群活码URL
*/ */
@Override @Override
public String selectGroupCodeUrlByEmplCodeState(String state) { public String selectGroupCodeUrlByEmplCodeState(String state) {
return weGroupCodeMapper.selectGroupCodeUrlByEmplCodeState(state); return baseMapper.selectGroupCodeUrlByEmplCodeState(state);
} }
} }
...@@ -9,6 +9,7 @@ import com.linkwechat.common.utils.StringUtils; ...@@ -9,6 +9,7 @@ import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeMessagePushClient; import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.dto.WeMessagePushDto; import com.linkwechat.wecom.domain.dto.WeMessagePushDto;
import com.linkwechat.wecom.domain.dto.WeMessagePushResultDto;
import com.linkwechat.wecom.domain.dto.message.TextMessageDto; import com.linkwechat.wecom.domain.dto.message.TextMessageDto;
import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo; import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo;
import com.linkwechat.wecom.domain.vo.WeGroupSopVo; import com.linkwechat.wecom.domain.vo.WeGroupSopVo;
...@@ -21,12 +22,14 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,12 +22,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -104,7 +107,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -104,7 +107,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int addGroupSop(WeGroupSop weGroupSop, List<String> groupIdList, List<Long> materialIdList, List<String> picUrlList) { 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();
...@@ -130,7 +133,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -130,7 +133,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int updateGroupSop(WeGroupSop weGroupSop, List<String> groupIdList, List<Long> materialIdList, List<String> picUrlList) { 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();
...@@ -159,7 +162,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -159,7 +162,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int batchRemoveGroupSopByIds(Long[] ids) { public int batchRemoveGroupSopByIds(Long[] ids) {
int affectedRows = groupSopMapper.deleteBatchIds(Arrays.asList(ids)); int affectedRows = groupSopMapper.deleteBatchIds(Arrays.asList(ids));
if (affectedRows > 0) { if (affectedRows > 0) {
...@@ -181,17 +184,6 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -181,17 +184,6 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
} }
/** /**
* 校验规则名是否唯一
*
* @param ruleName 规则名
* @return 是否唯一
*/
@Override
public boolean isRuleNameUnique(String ruleName) {
return groupSopMapper.isRuleNameUnique(ruleName) == 0;
}
/**
* 根据关联条件查询该sop所关联的群聊及素材对象,并将其放入WeGroupSopVo相应属性中用于前端使用 * 根据关联条件查询该sop所关联的群聊及素材对象,并将其放入WeGroupSopVo相应属性中用于前端使用
* *
* @param groupSopVo 目标sop规则 * @param groupSopVo 目标sop规则
...@@ -320,10 +312,25 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -320,10 +312,25 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
} }
/** /**
* 规则名是否已被占用
*
* @param groupSop 规则信息
* @return 是否被占用
*/
@Override
public boolean isNameOccupied(WeGroupSop groupSop) {
Long currentId = Optional.ofNullable(groupSop.getRuleId()).orElse(-1L);
LambdaQueryWrapper<WeGroupSop> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WeGroupSop::getRuleName, groupSop.getRuleName()).eq(WeGroupSop::getDelFlag, 0);
List<WeGroupSop> queryRes = baseMapper.selectList(queryWrapper);
return !queryRes.isEmpty() && !currentId.equals(queryRes.get(0).getRuleId());
}
/**
* 消息推送(企微API 消息推送 - 发送应用消息) * 消息推送(企微API 消息推送 - 发送应用消息)
*/ */
@Override @Override
@Async // @Async
public void sendMessage(List<String> groupIdList) { public void sendMessage(List<String> groupIdList) {
// 构造请求参数 // 构造请求参数
......
...@@ -5,11 +5,14 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,11 +5,14 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.WeConstans;
import com.linkwechat.common.core.domain.entity.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.ChatType; import com.linkwechat.common.enums.ChatType;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.enums.TaskSendType; import com.linkwechat.common.enums.TaskSendType;
import com.linkwechat.common.enums.CommunityTaskType; import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
...@@ -31,12 +34,14 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -31,12 +34,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -79,6 +84,9 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -79,6 +84,9 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
@Value("${wecome.authorizeRedirectUrl}") @Value("${wecome.authorizeRedirectUrl}")
private String authorizeRedirectUrl; private String authorizeRedirectUrl;
@Autowired
private IWeCustomerMessagePushService weCustomerMessagePushService;
/** /**
* 添加新标签建群任务 * 添加新标签建群任务
* @param task 建群任务本体信息 * @param task 建群任务本体信息
...@@ -87,7 +95,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -87,7 +95,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int add(WePresTagGroupTask task, List<String> tagIdList, List<String> emplIdList) { public int add(WePresTagGroupTask task, List<String> tagIdList, List<String> emplIdList) {
if (taskMapper.insertTask(task) > 0) { if (taskMapper.insertTask(task) > 0) {
// 保存标签对象 // 保存标签对象
...@@ -154,7 +162,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -154,7 +162,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
* @return 删除的行数 * @return 删除的行数
*/ */
@Override @Override
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int batchRemoveTaskByIds(Long[] idList) { public int batchRemoveTaskByIds(Long[] idList) {
List<Long> ids = Arrays.asList(idList); List<Long> ids = Arrays.asList(idList);
...@@ -184,11 +192,16 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -184,11 +192,16 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
* @return 更新条数 * @return 更新条数
*/ */
@Override @Override
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int updateTask(Long taskId, WePresTagGroupTaskDto wePresTagGroupTaskDto) { public int updateTask(Long taskId, WePresTagGroupTaskDto wePresTagGroupTaskDto) {
WePresTagGroupTask wePresTagGroupTask = new WePresTagGroupTask(); WePresTagGroupTask wePresTagGroupTask = new WePresTagGroupTask();
BeanUtils.copyProperties(wePresTagGroupTaskDto, wePresTagGroupTask); BeanUtils.copyProperties(wePresTagGroupTaskDto, wePresTagGroupTask);
wePresTagGroupTask.setTaskId(taskId); wePresTagGroupTask.setTaskId(taskId);
if (isNameOccupied(wePresTagGroupTask)) {
throw new CustomException("任务名已存在");
}
wePresTagGroupTask.setUpdateBy(SecurityUtils.getUsername()); wePresTagGroupTask.setUpdateBy(SecurityUtils.getUsername());
if (taskMapper.updateTask(wePresTagGroupTask) > 0) { if (taskMapper.updateTask(wePresTagGroupTask) > 0) {
...@@ -223,18 +236,6 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -223,18 +236,6 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
} }
/** /**
* 检测任务名是否已存在
*
* @param taskName 任务名
* @return 结果
*/
@Override
public boolean checkTaskNameUnique(String taskName) {
int count = taskMapper.checkTaskNameUnique(taskName);
return count <= 0;
}
/**
* 通过老客标签建群id获取其统计信息 * 通过老客标签建群id获取其统计信息
* *
* @param taskId 任务id * @param taskId 任务id
...@@ -317,11 +318,27 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -317,11 +318,27 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
public int updateEmplTaskStatus(Long taskId, String emplId) { public int updateEmplTaskStatus(Long taskId, String emplId) {
return taskScopeMapper.updateEmplTaskStatus(taskId, emplId); return taskScopeMapper.updateEmplTaskStatus(taskId, emplId);
} }
/** /**
* 任务名是否已占用
*
* @param task 任务信息
* @return 名称是否占用
*/
@Override
public boolean isNameOccupied(WePresTagGroupTask task) {
Long currentId = Optional.ofNullable(task.getTaskId()).orElse(-1L);
LambdaQueryWrapper<WePresTagGroupTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WePresTagGroupTask::getDelFlag, 0).eq(WePresTagGroupTask::getTaskName, task.getTaskName());
List<WePresTagGroupTask> queryRes = baseMapper.selectList(queryWrapper);
return !queryRes.isEmpty() && !currentId.equals(queryRes.get(0).getTaskId());
}
/**
* 任务群活码、员工和标签 * 任务群活码、员工和标签
* *
* @param taskVo 任务vo * @param taskVo 任务vo
...@@ -335,6 +352,11 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -335,6 +352,11 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
taskVo.setTagList(this.getTagListByTaskId(taskVo.getTaskId())); taskVo.setTagList(this.getTagListByTaskId(taskVo.getTaskId()));
} }
@Override
public List<String> selectExternalUserIds(Long taskId, boolean hasScope, boolean hasTag, Integer gender, String beginTime, String endTime) {
return baseMapper.selectExternalUserIds(taskId, hasScope, hasTag, gender, beginTime, endTime);
}
/** /**
* 任务派发 * 任务派发
* *
...@@ -342,14 +364,13 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -342,14 +364,13 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
*/ */
@Override @Override
@Async @Async
public void sendMessage(WePresTagGroupTask task) { public void sendMessage(WePresTagGroupTask task, List<String> externalIds) {
try { try {
Integer sendType = task.getSendType(); Integer sendType = task.getSendType();
if (sendType.equals(TaskSendType.CROP.getType())) { if (sendType.equals(TaskSendType.CROP.getType())) {
// 企业群发 // 企业群发
this.sendCorpMessage(task); this.sendCorpMessage(task, externalIds);
} else { } else {
// 个人群发 // 个人群发
...@@ -366,16 +387,19 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -366,16 +387,19 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
* *
* @param task 建群任务信息 * @param task 建群任务信息
*/ */
private void sendCorpMessage(WePresTagGroupTask task) { private void sendCorpMessage(WePresTagGroupTask task, List<String> externalIds) {
try { try {
// 构建企微api参数 [客户联系 - 消息推送 - 创建企业群发] // 构建企微api参数 [客户联系 - 消息推送 - 创建企业群发]
// 群发任务的类型、外部联系人id列表
List<String> externalIdList = taskTagMapper.getExternalUserIdListByTaskId(task.getTaskId()); if (externalIds.isEmpty()) {
throw new CustomException("查不到客户!");
}
WeCustomerMessagePushDto queryData = new WeCustomerMessagePushDto(); WeCustomerMessagePushDto queryData = new WeCustomerMessagePushDto();
queryData.setChat_type(ChatType.SINGLE.getName()); queryData.setChat_type(ChatType.SINGLE.getName());
queryData.setExternal_userid(externalIdList); queryData.setExternal_userid(externalIds);
// 引导语 // 引导语
TextMessageDto text = new TextMessageDto(); TextMessageDto text = new TextMessageDto();
...@@ -384,7 +408,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -384,7 +408,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
// 群活码图片(上传临时文件获取media_id) // 群活码图片(上传临时文件获取media_id)
ImageMessageDto image = new ImageMessageDto(); ImageMessageDto image = new ImageMessageDto();
WeGroupCode groupCode = groupCodeMapper.selectWeGroupCodeById(task.getGroupCodeId()); WeGroupCode groupCode = groupCodeMapper.selectById(task.getGroupCodeId());
WeMediaDto mediaDto = materialService.uploadTemporaryMaterial(groupCode.getCodeUrl(), MediaType.IMAGE.getMediaType(), "临时文件"); WeMediaDto mediaDto = materialService.uploadTemporaryMaterial(groupCode.getCodeUrl(), MediaType.IMAGE.getMediaType(), "临时文件");
image.setMedia_id(mediaDto.getMedia_id()); image.setMedia_id(mediaDto.getMedia_id());
//queryData.setImage(image); //queryData.setImage(image);
...@@ -441,6 +465,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -441,6 +465,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
pushDto.setMsgtype("text"); pushDto.setMsgtype("text");
// 请求消息推送接口,获取结果 [消息推送 - 发送应用消息] // 请求消息推送接口,获取结果 [消息推送 - 发送应用消息]
log.debug("发送个人群发信息 ============> ");
messagePushClient.sendMessageToUser(pushDto, agentId); messagePushClient.sendMessageToUser(pushDto, agentId);
} }
} }
...@@ -498,7 +498,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -498,7 +498,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
String groupQrcodeId = weTaskFission.getFissionTargetId(); String groupQrcodeId = weTaskFission.getFissionTargetId();
if (weTaskFission.getFissionType() != null && weTaskFission.getFissionType().equals(TaskFissionType.GROUP_FISSION.getCode()) if (weTaskFission.getFissionType() != null && weTaskFission.getFissionType().equals(TaskFissionType.GROUP_FISSION.getCode())
&& StringUtils.isNotBlank(groupQrcodeId) && StringUtils.isBlank(weTaskFission.getFissQrcode())) { && StringUtils.isNotBlank(groupQrcodeId) && StringUtils.isBlank(weTaskFission.getFissQrcode())) {
WeGroupCode groupCode = weGroupCodeService.selectWeGroupCodeById(Long.parseLong(groupQrcodeId)); WeGroupCode groupCode = weGroupCodeService.getById(Long.parseLong(groupQrcodeId));
if (groupCode != null) { if (groupCode != null) {
String qrcodeUrl = groupCode.getCodeUrl(); String qrcodeUrl = groupCode.getCodeUrl();
weTaskFission.setFissQrcode(qrcodeUrl); weTaskFission.setFissQrcode(qrcodeUrl);
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
AND create_by LIKE CONCAT("%",#{createBy},"%") AND create_by LIKE CONCAT("%",#{createBy},"%")
</if> </if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectWeCommunityNewGroupById" resultMap="communityNewGroupResult"> <select id="selectWeCommunityNewGroupById" resultMap="communityNewGroupResult">
...@@ -79,7 +80,4 @@ ...@@ -79,7 +80,4 @@
UPDATE we_community_new_group SET del_flag = 1 WHERE empl_code_id = #{emplCodeId} UPDATE we_community_new_group SET del_flag = 1 WHERE empl_code_id = #{emplCodeId}
</update> </update>
<update id="removeWeCommunityNewGroupByGroupCodeId" parameterType="Long">
UPDATE we_community_new_group SET del_flag = 1 WHERE group_code_id = #{groupCodeId}
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<result property="mediaId" column="media_id"/> <result property="mediaId" column="media_id"/>
<result property="scanTimes" column="scan_times" /> <result property="scanTimes" column="scan_times" />
<result property="state" column="state" /> <result property="state" column="state" />
<result property="isJoinConfirmFriends" column="is_join_confirm_friends" />
<collection property="weEmpleCodeUseScops" ofType="com.linkwechat.wecom.domain.WeEmpleCodeUseScop"> <collection property="weEmpleCodeUseScops" ofType="com.linkwechat.wecom.domain.WeEmpleCodeUseScop">
<result property="id" column="scopeId"/> <result property="id" column="scopeId"/>
<result property="businessId" column="business_id"/> <result property="businessId" column="business_id"/>
...@@ -74,14 +73,12 @@ ...@@ -74,14 +73,12 @@
wecusn.business_name, wecusn.business_name,
wecusn.mobile, wecusn.mobile,
wect.tag_id, wect.tag_id,
wect.tag_name, wect.tag_name
wecode.is_join_confirm_friends,
wecusn.id as scopeId
from from
we_emple_code wecode we_emple_code wecode
left join ( left join (
SELECT SELECT
wecus.id, wecus.emple_code_id, wecus.business_id, wecus.business_name,wu.mobile wecus.emple_code_id, wecus.business_id, wecus.business_name,wu.mobile
FROM FROM
we_emple_code_use_scop wecus we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON LEFT JOIN we_user wu ON
...@@ -119,7 +116,6 @@ ...@@ -119,7 +116,6 @@
AND wecusn.business_name like concat('%', #{useUserName}, '%') AND wecusn.business_name like concat('%', #{useUserName}, '%')
</if> </if>
group by wecode.id group by wecode.id
order by wecode.create_time desc
</select> </select>
<select id="selectWeEmpleCodeById" parameterType="Long" resultMap="WeEmpleCodeResult"> <select id="selectWeEmpleCodeById" parameterType="Long" resultMap="WeEmpleCodeResult">
...@@ -155,7 +151,6 @@ ...@@ -155,7 +151,6 @@
<if test="mediaId != null">media_id,</if> <if test="mediaId != null">media_id,</if>
<if test="state != null">state,</if> <if test="state != null">state,</if>
<if test="scanTimes != null">scan_times,</if> <if test="scanTimes != null">scan_times,</if>
<if test="isJoinConfirmFriends != null">is_join_confirm_friends,</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>
...@@ -171,7 +166,6 @@ ...@@ -171,7 +166,6 @@
<if test="mediaId != null">#{mediaId},</if> <if test="mediaId != null">#{mediaId},</if>
<if test="state != null">#{state},</if> <if test="state != null">#{state},</if>
<if test="scanTimes != null">#{scanTimes},</if> <if test="scanTimes != null">#{scanTimes},</if>
<if test="isJoinConfirmFriends != null">#{isJoinConfirmFriends},</if>
</trim> </trim>
</insert> </insert>
...@@ -190,7 +184,6 @@ ...@@ -190,7 +184,6 @@
<if test="mediaId != null">media_id = #{mediaId},</if> <if test="mediaId != null">media_id = #{mediaId},</if>
<if test="state != null">state = #{state},</if> <if test="state != null">state = #{state},</if>
<if test="scanTimes != null">scan_times = #{scanTimes},</if> <if test="scanTimes != null">scan_times = #{scanTimes},</if>
<if test="isJoinConfirmFriends != null"> is_join_confirm_friends =#{isJoinConfirmFriends},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -37,11 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,11 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectActualListByGroupCodeId" parameterType="WeGroupCodeActual" resultMap="WeGroupCodeActualResult"> <select id="selectActualList" parameterType="WeGroupCodeActual" resultMap="WeGroupCodeActualResult">
<include refid="selectWeGroupCodeActualVo"/> <include refid="selectWeGroupCodeActualVo"/>
<where> <where>
group_code_id = #{groupCodeId} group_code_id = #{groupCodeId}
</where> </where>
order by create_time
</select> </select>
<select id="selectWeGroupCodeActualByChatId" parameterType="String" resultMap="WeGroupCodeActualResult"> <select id="selectWeGroupCodeActualByChatId" parameterType="String" resultMap="WeGroupCodeActualResult">
......
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
<select id="getGroupSopById" resultMap="WeGroupSopResult"> <select id="getGroupSopById" resultMap="WeGroupSopResult">
<include refid="selectGroupVo" /> <include refid="selectGroupVo" />
WHERE rule_id = #{ruleId} WHERE rule_id = #{ruleId} AND del_flag = 0
</select> </select>
<select id="getGroupSopList" resultMap="WeGroupSopResult"> <select id="getGroupSopList" resultMap="WeGroupSopResult">
<include refid="selectGroupVo" /> <include refid="selectGroupVo" />
<where> <where>
1 = 1 del_flag = 0
<if test="ruleName != null and ruleName!=''"> <if test="ruleName != null and ruleName!=''">
AND rule_name LIKE CONCAT("%",#{ruleName},"%") AND rule_name LIKE CONCAT("%",#{ruleName},"%")
</if> </if>
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
AND create_by LIKE CONCAT("%",#{createBy},"%") AND create_by LIKE CONCAT("%",#{createBy},"%")
</if> </if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="getChatIdListByRuleId" resultType="String"> <select id="getChatIdListByRuleId" resultType="String">
...@@ -78,10 +79,6 @@ ...@@ -78,10 +79,6 @@
WHERE wgs.rule_id = #{ruleId} WHERE wgs.rule_id = #{ruleId}
</select> </select>
<select id="isRuleNameUnique" resultType="int" parameterType="String">
select count(1) from we_group_sop where rule_name = #{ruleName}
</select>
<select id="getEmplTaskList" resultMap="WeGroupSopResult"> <select id="getEmplTaskList" resultMap="WeGroupSopResult">
SELECT SELECT
wgs.rule_id, wgs.rule_id,
......
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeKeywordGroupTaskKwMapper">
<insert id="batchBindsTaskKeyword">
insert into we_keyword_group_kw(task_id, keyword) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.taskId},#{item.keyword})
</foreach>
</insert>
</mapper>
\ No newline at end of file \ No newline at end of file
...@@ -4,15 +4,17 @@ ...@@ -4,15 +4,17 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeKeywordGroupTaskMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeKeywordGroupTaskMapper">
<resultMap id="WeKeywordGroupTaskResult" type="WeKeywordGroupTaskVo"> <resultMap id="WeKeywordGroupTaskResult" type="WeKeywordGroupTask">
<result property="taskId" column="task_id"/> <id property="taskId" column="task_id"/>
<result property="taskName" column="task_name"/> <result property="taskName" column="task_name"/>
<result property="welcomeMsg" column="welcome_msg"/> <result property="welcomeMsg" column="welcome_msg"/>
<result property="groupCodeId" column="group_code_id"/>
<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="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="keywords" column="keywords" />
<result property="groupNameList" column="group_name_list" javaType="java.lang.String"/>
<association property="groupCodeInfo" column="group_code_id" javaType="com.linkwechat.wecom.domain.vo.WeGroupCodeVo" select="selectGroupByTaskId" />
</resultMap> </resultMap>
<sql id="selectTaskVo"> <sql id="selectTaskVo">
...@@ -21,29 +23,56 @@ ...@@ -21,29 +23,56 @@
wkg.task_name, wkg.task_name,
wkg.group_code_id, wkg.group_code_id,
wkg.welcome_msg, wkg.welcome_msg,
wkg.keywords,
GROUP_CONCAT(DISTINCT wg.group_name SEPARATOR ' ') AS group_name_list,
wkg.create_by, wkg.create_by,
wkg.create_time, wkg.create_time,
wkg.update_by, wkg.update_by,
wkg.update_time wkg.update_time,
wkg.del_flag
FROM FROM
we_keyword_group wkg we_keyword_group wkg
LEFT JOIN we_keyword_group_kw wkgk ON wkgk.task_id = wkg.task_id LEFT JOIN we_group_code gc ON wkg.group_code_id = gc.id AND gc.del_flag = 0
LEFT JOIN we_group_code_actual gca ON gca.group_code_id = gc.id AND gca.del_flag = 0
LEFT JOIN we_group wg ON wg.chat_id = gca.chat_id
</sql> </sql>
<!-- <select id="selectGroupNameByTaskId" parameterType="Long" resultMap="groupNameResultMap">-->
<!-- select distinct wg.group_name-->
<!-- from we_keyword_group wkg-->
<!-- LEFT JOIN we_keyword_group_kw wkgk ON wkgk.task_id = wkg.task_id-->
<!-- LEFT JOIN we_group_code gc ON wkg.group_code_id = gc.id-->
<!-- LEFT JOIN we_group_code_actual gca ON gca.group_code_id = gc.id-->
<!-- LEFT JOIN we_group wg ON wg.chat_id = gca.chat_id-->
<!-- WHERE wkg.task_id = #{taskId}-->
<!-- </select>-->
<!-- <select id="selectKeywordByTaskId" resultMap="keywordResultMap">-->
<!-- select task_id, keyword from we_keyword_group_kw where task_id = #{taskId}-->
<!-- </select>-->
<select id="selectGroupByTaskId" parameterType="Long" resultType="WeGroupCodeVo">
select distinct wgc.id, wgc.code_url
from we_group_code wgc left join we_keyword_group wkg on wgc.id = wkg.group_code_id
where wgc.id = #{groupCodeId};
</select>
<select id="getTaskById" parameterType="Long" resultMap="WeKeywordGroupTaskResult"> <select id="getTaskById" parameterType="Long" resultMap="WeKeywordGroupTaskResult">
<include refid="selectTaskVo" /> <include refid="selectTaskVo" />
WHERE wkg.task_id = #{taskId} WHERE wkg.task_id = #{taskId} AND wkg.del_flag = 0
GROUP BY wkg.task_id
</select> </select>
<select id="getTaskList" resultMap="WeKeywordGroupTaskResult"> <select id="getTaskList" resultMap="WeKeywordGroupTaskResult">
<include refid="selectTaskVo" /> <include refid="selectTaskVo" />
<where> WHERE
1 = 1 wkg.del_flag = 0
<if test="taskName != null and taskName !='' "> <if test="taskName != null and taskName !='' ">
AND wkg.task_name LIKE CONCAT("%",#{taskName},"%") AND wkg.task_name LIKE CONCAT("%",#{taskName},"%")
</if> </if>
<if test="keyword != null and keyword !='' "> <if test="keywords != null and keywords != ''">
AND wkgk.keyword LIKE CONCAT("%",#{keyword},"%") AND FIND_IN_SET(#{keywords}, keywords)
</if> </if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 --> <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wkg.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d') AND date_format(wkg.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
...@@ -55,27 +84,25 @@ ...@@ -55,27 +84,25 @@
<if test="createBy!=null and createBy!=''"> <if test="createBy!=null and createBy!=''">
AND wkg.create_by LIKE CONCAT("%",#{createBy},"%") AND wkg.create_by LIKE CONCAT("%",#{createBy},"%")
</if> </if>
</where> GROUP BY wkg.task_id
order by create_time desc
</select> </select>
<select id="getGroupNameListByTaskId" parameterType="Long" resultType="String"> <!-- <select id="getGroupNameListByTaskId" parameterType="Long" resultType="String">-->
SELECT DISTINCT <!-- SELECT DISTINCT-->
g.group_name <!-- g.group_name-->
FROM <!-- FROM-->
we_keyword_group wkg <!-- we_keyword_group wkg-->
LEFT JOIN we_group_code gc ON wkg.group_code_id = gc.id <!-- LEFT JOIN we_group_code gc ON wkg.group_code_id = gc.id-->
LEFT JOIN we_group_code_actual gca ON gca.group_code_id = gc.id <!-- LEFT JOIN we_group_code_actual gca ON gca.group_code_id = gc.id-->
LEFT JOIN we_group g ON g.chat_id = gca.chat_id <!-- LEFT JOIN we_group g ON g.chat_id = gca.chat_id-->
WHERE wkg.task_id = #{taskId} <!-- WHERE wkg.task_id = #{taskId}-->
</select> <!-- </select>-->
<select id="checkNameUnique" parameterType="String" resultType="int">
select count(1) from we_keyword_group where task_name = #{taskName}
</select>
<select id="filterByNameOrKeyword" parameterType="String" resultMap="WeKeywordGroupTaskResult"> <select id="filterByNameOrKeyword" parameterType="String" resultMap="WeKeywordGroupTaskResult">
<include refid="selectTaskVo" /> <include refid="selectTaskVo" />
WHERE wkg.task_name LIKE CONCAT("%",#{word},"%") WHERE wkg.task_name LIKE CONCAT("%",#{word},"%")
OR wkgk.keyword LIKE CONCAT("%",#{word},"%") OR FIND_IN_SET(#{word}, wkg.keywords)
GROUP BY wkg.task_id
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -5,28 +5,26 @@ ...@@ -5,28 +5,26 @@
<mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskMapper">
<resultMap id="WePresTagGroupTaskResult" type="WePresTagGroupTaskVo"> <resultMap id="WePresTagGroupTaskResult" type="WePresTagGroupTaskVo">
<result property="taskId" column="task_id" /> <result property="taskId" column="task_id"/>
<result property="taskName" column="task_name" /> <result property="taskName" column="task_name"/>
<result property="welcomeMsg" column="welcome_msg" /> <result property="welcomeMsg" column="welcome_msg"/>
<result property="sendType" column="send_type" /> <result property="sendType" column="send_type"/>
<result property="codeUrl" column="code_url" /> <result property="codeUrl" column="code_url"/>
<result property="codeUuid" column="code_uuid" /> <result property="codeId" column="group_code_id"/>
<result property="codeId" column="group_code_id" /> <result property="totalMember" column="total_member"/>
<result property="totalMember" column="total_member" /> <result property="sendScope" column="send_scope"/>
<result property="sendScope" column="send_scope" /> <result property="sendGender" column="send_gender"/>
<result property="sendGender" column="send_gender" /> <result property="cusBeginTime" column="cus_begin_time"/>
<result property="cusBeginTime" column="cus_begin_time" /> <result property="cusEndTime" column="cus_end_time"/>
<result property="cusEndTime" column="cus_end_time" /> <result property="msgid" column="msgid"/>
<result property="msgid" column="msgid" /> <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="updateBy" column="update_by"/>
<result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time"/>
<result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectTaskVo"> <sql id="selectTaskVo">
SELECT SELECT wptg.task_id,
wptg.task_id,
wptg.task_name, wptg.task_name,
wptg.welcome_msg, wptg.welcome_msg,
wptg.send_type, wptg.send_type,
...@@ -40,11 +38,12 @@ ...@@ -40,11 +38,12 @@
wptg.update_by, wptg.update_by,
wptg.update_time, wptg.update_time,
wgc.code_url, wgc.code_url,
wgc.uuid as code_uuid,
wgc.id as group_code_id, wgc.id as group_code_id,
IFNULL((SELECT SUM( wgca.scan_code_times ) AS scan_times FROM we_group_code_actual wgca GROUP BY group_code_id HAVING group_code_id = wgc.id), 0) as total_member IFNULL((SELECT SUM(wgca.scan_code_times) AS scan_times
FROM FROM we_group_code_actual wgca
we_pres_tag_group wptg GROUP BY group_code_id
HAVING group_code_id = wgc.id), 0) as total_member
FROM we_pres_tag_group wptg
LEFT JOIN we_group_code wgc ON wgc.id = wptg.group_code_id LEFT JOIN we_group_code wgc ON wgc.id = wptg.group_code_id
</sql> </sql>
...@@ -56,7 +55,7 @@ ...@@ -56,7 +55,7 @@
<select id="selectTaskList" resultMap="WePresTagGroupTaskResult"> <select id="selectTaskList" resultMap="WePresTagGroupTaskResult">
<include refid="selectTaskVo"/> <include refid="selectTaskVo"/>
<where> <where>
1 = 1 wptg.`del_flag` = 0
<if test="taskName != null and taskName!=''"> <if test="taskName != null and taskName!=''">
AND wptg.task_name LIKE CONCAT("%",#{taskName},"%") AND wptg.task_name LIKE CONCAT("%",#{taskName},"%")
</if> </if>
...@@ -74,20 +73,91 @@ ...@@ -74,20 +73,91 @@
AND wptg.create_by LIKE CONCAT("%",#{createBy},"%") AND wptg.create_by LIKE CONCAT("%",#{createBy},"%")
</if> </if>
</where> </where>
</select> order by wptg.`create_time` desc
<select id="checkTaskNameUnique" parameterType="String" resultType="int">
select count(1) from we_pres_tag_group where task_name = #{taskName}
</select> </select>
<select id="getTaskListByEmplId" resultMap="WePresTagGroupTaskResult"> <select id="getTaskListByEmplId" resultMap="WePresTagGroupTaskResult">
<include refid="selectTaskVo" /> <include refid="selectTaskVo"/>
LEFT JOIN we_pres_tag_group_scope wptgs ON wptgs.task_id = wptg.task_id LEFT JOIN we_pres_tag_group_scope wptgs ON wptgs.task_id = wptg.task_id
WHERE wptgs.we_user_id = #{emplId} WHERE wptgs.we_user_id = #{emplId}
AND wptgs.is_done = #{isDone} AND wptgs.is_done = #{isDone}
AND wptg.send_type = 1; AND wptg.send_type = 1 AND wptg.`del_flag` = 0;
</select> </select>
<select id="selectStaffList" parameterType="WePresTagGroupTask" resultType="String">
SELECT DISTINCT
u.`user_id`
FROM
we_user u
LEFT JOIN we_flower_customer_rel wfcr ON u.`user_id` = wfcr.`user_id`
LEFT JOIN we_customer wc ON wc.external_userid = wfcr.external_userid
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfcr.`id` = wfctr.`flower_customer_rel_id`
LEFT JOIN we_pres_tag_group_tag gtr ON wfctr.`tag_id` = gtr.`tag_id`
LEFT JOIN we_pres_tag_group task ON task.`task_id` = gtr.`task_id`
WHERE
task.`task_id` = #{taskId}
<!-- 性别过滤 -->
<if test="sendGender != null and sendGender != ''">
AND wc.`gender` = #{sendGender}
</if>
<!-- 添加客户时间过滤 -->
<if test="cusBeginTime != null and cusBeginTime != ''">
and date_format(wfcr.`create_time`,'%y%m%d') &gt;= date_format(#{cusBeginTime},'%y%m%d')
</if>
<if test="cusEndTime != null and cusEndTime != ''"><!-- 结束时间检索 -->
and date_format(wfcr.`create_time`,'%y%m%d') &lt;= date_format(#{cusEndTime},'%y%m%d')
</if>
</select>
<select id="selectExternalUserIds" resultType="String">
SELECT
customer.`external_userid`
FROM
we_customer customer
WHERE 1 = 1
<if test="hasTag">
AND customer.external_userid in (
SELECT
t3.external_userid
FROM
we_pres_tag_group task
LEFT JOIN we_pres_tag_group_tag t1 ON t1.task_id = task.task_id
LEFT JOIN we_flower_customer_tag_rel t2 ON t2.tag_id = t1.tag_id
LEFT JOIN we_flower_customer_rel t3 ON t2.flower_customer_rel_id = t3.id
WHERE
task.task_id = #{taskId}
)
</if>
<if test="hasScope">
AND customer.external_userid in (
SELECT
t3.external_userid
FROM
we_pres_tag_group task
LEFT JOIN we_pres_tag_group_scope scope ON scope.task_id = task.task_id
LEFT JOIN we_flower_customer_rel t3 ON t3.user_id = scope.we_user_id
LEFT JOIN we_customer customer ON customer.external_userid = t3.external_userid
WHERE
task.task_id = #{taskId}
)
</if>
<!-- 性别过滤 -->
<if test="gender != null and gender != ''">
AND customer.`gender` = #{gender}
</if>
<!-- 添加客户时间过滤 -->
<if test="beginTime != null and beginTime != ''">
and date_format(customer.`create_time`,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
and date_format(customer.`create_time`,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</select>
<insert id="insertTask" parameterType="WePresTagGroupTask"> <insert id="insertTask" parameterType="WePresTagGroupTask">
INSERT INTO we_pres_tag_group INSERT INTO we_pres_tag_group
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!