Commit ac5fe383 by xinla

Merge remote-tracking branch 'origin/master' into front_end_dev_2.0

2 parents ec3f4667 2f651779
Showing 91 changed files with 1016 additions and 773 deletions
...@@ -27,16 +27,16 @@ import java.util.List; ...@@ -27,16 +27,16 @@ import java.util.List;
public class WeCommunityH5Controller extends BaseController { public class WeCommunityH5Controller extends BaseController {
@Autowired @Autowired
private IWePresTagGroupTaskService tagGroupTaskService; IWePresTagGroupTaskService tagGroupTaskService;
@Autowired @Autowired
private IWeGroupSopService sopService; IWeGroupSopService sopService;
@Autowired @Autowired
private IWeCommunityKeywordToGroupService keywordToGroupService; IWeCommunityKeywordToGroupService keywordToGroupService;
@Autowired @Autowired
private ISysUserService userService; ISysUserService userService;
/** /**
* 获取任务对应的执行人列表 * 获取任务对应的执行人列表
...@@ -65,8 +65,8 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -65,8 +65,8 @@ public class WeCommunityH5Controller extends BaseController {
AjaxResult res = AjaxResult.success(); AjaxResult res = AjaxResult.success();
if (type.equals(CommunityTaskType.TAG.getType())) { if (type.equals(CommunityTaskType.TAG.getType())) {
// 老客标签建群数据 // 老客标签建群数据
res.put("todo", tagGroupTaskService.getEmplTaskList(emplId, false)); res.put("todo", tagGroupTaskService.getFollowerTaskList(emplId, 0));
res.put("done", tagGroupTaskService.getEmplTaskList(emplId, true)); res.put("done", tagGroupTaskService.getFollowerTaskList(emplId, 1));
} else if (type.equals(CommunityTaskType.SOP.getType())) { } else if (type.equals(CommunityTaskType.SOP.getType())) {
// 群SOP数据 // 群SOP数据
res.put("todo", sopService.getEmplTaskList(emplId, false)); res.put("todo", sopService.getEmplTaskList(emplId, false));
...@@ -75,10 +75,10 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -75,10 +75,10 @@ public class WeCommunityH5Controller extends BaseController {
// 全部数据 // 全部数据
List todoList = new ArrayList(); List todoList = new ArrayList();
List doneList = new ArrayList(); List doneList = new ArrayList();
todoList.addAll(tagGroupTaskService.getEmplTaskList(emplId, false)); todoList.addAll(tagGroupTaskService.getFollowerTaskList(emplId, 0));
todoList.addAll(sopService.getEmplTaskList(emplId, false)); todoList.addAll(sopService.getEmplTaskList(emplId, false));
res.put("todo", todoList); res.put("todo", todoList);
doneList.addAll(tagGroupTaskService.getEmplTaskList(emplId, true)); doneList.addAll(tagGroupTaskService.getFollowerTaskList(emplId, 1));
doneList.addAll(sopService.getEmplTaskList(emplId, true)); doneList.addAll(sopService.getEmplTaskList(emplId, true));
res.put("done", doneList); res.put("done", doneList);
} }
...@@ -99,11 +99,11 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -99,11 +99,11 @@ public class WeCommunityH5Controller extends BaseController {
@GetMapping("/changeStatus") @GetMapping("/changeStatus")
public AjaxResult changeStatus(@RequestParam("taskId") Long taskId, @RequestParam("emplId") String emplId, @RequestParam("type") Integer type) { public AjaxResult changeStatus(@RequestParam("taskId") Long taskId, @RequestParam("emplId") String emplId, @RequestParam("type") Integer type) {
if (type.equals(0)) { if (type.equals(0)) {
return toAjax(tagGroupTaskService.updateEmplTaskStatus(taskId, emplId));
return toAjax(tagGroupTaskService.updateFollowerTaskStatus(taskId, emplId));
} else { } else {
return toAjax(sopService.updateChatSopStatus(taskId, emplId)); return toAjax(sopService.updateChatSopStatus(taskId, emplId));
} }
} }
/** /**
......
...@@ -2,50 +2,49 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,50 +2,49 @@ 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;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.WePresTagGroupTask; import com.linkwechat.wecom.domain.WePresTagGroupTask;
import com.linkwechat.wecom.domain.dto.WePresTagGroupTaskDto; import com.linkwechat.wecom.domain.WePresTagGroupTaskStat;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskStatVo;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo; import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo;
import com.linkwechat.wecom.domain.vo.WePresTagTaskListVO;
import com.linkwechat.wecom.service.IWePresTagGroupTaskService; import com.linkwechat.wecom.service.IWePresTagGroupTaskService;
import com.linkwechat.wecom.service.IWeGroupCodeService; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
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;
@Api("老客标签建群接口")
@RestController @RestController
@RequestMapping(value = "/wecom/communityPresTagGroup") @RequestMapping(value = "/wecom/communityPresTagGroup")
public class WeCommunityPresTagGroupController extends BaseController { public class WeCommunityPresTagGroupController extends BaseController {
@Autowired @Autowired
private IWePresTagGroupTaskService taskService; IWePresTagGroupTaskService taskService;
@Autowired
private IWeGroupCodeService groupCodeService;
/** /**
* 获取老客标签建群列表数据 * 获取老客标签建群列表数据
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:list')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:list')")
@GetMapping(path = "/list") @GetMapping(path = "/list")
public TableDataInfo<List<WePresTagGroupTaskVo>> getList( @ApiOperation(value = "获取老客标签建群任务分页数据", httpMethod = "GET")
public TableDataInfo<List<WePresTagTaskListVO>> getPage(
@RequestParam(value = "taskName", required = false) String taskName, @RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "sendType", required = false) Integer sendType, @RequestParam(value = "sendType", required = false) Integer sendType,
@RequestParam(value = "createBy", required = false) String createBy, @RequestParam(value = "createBy", required = false) String createBy,
@RequestParam(value = "beginTime", required = false) String beginTime, @RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime) { @RequestParam(value = "endTime", required = false) String endTime) {
startPage(); startPage();
List<WePresTagGroupTaskVo> wePresTagGroupTaskVoList = taskService.selectTaskList(taskName, sendType, createBy, beginTime, endTime); List<WePresTagTaskListVO> result = taskService.selectTaskList(taskName, sendType, createBy, beginTime, endTime);
return getDataTable(wePresTagGroupTaskVoList); return getDataTable(result);
} }
/** /**
...@@ -53,28 +52,16 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -53,28 +52,16 @@ 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) { @ApiOperation(value = "新建老客标签建群任务", httpMethod = "POST")
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) { public AjaxResult add(@RequestBody @Validated WePresTagGroupTask task) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
}
WePresTagGroupTask task = new WePresTagGroupTask();
BeanUtils.copyProperties(wePresTagGroupTaskDto, task);
// 检测任务名是否可用 // 检测任务名是否可用
if (taskService.isNameOccupied(task)) { if (taskService.isNameOccupied(task)) {
return AjaxResult.error("任务名已存在"); return AjaxResult.error("任务名已存在");
} }
task.setCreateBy(SecurityUtils.getUsername()); task.setCreateBy(SecurityUtils.getUsername());
List<String> tagList = wePresTagGroupTaskDto.getTagList(); int affectedRows = taskService.add(task);
List<String> scopeList = wePresTagGroupTaskDto.getScopeList(); // 再发送消息
int affectedRows = taskService.add(task, tagList, scopeList); if (affectedRows > 0) taskService.sendMessage(task);
if (affectedRows > 0) {
boolean hasScope = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getScopeList());
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);
} }
...@@ -83,7 +70,8 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -83,7 +70,8 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
@GetMapping(path = "/{id}") @GetMapping(path = "/{id}")
public AjaxResult getTask(@PathVariable("id") Long id) { @ApiOperation(value = "根据获取任务详细信息", httpMethod = "GET")
public AjaxResult getInfo(@PathVariable("id") Long id) {
WePresTagGroupTaskVo taskVo = taskService.getTaskById(id); WePresTagGroupTaskVo taskVo = taskService.getTaskById(id);
if (StringUtils.isNull(taskVo)) { if (StringUtils.isNull(taskVo)) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
...@@ -96,11 +84,15 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -96,11 +84,15 @@ 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) { @ApiOperation(value = "更新任务信息", httpMethod = "PUT")
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) { public AjaxResult update(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTask task) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); // 保存新任务
} task.setTaskId(id);
return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto)); task.setUpdateBy(SecurityUtils.getUsername());
task.setUpdateTime(new Date());
int rows = taskService.updateTask(task);
if (rows > 0) taskService.sendMessage(task);
return toAjax(rows);
} }
/** /**
...@@ -108,7 +100,8 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -108,7 +100,8 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:remove')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:remove')")
@DeleteMapping(path = "/{ids}") @DeleteMapping(path = "/{ids}")
public AjaxResult batchRemoveTask(@PathVariable("ids") Long[] ids) { @ApiOperation(value = "批量删除老客标签建群任务", httpMethod = "DELETE")
public AjaxResult batchRemove(@PathVariable("ids") Long[] ids) {
return toAjax(taskService.batchRemoveTaskByIds(ids)); return toAjax(taskService.batchRemoveTaskByIds(ids));
} }
...@@ -117,16 +110,17 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -117,16 +110,17 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
@GetMapping(path = "/stat/{id}") @GetMapping(path = "/stat/{id}")
public TableDataInfo<List<WePresTagGroupTaskStatVo>> getStatInfo( public TableDataInfo<List<WePresTagGroupTaskStat>> getStatInfo(
@PathVariable("id") Long id, @PathVariable("id") Long id,
@RequestParam(value = "customerName", required = false) String customerName, @RequestParam(value = "customerName", required = false) String customerName,
@RequestParam(value = "isInGroup", required = false) Integer isInGroup, @RequestParam(value = "isInGroup", required = false) Integer isInGroup,
@RequestParam(value = "isSent", required = false) Integer isSent @RequestParam(value = "isSent", required = false) Integer isSent
) { ) {
WePresTagGroupTask task = taskService.getById(id);
startPage(); startPage();
List<WePresTagGroupTaskStatVo> statVoList = taskService.getStatByTaskId(id); List<WePresTagGroupTaskStat> stats = taskService.getTaskStat(id, customerName, isInGroup, isSent, task.getSendType());
return getDataTable(statVoList); return getDataTable(stats);
} }
......
...@@ -150,6 +150,13 @@ public class WeCustomerController extends BaseController ...@@ -150,6 +150,13 @@ public class WeCustomerController extends BaseController
} }
@GetMapping("/getCustomersInfoAndSynch")
public AjaxResult getCustomersInfoAndSynchWeCustomer(String externalUserid,String userId){
weCustomerService.getCustomersInfoAndSynchWeCustomer(externalUserid,userId);
return AjaxResult.success();
}
/** /**
* 客户打标签 * 客户打标签
* @param weMakeCustomerTag * @param weMakeCustomerTag
......
...@@ -190,7 +190,7 @@ public class WeEmpleCodeController extends BaseController { ...@@ -190,7 +190,7 @@ public class WeEmpleCodeController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:code:getUserAddCustomerStat')") // @PreAuthorize("@ss.hasPermi('wecom:code:getUserAddCustomerStat')")
@Log(title = "成员添加客户统计", businessType = BusinessType.OTHER) @Log(title = "成员添加客户统计", businessType = BusinessType.OTHER)
@GetMapping("/getUserAddCustomerStat") @GetMapping("/getUserAddCustomerStat")
public AjaxResult getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel){ public AjaxResult getUserAddCustomerStat(String codeId,String beginTime,String endTime){
return AjaxResult.success(weFlowerCustomerRelService.getUserAddCustomerStat(weFlowerCustomerRel)); return AjaxResult.success(weFlowerCustomerRelService.getUserAddCustomerStat(codeId, beginTime, endTime));
} }
} }
...@@ -73,9 +73,9 @@ public class WeGroupCodeActualController extends BaseController { ...@@ -73,9 +73,9 @@ public class WeGroupCodeActualController extends BaseController {
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody WeGroupCodeActual weGroupCodeActual) { public AjaxResult add(@Validated @RequestBody WeGroupCodeActual weGroupCodeActual) {
// 唯一性检查 // 唯一性检查
if (!weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) { // if (!weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) {
return AjaxResult.error("新增实际群码失败, 该群聊二维码已存在"); // return AjaxResult.error("新增实际群码失败, 该群聊二维码已存在");
} // }
return toAjax(weGroupCodeActualService.insertWeGroupCodeActual(weGroupCodeActual)); return toAjax(weGroupCodeActualService.insertWeGroupCodeActual(weGroupCodeActual));
} }
...@@ -86,15 +86,15 @@ public class WeGroupCodeActualController extends BaseController { ...@@ -86,15 +86,15 @@ public class WeGroupCodeActualController extends BaseController {
@Log(title = "实际群码", businessType = BusinessType.UPDATE) @Log(title = "实际群码", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual) { public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual) {
WeGroupCodeActual original = weGroupCodeActualService.selectWeGroupCodeActualById(weGroupCodeActual.getId()); // WeGroupCodeActual original = weGroupCodeActualService.selectWeGroupCodeActualById(weGroupCodeActual.getId());
if (StringUtils.isNull(original)) { // if (StringUtils.isNull(original)) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在"); // return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在");
} // }
// 实际码对应客户群变化时,检查其唯一性 // // 实际码对应客户群变化时,检查其唯一性
if (!original.getChatId().equals(weGroupCodeActual.getChatId()) && // if (!original.getChatId().equals(weGroupCodeActual.getChatId()) &&
!weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) { // !weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) {
return AjaxResult.error("修改实际群码失败, 该群聊二维码已存在"); // return AjaxResult.error("修改实际群码失败, 该群聊二维码已存在");
} // }
return toAjax(weGroupCodeActualService.updateWeGroupCodeActual(weGroupCodeActual)); return toAjax(weGroupCodeActualService.updateWeGroupCodeActual(weGroupCodeActual));
} }
......
...@@ -5,6 +5,8 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -5,6 +5,8 @@ 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.wecom.domain.WeGroupMessageSendResult;
import com.linkwechat.wecom.domain.WeGroupMessageTask;
import com.linkwechat.wecom.domain.WeGroupMessageTemplate; import com.linkwechat.wecom.domain.WeGroupMessageTemplate;
import com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery; import com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery;
import com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo; import com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo;
...@@ -89,4 +91,30 @@ public class WeGroupMessageTemplateController extends BaseController { ...@@ -89,4 +91,30 @@ public class WeGroupMessageTemplateController extends BaseController {
iWeGroupMessageTemplateService.cancelByIds(Arrays.asList(ids)); iWeGroupMessageTemplateService.cancelByIds(Arrays.asList(ids));
return AjaxResult.success(); return AjaxResult.success();
} }
/**
* 群发成员发送任务列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员发送任务列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/task/list")
public TableDataInfo<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task) {
startPage();
List<WeGroupMessageTask> messageTaskList = iWeGroupMessageTemplateService.groupMsgTaskList(task);
return getDataTable(messageTaskList);
}
/**
* 群发成员执行结果列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员执行结果列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/send/result/list")
public TableDataInfo<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) {
startPage();
List<WeGroupMessageSendResult> sendResultList = iWeGroupMessageTemplateService.groupMsgSendResultList(sendResult);
return getDataTable(sendResultList);
}
} }
...@@ -32,6 +32,7 @@ import com.linkwechat.wecom.service.IWeTaskFissionService; ...@@ -32,6 +32,7 @@ import com.linkwechat.wecom.service.IWeTaskFissionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -51,6 +52,7 @@ import java.util.Objects; ...@@ -51,6 +52,7 @@ import java.util.Objects;
* @author leejoker * @author leejoker
* @date 2021-01-20 * @date 2021-01-20
*/ */
@Slf4j
@Api("任务宝Controller") @Api("任务宝Controller")
@RestController @RestController
@RequestMapping("/wecom/fission") @RequestMapping("/wecom/fission")
...@@ -218,6 +220,7 @@ public class WeTaskFissionController extends BaseController { ...@@ -218,6 +220,7 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "生成带二维码的海报", businessType = BusinessType.OTHER) @Log(title = "生成带二维码的海报", businessType = BusinessType.OTHER)
@PostMapping("/poster") @PostMapping("/poster")
public AjaxResult<JSONObject> posterGenerate(@RequestBody WeTaskFissionPosterDTO weTaskFissionPosterDTO) { public AjaxResult<JSONObject> posterGenerate(@RequestBody WeTaskFissionPosterDTO weTaskFissionPosterDTO) {
log.info("获取任务所有参与客户的完成情况 入参params:{}",JSONObject.toJSONString(weTaskFissionPosterDTO));
String posterUrl = weTaskFissionService.fissionPosterGenerate(weTaskFissionPosterDTO); String posterUrl = weTaskFissionService.fissionPosterGenerate(weTaskFissionPosterDTO);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("posterUrl", posterUrl); json.put("posterUrl", posterUrl);
...@@ -250,6 +253,7 @@ public class WeTaskFissionController extends BaseController { ...@@ -250,6 +253,7 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "根据任务id获取参与任务客户列表", businessType = BusinessType.OTHER) @Log(title = "根据任务id获取参与任务客户列表", businessType = BusinessType.OTHER)
@GetMapping("/getCustomerListById/{id}") @GetMapping("/getCustomerListById/{id}")
public AjaxResult<List<WeCustomer>> getCustomerListById(@ApiParam("任务id") @PathVariable("id") String id) { public AjaxResult<List<WeCustomer>> getCustomerListById(@ApiParam("任务id") @PathVariable("id") String id) {
log.info("根据任务id获取参与任务客户列表 入参id:{}",id);
return AjaxResult.success(weTaskFissionService.getCustomerListById(null, id)); return AjaxResult.success(weTaskFissionService.getCustomerListById(null, id));
} }
...@@ -263,6 +267,7 @@ public class WeTaskFissionController extends BaseController { ...@@ -263,6 +267,7 @@ public class WeTaskFissionController extends BaseController {
@GetMapping("/{id}/progress/{unionId}") @GetMapping("/{id}/progress/{unionId}")
public AjaxResult<WeTaskFissionProgressVO> getCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id public AjaxResult<WeTaskFissionProgressVO> getCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id
, @PathVariable("unionId") @ApiParam("客户id") String unionId) { , @PathVariable("unionId") @ApiParam("客户id") String unionId) {
log.info("获取客户邀请列表和任务进度 入参id:{},unionId:{}",id,unionId);
WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id); WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id);
if (weTaskFission != null) { if (weTaskFission != null) {
return AjaxResult.success(weTaskFissionService.getCustomerTaskProgress(weTaskFission, unionId)); return AjaxResult.success(weTaskFissionService.getCustomerTaskProgress(weTaskFission, unionId));
...@@ -279,6 +284,7 @@ public class WeTaskFissionController extends BaseController { ...@@ -279,6 +284,7 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "获取任务所有参与客户的完成情况", businessType = BusinessType.OTHER) @Log(title = "获取任务所有参与客户的完成情况", businessType = BusinessType.OTHER)
@GetMapping("/{id}/progress") @GetMapping("/{id}/progress")
public AjaxResult<List<WeTaskFissionTotalProgressVO>> getAllCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id) { public AjaxResult<List<WeTaskFissionTotalProgressVO>> getAllCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id) {
log.info("获取任务所有参与客户的完成情况 入参id:{}",id);
WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id); WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id);
List<WeTaskFissionTotalProgressVO> list = Lists.newArrayList(); List<WeTaskFissionTotalProgressVO> list = Lists.newArrayList();
if (weTaskFission != null) { if (weTaskFission != null) {
......
...@@ -418,4 +418,9 @@ public class WeConstans { ...@@ -418,4 +418,9 @@ public class WeConstans {
* 群发消息任务开关 * 群发消息任务开关
*/ */
public static Boolean WEGROUPMSGTIMEDTASK_SWITCH = true; public static Boolean WEGROUPMSGTIMEDTASK_SWITCH = true;
/**
* 老客标签建群企业群发消息模板
*/
public static final String MSG_TEMPLATE = "你有一个新社群运营任务,<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>请点击此链接查看详情</a>";
} }
package com.linkwechat.common.enums;
import lombok.Getter;
/**
* 老客标签建群任务群发类型
* @Author Hang
* @Date 2021/3/24 9:56
*/
@Getter
public enum TaskSendType {
/**
* 个人群发
*/
CROP(0, "企业群发"),
/**
* 企业群发
*/
SINGLE(1, "个人群发");
private final String name;
private final Integer type;
TaskSendType(Integer type, String name) {
this.name = name;
this.type = type;
}
}
...@@ -2,9 +2,8 @@ package com.linkwechat.framework.handler; ...@@ -2,9 +2,8 @@ package com.linkwechat.framework.handler;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -22,7 +21,7 @@ import java.util.List; ...@@ -22,7 +21,7 @@ import java.util.List;
//支持的java对象 //支持的java对象
@SuppressWarnings("all") @SuppressWarnings("all")
@Slf4j @Slf4j
@MappedTypes(value = {WeCustomer.class,WeGroup.class}) @MappedTypes(value = {WeGroup.class, WeCustomerList.class})
@MappedJdbcTypes({JdbcType.VARCHAR}) @MappedJdbcTypes({JdbcType.VARCHAR})
public class ListTypeHandler<T extends Object> implements TypeHandler<List<T>> { public class ListTypeHandler<T extends Object> implements TypeHandler<List<T>> {
...@@ -33,7 +32,7 @@ public class ListTypeHandler<T extends Object> implements TypeHandler<List<T>> { ...@@ -33,7 +32,7 @@ public class ListTypeHandler<T extends Object> implements TypeHandler<List<T>> {
} }
if(filedName!=null && "customers_info".equals(filedName)){ if(filedName!=null && "customers_info".equals(filedName)){
return JSONObject.parseArray(content, WeCustomer.class); return JSONObject.parseArray(content, WeCustomerList.class);
} }
if(filedName!=null && "groups_info".equals(filedName)){ if(filedName!=null && "groups_info".equals(filedName)){
......
...@@ -30,8 +30,8 @@ public class GroupMessageTask { ...@@ -30,8 +30,8 @@ public class GroupMessageTask {
*/ */
public void messageTask() { public void messageTask() {
//获的当前时间的毫秒数 //获的当前时间的毫秒数
List<WeCustomerMessageTimeTask> weCustomerMessageTimeTasks = customerMessageTimeTaskMapper.selectWeCustomerMessageTimeTaskGteSettingTime(DateUtils.getDateTime().getTime(),System.currentTimeMillis()); //customerMessageTimeTaskMapper
List<WeCustomerMessageTimeTask> weCustomerMessageTimeTasks = customerMessageTimeTaskMapper.selectWeCustomerMessageTimeTaskGteSettingTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(weCustomerMessageTimeTasks)) { if (CollectionUtils.isNotEmpty(weCustomerMessageTimeTasks)) {
weCustomerMessageTimeTasks.forEach( weCustomerMessageTimeTasks.forEach(
s -> { s -> {
......
package com.linkwechat.quartz.task;
import com.linkwechat.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 定时任务调度测试
*
* @author ruoyi
*/
@Slf4j
@Component("ryTask")
public class RyTask {
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
}
public void ryParams(String params) {
System.out.println("执行有参方法:" + params);
}
public void ryNoParams() {
System.out.println("执行无参方法");
}
}
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
</el-form-item> </el-form-item>
<el-form-item label="选择群活码"> <el-form-item label="选择群活码">
<el-image v-if="groupQrCode && groupQrCode.codeUrl" :src="groupQrCode.codeUrl" class="code-image"> <el-image
v-if="groupQrCode && groupQrCode.codeUrl"
:src="groupQrCode.codeUrl"
class="code-image"
>
</el-image> </el-image>
<el-button <el-button
...@@ -59,10 +63,9 @@ ...@@ -59,10 +63,9 @@
<PhoneDialog <PhoneDialog
:message="form.welcomeMsg || '请输入加群引导语'" :message="form.welcomeMsg || '请输入加群引导语'"
:isOther="(groupQrCode && groupQrCode.codeUrl) ? true : false" :isOther="groupQrCode && groupQrCode.codeUrl ? true : false"
> >
<el-image style="border-radius: 6px; width: 100px;" :src="groupQrCode.codeUrl"> <el-image style="border-radius: 6px; width: 100px;" :src="groupQrCode.codeUrl"> </el-image>
</el-image>
</PhoneDialog> </PhoneDialog>
</div> </div>
...@@ -92,24 +95,16 @@ export default { ...@@ -92,24 +95,16 @@ export default {
taskName: '', // 任务名称 taskName: '', // 任务名称
groupCodeId: '', // 群活码ID groupCodeId: '', // 群活码ID
welcomeMsg: '', // 欢迎语 welcomeMsg: '', // 欢迎语
keywords: '', // 关键词 keywords: '' // 关键词
}, },
codes: [], codes: [],
groupQrCode: {}, groupQrCode: {},
rules: Object.freeze({ rules: Object.freeze({
taskName: [ taskName: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
{ required: true, message: '该项为必填项', trigger: 'blur' } welcomeMsg: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
], keywords: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
welcomeMsg: [ groupCodeId: [{ required: true, message: '该项为必填项', trigger: 'change' }]
{ required: true, message: '该项为必填项', trigger: 'blur' } })
],
keywords: [
{ required: true, message: '该项为必填项', trigger: 'blur' }
],
groupCodeId: [
{ required: true, message: '该项为必填项', trigger: 'change' }
],
}),
} }
}, },
created() { created() {
...@@ -120,8 +115,7 @@ export default { ...@@ -120,8 +115,7 @@ export default {
/** 获取详情 */ /** 获取详情 */
getDetail(id) { getDetail(id) {
this.loading = true this.loading = true
getDetail(id) getDetail(id).then(({ data }) => {
.then(({ data }) => {
this.form.taskName = data.taskName this.form.taskName = data.taskName
this.form.welcomeMsg = data.welcomeMsg this.form.welcomeMsg = data.welcomeMsg
...@@ -132,7 +126,7 @@ export default { ...@@ -132,7 +126,7 @@ export default {
if (data.groupCodeInfo && data.groupCodeInfo.id) { if (data.groupCodeInfo && data.groupCodeInfo.id) {
this.form.groupCodeId = data.groupCodeInfo.id this.form.groupCodeId = data.groupCodeInfo.id
this.codes = [ data.groupCodeInfo ] this.codes = [data.groupCodeInfo]
this.groupQrCode = data.groupCodeInfo this.groupQrCode = data.groupCodeInfo
} else { } else {
this.form.groupCodeId = '' this.form.groupCodeId = ''
...@@ -144,7 +138,7 @@ export default { ...@@ -144,7 +138,7 @@ export default {
}) })
}, },
submit() { submit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
this.loading = true this.loading = true
if (this.taskId) { if (this.taskId) {
...@@ -176,87 +170,11 @@ export default { ...@@ -176,87 +170,11 @@ export default {
this.groupQrCode = data this.groupQrCode = data
this.form.groupCodeId = data.id this.form.groupCodeId = data.id
this.$refs.form.validateField('groupCodeId') this.$refs.form.validateField('groupCodeId')
}, }
} }
} }
</script> </script>
<template>
<div class="wrap" v-loading="loading">
<el-form
:model="form"
ref="form"
:rules="rules"
label-width="100px"
>
<el-form-item label="活码名称" prop="taskName">
<el-input
v-model="form.taskName"
maxlength="30"
show-word-limit
placeholder="请输入名称"
clearable
></el-input>
</el-form-item>
<el-form-item label="关键词" prop="keywords">
<el-input
v-model="form.keywords"
placeholder="请输入关键词,多个词用英文逗号分隔,每个词不超过10个字"
clearable
></el-input>
</el-form-item>
<el-form-item label="加群引导语" prop="welcomeMsg">
<el-input
type="textarea"
v-model="form.welcomeMsg"
maxlength="220"
show-word-limit
:autosize="{ minRows: 5, maxRows: 20 }"
placeholder="请输入加群引导语"
clearable
></el-input>
</el-form-item>
<el-form-item label="选择群活码" prop="groupCodeId">
<el-image
v-if="groupQrCode && groupQrCode.codeUrl"
:src="groupQrCode.codeUrl"
class="code-image mr10"
></el-image>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="dialogVisibleSelectQrCode = true"
>{{ groupQrCode && groupQrCode.codeUrl ? '修改' : '添加' }}</el-button
>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="submit">保存</el-button>
<el-button @click="$router.back()">取消</el-button>
</el-form-item>
</el-form>
<div class="preview-wrap">
<!-- 预览 -->
<div class="tip">欢迎语样式</div>
<PhoneDialog
:message="form.welcomeMsg || '请输入加群引导语'"
:isOther="(groupQrCode && groupQrCode.codeUrl) ? true : false"
>
<el-image class="phone-dialog-image" :src="groupQrCode.codeUrl">
</el-image>
</PhoneDialog>
</div>
<SelectQrCode
:visible.sync="dialogVisibleSelectQrCode"
@success="submitSelectQrCode"
:selected="codes"
></SelectQrCode>
</div>
</template>
<style lang="scss" scoped> <style lang="scss" scoped>
.wrap { .wrap {
display: flex; display: flex;
......
...@@ -161,31 +161,6 @@ export default { ...@@ -161,31 +161,6 @@ export default {
<template> <template>
<div> <div>
<div class="link-info">
<div class="link-info__header">配置链接</div>
<div class="link-info__content">
请点击按钮复制该应用链接,并将应用页面配置到聊天工具栏,方便成员在与客户的聊天中查看和使用,提高服务效率
</div>
<div class="link">
<div class="link__content">
<span>
{{ h5Link }}
</span>
</div>
<div class="link__action">
<el-button
v-hasPermi="['customerManage:customer:query']"
type="primary"
plain
class="copy-btn"
:data-clipboard-text="h5Link"
>复制地址</el-button
>
<el-link type="info" @click="openHelpDialog">如何配置?</el-link>
</div>
</div>
</div>
<el-form ref="queryForm" :inline="true" :model="query" label-width="100px" class="top-search" size="small"> <el-form ref="queryForm" :inline="true" :model="query" label-width="100px" class="top-search" size="small">
<el-form-item label="活码名称" prop="taskName"> <el-form-item label="活码名称" prop="taskName">
<el-input v-model="query.taskName" placeholder="请输入"></el-input> <el-input v-model="query.taskName" placeholder="请输入"></el-input>
...@@ -330,41 +305,6 @@ export default { ...@@ -330,41 +305,6 @@ export default {
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.link-info {
.link-info__header {
padding-bottom: 10px;
font-size: 16px;
}
.link-info__content {
color: #aaaaaa;
padding: 5px 0;
}
.link {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-bottom: 14px;
.link__content {
background: #e0e0e0;
margin: 8px 10px 8px 0;
border-radius: 4px;
line-height: 32px;
padding: 0 12px;
span {
align-items: center;
height: 100%;
color: #aaaaaa;
}
}
.link__action {
:nth-child(n + 2) {
margin-left: 10px;
}
}
}
}
.help { .help {
.step { .step {
margin-bottom: 20px; margin-bottom: 20px;
......
...@@ -12,7 +12,7 @@ import com.linkwechat.wecom.retry.WeCommonRetryWhen; ...@@ -12,7 +12,7 @@ import com.linkwechat.wecom.retry.WeCommonRetryWhen;
* @author: HaoN * @author: HaoN
* @create: 2020-08-27 16:42 * @create: 2020-08-27 16:42
**/ **/
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeCommonAccessTokenInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class) @Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class)
public interface WeUserClient { public interface WeUserClient {
......
...@@ -171,11 +171,17 @@ public class WeCustomer extends BaseEntity { ...@@ -171,11 +171,17 @@ public class WeCustomer extends BaseEntity {
private String updateBy; private String updateBy;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */
private String state;
/** /**
* 首位添加时间 * 首位添加时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date firstAddTime; private Date firstAddTime;
...@@ -195,9 +201,10 @@ public class WeCustomer extends BaseEntity { ...@@ -195,9 +201,10 @@ public class WeCustomer extends BaseEntity {
/** /**
* 0:正常;1:删除 * 0:正常;1:删除
*/ */
@TableLogic // @TableLogic
private Integer delFlag; private Integer delFlag;
//添加方式 //添加方式
private Integer addMethod; private Integer addMethod;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@Data @Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeCustomerList { public class WeCustomerList {
...@@ -59,6 +65,11 @@ public class WeCustomerList { ...@@ -59,6 +65,11 @@ public class WeCustomerList {
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday; private Date birthday;
...@@ -74,6 +85,9 @@ public class WeCustomerList { ...@@ -74,6 +85,9 @@ public class WeCustomerList {
//查询结束时间 //查询结束时间
private String endTime; private String endTime;
//所属部门id,多个用逗号隔开
private String departmentIds;
//0正常;1:删除; //0正常;1:删除;
private Integer delFlag=new Integer(0); private Integer delFlag=new Integer(0);
......
...@@ -7,6 +7,7 @@ import lombok.AllArgsConstructor; ...@@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -17,7 +18,7 @@ import java.util.List; ...@@ -17,7 +18,7 @@ import java.util.List;
@TableName("we_customer_messageTimeTask") @TableName("we_customer_messageTimeTask")
public class WeCustomerMessageTimeTask extends BaseEntity { public class WeCustomerMessageTimeTask extends BaseEntity {
public WeCustomerMessageTimeTask(Long messageId, CustomerMessagePushDto messageInfo, List<WeCustomer> customersInfo, List<WeGroup> groupsInfo, Long settingTime) { public WeCustomerMessageTimeTask(Long messageId, CustomerMessagePushDto messageInfo, List<WeCustomerList> customersInfo, List<WeGroup> groupsInfo, Long settingTime) {
this.messageId = messageId; this.messageId = messageId;
this.messageInfo = messageInfo; this.messageInfo = messageInfo;
this.customersInfo = customersInfo; this.customersInfo = customersInfo;
...@@ -46,7 +47,7 @@ public class WeCustomerMessageTimeTask extends BaseEntity { ...@@ -46,7 +47,7 @@ public class WeCustomerMessageTimeTask extends BaseEntity {
/** /**
* 客户信息列表 * 客户信息列表
*/ */
private List<WeCustomer> customersInfo; private List<WeCustomerList> customersInfo;
/** /**
* 客户群组信息列表 * 客户群组信息列表
......
package com.linkwechat.wecom.domain; 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.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;
...@@ -26,6 +27,7 @@ public class WeEmpleCode extends BaseEntity { ...@@ -26,6 +27,7 @@ public class WeEmpleCode extends BaseEntity {
/** /**
* $column.columnComment * $column.columnComment
*/ */
@TableId
private Long id = SnowFlakeUtil.nextId(); private Long id = SnowFlakeUtil.nextId();
/** /**
......
...@@ -23,7 +23,7 @@ public class WeEmpleCodeTag ...@@ -23,7 +23,7 @@ public class WeEmpleCodeTag
/** $column.columnComment */ /** $column.columnComment */
@TableId @TableId
private Long id; private Long id=SnowFlakeUtil.nextId();
/** 标签id */ /** 标签id */
@ApiModelProperty("标签id") @ApiModelProperty("标签id")
......
...@@ -77,4 +77,18 @@ public class WeGroupMessageTask extends BaseEntity{ ...@@ -77,4 +77,18 @@ public class WeGroupMessageTask extends BaseEntity{
@ApiModelProperty("企业服务人员名称") @ApiModelProperty("企业服务人员名称")
@TableField(exist = false) @TableField(exist = false)
private String userName; private String userName;
/**
* 预计发送数量
*/
@ApiModelProperty("预计发送数量")
@TableField(exist = false)
private Integer total;
/**
* 实际发送数量
*/
@ApiModelProperty("实际发送数量")
@TableField(exist = false)
private Integer already;
} }
...@@ -71,4 +71,8 @@ public class WeGroupMessageTemplate extends BaseEntity { ...@@ -71,4 +71,8 @@ public class WeGroupMessageTemplate extends BaseEntity {
@ApiModelProperty("状态 -1:失败 0:未执行 1:完成 2:取消") @ApiModelProperty("状态 -1:失败 0:未执行 1:完成 2:取消")
@Excel(name = "是否执行 -1:失败 0:未执行 1:完成 2:取消") @Excel(name = "是否执行 -1:失败 0:未执行 1:完成 2:取消")
private Integer status; private Integer status;
@ApiModelProperty("同步时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date refreshTime;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.fasterxml.jackson.annotation.JsonFormat;
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;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
@ApiModel
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("we_pres_tag_group") @TableName("we_pres_tag_group")
...@@ -19,57 +27,104 @@ public class WePresTagGroupTask extends BaseEntity { ...@@ -19,57 +27,104 @@ public class WePresTagGroupTask extends BaseEntity {
/** /**
*主键ID *主键ID
*/ */
@ApiModelProperty("id")
@TableId @TableId
private Long taskId = SnowFlakeUtil.nextId(); private Long taskId = SnowFlakeUtil.nextId();
/** /**
* 任务名称 * 任务名称
*/ */
@ApiModelProperty("任务名")
@NotNull(message = "任务名称不能为空")
private String taskName; private String taskName;
/** /**
* 加群引导语 * 加群引导语
*/ */
@ApiModelProperty("加群引导语")
@Size(max = 64, message = "引导与不能超过64字符")
@NotBlank(message = "引导语不能为空")
private String welcomeMsg; private String welcomeMsg;
/** /**
* 发送方式 0: 企业群发 1:个人群发 * 发送方式 0: 企业群发 1:个人群发
*/ */
@ApiModelProperty("加群引导语")
@NotNull(message = "发送方式不能为空")
private Integer sendType; private Integer sendType;
/** /**
* 群活码id * 群活码id
*/ */
@ApiModelProperty("群活码id")
@NotNull(message = "活码不能为空")
private Long groupCodeId; private Long groupCodeId;
/** /**
* 发送范围 0: 全部客户 1:部分客户 * 发送范围 0: 全部客户 1:部分客户
*/ */
@ApiModelProperty("发送范围 0: 全部客户 1:部分客户")
private Integer sendScope; private Integer sendScope;
/** /**
* 发送性别 0: 全部 1: 男 2: 女 3:未知 * 发送性别 0: 全部 1: 男 2: 女 3:未知
*/ */
@ApiModelProperty("发送性别 0: 全部 1: 男 2: 女 3:未知")
private Integer sendGender; private Integer sendGender;
/** /**
* 目标客户被添加起始时间 * 目标客户被添加起始时间
*/ */
private String cusBeginTime; @ApiModelProperty("目标客户被添加起始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date cusBeginTime;
/** /**
* 目标客户被添加结束时间 * 目标客户被添加结束时间
*/ */
private String cusEndTime; @ApiModelProperty("目标客户被添加结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date cusEndTime;
/** /**
* 企业群发消息的id * 群发消息id
*/ */
private String msgid; @ApiModelProperty(value = "目标客户被添加结束时间", hidden = true)
private Long messageTemplateId;
/** /**
* 逻辑删除字段 * 逻辑删除字段
*/ */
@TableLogic(value = "0", delval = "1") @ApiModelProperty(value = "逻辑删除字段", hidden = true)
private Integer delFlag; private Integer delFlag = 0;
/**
* 客户标签
*/
@ApiModelProperty("客户标签id列表")
@TableField(exist = false)
private List<String> tagList;
/**
* 选择员工
*/
@ApiModelProperty("员工id列表")
@TableField(exist = false)
private List<String> scopeList;
/**
* 群活码链接
*/
@ApiModelProperty("群活码链接")
@TableField(exist = false)
private String codeUrl;
/**
* 当前群总人数
*/
@ApiModelProperty("当前群总人数")
@TableField(exist = false)
private Integer totalNumber;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* 老客户标签建群任务使用人对象 * 老客户标签建群任务使用人对象
*/ */
@ApiModel("老客户标签建群跟进者")
@EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("we_pres_tag_group_scope") @TableName("we_pres_tag_group_scope")
public class WePresTagGroupTaskScope { public class WePresTagGroupTaskScope extends BaseEntity {
private static final long serialVersionUID = 86648978618184060L;
/** /**
* 老客户标签建群任务id * 老客户标签建群任务id
*/ */
@ApiModelProperty("老客户标签建群任务id")
private Long taskId; private Long taskId;
/** /**
* 任务目标员工id * 任务目标员工id
*/ */
@ApiModelProperty("任务目标员工id")
private String weUserId; private String weUserId;
/**
* 是否已处理
*/
private boolean isDone;
@ApiModelProperty(value = "有效标识", hidden = true)
@JsonIgnore
private Integer delFlag = 0;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.NoArgsConstructor;
/** /**
* 老客户标签建群客户统计 * 老客户标签建群客户统计(用于个人群发类型的统计)
*/ */
@ApiModel("老客标签建群发送统计对象")
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("we_pres_tag_group_stat") @TableName("we_pres_tag_group_stat")
public class WePresTagGroupTaskStat extends BaseEntity { public class WePresTagGroupTaskStat extends BaseEntity {
private static final long serialVersionUID = 504772877084507165L;
/** /**
* 老客户标签建群任务id * 老客户标签建群任务id
*/ */
@ApiModelProperty("老客户标签建群任务id")
private Long taskId; private Long taskId;
/** /**
* 客户id * 客户名称
*/ */
@ApiModelProperty("客户名称")
@TableField(exist = false)
private String customerName; private String customerName;
/** /**
* 跟进者id
*/
@ApiModelProperty("跟进者")
private String userId;
/**
* 客户external_id
*/
@ApiModelProperty("老客户标签建群任务id")
@TableField(value = "external_userid")
private String externalUserId;
/**
* 是否已送达 * 是否已送达
*/ */
private boolean isSent; @ApiModelProperty("老客户标签建群任务id")
private Integer sent = 0;
/** /**
* 是否已经在群 * 是否已经在群
*/ */
private boolean isInGroup; @ApiModelProperty("老客户标签建群任务id")
@TableField(exist = false)
private Integer inGroup = 0;
@ApiModelProperty(value = "有效标识", hidden = true)
@JsonIgnore
private Integer delFlag = 0;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* 老客标签建群任务标签关联对象 * 老客标签建群任务标签关联对象
*/ */
@ApiModel("老客标签建群标签")
@EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("we_pres_tag_group_tag") @TableName("we_pres_tag_group_tag")
public class WePresTagGroupTaskTag { public class WePresTagGroupTaskTag extends BaseEntity {
private static final long serialVersionUID = 4859443233276436220L;
/** /**
* 老客建群任务id * 老客建群任务id
*/ */
@ApiModelProperty("老客建群任务id")
private Long taskId; private Long taskId;
/** /**
* 标签id * 标签id
*/ */
@ApiModelProperty("标签id")
private String tagId; private String tagId;
/**
* 有效标识
*/
@ApiModelProperty("有效标识")
@JsonIgnore
private Integer delFlag = 0;
} }
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@TableName("we_scan_emple_code_count")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeScanEmpleCodeCount {
@TableId
private Long id;
private String externalUserid;
private String userId;
private Date createTime;
private Long empleCodeId;
}
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* 社群运营 老客户标签建群
*/
@Data
public class WePresTagGroupTaskDto {
/**
* 任务名称
*/
@NotNull(message = "任务名称不能为空")
private String taskName;
/**
* 发送方式 0: 企业群发 1:个人群发
*/
@NotNull(message = "发送方式不能为空")
private Integer sendType;
/**
* 加群引导语
*/
@Size(max = 64, message = "引导与不能超过64字符")
@NotBlank(message = "引导语不能为空")
private String welcomeMsg;
/**
* 群活码id
*/
@NotNull(message = "活码不能为空")
private Long groupCodeId;
/**
* 客户标签
*/
private List<String> tagList;
/**
* 选择员工
*/
private List<String> scopeList;
/**
* 发送范围 0: 全部客户 1:部分客户
*/
private Integer sendScope;
/**
* 发送性别 0: 全部 1: 男 2: 女 3:未知
*/
private Integer sendGender;
/**
* 目标客户被添加起始时间
*/
private String cusBeginTime;
/**
* 目标客户被添加结束时间
*/
private String cusEndTime;
}
...@@ -93,6 +93,9 @@ public class ExternalUserDetail extends WeResultDto { ...@@ -93,6 +93,9 @@ public class ExternalUserDetail extends WeResultDto {
private String oper_userid; private String oper_userid;
/**标签**/ /**标签**/
private String[] tag_id; private String[] tag_id;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */
private String state;
} }
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.query; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.query;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import com.linkwechat.common.enums.MessageType; import com.linkwechat.common.enums.MessageType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.wecom.domain.WeMessageTemplate; import com.linkwechat.wecom.domain.WeMessageTemplate;
...@@ -50,9 +51,8 @@ public class WeAddMsgTemplateQuery { ...@@ -50,9 +51,8 @@ public class WeAddMsgTemplateQuery {
} }
public void setAttachments(List<WeMessageTemplate> messageTemplates) { public void setAttachments(List<WeMessageTemplate> messageTemplates) {
final int size = 10; if (CollectionUtil.isNotEmpty(messageTemplates)) {
this.attachments = new ArrayList<>(16); this.attachments = Lists.newArrayList();
if (CollectionUtil.isNotEmpty(messageTemplates) && messageTemplates.size() < size) {
messageTemplates.forEach(messageTemplate -> { messageTemplates.forEach(messageTemplate -> {
if (ObjectUtil.equal(MessageType.IMAGE.getMessageType(), messageTemplate.getMsgType())) { if (ObjectUtil.equal(MessageType.IMAGE.getMessageType(), messageTemplate.getMsgType())) {
Attachments images = new Images(messageTemplate.getMsgType(), messageTemplate.getMediaId(), Attachments images = new Images(messageTemplate.getMsgType(), messageTemplate.getMediaId(),
...@@ -74,8 +74,6 @@ public class WeAddMsgTemplateQuery { ...@@ -74,8 +74,6 @@ public class WeAddMsgTemplateQuery {
attachments.add(files); attachments.add(files);
} }
}); });
} else {
throw new WeComException("仅支持最多同时发送9个附件");
} }
} }
......
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class SenderInfo implements Serializable {
private static final long serialVersionUID = 3912731370147355807L;
/**
* 跟进员工user_id
*/
private String userId;
/**
* 客户external_userid
*/
private String customerList;
}
...@@ -28,4 +28,35 @@ public class WeAllocateCustomersVo extends BaseEntity { ...@@ -28,4 +28,35 @@ public class WeAllocateCustomersVo extends BaseEntity {
/**原拥有着*/ /**原拥有着*/
private String handoverUserId; private String handoverUserId;
private String avatar;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
//0-未知 1-男性 2-女性
private Integer gender;
//查询标签id
private String tagIds;
//标签名称,使用逗号隔开
private String tagNames;
//跟进人名称
private String userName;
//添加时间
@JsonFormat(pattern = "yyyy-MM-dd")
private Date firstAddTime;
} }
package com.linkwechat.wecom.domain.vo; package com.linkwechat.wecom.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
/** /**
* 社群运营相关任务执行人信息 * 社群运营相关任务执行人信息
*/ */
@ApiModel("社群运营任务跟进人")
@Data @Data
public class WeCommunityTaskEmplVo { public class WeCommunityTaskEmplVo implements Serializable {
private static final long serialVersionUID = 1004068763061592787L;
/** /**
* 员工id * 员工id
*/ */
@ApiModelProperty("员工id")
private String userId; private String userId;
/** /**
* 员工名称 * 员工名称
*/ */
@ApiModelProperty("员工名称")
private String name; private String name;
/** /**
* 员工头像 * 员工头像
*/ */
@ApiModelProperty("员工头像")
private String avatar; private String avatar;
/** /**
* 是否已完成任务 * 是否已完成任务
*/ */
@ApiModelProperty("是否已完成任务")
private boolean isDone; private boolean isDone;
} }
...@@ -48,4 +48,8 @@ public class WeGroupMessageDetailVo { ...@@ -48,4 +48,8 @@ public class WeGroupMessageDetailVo {
@ApiModelProperty("未送达客户数") @ApiModelProperty("未送达客户数")
private Integer toBeSendCustomerNum; private Integer toBeSendCustomerNum;
@ApiModelProperty("同步时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date refreshTime;
} }
package com.linkwechat.wecom.domain.vo; package com.linkwechat.wecom.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.enums.CommunityTaskType; import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.wecom.domain.WeTag; import com.linkwechat.wecom.domain.WeTag;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* 老客标签建群任务Vo * 老客标签建群任务Vo
*/ */
@Data @Data
public class WePresTagGroupTaskVo { public class WePresTagGroupTaskVo implements Serializable {
private static final long serialVersionUID = 1110810083969589691L;
/** /**
* 类型。该属性仅用于H5页面与SOP混合列表的任务类型判断 * 类型。该属性仅用于H5页面与SOP混合列表的任务类型判断
*/ */
@TableField(exist = false)
private final Integer type = CommunityTaskType.TAG.getType(); private final Integer type = CommunityTaskType.TAG.getType();
/** /**
...@@ -39,7 +38,7 @@ public class WePresTagGroupTaskVo { ...@@ -39,7 +38,7 @@ public class WePresTagGroupTaskVo {
private String welcomeMsg; private String welcomeMsg;
/** /**
* 群活吗id * 群活码id
*/ */
@JsonIgnore @JsonIgnore
private Long codeId; private Long codeId;
...@@ -50,7 +49,6 @@ public class WePresTagGroupTaskVo { ...@@ -50,7 +49,6 @@ public class WePresTagGroupTaskVo {
@JsonIgnore @JsonIgnore
private String codeUrl; private String codeUrl;
@TableField(exist = false)
private WeGroupCodeVo groupCodeInfo; private WeGroupCodeVo groupCodeInfo;
/** /**
...@@ -66,13 +64,11 @@ public class WePresTagGroupTaskVo { ...@@ -66,13 +64,11 @@ public class WePresTagGroupTaskVo {
/** /**
* 使用员工 * 使用员工
*/ */
@TableField(exist = false)
private List<WeCommunityTaskEmplVo> scopeList; private List<WeCommunityTaskEmplVo> scopeList;
/** /**
* 标签 * 标签
*/ */
@TableField(exist = false)
private List<WeTag> tagList; private List<WeTag> tagList;
/** /**
...@@ -96,11 +92,6 @@ public class WePresTagGroupTaskVo { ...@@ -96,11 +92,6 @@ public class WePresTagGroupTaskVo {
private String cusEndTime; private String cusEndTime;
/** /**
* msgid
*/
private String msgid;
/**
* 创建者 * 创建者
*/ */
private String createBy; private String createBy;
...@@ -109,7 +100,7 @@ public class WePresTagGroupTaskVo { ...@@ -109,7 +100,7 @@ public class WePresTagGroupTaskVo {
* 创建时间 * 创建时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private String createTime;
/** /**
* 更新人 * 更新人
...@@ -122,11 +113,4 @@ public class WePresTagGroupTaskVo { ...@@ -122,11 +113,4 @@ public class WePresTagGroupTaskVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String updateTime; private String updateTime;
/**
* 设置群活码信息
*/
public void fillGroupCodeVo() {
WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(),this.getCodeUrl());
this.setGroupCodeInfo(groupCodeVo);
}
} }
package com.linkwechat.wecom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ApiModel("老客标签建群列表接口简略信息")
@Data
public class WePresTagTaskListVO implements Serializable {
private static final long serialVersionUID = -2266869943970611146L;
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("任务名")
private String taskName;
@ApiModelProperty("标签名列表")
private List<String> tagList;
@ApiModelProperty("发送类型 0: 企业群发 1: 个人群发")
private Integer sendType;
// @ApiModelProperty("群活码id")
// private String codeId;
//
// @ApiModelProperty("群活码URL")
// private String codeUrl;
@ApiModelProperty("当前群人数")
private Integer totalMember;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
@ApiModelProperty("创建者")
@JsonFormat(pattern = "yyyy-MM-dd")
private String createBy;
@JsonIgnore
private String tagListStr;
}
package com.linkwechat.wecom.factory.impl.customer; package com.linkwechat.wecom.factory.impl.customer;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -61,6 +62,10 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -61,6 +62,10 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
private WeCustomerClient weCustomerClient; private WeCustomerClient weCustomerClient;
@Autowired
private IWeScanEmpleCodeCountService iWeScanEmpleCodeCountService;
@Override @Override
public void eventHandle(WxCpXmlMessageVO message) { public void eventHandle(WxCpXmlMessageVO message) {
if (message.getExternalUserId() != null) { if (message.getExternalUserId() != null) {
...@@ -122,7 +127,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -122,7 +127,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
} }
/** /**
* 活码欢迎语发送 * 活码欢迎语发送(扫码回掉)
* *
* @param state 渠道 * @param state 渠道
* @param wecomCode 欢迎语code * @param wecomCode 欢迎语code
...@@ -137,6 +142,15 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -137,6 +142,15 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
WeWelcomeMsg.WeWelcomeMsgBuilder weWelcomeMsgBuilder = WeWelcomeMsg.builder().welcome_code(wecomCode); WeWelcomeMsg.WeWelcomeMsgBuilder weWelcomeMsgBuilder = WeWelcomeMsg.builder().welcome_code(wecomCode);
WeEmpleCodeDto messageMap = weEmpleCodeService.selectWelcomeMsgByState(state); WeEmpleCodeDto messageMap = weEmpleCodeService.selectWelcomeMsgByState(state);
if (StringUtils.isNotNull(messageMap)) { if (StringUtils.isNotNull(messageMap)) {
//扫码统计记录入库
iWeScanEmpleCodeCountService.save(
WeScanEmpleCodeCount.builder()
.empleCodeId(Long.valueOf(state))
.createTime(new Date())
.userId(userId)
.externalUserid(externalUserId)
.build());
//查询活码对应标签 //查询活码对应标签
List<WeEmpleCodeTag> tagList = weEmpleCodeTagService.list(new LambdaQueryWrapper<WeEmpleCodeTag>() List<WeEmpleCodeTag> tagList = weEmpleCodeTagService.list(new LambdaQueryWrapper<WeEmpleCodeTag>()
.eq(WeEmpleCodeTag::getEmpleCodeId, messageMap.getEmpleCodeId())); .eq(WeEmpleCodeTag::getEmpleCodeId, messageMap.getEmpleCodeId()));
......
package com.linkwechat.wecom.factory.impl.customer; package com.linkwechat.wecom.factory.impl.customer;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeEmpleCodeTag; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto; import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.dto.WeMediaDto;
import com.linkwechat.wecom.domain.dto.WeWelcomeMsg; import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
...@@ -45,6 +44,9 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy { ...@@ -45,6 +44,9 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
@Autowired @Autowired
private IWeMaterialService weMaterialService; private IWeMaterialService weMaterialService;
@Autowired
private IWeScanEmpleCodeCountService iWeScanEmpleCodeCountService;
@Override @Override
public void eventHandle(WxCpXmlMessageVO message) { public void eventHandle(WxCpXmlMessageVO message) {
try { try {
...@@ -53,6 +55,15 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy { ...@@ -53,6 +55,15 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
} }
//向扫码客户发送欢迎语 //向扫码客户发送欢迎语
if (message.getState() != null && message.getWelcomeCode() != null) { if (message.getState() != null && message.getWelcomeCode() != null) {
//扫码统计记录入库
iWeScanEmpleCodeCountService.save(
WeScanEmpleCodeCount.builder()
.empleCodeId(Long.valueOf(message.getState()))
.createTime(new Date())
.userId(message.getUserId())
.externalUserid(message.getExternalUserId())
.build());
log.info("执行发送欢迎语>>>>>>>>>>>>>>>"); log.info("执行发送欢迎语>>>>>>>>>>>>>>>");
WeWelcomeMsg.WeWelcomeMsgBuilder weWelcomeMsgBuilder = WeWelcomeMsg.builder().welcome_code(message.getWelcomeCode()); WeWelcomeMsg.WeWelcomeMsgBuilder weWelcomeMsgBuilder = WeWelcomeMsg.builder().welcome_code(message.getWelcomeCode());
WeEmpleCodeDto messageMap = weEmpleCodeService.selectWelcomeMsgByScenario(message.getState(),message.getUserId()); WeEmpleCodeDto messageMap = weEmpleCodeService.selectWelcomeMsgByScenario(message.getState(),message.getUserId());
......
package com.linkwechat.wecom.factory.impl.customer; package com.linkwechat.wecom.factory.impl.customer;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.WeSensitiveAct;
import com.linkwechat.wecom.domain.WeSensitiveActHit;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO; import com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO;
import com.linkwechat.wecom.factory.WeEventStrategy; import com.linkwechat.wecom.factory.WeEventStrategy;
import com.linkwechat.wecom.service.IWeCustomerService; import com.linkwechat.wecom.service.IWeCustomerService;
...@@ -15,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author danmo * @author danmo
...@@ -52,13 +51,26 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy { ...@@ -52,13 +51,26 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy {
WeUser user = weUserService.getById(message.getUserId()); WeUser user = weUserService.getById(message.getUserId());
weSensitiveActHit.setOperator(user.getName()); weSensitiveActHit.setOperator(user.getName());
WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>()
.eq(WeCustomer::getExternalUserid,message.getExternalUserId())
.eq(WeCustomer::getFirstUserId,message.getUserId()));
weSensitiveActHit.setOperateTargetId(weCustomer.getUserId()); List<WeCustomerList> weCustomerList = weCustomerService.findWeCustomerList(WeCustomerList.builder()
weSensitiveActHit.setOperateTarget(weCustomer.getName()); .externalUserid(message.getExternalUserId())
.firstUserId(message.getUserId())
.delFlag(new Integer(1))
.build());
if(CollectionUtil.isNotEmpty(weCustomerList)) {
WeCustomerList weCustomer = weCustomerList.stream().findFirst().get();
weSensitiveActHit.setOperateTargetId(weCustomer.getFirstUserId());
weSensitiveActHit.setOperateTarget(weCustomer.getCustomerName());
weSensitiveActHitService.insertWeSensitiveActHit(weSensitiveActHit); weSensitiveActHitService.insertWeSensitiveActHit(weSensitiveActHit);
}
} }
} }
......
package com.linkwechat.wecom.factory.impl.customer; package com.linkwechat.wecom.factory.impl.customer;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
...@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Optional; import java.util.Optional;
/** /**
...@@ -51,10 +53,19 @@ public class WeCallBackDelFollowUserImpl extends WeEventStrategy { ...@@ -51,10 +53,19 @@ public class WeCallBackDelFollowUserImpl extends WeEventStrategy {
Optional.ofNullable(validWeCorpAccount).ifPresent(weCorpAccount -> { Optional.ofNullable(validWeCorpAccount).ifPresent(weCorpAccount -> {
String customerChurnNoticeSwitch = weCorpAccount.getCustomerChurnNoticeSwitch(); String customerChurnNoticeSwitch = weCorpAccount.getCustomerChurnNoticeSwitch();
if (WeConstans.DEL_FOLLOW_USER_SWITCH_OPEN.equals(customerChurnNoticeSwitch)) { if (WeConstans.DEL_FOLLOW_USER_SWITCH_OPEN.equals(customerChurnNoticeSwitch)) {
WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>().eq(WeCustomer::getFirstUserId,message.getUserId())
.eq(WeCustomer::getExternalUserid,message.getExternalUserId()));
String content = "您已经被客户@" + weCustomer.getName() + "删除!"; List<WeCustomerList> weCustomerList = weCustomerService.findWeCustomerList(WeCustomerList.builder()
.externalUserid(message.getExternalUserId())
.firstUserId(message.getUserId())
.delFlag(new Integer(1))
.build());
if(CollectionUtil.isNotEmpty(weCustomerList)){
WeCustomerList weCustomer = weCustomerList.stream().findFirst().get();
String content = "您已经被客户@" + weCustomer.getCustomerName() + "删除!";
TextMessageDto textMessageDto = new TextMessageDto(); TextMessageDto textMessageDto = new TextMessageDto();
textMessageDto.setContent(content); textMessageDto.setContent(content);
WeMessagePushDto weMessagePushDto = new WeMessagePushDto(); WeMessagePushDto weMessagePushDto = new WeMessagePushDto();
...@@ -77,12 +88,20 @@ public class WeCallBackDelFollowUserImpl extends WeEventStrategy { ...@@ -77,12 +88,20 @@ public class WeCallBackDelFollowUserImpl extends WeEventStrategy {
weSensitiveActHit.setCreateTime(new Date(message.getCreateTime())); weSensitiveActHit.setCreateTime(new Date(message.getCreateTime()));
weSensitiveActHit.setCreateBy("admin"); weSensitiveActHit.setCreateBy("admin");
WeUser user = weUserService.getById(message.getUserId()); WeUser user = weUserService.getById(message.getUserId());
weSensitiveActHit.setOperatorId(weCustomer.getUserId()); weSensitiveActHit.setOperatorId(weCustomer.getFirstUserId());
weSensitiveActHit.setOperator(weCustomer.getName()); weSensitiveActHit.setOperator(weCustomer.getCustomerName());
weSensitiveActHit.setOperateTargetId(user.getUserId()); weSensitiveActHit.setOperateTargetId(user.getUserId());
weSensitiveActHit.setOperateTarget(user.getName()); weSensitiveActHit.setOperateTarget(user.getName());
weSensitiveActHitService.insertWeSensitiveActHit(weSensitiveActHit); weSensitiveActHitService.insertWeSensitiveActHit(weSensitiveActHit);
} }
}
} }
}); });
......
...@@ -122,9 +122,9 @@ public class WeGroupMessageTaskHandler implements ApplicationRunner { ...@@ -122,9 +122,9 @@ public class WeGroupMessageTaskHandler implements ApplicationRunner {
void getMediaId(List<WeMessageTemplate> messageTemplates){ void getMediaId(List<WeMessageTemplate> messageTemplates){
Optional.ofNullable(messageTemplates).orElseGet(ArrayList::new).forEach(messageTemplate -> { Optional.ofNullable(messageTemplates).orElseGet(ArrayList::new).forEach(messageTemplate -> {
if (ObjectUtil.equal(MessageType.IMAGE.getMessageType(), messageTemplate.getMsgType())) { if (ObjectUtil.equal(MessageType.IMAGE.getMessageType(), messageTemplate.getMsgType())) {
WeMediaDto weMedia = weMaterialService.uploadTemporaryMaterial(messageTemplate.getMediaId() WeMediaDto weMedia = weMaterialService.uploadTemporaryMaterial(messageTemplate.getPicUrl()
,MessageType.IMAGE.getMessageType() ,MessageType.IMAGE.getMessageType()
,FileUtil.getName(messageTemplate.getMediaId())); ,FileUtil.getName(messageTemplate.getPicUrl()));
messageTemplate.setMediaId(weMedia.getMedia_id()); messageTemplate.setMediaId(weMedia.getMedia_id());
}else if (ObjectUtil.equal(MessageType.MINIPROGRAM.getMessageType(), messageTemplate.getMsgType())) { }else if (ObjectUtil.equal(MessageType.MINIPROGRAM.getMessageType(), messageTemplate.getMsgType())) {
WeMediaDto weMedia = weMaterialService.uploadTemporaryMaterial(messageTemplate.getMediaId() WeMediaDto weMedia = weMaterialService.uploadTemporaryMaterial(messageTemplate.getMediaId()
......
...@@ -122,7 +122,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -122,7 +122,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param weCustomerList * @param weCustomerList
* @return * @return
*/ */
List<WeCustomerList> findWeCustomerList(WeCustomerList weCustomerList); List<WeCustomerList> findWeCustomerList(@Param("weCustomerList") WeCustomerList weCustomerList);
/** /**
......
...@@ -21,7 +21,7 @@ public interface WeCustomerMessageTimeTaskMapper extends BaseMapper<WeCustomerMe ...@@ -21,7 +21,7 @@ public interface WeCustomerMessageTimeTaskMapper extends BaseMapper<WeCustomerMe
* @param timeMillis 当前时间毫秒数 * @param timeMillis 当前时间毫秒数
* @return {@link WeCustomerMessageTimeTask}s * @return {@link WeCustomerMessageTimeTask}s
*/ */
List<WeCustomerMessageTimeTask> selectWeCustomerMessageTimeTaskGteSettingTime(@Param("beginTime") Long beginTime,@Param("endTime") Long endTime); List<WeCustomerMessageTimeTask> selectWeCustomerMessageTimeTaskGteSettingTime(@Param("timeMillis") long timeMillis);
/** /**
* 保存群发任务 * 保存群发任务
......
...@@ -82,8 +82,8 @@ public interface WeFlowerCustomerRelMapper extends BaseMapper<WeFlowerCustomerRe ...@@ -82,8 +82,8 @@ public interface WeFlowerCustomerRelMapper extends BaseMapper<WeFlowerCustomerRe
/** /**
* 成员添加客户统计 * 成员添加客户统计
* @param weFlowerCustomerRel * @param
* @return * @return
*/ */
public List<Map<String,Object>> getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel); public List<Map<String,Object>> getUserAddCustomerStat(@Param("codeId") String codeId,@Param("beginTime") String beginTime,@Param("endTime") String endTime);
} }
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.vo.SenderInfo;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo; import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo;
import com.linkwechat.wecom.domain.vo.WePresTagTaskListVO;
import org.apache.ibatis.annotations.Mapper; 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.security.core.parameters.P;
import java.util.List; import java.util.List;
...@@ -16,27 +18,6 @@ import java.util.List; ...@@ -16,27 +18,6 @@ import java.util.List;
public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> { public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> {
/** /**
* 添加新任务
* @param task 老客标签建群任务
* @return 结果
*/
int insertTask(WePresTagGroupTask task);
/**
* 更新任务
* @param task 建群任务信息
* @return 结果
*/
int updateTask(WePresTagGroupTask task);
/**
* 获取老客户标签建群任务
*
* @param taskId 任务id
* @return 结果
*/
WePresTagGroupTaskVo selectTaskById(Long taskId);
/**
* 根据条件查询老客标签建群任务 * 根据条件查询老客标签建群任务
* *
* @param taskName 任务名称 * @param taskName 任务名称
...@@ -46,36 +27,68 @@ public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask> ...@@ -46,36 +27,68 @@ public interface WePresTagGroupTaskMapper extends BaseMapper<WePresTagGroupTask>
* @param sendType 发送方式 * @param sendType 发送方式
* @return 结果 * @return 结果
*/ */
List<WePresTagGroupTaskVo> selectTaskList( List<WePresTagTaskListVO> selectListVO(@Param("taskName") String taskName,
@Param("taskName") String taskName,
@Param("sendType") Integer sendType, @Param("sendType") Integer sendType,
@Param("createBy") String createBy, @Param("createBy") String createBy,
@Param("beginTime") String beginTime, @Param("beginTime") String beginTime,
@Param("endTime") String endTime @Param("endTime") String endTime);
);
/**
* 获取老客户标签建群任务
*
* @param taskId 任务id
* @return 结果
*/
WePresTagGroupTaskVo selectTaskById(Long taskId);
/** /**
* 获取某员工的任务 * 获取某员工的任务
* *
* @param emplId 员工id * @param followerId 员工id
* @param isDone 已完成的还是待处理 * @param isDone 已完成的还是待处理
* @return 结果 * @return 结果
*/ */
List<WePresTagGroupTaskVo> getTaskListByEmplId(@Param("emplId") String emplId, @Param("isDone") boolean isDone); List<WePresTagGroupTaskVo> getTaskListByFollowerId(@Param("followerId") String followerId, @Param("isDone") Integer isDone);
/** /**
* 根据task获取员工信息 * 获取指定条件的外部联系人id,且需要排除已经在群的客户
* @param task *
* @return * @param taskId 标签建群任务id
* @return 客户的external_userids字段值数组
*/ */
List<String> selectStaffList(WePresTagGroupTask task); List<WeCustomer> selectTaskExternalIds(@Param("taskId") Long taskId);
List<String> selectExternalUserIds( /**
@Param("taskId") Long taskId, * 获取指定条件的外部联系人id,且需要排除已经在群的客户
@Param("hasScope") boolean hasScope, *
@Param("hasTag") boolean hasTag, * @param taskId 标签建群任务id
@Param("gender") Integer gender, * @return 客户的external_userids字段值数组
@Param("beginTime") String beginTime, */
@Param("endTime") String endTime List<SenderInfo> selectSenderInfo(@Param("taskId") Long taskId);
);
/**
* 获取指定条件的员工id
*
* @param taskId 标签建群任务id
* @return 获取目标客户对应员工的id数组
*/
List<String> selectTaskFollowerIds(@Param("taskId") Long taskId);
/**
* 根据任务id和员工id获取客户的external_id
*
* @param taskId 任务id
* @param followerId 跟进者user_id字段
* @return 客户external_id列表
*/
List<String> selectTaskExternalByFollowerId(@Param("taskId") Long taskId, @Param("followerId") String followerId);
/**
* 通过taskId获取所有对应群聊的客户的external_id, 用于个人群发的统计
*
* @param taskId 老客标签建群任务id
* @return 结果
*/
List<String> getGroupMemberExternalIdsByTaskId(Long taskId);
} }
...@@ -28,12 +28,4 @@ public interface WePresTagGroupTaskScopeMapper extends BaseMapper<WePresTagGroup ...@@ -28,12 +28,4 @@ public interface WePresTagGroupTaskScopeMapper extends BaseMapper<WePresTagGroup
*/ */
int batchBindsTaskScopes(List<WePresTagGroupTaskScope> taskScopeList); int batchBindsTaskScopes(List<WePresTagGroupTaskScope> taskScopeList);
/**
* 员工发送信息后,变更其任务状态为 "完成"
*
* @param taskId 任务id
* @param emplId 员工id
* @return 结果
*/
int updateEmplTaskStatus(@Param("taskId") Long taskId, @Param("emplId") String emplId);
} }
...@@ -11,22 +11,21 @@ import org.springframework.stereotype.Repository; ...@@ -11,22 +11,21 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Mapper @Mapper
@Repository
public interface WePresTagGroupTaskStatMapper extends BaseMapper<WePresTagGroupTaskStat> { public interface WePresTagGroupTaskStatMapper extends BaseMapper<WePresTagGroupTaskStat> {
int batchSave(List<WePresTagGroupTaskStat> stats);
/** /**
* 根据 老客标签建群任务id及附属相关属性条件获取任务对应的客户统计 * 获取老客标签建群任务的消息发送结果
* * @param stat 过滤条件
* @param taskId 任务id * @return 发送结果列表
* @return 客户统计列表
*/ */
List<WePresTagGroupTaskStatVo> selectStatInfoByTaskId(@Param("taskId") Long taskId); List<WePresTagGroupTaskStat> cropSendResultList(WePresTagGroupTaskStat stat);
/** /**
* 通过taskId获取所有外部联系人id * 获取老客标签建群任务的消息发送结果
* * @param stat 过滤条件
* @param taskId 老客标签建群任务id * @return 发送结果列表
* @return 结果
*/ */
List<String> getAllExternalIdByTaskId(Long taskId); List<WePresTagGroupTaskStat> singleSendResultList(WePresTagGroupTaskStat stat);
} }
...@@ -2,9 +2,7 @@ package com.linkwechat.wecom.mapper; ...@@ -2,9 +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.WePresTagGroupTaskTag; import com.linkwechat.wecom.domain.WePresTagGroupTaskTag;
import com.linkwechat.wecom.domain.WeTag;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -12,30 +10,13 @@ import java.util.List; ...@@ -12,30 +10,13 @@ import java.util.List;
* 老客户标签建群任务tag mapper接口 * 老客户标签建群任务tag mapper接口
*/ */
@Mapper @Mapper
@Repository
public interface WePresTagGroupTaskTagMapper extends BaseMapper<WePresTagGroupTaskTag> { public interface WePresTagGroupTaskTagMapper extends BaseMapper<WePresTagGroupTaskTag> {
/** /**
* 通过标签建群任务id获取该任务对应所有标签
*
* @param taskId 建群任务id
* @return 标签Vo列表
*/
List<WeTag> getTagListByTaskId(Long taskId);
/**
* 批量绑定建群任务与标签 * 批量绑定建群任务与标签
* *
* @param taskTagList 任务-标签关联对象 * @param taskTagList 任务-标签关联对象
* @return 结果 * @return 结果
*/ */
int batchBindsTaskTags(List<WePresTagGroupTaskTag> taskTagList); int batchBindsTaskTags(List<WePresTagGroupTaskTag> taskTagList);
/**
* 通过任务id获取所有符合该任务标签的客户的external_id
*
* @param taskId 热任务id
* @return 结果
*/
List<String> getExternalUserIdListByTaskId(Long taskId);
} }
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeScanEmpleCodeCount;
public interface WeScanEmpleCodeCountMapper extends BaseMapper<WeScanEmpleCodeCount> {
}
...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessage; import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto; import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
...@@ -50,6 +51,6 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> { ...@@ -50,6 +51,6 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
* @param messageId * @param messageId
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) throws JsonProcessingException; public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups) throws JsonProcessingException;
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult; import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto; import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
...@@ -34,6 +35,6 @@ public interface IWeCustomerMessgaeResultService extends IService<WeCustomerMess ...@@ -34,6 +35,6 @@ public interface IWeCustomerMessgaeResultService extends IService<WeCustomerMess
* @param messageId * @param messageId
* @return * @return
*/ */
int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomer> customers, List<WeGroup> groups); int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups);
} }
...@@ -10,6 +10,7 @@ import com.linkwechat.wecom.domain.dto.WeWelcomeMsg; ...@@ -10,6 +10,7 @@ import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
import com.linkwechat.wecom.domain.vo.WeCustomerDetailVo; import com.linkwechat.wecom.domain.vo.WeCustomerDetailVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -155,4 +156,7 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -155,4 +156,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
* @param params * @param params
*/ */
void getCustomerByCondition(JSONObject params); void getCustomerByCondition(JSONObject params);
void batchAddOrUpdate(List<WeCustomer> weCustomer);
} }
...@@ -23,9 +23,9 @@ public interface IWeFlowerCustomerRelService extends IService<WeFlowerCustomerRe ...@@ -23,9 +23,9 @@ public interface IWeFlowerCustomerRelService extends IService<WeFlowerCustomerRe
/** /**
* 成员添加客户统计 * 成员添加客户统计
* @param weFlowerCustomerRel * @param
* @return Map * @return Map
*/ */
public Map<String,Object> getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel); public Map<String,Object> getUserAddCustomerStat(String codeId,String beginTime,String endTime);
} }
...@@ -74,7 +74,7 @@ public interface IWeGroupCodeActualService extends IService<WeGroupCodeActual> ...@@ -74,7 +74,7 @@ public interface IWeGroupCodeActualService extends IService<WeGroupCodeActual>
* @param weGroupCodeActual 实际码 * @param weGroupCodeActual 实际码
* @return 结果 * @return 结果
*/ */
public boolean checkChatIdUnique(WeGroupCodeActual weGroupCodeActual); // public boolean checkChatIdUnique(WeGroupCodeActual weGroupCodeActual);
/** /**
* 通过群id递增其实际群活码扫码次数 * 通过群id递增其实际群活码扫码次数
......
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WePresTagGroupTask; import com.linkwechat.wecom.domain.WePresTagGroupTask;
import com.linkwechat.wecom.domain.WeTag; import com.linkwechat.wecom.domain.WePresTagGroupTaskStat;
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.WePresTagTaskListVO;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* 社区运营 老客户标签建群 相关逻辑 * 社区运营 老客户标签建群 相关逻辑
*/ */
public interface IWePresTagGroupTaskService { public interface IWePresTagGroupTaskService extends IService<WePresTagGroupTask> {
/** /**
* 添加新标签建群任务 * 添加新标签建群任务
* *
* @param task 建群任务本体信息 * @param task 建群任务本体信息
* @param tagIdList 标签列表
* @param emplIdList 员工列表
* @return 结果 * @return 结果
*/ */
int add(WePresTagGroupTask task, List<String> tagIdList, List<String> emplIdList); int add(WePresTagGroupTask task);
/** /**
* 根据条件查询任务列表 * 根据条件查询任务列表
...@@ -35,7 +32,7 @@ public interface IWePresTagGroupTaskService { ...@@ -35,7 +32,7 @@ public interface IWePresTagGroupTaskService {
* @param endTime 结束时间 * @param endTime 结束时间
* @return 结果 * @return 结果
*/ */
List<WePresTagGroupTaskVo> selectTaskList(String taskName, Integer sendType, String createBy, String beginTime, String endTime); List<WePresTagTaskListVO> selectTaskList(String taskName, Integer sendType, String createBy, String beginTime, String endTime);
/** /**
* 通过id获取老客标签建群任务 * 通过id获取老客标签建群任务
...@@ -56,20 +53,22 @@ public interface IWePresTagGroupTaskService { ...@@ -56,20 +53,22 @@ public interface IWePresTagGroupTaskService {
/** /**
* 更新老客户标签建群任务 * 更新老客户标签建群任务
* *
* @param taskId 待更新任务id * @param task 待更新任务
* @param wePresTagGroupTaskDto 更新数据
* @return 更新条数 * @return 更新条数
*/ */
int updateTask(Long taskId, WePresTagGroupTaskDto wePresTagGroupTaskDto); int updateTask(WePresTagGroupTask task);
/** /**
* 通过老客标签建群id获取其统计信息 * 根据查询条件获取任务的统计结果
* *
* @param taskId 任务id * @param id 任务id
* @return 统计信息 * @param customerName 客户名
* @param isInGroup 是否在群
* @param isSent 是否送达
* @param sendType 发送类型 0 企业群发 1 个人群发
* @return 统计结果
*/ */
List<WePresTagGroupTaskStatVo> getStatByTaskId(Long taskId); List<WePresTagGroupTaskStat> getTaskStat(Long id, String customerName, Integer isInGroup, Integer isSent, Integer sendType);
/** /**
* 根据任务id获取对应员工信息列表 * 根据任务id获取对应员工信息列表
...@@ -80,37 +79,29 @@ public interface IWePresTagGroupTaskService { ...@@ -80,37 +79,29 @@ public interface IWePresTagGroupTaskService {
List<WeCommunityTaskEmplVo> getScopeListByTaskId(Long taskId); List<WeCommunityTaskEmplVo> getScopeListByTaskId(Long taskId);
/** /**
* 根据任务id获取对应标签信息列表
*
* @param taskId 任务id
* @return 结果
*/
List<WeTag> getTagListByTaskId(Long taskId);
/**
* 获取员工建群任务信息 * 获取员工建群任务信息
* *
* @param emplId 员工id * @param emplId 员工id
* @param isDone 是否已处理 * @param isDone 是否已处理
* @return 结果 * @return 结果
*/ */
List<WePresTagGroupTaskVo> getEmplTaskList(String emplId, boolean isDone); List<WePresTagGroupTaskVo> getFollowerTaskList(String emplId, Integer isDone);
/** /**
* 员工发送信息后,变更其任务状态为 "完成" * 员工在H5任务页面发送信息后,变更其任务状态为 "完成"
* *
* @param taskId 任务id * @param taskId 任务id
* @param emplId 员工id * @param followerId 跟进者id
* @return 结果 * @return 结果
*/ */
int updateEmplTaskStatus(Long taskId, String emplId); int updateFollowerTaskStatus(Long taskId, String followerId);
/** /**
* 根据标签建群任务信息发送消息 * 根据标签建群任务信息发送消息
* *
* @param task 标签建群任务 * @param task 标签建群任务id
*/ */
void sendMessage(WePresTagGroupTask task, List<String> externalIds); void sendMessage(WePresTagGroupTask task);
/** /**
* 任务名是否已占用 * 任务名是否已占用
...@@ -120,12 +111,19 @@ public interface IWePresTagGroupTaskService { ...@@ -120,12 +111,19 @@ public interface IWePresTagGroupTaskService {
*/ */
boolean isNameOccupied(WePresTagGroupTask task); boolean isNameOccupied(WePresTagGroupTask task);
List<String> selectExternalUserIds( /**
Long taskId, * 获取外部联系人id, 用于企业群发的 external_userid参数
boolean hasScope, *
boolean hasTag, * @param taskId 任务id
Integer gender, * @return 外部联系人id
String beginTime, */
String endTime List<String> selectExternalIds(Long taskId);
);
/**
* 获取某个任务选择范围内客户对应的员工id, 用于个人群发的touser参数
*
* @param taskId 任务id
* @return 员工id列表
*/
List<String> selectFollowerIdByTaskId(Long taskId);
} }
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeScanEmpleCodeCount;
public interface IWeScanEmpleCodeCountService extends IService<WeScanEmpleCodeCount> {
}
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.enums.WeEmpleCodeType; import com.linkwechat.common.enums.WeEmpleCodeType;
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.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto; import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
...@@ -215,6 +216,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -215,6 +216,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
WeEmpleCode weEmpleCode = new WeEmpleCode(); WeEmpleCode weEmpleCode = new WeEmpleCode();
weEmpleCode.setId(SnowFlakeUtil.nextId());
// 设置员工和扫码标签 // 设置员工和扫码标签
setScopsAndTags(weEmpleCode, communityNewGroupDto); setScopsAndTags(weEmpleCode, communityNewGroupDto);
...@@ -286,7 +288,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -286,7 +288,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
Optional.ofNullable(empleCode).ifPresent(e -> { Optional.ofNullable(empleCode).ifPresent(e -> {
vo.setEmplCodeUrl(e.getQrCode()); vo.setEmplCodeUrl(e.getQrCode());
vo.setWelcomeMsg(e.getWelcomeMsg()); vo.setWelcomeMsg(e.getWelcomeMsg());
vo.setSkipVerify(e.getIsJoinConfirmFriends().equals(new Integer(1))?true:false); vo.setSkipVerify(e.getIsJoinConfirmFriends().equals(1));
}); });
// 设置群活码信息 // 设置群活码信息
...@@ -309,7 +311,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -309,7 +311,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
.eq(WeGroupCodeActual::getGroupCodeId, vo.getGroupCodeId())); .eq(WeGroupCodeActual::getGroupCodeId, vo.getGroupCodeId()));
if(CollectionUtil.isNotEmpty(codeActuals)){ if(CollectionUtil.isNotEmpty(codeActuals)){
vo.setActualGroupName( vo.setActualGroupName(
String.join(",", codeActuals.stream().map(WeGroupCodeActual::getGroupName).collect(Collectors.toList())) codeActuals.stream().map(WeGroupCodeActual::getGroupName).collect(Collectors.joining(","))
); );
} }
......
...@@ -14,6 +14,7 @@ import com.linkwechat.common.utils.DateUtils; ...@@ -14,6 +14,7 @@ import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient; import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessageTimeTask; import com.linkwechat.wecom.domain.WeCustomerMessageTimeTask;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.dto.WeMediaDto;
...@@ -114,7 +115,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -114,7 +115,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
} }
List<WeCustomer> customers = Lists.newArrayList(); List<WeCustomerList> customers = Lists.newArrayList();
List<WeGroup> groups = new ArrayList<>(); List<WeGroup> groups = new ArrayList<>();
// 0 发给客户 // 0 发给客户
if (customerMessagePushDto.getPushType().equals(WeConstans.SEND_MESSAGE_CUSTOMER)) { if (customerMessagePushDto.getPushType().equals(WeConstans.SEND_MESSAGE_CUSTOMER)) {
...@@ -165,7 +166,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -165,7 +166,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
private void sendMessage(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomer> customers,List<WeGroup> groups ) throws ParseException, JsonProcessingException { private void sendMessage(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers,List<WeGroup> groups ) throws ParseException, JsonProcessingException {
//发送群发消息 //发送群发消息
//调用微信api发送消息 //调用微信api发送消息
...@@ -176,6 +177,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -176,6 +177,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
} else { } else {
WeCustomerMessageTimeTask timeTask = new WeCustomerMessageTimeTask(messageId, customerMessagePushDto, customers, groups WeCustomerMessageTimeTask timeTask = new WeCustomerMessageTimeTask(messageId, customerMessagePushDto, customers, groups
, DateUtils.getMillionSceondsBydate(customerMessagePushDto.getSettingTime())); , DateUtils.getMillionSceondsBydate(customerMessagePushDto.getSettingTime()));
customerMessageTimeTaskMapper.saveWeCustomerMessageTimeTask(timeTask); customerMessageTimeTaskMapper.saveWeCustomerMessageTimeTask(timeTask);
} }
...@@ -197,34 +201,28 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -197,34 +201,28 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
* @param tag 客户标签id列表 * @param tag 客户标签id列表
* @return {@link List}s 客户的外部联系人id列表 * @return {@link List}s 客户的外部联系人id列表
*/ */
public List<WeCustomer> externalUserIds(String pushRange, String staffId, String department, String tag) { public List<WeCustomerList> externalUserIds(String pushRange, String staffId, String department, String tag) {
if (pushRange.equals(WeConstans.SEND_MESSAGE_CUSTOMER_ALL)) { if (pushRange.equals(WeConstans.SEND_MESSAGE_CUSTOMER_ALL)) {
//从redis中读取数据
List<WeCustomer> customers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isEmpty(customers)) {
WeCustomer weCustomer = new WeCustomer(); return weCustomerService.findWeCustomerList(WeCustomerList.builder()
weCustomer.setUserIds(staffId); .userIds(staffId)
weCustomer.setDepartmentIds(department); .departmentIds(department)
customers = weCustomerService.selectWeCustomerAllList(weCustomer); .build());
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
redisCache.expire(WeConstans.WECUSTOMERS_KEY,2 * 60L);
}else{
return customers;
}
WeCustomer weCustomer = new WeCustomer();
weCustomer.setUserIds(staffId);
weCustomer.setDepartmentIds(department);
return weCustomerService.selectWeCustomerListNoRel(weCustomer);
} else { } else {
//按条件查询客户 //按条件查询客户
//通过部门id查询所有的员工 //通过部门id查询所有的员工
//通过员工列表查询该员工的外部联系人列表 //通过员工列表查询该员工的外部联系人列表
WeCustomer weCustomer = new WeCustomer();
weCustomer.setUserIds(staffId); return weCustomerService.findWeCustomerList(WeCustomerList.builder()
weCustomer.setTagIds(tag); .userIds(staffId)
weCustomer.setDepartmentIds(department); .tagIds(tag)
return weCustomerService.selectWeCustomerListNoRel(weCustomer); .departmentIds(department)
.build());
} }
} }
......
...@@ -14,6 +14,7 @@ import com.linkwechat.common.utils.SecurityUtils; ...@@ -14,6 +14,7 @@ import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient; import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessage; import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.dto.WeMediaDto;
...@@ -94,14 +95,15 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM ...@@ -94,14 +95,15 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
} }
@Override @Override
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) throws JsonProcessingException { public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups) throws JsonProcessingException {
List<String> msgid = new ArrayList<>(); List<String> msgid = new ArrayList<>();
//发给客户 //发给客户
if(CollectionUtils.isNotEmpty(customers)){ if(CollectionUtils.isNotEmpty(customers)){
customers.stream().filter(customer -> StringUtils.isNotEmpty(customer.getFirstUserId())) customers.stream().filter(customer -> StringUtils.isNotEmpty(customer.getFirstUserId()))
.collect(Collectors.groupingBy(WeCustomer::getFirstUserId)).forEach((k,v)->{ .collect(Collectors.groupingBy(WeCustomerList::getFirstUserId)).forEach((k,v)->{
customerMessagePushDto.setStaffId(k); customerMessagePushDto.setStaffId(k);
//发送群发消息 //发送群发消息
...@@ -111,16 +113,23 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM ...@@ -111,16 +113,23 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
WeCustomerMessagePushDto messagePushDto = new WeCustomerMessagePushDto(); WeCustomerMessagePushDto messagePushDto = new WeCustomerMessagePushDto();
messagePushDto.setChat_type(ChatType.of(customerMessagePushDto.getPushType()).getName()); messagePushDto.setChat_type(ChatType.of(customerMessagePushDto.getPushType()).getName());
List<String> externalUserIds = v.stream().map(WeCustomer::getExternalUserid).collect(Collectors.toList()); List<String> externalUserIds = v.stream().map(WeCustomerList::getExternalUserid).collect(Collectors.toList());
messagePushDto.setExternal_userid(externalUserIds); messagePushDto.setExternal_userid(externalUserIds);
messagePushDto.setSender(customerMessagePushDto.getStaffId()); messagePushDto.setSender(customerMessagePushDto.getStaffId());
childMessage(messagePushDto, customerMessagePushDto); childMessage(messagePushDto, customerMessagePushDto);
try {
SendMessageResultDto sendMessageResultDto = weCustomerMessagePushClient.sendCustomerMessageToUser(messagePushDto); SendMessageResultDto sendMessageResultDto = weCustomerMessagePushClient.sendCustomerMessageToUser(messagePushDto);
if (WeConstans.WE_SUCCESS_CODE.equals(sendMessageResultDto.getErrcode())) { if (WeConstans.WE_SUCCESS_CODE.equals(sendMessageResultDto.getErrcode())) {
msgid.add(sendMessageResultDto.getMsgid()); msgid.add(sendMessageResultDto.getMsgid());
} }
}catch (Exception e){
log.error("消息发送失败:"+e.getMessage());
}
} }
}); });
} }
......
...@@ -5,6 +5,7 @@ import com.google.common.collect.Lists; ...@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult; import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto; import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
...@@ -36,7 +37,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe ...@@ -36,7 +37,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe
} }
@Override @Override
public int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) { public int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups) {
int size = 0; int size = 0;
// 0 发给客户 // 0 发给客户
...@@ -56,8 +57,8 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe ...@@ -56,8 +57,8 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe
customerMessgaeResult.setSendTime(null); customerMessgaeResult.setSendTime(null);
customerMessgaeResult.setSendType(customerMessgaeResult.getSettingTime() == null ? customerMessagePushDto.getPushType() : "2"); customerMessgaeResult.setSendType(customerMessgaeResult.getSettingTime() == null ? customerMessagePushDto.getPushType() : "2");
customerMessgaeResult.setExternalUserid(customer.getExternalUserid()); customerMessgaeResult.setExternalUserid(customer.getExternalUserid());
customerMessgaeResult.setExternalName(customer.getName()); customerMessgaeResult.setExternalName(customer.getCustomerName());
customerMessgaeResult.setUserid(customer.getUserId()); customerMessgaeResult.setUserid(customer.getFirstUserId());
customerMessgaeResult.setUserName(customer.getUserName()); customerMessgaeResult.setUserName(customer.getUserName());
customerMessgaeResult.setStatus("0"); customerMessgaeResult.setStatus("0");
customerMessgaeResult.setSettingTime(customerMessagePushDto.getSettingTime()); customerMessgaeResult.setSettingTime(customerMessagePushDto.getSettingTime());
......
...@@ -10,6 +10,7 @@ import com.google.common.collect.Lists; ...@@ -10,6 +10,7 @@ import com.google.common.collect.Lists;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.enums.TrajectorySceneType; import com.linkwechat.common.enums.TrajectorySceneType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
...@@ -77,6 +78,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -77,6 +78,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Autowired @Autowired
private IWeCustomerTrajectoryService iWeCustomerTrajectoryService; private IWeCustomerTrajectoryService iWeCustomerTrajectoryService;
@Autowired
private IWeTagService iWeTagService;
// /** // /**
...@@ -166,6 +170,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -166,6 +170,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weCustomer.setFirstUserId(followInfo.getUserid()); weCustomer.setFirstUserId(followInfo.getUserid());
weCustomer.setFirstAddTime(new Date(followInfo.getCreatetime() * 1000L)); weCustomer.setFirstAddTime(new Date(followInfo.getCreatetime() * 1000L));
weCustomer.setAddMethod(followInfo.getAdd_way()); weCustomer.setAddMethod(followInfo.getAdd_way());
weCustomer.setState(followInfo.getState());
weCustomer.setDelFlag(new Integer(0));
weCustomerList.add(weCustomer); weCustomerList.add(weCustomer);
List<String> tags = Stream.of(followInfo.getTag_id()).collect(Collectors.toList()); List<String> tags = Stream.of(followInfo.getTag_id()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(tags)) { if (CollectionUtil.isNotEmpty(tags)) {
...@@ -291,6 +297,21 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -291,6 +297,21 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
List<WeTag> addTag = weMakeCustomerTag.getAddTag(); List<WeTag> addTag = weMakeCustomerTag.getAddTag();
if(CollectionUtil.isNotEmpty(addTag)){ if(CollectionUtil.isNotEmpty(addTag)){
//校验是否有标签在库里不存在
List<WeTag> weTagList = iWeTagService.list(
new LambdaQueryWrapper<WeTag>()
.in(WeTag::getTagId, addTag.stream().map(WeTag::getTagId).collect(Collectors.toList()))
);
if(CollectionUtil.isNotEmpty(weTagList)){
if(addTag.size()!=weTagList.size()){
throw new WeComException("部门标签不存在");
}
}else{
throw new WeComException("部门标签不存在");
}
CutomerTagEdit cutomerTagEdit = CutomerTagEdit.builder() CutomerTagEdit cutomerTagEdit = CutomerTagEdit.builder()
.external_userid(weMakeCustomerTag.getExternalUserid()) .external_userid(weMakeCustomerTag.getExternalUserid())
...@@ -355,6 +376,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -355,6 +376,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
} }
} }
} }
} }
...@@ -398,7 +423,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -398,7 +423,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
if(null != followUser){ if(null != followUser){
weCustomer.setFirstAddTime(new Date(followUser.getCreatetime() * 1000L)); weCustomer.setFirstAddTime(new Date(followUser.getCreatetime() * 1000L));
weCustomer.setState(followUser.getState());
weCustomer.setAddMethod(followUser.getAddWay());
weCustomer.setDelFlag(new Integer(0));
this.baseMapper.batchAddOrUpdate( this.baseMapper.batchAddOrUpdate(
ListUtil.toList(weCustomer) ListUtil.toList(weCustomer)
); );
...@@ -685,5 +712,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -685,5 +712,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
} }
@Override
public void batchAddOrUpdate(List<WeCustomer> weCustomer) {
this.baseMapper.batchAddOrUpdate(weCustomer);
}
} }
...@@ -422,7 +422,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp ...@@ -422,7 +422,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
weContactWay.setType(weEmpleCode.getCodeType()); weContactWay.setType(weEmpleCode.getCodeType());
weContactWay.setScene(WeConstans.QR_CODE_EMPLE_CODE_SCENE); weContactWay.setScene(WeConstans.QR_CODE_EMPLE_CODE_SCENE);
weContactWay.setSkip_verify(weEmpleCode.getIsJoinConfirmFriends().equals(new Integer(0))?false:true); weContactWay.setSkip_verify(weEmpleCode.getIsJoinConfirmFriends().equals(new Integer(0))?false:true);
weContactWay.setState(String.valueOf(weEmpleCode.getId())); weContactWay.setState(String.valueOf(weEmpleCode.getState()));
if (CollectionUtil.isNotEmpty(weEmpleCodeUseScops)) { if (CollectionUtil.isNotEmpty(weEmpleCodeUseScops)) {
//员工列表 //员工列表
String[] userIdArr = weEmpleCodeUseScops.stream().filter(itme -> String[] userIdArr = weEmpleCodeUseScops.stream().filter(itme ->
......
...@@ -69,14 +69,14 @@ public class WeFlowerCustomerRelServiceImpl extends ServiceImpl<WeFlowerCustomer ...@@ -69,14 +69,14 @@ public class WeFlowerCustomerRelServiceImpl extends ServiceImpl<WeFlowerCustomer
} }
@Override @Override
public Map<String, Object> getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel) { public Map<String, Object> getUserAddCustomerStat(String codeId,String beginTime,String endTime) {
Map<String, Object> resultMap = new HashMap<>(16); Map<String, Object> resultMap = new HashMap<>(16);
List<String> dateList = new ArrayList<>(); List<String> dateList = new ArrayList<>();
List<Long> statList = new ArrayList<>(); List<Long> statList = new ArrayList<>();
Long resultTotal = 0L; Long resultTotal = 0L;
List<Map<String, Object>> userAddCustomerStatList = this.baseMapper.getUserAddCustomerStat(weFlowerCustomerRel); List<Map<String, Object>> userAddCustomerStatList = this.baseMapper.getUserAddCustomerStat(codeId, beginTime, endTime);
String beginTime = weFlowerCustomerRel.getBeginTime(); // String beginTime = weFlowerCustomerRel.getBeginTime();
String endTime = weFlowerCustomerRel.getEndTime(); // String endTime = weFlowerCustomerRel.getEndTime();
if (beginTime != null && endTime != null) { if (beginTime != null && endTime != null) {
Date beginDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, beginTime); Date beginDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, beginTime);
Date endDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, endTime); Date endDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, endTime);
......
...@@ -119,17 +119,17 @@ public class WeGroupCodeActualServiceImpl extends ServiceImpl<WeGroupCodeActualM ...@@ -119,17 +119,17 @@ public class WeGroupCodeActualServiceImpl extends ServiceImpl<WeGroupCodeActualM
* @param weGroupCodeActual 实际码 * @param weGroupCodeActual 实际码
* @return 结果 * @return 结果
*/ */
@Override // @Override
public boolean checkChatIdUnique(WeGroupCodeActual weGroupCodeActual) { // public boolean checkChatIdUnique(WeGroupCodeActual weGroupCodeActual) {
// 不指定群聊时,不用检测唯一性 // // 不指定群聊时,不用检测唯一性
String chatId = weGroupCodeActual.getChatId(); // String chatId = weGroupCodeActual.getChatId();
if (StringUtils.isNull(chatId) | StringUtils.isEmpty(chatId)) // if (StringUtils.isNull(chatId) | StringUtils.isEmpty(chatId))
{ // {
return true; // return true;
} // }
int rows = weGroupCodeActualMapper.checkChatIdUnique(chatId); // int rows = weGroupCodeActualMapper.checkChatIdUnique(chatId);
return rows == 0; // return rows == 0;
} // }
/** /**
* 通过群id递增其实际群活码扫码次数 * 通过群id递增其实际群活码扫码次数
......
...@@ -50,6 +50,9 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -50,6 +50,9 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
private IWeGroupMessageSendResultService messageSendResultService; private IWeGroupMessageSendResultService messageSendResultService;
@Autowired @Autowired
private IWeCustomerService weCustomerService;
@Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Override @Override
...@@ -163,6 +166,24 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -163,6 +166,24 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
@Override @Override
public void addGroupMsgTemplate(WeAddGroupMessageQuery query) { public void addGroupMsgTemplate(WeAddGroupMessageQuery query) {
List<WeAddGroupMessageQuery.SenderInfo> senderList = query.getSenderList(); List<WeAddGroupMessageQuery.SenderInfo> senderList = query.getSenderList();
//当发送为空时,默认发送所有客户
if(CollectionUtil.isEmpty(senderList)){
List<Map<String, Object>> customerList = weCustomerService.listMaps(new LambdaQueryWrapper<WeCustomer>()
.select(WeCustomer::getExternalUserid, WeCustomer::getFirstUserId)
.eq(WeCustomer::getDelFlag, 0).groupBy(WeCustomer::getExternalUserid, WeCustomer::getFirstUserId));
if(CollectionUtil.isNotEmpty(customerList)){
Map<String, List<Map<String, Object>>> customerMap = customerList.stream().collect(Collectors.groupingBy(item -> String.valueOf(item.get("first_user_id"))));
List<WeAddGroupMessageQuery.SenderInfo> senders = new ArrayList<>();
customerMap.forEach((userId, customers) ->{
WeAddGroupMessageQuery.SenderInfo senderInfo = new WeAddGroupMessageQuery.SenderInfo();
senderInfo.setUserId(userId);
List<String> externalUserIds = customers.stream().map(customer -> String.valueOf(customer.get("external_userid"))).collect(Collectors.toList());
senderInfo.setCustomerList(externalUserIds);
senders.add(senderInfo);
});
query.setSenderList(senders);
}
}
WeGroupMessageTemplate weGroupMessageTemplate = new WeGroupMessageTemplate(); WeGroupMessageTemplate weGroupMessageTemplate = new WeGroupMessageTemplate();
BeanUtil.copyProperties(query, weGroupMessageTemplate); BeanUtil.copyProperties(query, weGroupMessageTemplate);
if(query.getSendTime() == null){ if(query.getSendTime() == null){
...@@ -192,7 +213,7 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -192,7 +213,7 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
List<WeGroupMessageList> weGroupMessageLists = new ArrayList<>(); List<WeGroupMessageList> weGroupMessageLists = new ArrayList<>();
List<WeGroupMessageTask> messageTaskList = new ArrayList<>(); List<WeGroupMessageTask> messageTaskList = new ArrayList<>();
List<WeGroupMessageSendResult> sendResultList = new ArrayList<>(); List<WeGroupMessageSendResult> sendResultList = new ArrayList<>();
for (WeAddGroupMessageQuery.SenderInfo senderInfo :senderList ) { for (WeAddGroupMessageQuery.SenderInfo senderInfo : senderList ) {
WeGroupMessageList weGroupMessageList = new WeGroupMessageList(); WeGroupMessageList weGroupMessageList = new WeGroupMessageList();
weGroupMessageList.setMsgTemplateId(weGroupMessageTemplate.getId()); weGroupMessageList.setMsgTemplateId(weGroupMessageTemplate.getId());
if(query.getChatType() == 1){ if(query.getChatType() == 1){
...@@ -258,6 +279,10 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -258,6 +279,10 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
@Async @Async
@Override @Override
public void syncGroupMsgSendResultByIds(List<Long> asList) { public void syncGroupMsgSendResultByIds(List<Long> asList) {
WeGroupMessageTemplate weGroupMessageTemplate = new WeGroupMessageTemplate();
weGroupMessageTemplate.setRefreshTime(new Date());
update(weGroupMessageTemplate,new LambdaQueryWrapper<WeGroupMessageTemplate>().in(WeGroupMessageTemplate::getId,asList));
List<WeGroupMessageList> weGroupMessageLists = weGroupMessageListService.list(new LambdaQueryWrapper<WeGroupMessageList>() List<WeGroupMessageList> weGroupMessageLists = weGroupMessageListService.list(new LambdaQueryWrapper<WeGroupMessageList>()
.in(WeGroupMessageList::getMsgTemplateId, asList)); .in(WeGroupMessageList::getMsgTemplateId, asList));
List<WeGroupMessageTask> taskList = new ArrayList<>(); List<WeGroupMessageTask> taskList = new ArrayList<>();
......
...@@ -330,7 +330,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -330,7 +330,7 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
* 消息推送(企微API 消息推送 - 发送应用消息) * 消息推送(企微API 消息推送 - 发送应用消息)
*/ */
@Override @Override
// @Async @Async
public void sendMessage(List<String> groupIdList) { public void sendMessage(List<String> groupIdList) {
// 构造请求参数 // 构造请求参数
......
...@@ -29,8 +29,6 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService ...@@ -29,8 +29,6 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService
@Autowired @Autowired
private WeMsgTlpMapper weMsgTlpMapper; private WeMsgTlpMapper weMsgTlpMapper;
@Autowired
private IWeMsgTlpScopeService iWeMsgTlpScopeService;
/** /**
* 查询欢迎语模板 * 查询欢迎语模板
......
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeScanEmpleCodeCount;
import com.linkwechat.wecom.mapper.WeScanEmpleCodeCountMapper;
import com.linkwechat.wecom.service.IWeScanEmpleCodeCountService;
import org.springframework.stereotype.Service;
@Service
public class WeScanEmpleCodeCountServiceImpl extends ServiceImpl<WeScanEmpleCodeCountMapper, WeScanEmpleCodeCount>
implements IWeScanEmpleCodeCountService {
}
...@@ -211,7 +211,11 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -211,7 +211,11 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
linkMessageDto.setUrl(pageUrlBuilder.toString()); linkMessageDto.setUrl(pageUrlBuilder.toString());
CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto(); CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto();
if (weTaskFission.getStartTime() != null) { if (weTaskFission.getStartTime() != null && weTaskFission.getStartTime().getTime() <= System.currentTimeMillis()) {
customerMessagePushDto.setSendNow(true);
customerMessagePushDto.setSettingTime(null);
}else {
customerMessagePushDto.setSendNow(false);
customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime())); customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime()));
} }
customerMessagePushDto.setLinkMessage(linkMessageDto); customerMessagePushDto.setLinkMessage(linkMessageDto);
...@@ -250,7 +254,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -250,7 +254,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
@Transactional @Transactional
public String fissionPosterGenerate(WeTaskFissionPosterDTO weTaskFissionPosterDTO) { public String fissionPosterGenerate(WeTaskFissionPosterDTO weTaskFissionPosterDTO) {
WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>() WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>()
.eq(WeCustomer::getUnionid, weTaskFissionPosterDTO.getUnionId())); .eq(WeCustomer::getUnionid, weTaskFissionPosterDTO.getUnionId()).last("limit 1"));
if (weCustomer != null) { if (weCustomer != null) {
//任务表添加当前客户任务 //任务表添加当前客户任务
WeTaskFissionRecord record = getTaskFissionRecordId(weTaskFissionPosterDTO.getTaskFissionId(), weCustomer.getUnionid(), weCustomer.getName()); WeTaskFissionRecord record = getTaskFissionRecordId(weTaskFissionPosterDTO.getTaskFissionId(), weCustomer.getUnionid(), weCustomer.getName());
...@@ -311,16 +315,16 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -311,16 +315,16 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
}); });
} }
} else { } else {
// WeTaskFissionRecord weTaskFissionRecord = weTaskFissionRecordService WeTaskFissionRecord weTaskFissionRecord = weTaskFissionRecordService
// .selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), unionId); .selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), unionId);
// Optional.ofNullable(weTaskFissionRecord).orElseThrow(() -> new WeComException("任务记录信息不存在")); Optional.ofNullable(weTaskFissionRecord).orElseThrow(() -> new WeComException("任务记录信息不存在"));
// List<WeFlowerCustomerRel> list = weFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>()
// .eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId())); List<WeCustomer> weCustomers = weCustomerService.list(new LambdaQueryWrapper<WeCustomer>()
// List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream() .eq(WeCustomer::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId()));
// .map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(eidList)) { if (CollectionUtil.isNotEmpty(weCustomers)) {
// customerList.addAll(weCustomerService.listByIds(eidList)); customerList.addAll(weCustomers);
// } }
} }
return customerList; return customerList;
} }
...@@ -376,6 +380,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -376,6 +380,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
weCustomer.setAvatar(completeRecord.getCustomerAvatar()); weCustomer.setAvatar(completeRecord.getCustomerAvatar());
weCustomer.setUnionid(completeRecord.getCustomerId()); weCustomer.setUnionid(completeRecord.getCustomerId());
weCustomer.setName(completeRecord.getCustomerName()); weCustomer.setName(completeRecord.getCustomerName());
weCustomer.setFirstAddTime(completeRecord.getCreateTime());
list.add(weCustomer); list.add(weCustomer);
}); });
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
where FIND_IN_SET(#{fromId}, to_list) and is_external = 0 and room_id = '' where FIND_IN_SET(#{fromId}, to_list) and is_external = 0 and room_id = ''
order by msg_time desc order by msg_time desc
) as msg group by receiver order by msg.msg_time desc) t ) as msg group by receiver order by msg.msg_time desc) t
inner join we_customer wc on t.receiver = wc.external_userid; inner join we_customer wc on t.receiver = wc.external_userid and wc.first_user_id=#{fromId};
</select> </select>
<select id="selectAloneChatList" resultType="com.linkwechat.wecom.domain.vo.WeChatContactMsgVo"> <select id="selectAloneChatList" resultType="com.linkwechat.wecom.domain.vo.WeChatContactMsgVo">
......
...@@ -288,29 +288,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -288,29 +288,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where> <where>
<if test="gender !=null"> <if test="weCustomerList.gender !=null">
wc.gender=#{gender} AND wc.gender=#{weCustomerList.gender}
</if> </if>
<if test="delFlag != null">
wc.del_flag = #{delFlag} <if test="weCustomerList.departmentIds != null and weCustomerList.departmentIds !=''">
<if test="weCustomerList.departmentIds.indexOf(',') != -1">
OR wu.department in
<foreach item="item" index="index" collection="weCustomerList.departmentIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="name != null and name !=''">
AND wc.`name` like concat('%',#{name,jdbcType=VARCHAR},'%') </if>
<if test="weCustomerList.delFlag != null">
wc.del_flag = #{weCustomerList.delFlag}
</if> </if>
<if test="userIds !=null and userIds !=''"> <if test="weCustomerList.name != null and weCustomerList.name !=''">
AND wc.`name` like concat('%',#{weCustomerList.name,jdbcType=VARCHAR},'%')
</if>
<if test="weCustomerList.userIds !=null and weCustomerList.userIds !=''">
AND wc.first_user_id in AND wc.first_user_id in
<foreach collection="userIds.split(',')" item="item" index="index" open="(" close=")" separator=","> <foreach collection="weCustomerList.userIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="tagIds !=null and tagIds !=''"> <if test="weCustomerList.tagIds !=null and weCustomerList.tagIds !=''">
AND wt.tag_id in AND wt.tag_id in
<foreach collection="tagIds.split(',')" item="item" index="index" open="(" close=")" separator=","> <foreach collection="weCustomerList.tagIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="beginTime !=null and beginTime != '' and endTime !='' and endTime != null"> <if test="weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null">
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime} AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.beginTime.endTime}
</if> </if>
</where> </where>
GROUP BY wc.external_userid,wc.first_user_id GROUP BY wc.external_userid,wc.first_user_id
...@@ -466,7 +477,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -466,7 +477,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(wt.`tag_id`) as tagIds GROUP_CONCAT(wt.`tag_id`) as tagIds
FROM FROM
we_customer wc we_customer wc
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id AND wfcrf.del_flag=0
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid} and wc.first_user_id=#{userid} WHERE wc.external_userid=#{externalUserid} and wc.first_user_id=#{userid}
</select> </select>
...@@ -581,7 +592,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -581,7 +592,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchAddOrUpdate"> <insert id="batchAddOrUpdate">
INSERT INTO we_customer( INSERT INTO we_customer(
external_userid, external_userid,
NAME, `name`,
avatar, avatar,
type, type,
gender, gender,
...@@ -599,32 +610,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -599,32 +610,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
email, email,
address, address,
phone, phone,
add_method add_method,
del_flag,
state
) values ) values
<foreach collection="weCustomers" item="item" index="index" separator=","> <foreach collection="weCustomers" item="item" index="index" separator=",">
(#{item.externalUserid},#{item.name},#{item.avatar},#{item.type},#{item.gender}, #{item.unionid},#{item.birthday}, (#{item.externalUserid},#{item.name},#{item.avatar},#{item.type},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.corpFullName},#{item.position},#{item.isOpenChat}, #{item.createTime}, #{item.corpName},#{item.corpFullName},#{item.position},#{item.isOpenChat}, #{item.createTime},
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod} #{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod},
#{item.delFlag},#{item.state}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
NAME=IF(we_customer.NAME != null, VALUES(NAME), we_customer.NAME), NAME=IF(ISNULL(VALUES(NAME))=0 and LENGTH(trim(VALUES(NAME))),VALUES(NAME),we_customer.NAME),
avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar), avatar=IF(ISNULL(VALUES(avatar))=0 and LENGTH(trim(VALUES(avatar))),VALUES(avatar), we_customer.avatar),
type=IF(we_customer.type != null, VALUES(type), we_customer.type), type=IF(VALUES(type),VALUES(type),we_customer.type),
gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender), gender=IF(VALUES(gender) ,VALUES(gender), we_customer.gender),
unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid), unionid=IF(ISNULL(VALUES(unionid))=0 and LENGTH(trim(VALUES(unionid))),VALUES(unionid),we_customer.unionid),
birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday), birthday=IF(VALUES(birthday),VALUES(birthday), we_customer.birthday),
corp_name=IF(we_customer.corp_name != null, VALUES(corp_name), we_customer.corp_name), corp_name=IF(ISNULL(VALUES(corp_name))=0 and LENGTH(trim(VALUES(corp_name))),VALUES(corp_name),we_customer.corp_name),
corp_full_name=IF(we_customer.corp_full_name != null, VALUES(corp_full_name), we_customer.corp_full_name), corp_full_name=IF(ISNULL(VALUES(corp_full_name))=0 and LENGTH(trim(VALUES(corp_full_name))),VALUES(corp_full_name),we_customer.corp_full_name),
position=IF(we_customer.position != null, VALUES(position), we_customer.position), position=IF(ISNULL(VALUES(position))=0 and LENGTH(trim(VALUES(position))),VALUES(position),we_customer.position),
is_open_chat=IF(we_customer.is_open_chat != null, VALUES(is_open_chat), we_customer.is_open_chat), is_open_chat=IF(VALUES(is_open_chat),VALUES(is_open_chat),we_customer.is_open_chat),
first_user_id=IF(we_customer.first_user_id != null, VALUES(first_user_id), we_customer.first_user_id), first_user_id=IF(ISNULL(VALUES(first_user_id))=0 and LENGTH(trim(VALUES(first_user_id))),VALUES(first_user_id), we_customer.first_user_id),
first_add_time=IF(we_customer.first_add_time != null, VALUES(first_add_time), we_customer.first_add_time), first_add_time=IF(VALUES(first_add_time) ,VALUES(first_add_time),we_customer.first_add_time),
qq=IF(we_customer.qq != null, VALUES(qq), we_customer.qq), qq=IF(ISNULL(VALUES(qq))=0 and LENGTH(trim(VALUES(qq))),VALUES(qq), we_customer.qq),
email=IF(we_customer.email != null, VALUES(email), we_customer.email), email=IF(ISNULL(VALUES(email))=0 and LENGTH(trim(VALUES(email))),VALUES(email),we_customer.email),
address=IF(we_customer.address != null, VALUES(address), we_customer.address), address=IF(ISNULL(VALUES(address))=0 and LENGTH(trim(VALUES(address))),VALUES(address),we_customer.address),
phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone), phone=IF(ISNULL(VALUES(phone))=0 and LENGTH(trim(VALUES(phone))),VALUES(phone), we_customer.phone),
add_method=IF(we_customer.add_method != null, VALUES(add_method), we_customer.add_method); add_method=IF(VALUES(add_method),VALUES(add_method),we_customer.add_method),
del_flag=IF(VALUES(del_flag),we_customer.del_flag, VALUES(del_flag)),
state=IF(ISNULL(VALUES(state))=0 and LENGTH(trim(VALUES(state))), we_customer.state, VALUES(state));
</insert> </insert>
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
</where> </where>
</update> </update>
<select id="selectWeCustomerMessageTimeTaskGteSettingTime" resultMap="tasks"> <select id="selectWeCustomerMessageTimeTaskGteSettingTime" resultMap="tasks">
SELECT SELECT
task_id, task_id,
...@@ -62,7 +63,9 @@ ...@@ -62,7 +63,9 @@
setting_time setting_time
FROM FROM
we_customer_messageTimeTask we_customer_messageTimeTask
WHERE solved=0 and setting_time BETWEEN #{beginTime} AND #{endTime} <where>
setting_time <![CDATA[<=]]> #{timeMillis} AND solved=0
</where>
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -72,11 +72,14 @@ ...@@ -72,11 +72,14 @@
<select id="customerMessagePushs" resultType="com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo"> <select id="customerMessagePushs" resultType="com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo">
SELECT SELECT
user_name, user_name,
GROUP_CONCAT(IFNULL(external_name,chat_name) SEPARATOR '、') customers GROUP_CONCAT(IFNULL(external_name,chat_name)) customers
FROM FROM
we_customer_messgaeResult we_customer_messgaeResult
<where> <where>
message_id=#{messageId} <if test="messageId !=null">
AND message_id=#{messageId}
</if>
<if test="status!=null"> <if test="status!=null">
AND `status`=#{status} AND `status`=#{status}
</if> </if>
......
...@@ -118,22 +118,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -118,22 +118,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</update> </update>
<select id="getUserAddCustomerStat" parameterType="WeFlowerCustomerRel" resultType="java.util.HashMap"> <select id="getUserAddCustomerStat" resultType="java.util.HashMap">
select select
left(wfcr.first_add_time,10) as createTime , count(1) as total left(wfcr.create_time,10) as createTime , count(1) as total
from from
we_customer wfcr we_scan_emple_code_count wfcr
<where> <where>
<if test="userId != null and userId != ''">and wfcr.first_user_id = #{userId}</if> <if test="codeId != null and codeId != ''">and wfcr.emple_code_id = #{codeId}</if>
<if test="addWay != null and addWay != ''">and wfcr.add_method = #{addWay}</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 --> <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wfcr.first_add_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d') AND date_format(wfcr.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if> </if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 --> <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.first_add_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
</where> </where>
group by group by
left(wfcr.first_add_time,10) left(wfcr.create_time,10)
<!-- select-->
<!-- left(wfcr.first_add_time,10) as createTime , count(1) as total-->
<!-- from-->
<!-- we_customer wfcr-->
<!-- <where>-->
<!-- <if test="userId != null and userId != ''">and wfcr.first_user_id = #{userId}</if>-->
<!-- <if test="addWay != null and addWay != ''">and wfcr.add_method = #{addWay}</if>-->
<!-- <if test="beginTime != null and beginTime != ''">&lt;!&ndash; 开始时间检索 &ndash;&gt;-->
<!-- AND date_format(wfcr.first_add_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')-->
<!-- </if>-->
<!-- <if test="endTime != null and endTime != ''">&lt;!&ndash; 结束时间检索 &ndash;&gt;-->
<!-- AND date_format(wfcr.first_add_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')-->
<!-- </if>-->
<!-- </where>-->
<!-- group by-->
<!-- left(wfcr.first_add_time,10)-->
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -85,7 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -85,7 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
user_id=IF(we_flower_customer_tag_rel.user_id != null, VALUES(user_id), we_flower_customer_tag_rel.user_id), user_id=IF(we_flower_customer_tag_rel.user_id != null, VALUES(user_id), we_flower_customer_tag_rel.user_id),
external_userid=IF(we_flower_customer_tag_rel.external_userid != null, VALUES(external_userid), we_flower_customer_tag_rel.external_userid), external_userid=IF(we_flower_customer_tag_rel.external_userid != null, VALUES(external_userid), we_flower_customer_tag_rel.external_userid),
tag_id=IF(we_flower_customer_tag_rel.tag_id != null, VALUES(tag_id), we_flower_customer_tag_rel.tag_id); tag_id=IF(we_flower_customer_tag_rel.tag_id != null, VALUES(tag_id), we_flower_customer_tag_rel.tag_id),
create_time=IF(we_flower_customer_tag_rel.create_time != null, VALUES(create_time), we_flower_customer_tag_rel.create_time);
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -64,14 +64,14 @@ ...@@ -64,14 +64,14 @@
<insert id="insertBatch"> <insert id="insertBatch">
insert into we_group (chat_id, group_name, owner, add_time, notice, status,admin_user_id, create_by, create_time,update_by, update_time,del_flag) insert into we_group (chat_id, group_name, owner, add_time, notice, status,admin_user_id, create_by, create_time,update_by, update_time)
values values
<foreach collection="weGroups" item="weGroup" index="index" separator=","> <foreach collection="weGroups" item="weGroup" index="index" separator=",">
(#{weGroup.chatId},#{weGroup.groupName},#{weGroup.owner},#{weGroup.addTime},#{weGroup.notice},#{weGroup.status},#{weGroup.adminUserId}, (#{weGroup.chatId},#{weGroup.groupName},#{weGroup.owner},#{weGroup.addTime},#{weGroup.notice},#{weGroup.status},#{weGroup.adminUserId},
#{weGroup.createBy},#{weGroup.createTime},#{weGroup.updateBy},#{weGroup.updateTime},#{weGroup.delFlag}) #{weGroup.createBy},#{weGroup.createTime},#{weGroup.updateBy},#{weGroup.updateTime})
</foreach> </foreach>
on duplicate key update group_name= values(group_name),owner= values(owner), on duplicate key update group_name= values(group_name),owner= values(owner),
notice= values(notice),status= values(status),admin_user_id= values(admin_user_id), notice= values(notice),status= values(status),admin_user_id= values(admin_user_id),
update_by= values(update_by),update_time= values(update_time),del_flag=values(del_flag) update_by= values(update_by),update_time= values(update_time)
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -50,18 +50,18 @@ ...@@ -50,18 +50,18 @@
<insert id="insertBatch"> <insert id="insertBatch">
insert into we_group_member (chat_id, user_id, union_id, join_time, join_scene, `type`, insert into we_group_member (chat_id, user_id, union_id, join_time, join_scene, `type`,
group_nick_name,`name`,invitor_user_id, group_nick_name,`name`,invitor_user_id,
create_by, create_time,update_by, update_time,del_flag) create_by, create_time,update_by, update_time)
values values
<foreach collection="weGroupMembers" item="weGroupMember" index="index" separator=","> <foreach collection="weGroupMembers" item="weGroupMember" index="index" separator=",">
(#{weGroupMember.chatId},#{weGroupMember.userId},#{weGroupMember.unionId}, (#{weGroupMember.chatId},#{weGroupMember.userId},#{weGroupMember.unionId},
#{weGroupMember.joinTime},#{weGroupMember.joinScene},#{weGroupMember.type}, #{weGroupMember.joinTime},#{weGroupMember.joinScene},#{weGroupMember.type},
#{weGroupMember.groupNickName},#{weGroupMember.name},#{weGroupMember.invitorUserId}, #{weGroupMember.groupNickName},#{weGroupMember.name},#{weGroupMember.invitorUserId},
#{weGroupMember.createBy},#{weGroupMember.createTime}, #{weGroupMember.createBy},#{weGroupMember.createTime},
#{weGroupMember.updateBy},#{weGroupMember.updateTime},#{weGroupMember.delFlag}) #{weGroupMember.updateBy},#{weGroupMember.updateTime})
</foreach> </foreach>
on duplicate key update on duplicate key update
join_time= values(join_time),join_scene= values(join_scene), join_time= values(join_time),join_scene= values(join_scene),
group_nick_name= values(group_nick_name),`name`= values(`name`),invitor_user_id= values(invitor_user_id), group_nick_name= values(group_nick_name),`name`= values(`name`),invitor_user_id= values(invitor_user_id),
`type`= values(`type`),update_by= values(update_by),update_time= values(update_time),del_flag=values(del_flag) `type`= values(`type`),update_by= values(update_by),update_time= values(update_time)
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -12,6 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userName" column="user_name" /> <result property="userName" column="user_name" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="sendTime" column="send_time" /> <result property="sendTime" column="send_time" />
<result property="total" column="total" />
<result property="already" column="already" />
</resultMap> </resultMap>
<select id="groupMsgTaskList" resultMap="WeGroupMessageTaskResult"> <select id="groupMsgTaskList" resultMap="WeGroupMessageTaskResult">
select select
...@@ -21,7 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,7 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wgmt.user_id, wgmt.user_id,
wu.user_name, wu.user_name,
wgmt.status, wgmt.status,
wgmt.send_time wgmt.send_time,
(select count(1) from we_group_message_send_result wgmsr where wgmsr.msg_template_id = wgmt.msg_template_id) as total,
(select count(1) from we_group_message_send_result wgmsr where wgmsr.msg_template_id = wgmt.msg_template_id and wgmsr.status = 1) as already
from we_group_message_task wgmt from we_group_message_task wgmt
left join we_user wu on wu.user_id = wgmt.user_id left join we_user wu on wu.user_id = wgmt.user_id
<where> <where>
......
...@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="welcomeMsgTplType !=null "> and wmt.welcome_msg_tpl_type = #{welcomeMsgTplType}</if> <if test="welcomeMsgTplType !=null "> and wmt.welcome_msg_tpl_type = #{welcomeMsgTplType}</if>
and wmt.del_flag = 0 and wmt.del_flag = 0
</where> </where>
ORDER BY wmt.create_time DESC
</select> </select>
...@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag,</if> <if test="delFlag != null">del_flag,</if>
<if test="welcomeMsgTplType != null">welcome_msg_tpl_type,</if> <if test="welcomeMsgTplType != null">welcome_msg_tpl_type,</if>
<if test="createBy != null ">create_by,</if> <if test="createBy != null ">create_by,</if>
<if test="createTime !=null">create_time,</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>
...@@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if> <if test="delFlag != null">#{delFlag},</if>
<if test="welcomeMsgTplType != null">#{welcomeMsgTplType},</if> <if test="welcomeMsgTplType != null">#{welcomeMsgTplType},</if>
<if test="createBy != null ">#{createBy},</if> <if test="createBy != null ">#{createBy},</if>
<if test="createTime !=null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
......
...@@ -4,39 +4,33 @@ ...@@ -4,39 +4,33 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskScopeMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskScopeMapper">
<resultMap type="WeCommunityTaskEmplVo" id="WeEmplVoResult"> <resultMap type="com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo" id="WeEmplVoResult">
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="name" column="user_name"/> <result property="name" column="user_name"/>
<result property="avatar" column="head_image_url"/> <result property="avatar" column="head_image_url"/>
<result property="isDone" column="is_done"/> <result property="isDone" column="sent"/>
</resultMap> </resultMap>
<select id="getScopeListByTaskId" parameterType="Long" resultMap="WeEmplVoResult"> <select id="getScopeListByTaskId" parameterType="Long" resultMap="WeEmplVoResult">
SELECT SELECT DISTINCT
wu.user_id, wu.user_id,
wu.user_name, wu.user_name,
wu.head_image_url, wu.head_image_url,
wptgs.is_done st.sent
FROM FROM
we_pres_tag_group_scope wptgs we_user wu
LEFT JOIN we_pres_tag_group wcog ON wcog.task_id = wptgs.task_id LEFT JOIN we_pres_tag_group_stat st ON st.user_id = wu.user_id
LEFT JOIN we_user wu ON wu.user_id = wptgs.we_user_id AND st.del_flag = 0
WHERE WHERE
wptgs.task_id = #{taskId} st.task_id = #{taskId}
</select> </select>
<insert id="batchBindsTaskScopes"> <insert id="batchBindsTaskScopes">
insert into we_pres_tag_group_scope(task_id, we_user_id, is_done) values insert into we_pres_tag_group_scope(task_id, we_user_id, create_by, create_time) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.taskId},#{item.weUserId},#{item.isDone}) (#{item.taskId},#{item.weUserId}, #{item.createBy}, #{item.createTime})
</foreach> </foreach>
</insert> </insert>
<update id="updateEmplTaskStatus">
UPDATE we_pres_tag_group_scope
SET is_done = TRUE
WHERE
task_id = #{taskId} AND we_user_id = #{emplId}
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -4,52 +4,81 @@ ...@@ -4,52 +4,81 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskStatMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskStatMapper">
<resultMap type="WePresTagGroupTaskStatVo" id="WePresTagGroupTaskStatResult">
<result property="customerName" column="customer_name" />
<result property="isSent" column="is_sent" />
<result property="isInGroup" column="is_in_group" />
</resultMap>
<delete id="removeStatByTaskId" parameterType="Long"> <insert id="batchSave">
delete from we_pres_tag_group_stat where task_id = #{taskId} insert into we_pres_tag_group_stat (task_id, user_id, external_userid, sent, create_by, create_time) values
</delete> <foreach item="item" index="index" collection="list" separator=",">
(#{item.taskId}, #{item.userId}, #{item.externalUserId}, #{item.sent}, #{item.createBy}, #{item.createTime})
</foreach>
</insert>
<select id="cropSendResultList" parameterType="com.linkwechat.wecom.domain.WePresTagGroupTaskStat" resultType="com.linkwechat.wecom.domain.WePresTagGroupTaskStat">
select distinct
wc.name as customerName,
(case wgmsr.`status` when 0 then 0 when 1 then 1 when 2 then 0 when 3 then 1 else 0 end) as sent,
(
select count(*) > 0
from
we_group_member wgm
left join we_group_code_actual ac on ac.chat_id = wgm.chat_id and ac.del_flag = 0
where ac.group_code_id = task.group_code_id and wgm.user_id = wgmsr.external_userid
) as inGroup
from
we_group_message_send_result wgmsr
left join we_customer wc on wc.external_userid = wgmsr.external_userid
left join we_pres_tag_group task on task.message_template_id = wgmsr.msg_template_id
where
wgmsr.del_flag = 0
and task.task_id = #{taskId}
<if test="customerName != null and customerName != ''">
and wc.name like concat('%', #{customerName}, '%')
</if>
<if test="(sent != null and sent != '') or sent == 0">
and (case wgmsr.`status` when 0 then 0 when 1 then 1 when 2 then 0 when 3 then 1 else 0 end) = #{sent}
</if>
<if test="(inGroup != null and inGroup != '') or inGroup == 0">
and (
select count(*) > 0
from
we_group_member wgm
left join we_group_code_actual ac on ac.chat_id = wgm.chat_id and ac.del_flag = 0
where ac.group_code_id = task.group_code_id and wgm.user_id = wgmsr.external_userid
) = #{inGroup}
</if>
<select id="getAllExternalIdByTaskId" parameterType="Long" resultType="String">
SELECT DISTINCT
wc.external_userid
FROM
we_customer wc
LEFT JOIN we_group_member wgm ON wgm.user_id = wc.external_userid
LEFT JOIN we_group wg ON wg.chat_id = wgm.chat_id
LEFT JOIN we_group_code_actual wgca ON wgca.chat_id = wg.chat_id
LEFT JOIN we_pres_tag_group wptg ON wptg.group_code_id = wgca.group_code_id
WHERE
wptg.task_id = #{taskId}
</select> </select>
<select id="selectStatInfoByTaskId" parameterType="Long" resultMap="WePresTagGroupTaskStatResult"> <select id="singleSendResultList" parameterType="com.linkwechat.wecom.domain.WePresTagGroupTaskStat" resultType="com.linkwechat.wecom.domain.WePresTagGroupTaskStat">
SELECT SELECT DISTINCT
wc.`name`, cu.`name` AS customerName,
0 AS is_sent,
( (
SELECT SELECT count(*) > 0
count(1) > 0 FROM we_group_member wgm
FROM LEFT JOIN we_group_code_actual ac ON ac.chat_id = wgm.chat_id AND ac.del_flag = 0
we_customer wc1 LEFt JOIn we_pres_tag_group task On ac.group_code_id = task.group_code_id
LEFT JOIN we_group_member wgm ON wgm.user_id = wc1.external_userid
LEFT JOIN we_group wg ON wg.chat_id = wgm.chat_id
LEFT JOIN we_group_code_actual wgca ON wgca.chat_id = wg.chat_id
LEFT JOIN we_pres_tag_group wptg1 ON wptg1.group_code_id = wgca.group_code_id
WHERE WHERE
wc1.external_userid = wptgs.external_userid task.task_id = st.task_id AND wgm.user_id = st.external_userid
) AS is_in_group ) AS inGroup,
st.sent
FROM FROM
we_pres_tag_group_stat wptgs we_pres_tag_group_stat st
LEFT JOIN we_pres_tag_group wptg ON wptgs.task_id = wptg.task_id left join we_customer cu on cu.external_userid = st.external_userid and cu.del_flag = 0
LEFT JOIN we_customer wc ON wc.external_userid = wptgs.external_userid where st.del_flag = 0 and st.task_id = #{taskId}
<if test="customerName != null and customerName != ''">
and cu.`name` like concat('%', #{customerName}, '%')
</if>
<if test="(sent != null and sent != '') or sent == 0">
and st.sent = #{sent}
</if>
<if test="(inGroup != null and inGroup != '') or inGroup == 0">
and (
SELECT count(*) > 0
FROM we_group_member wgm
LEFT JOIN we_group_code_actual ac ON ac.chat_id = wgm.chat_id AND ac.del_flag = 0
LEFt JOIn we_pres_tag_group task On ac.group_code_id = task.group_code_id
WHERE WHERE
wptgs.task_id = #{taskId} task.task_id = st.task_id AND wgm.user_id = st.external_userid
) = #{inGroup}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -4,43 +4,10 @@ ...@@ -4,43 +4,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskTagMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WePresTagGroupTaskTagMapper">
<resultMap type="WeTag" id="WeTagResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
<result property="name" column="name" />
<result property="createTime" column="create_time" />
</resultMap>
<select id="getTagListByTaskId" parameterType="Long" resultMap="WeTagResult">
SELECT
wt.*
FROM
we_pres_tag_group_tag wogt
LEFT JOIN we_pres_tag_group wcog ON wcog.task_id = wogt.task_id
LEFT JOIN we_tag wt ON wt.tag_id = wogt.tag_id
WHERE
wcog.task_id = #{taskId}
</select>
<select id="getExternalUserIdListByTaskId" parameterType="Long" resultType="String">
SELECT DISTINCT
wc.external_userid
FROM
we_pres_tag_group_tag wptgt
LEFT JOIN
we_flower_customer_tag_rel wfctr ON wfctr.tag_id = wptgt.tag_id
LEFT JOIN
we_flower_customer_rel wfcr ON wfcr.id = wfctr.flower_customer_rel_id
LEFT JOIN
we_customer wc ON wc.external_userid = wfcr.external_userid
WHERE
wptgt.task_id = #{taskId}
</select>
<insert id="batchBindsTaskTags"> <insert id="batchBindsTaskTags">
insert into we_pres_tag_group_tag(task_id, tag_id) values insert into we_pres_tag_group_tag(task_id, tag_id, create_by, create_time) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.taskId},#{item.tagId}) (#{item.taskId},#{item.tagId}, #{item.createBy}, #{item.createTime})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
<?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.WeScanEmpleCodeCountMapper">
</mapper>
\ No newline at end of file \ No newline at end of file
...@@ -156,11 +156,20 @@ ...@@ -156,11 +156,20 @@
wc.`name` as customerName, wc.`name` as customerName,
wu.user_name as takeUserName, wu.user_name as takeUserName,
wac.allocate_time, wac.allocate_time,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id in (wu.department)) as department,
wc.avatar,
wc.birthday,
wc.gender,
GROUP_CONCAT(wt.`tag_id`) as tagIds,
GROUP_CONCAT(wt.`name`) as tagNames,
wu.user_name,
wc.first_add_time
FROM FROM
we_allocate_customer wac we_allocate_customer wac
LEFT JOIN we_customer wc ON wac.external_userid=wc.external_userid LEFT JOIN we_customer wc ON wac.external_userid=wc.external_userid and wac.takeover_userid=wc.first_user_id
LEFT JOIN we_user wu ON wu.user_id=wac.takeover_userid LEFT JOIN we_user wu ON wu.user_id=wac.takeover_userid
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where> <where>
<if test="handoverUserId != null and handoverUserId !=''">and wac.handover_userid=#{handoverUserId}</if> <if test="handoverUserId != null and handoverUserId !=''">and wac.handover_userid=#{handoverUserId}</if>
<if test="beginTime != null and beginTime !='' and endTime != null and endTime !=''"> <if test="beginTime != null and beginTime !='' and endTime != null and endTime !=''">
......
...@@ -307,12 +307,6 @@ ...@@ -307,12 +307,6 @@
</dependency> </dependency>
<dependency>
<groupId>com.github.jeffreyning</groupId>
<artifactId>mybatisplus-plus</artifactId>
<version>1.5.1-RELEASE</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!