Commit 39f97d7a by leejoker

修改查询接口

修复选择所有客户错误
1 parent 9bbca27e
......@@ -63,7 +63,7 @@ public class WeTaskFissionController extends BaseController {
@ApiOperation(value = "查询任务宝列表", httpMethod = "GET")
@PreAuthorize("@ss.hasPermi('wecom:fission:list')")
@GetMapping("/list")
public TableDataInfo<List<WeTaskFission>> list(WeTaskFission weTaskFission) {
public TableDataInfo<List<WeTaskFission>> list(WeTaskFission weTaskFission) throws ParseException {
startPage();
List<WeTaskFission> list = weTaskFissionService.selectWeTaskFissionList(weTaskFission);
return getDataTable(list);
......@@ -100,7 +100,7 @@ public class WeTaskFissionController extends BaseController {
@PreAuthorize("@ss.hasPermi('wecom:fission:export')")
@Log(title = "任务宝", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(WeTaskFission weTaskFission) {
public AjaxResult export(WeTaskFission weTaskFission) throws ParseException {
List<WeTaskFission> list = weTaskFissionService.selectWeTaskFissionList(weTaskFission);
ExcelUtil<WeTaskFission> util = new ExcelUtil<WeTaskFission>(WeTaskFission.class);
return util.exportExcel(list, "fission");
......@@ -195,7 +195,7 @@ public class WeTaskFissionController extends BaseController {
return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在");
}
weTaskFissionService.completeFissionRecord(id, recordId, weChatUserDTO);
return AjaxResult.success("操作成功",taskFission.getFissQrcode());
return AjaxResult.success("操作成功", taskFission.getFissQrcode());
}
/**
......
......@@ -7,6 +7,7 @@ import com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO;
import com.linkwechat.wecom.domain.vo.WeTaskFissionProgressVO;
import com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
......@@ -31,7 +32,7 @@ public interface IWeTaskFissionService {
* @param weTaskFission 任务宝
* @return 任务宝集合
*/
public List<WeTaskFission> selectWeTaskFissionList(WeTaskFission weTaskFission);
public List<WeTaskFission> selectWeTaskFissionList(WeTaskFission weTaskFission) throws ParseException;
/**
* 新增任务宝
......
package com.linkwechat.wecom.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.redis.RedisCache;
import com.linkwechat.common.enums.ChatType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.dto.message.*;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerMessageTimeTask;
import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
import com.linkwechat.wecom.domain.vo.CustomerMessagePushVo;
import com.linkwechat.wecom.mapper.WeCustomerMessageTimeTaskMapper;
import com.linkwechat.wecom.service.*;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,8 +24,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @description: 群发消息服务类
......@@ -85,9 +83,13 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
// 0 发给客户
if (customerMessagePushDto.getPushType().equals(WeConstans.SEND_MESSAGE_CUSTOMER)) {
//查询客户信息列表
customers = externalUserIds(customerMessagePushDto.getPushRange(), customerMessagePushDto.getStaffId()
, customerMessagePushDto.getDepartment(), customerMessagePushDto.getTag());
if(CollectionUtils.isEmpty(customers)){
if ("all".equals(customerMessagePushDto.getTag())) {
customers = externalUserIds(WeConstans.SEND_MESSAGE_CUSTOMER_ALL, null, null, null);
} else {
customers = externalUserIds(customerMessagePushDto.getPushRange(), customerMessagePushDto.getStaffId()
, customerMessagePushDto.getDepartment(), customerMessagePushDto.getTag());
}
if (CollectionUtils.isEmpty(customers)) {
throw new WeComException("没有外部联系人");
}
}
......@@ -104,7 +106,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
WeGroup weGroup = new WeGroup();
weGroup.setUserIds(customerMessagePushDto.getStaffId());
groups = weGroupService.selectWeGroupList(weGroup);
if(CollectionUtils.isEmpty(customers)){
if (CollectionUtils.isEmpty(customers)) {
throw new WeComException("没有客户群!");
}
......@@ -116,10 +118,10 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
long messageId = SnowFlakeUtil.nextId();
//保存映射信息
int size = weCustomerMessgaeResultService.workerMappingCustomer(customerMessagePushDto, messageId,customers,groups);
int size = weCustomerMessgaeResultService.workerMappingCustomer(customerMessagePushDto, messageId, customers, groups);
//保存微信消息
weCustomerMessageService.saveWeCustomerMessage(messageId, messageOriginalId, customerMessagePushDto, size,customerMessagePushDto.content());
weCustomerMessageService.saveWeCustomerMessage(messageId, messageOriginalId, customerMessagePushDto, size, customerMessagePushDto.content());
//保存分类消息信息
weCustomerSeedMessageService.saveSeedMessage(customerMessagePushDto, messageId);
......@@ -127,11 +129,11 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//发送群发消息
//调用微信api发送消息
if (null == customerMessagePushDto.getSettingTime() || customerMessagePushDto.getSettingTime().equals("")) {
weCustomerMessageService.sendMessgae(customerMessagePushDto, messageId,customers,groups);
weCustomerMessageService.sendMessgae(customerMessagePushDto, messageId, customers, groups);
} else {
WeCustomerMessageTimeTask timeTask=new WeCustomerMessageTimeTask(messageId, customerMessagePushDto, customers,groups
,DateUtils.getMillionSceondsBydate(customerMessagePushDto.getSettingTime()));
WeCustomerMessageTimeTask timeTask = new WeCustomerMessageTimeTask(messageId, customerMessagePushDto, customers, groups
, DateUtils.getMillionSceondsBydate(customerMessagePushDto.getSettingTime()));
customerMessageTimeTaskMapper.saveWeCustomerMessageTimeTask(timeTask);
......
......@@ -39,6 +39,7 @@ import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -101,7 +102,13 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
* @return 任务宝
*/
@Override
public List<WeTaskFission> selectWeTaskFissionList(WeTaskFission weTaskFission) {
public List<WeTaskFission> selectWeTaskFissionList(WeTaskFission weTaskFission) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf_day = new SimpleDateFormat("yyyy-MM-dd");
if (weTaskFission.getStartTime() != null && weTaskFission.getOverTime() != null) {
weTaskFission.setStartTime(sdf.parse(sdf_day.format(weTaskFission.getStartTime()) + " 00:00:00"));
weTaskFission.setOverTime(sdf.parse(sdf_day.format(weTaskFission.getOverTime()) + " 23:59:59"));
}
return weTaskFissionMapper.selectWeTaskFissionList(weTaskFission);
}
......
......@@ -41,8 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
<if test="fissInfo != null and fissInfo != ''"> and fiss_info = #{fissInfo}</if>
<if test="fissNum != null "> and fiss_num = #{fissNum}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="overTime != null "> and over_time = #{overTime}</if>
<if test="startTime != null "> and start_time >= #{startTime}</if>
<if test="overTime != null "> <![CDATA[and over_time <= #{overTime}]]></if>
<if test="customerTagId != null and customerTagId != ''"> and customer_tag_id = #{customerTagId}</if>
<if test="customerTag != null and customerTag != ''"> and customer_tag = #{customerTag}</if>
<if test="postersId != null "> and posters_id = #{postersId}</if>
......@@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fissStatus != null "> and fiss_status = #{fissStatus}</if>
<if test="welcomeMsg != null and welcomeMsg != ''"> and welcome_msg = #{welcomeMsg}</if>
</where>
order by create_time desc
</select>
<select id="selectWeTaskFissionById" parameterType="Long" resultMap="WeTaskFissionResult">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!