群发bug,修复

1 parent 96393a57
Showing 18 changed files with 114 additions and 82 deletions
...@@ -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("执行无参方法");
}
}
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,9 @@ public class WeCustomerList { ...@@ -59,6 +65,9 @@ public class WeCustomerList {
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday; private Date birthday;
...@@ -74,6 +83,9 @@ public class WeCustomerList { ...@@ -74,6 +83,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")
......
...@@ -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);
/** /**
* 保存群发任务 * 保存群发任务
......
...@@ -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);
} }
...@@ -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);
......
...@@ -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,53 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -197,34 +201,53 @@ 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中读取数据 //从redis中读取数据
List<WeCustomer> customers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY); // List<WeCustomer> customers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isEmpty(customers)) { // if (CollectionUtils.isEmpty(customers)) {
WeCustomer weCustomer = new WeCustomer(); // WeCustomer weCustomer = new WeCustomer();
weCustomer.setUserIds(staffId); // weCustomer.setUserIds(staffId);
weCustomer.setDepartmentIds(department); // weCustomer.setDepartmentIds(department);
customers = weCustomerService.selectWeCustomerAllList(weCustomer); // customers = weCustomerService.selectWeCustomerAllList(weCustomer);
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers); // redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
redisCache.expire(WeConstans.WECUSTOMERS_KEY,2 * 60L); // redisCache.expire(WeConstans.WECUSTOMERS_KEY,2 * 60L);
}else{ // }else{
return customers; // return customers;
} // }
//
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setDepartmentIds(department);
// return weCustomerService.selectWeCustomerListNoRel(weCustomer);
return weCustomerService.findWeCustomerList(WeCustomerList.builder()
.userIds(staffId)
.departmentIds(department)
.build());
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());
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setTagIds(tag);
// weCustomer.setDepartmentIds(department);
//
//
//
// return weCustomerService.selectWeCustomerListNoRel(weCustomer);
} }
} }
......
...@@ -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,14 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM ...@@ -94,14 +95,14 @@ 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,7 +112,7 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM ...@@ -111,7 +112,7 @@ 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());
......
...@@ -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 发给客户
...@@ -57,7 +58,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe ...@@ -57,7 +58,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe
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.getName());
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());
......
...@@ -291,6 +291,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -291,6 +291,9 @@ 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)){
//校验是否有标签在库里不存在
CutomerTagEdit cutomerTagEdit = CutomerTagEdit.builder() CutomerTagEdit cutomerTagEdit = CutomerTagEdit.builder()
.external_userid(weMakeCustomerTag.getExternalUserid()) .external_userid(weMakeCustomerTag.getExternalUserid())
......
...@@ -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>
<if test="name != null and name !=''">
AND wc.`name` like concat('%',#{name,jdbcType=VARCHAR},'%') <if test="weCustomerList.delFlag != null">
wc.del_flag = #{weCustomerList.delFlag}
</if>
<if test="weCustomerList.name != null and weCustomerList.name !=''">
AND wc.`name` like concat('%',#{weCustomerList.name,jdbcType=VARCHAR},'%')
</if> </if>
<if test="userIds !=null and userIds !=''"> <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
......
...@@ -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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!