客户详情编辑bug修复

1 parent 3633c89d
Showing 24 changed files with 459 additions and 230 deletions
......@@ -111,14 +111,17 @@ public class WeCustomerController extends BaseController
/**
* 修改企业微信客户
* 修改企业微信客户(目前只更新生日)
*/
// @PreAuthorize("@ss.hasPermi('wecom:customer:edit')")
@Log(title = "企业微信客户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody WeCustomer weCustomer)
{
weCustomerService.saveOrUpdate(weCustomer);
weCustomerService.update(weCustomer,new LambdaQueryWrapper<WeCustomer>()
.eq(WeCustomer::getExternalUserid,weCustomer.getExternalUserid())
.eq(WeCustomer::getFirstUserId,weCustomer.getFirstUserId()));
return AjaxResult.success();
}
......
/*
package com.linkwechat.common.config;/*
package com.linkwechat.common.config;
import org.apache.http.HttpHost;
......
......@@ -408,4 +408,14 @@ public class WeConstans {
* 会话消息订阅的频道
*/
public static final String CONVERSATION_MSG_CHANNEL = "CONVERSATION_MSG_CHANNEL";
/**
* 群发消息任务key
*/
public static final String WEGROUPMSGTIMEDTASK_KEY = "weGroupMessageTimedTask";
/**
* 群发消息任务开关
*/
public static Boolean WEGROUPMSGTIMEDTASK_SWITCH = true;
}
......@@ -16,7 +16,7 @@ import javax.validation.constraints.NotBlank;
/**
* 企业id相关配置对象 wx_corp_account
*
*
* @author ruoyi
* @date 2020-08-24
*/
......@@ -35,105 +35,45 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty("主键")
private Long id= SnowFlakeUtil.nextId();
/*****************************************
*******************企业配置****************
******************************************/
/** 企业ID */
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空")
private String corpId;
/** 企业名称 */
@ApiModelProperty("企业名称")
@NotBlank(message = "企业名称不能为空")
private String companyName;
/** 企业ID */
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空")
private String corpId;
/*****************************************
*******************通讯录配置****************
******************************************/
/** 通讯录 Secret */
/** 应用的密钥凭证 */
@ApiModelProperty("企业为corpSecret")
@NotBlank(message = "应用的密钥凭证不能为空")
private String corpSecret;
/** 帐号状态(0正常 1停用) */
@ApiModelProperty("帐号状态(0正常 1停用)")
private String status;
/*****************************************
*******************客户联系配置****************
******************************************/
/** 删除标志(0代表存在 2代表删除) */
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
private String delFlag=new String("0");
@ApiModelProperty("客户联系配置")
@ApiModelProperty("外部联系人密钥")
@NotBlank(message = "外部联系人密钥凭证不能为空")
private String contactSecret;
/*****************************************
*******************应用配置****************
******************************************/
@ApiModelProperty("应用id")
private String agentId;
@ApiModelProperty("应用密钥")
private String agentSecret;
@ApiModelProperty("会话存档私钥")
private String financePrivateKey;
@ApiModelProperty("会话存档密钥")
private String chatSecret;
/*****************************************
*******************接受事件服务器****************
******************************************/
/**回调URL*/
private String backOffUrl;
/**回调token*/
private String token;
/**回调EncodingAESKey*/
private String encodingAesKey;
/** 帐号状态(0正常 1停用) */
@ApiModelProperty("帐号状态(0正常 1停用)")
private String status;
/** 删除标志(0代表存在 1代表删除) */
@ApiModelProperty("删除标志(0代表存在 1代表删除)")
private Integer delFlag;
@ApiModelProperty("服务商密钥")
private String providerSecret;
@ApiModelProperty("会话存档密钥")
private String chatSecret;
@ApiModelProperty("企业微信扫码登陆回调地址")
......@@ -142,7 +82,8 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启")
private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
@ApiModelProperty("会话存档私钥")
private String financePrivateKey;
@ApiModelProperty("企业管理员账号")
private String corpAccount;
......
package com.linkwechat.common.core.redis;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* spring redis 工具类
*
* @author ruoyi
**/
@SuppressWarnings(value = { "unchecked", "rawtypes" })
@SuppressWarnings(value = {"unchecked", "rawtypes"})
@Component
public class RedisCache
{
public class RedisCache {
@Autowired
public RedisTemplate redisTemplate;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param key 缓存的键值
* @param value 缓存的值
*/
public <T> void setCacheObject(final String key, final T value)
{
public <T> void setCacheObject(final String key, final T value) {
redisTemplate.opsForValue().set(key, value);
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @param timeout 时间
* @param key 缓存的键值
* @param value 缓存的值
* @param timeout 时间
* @param timeUnit 时间颗粒度
*/
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
{
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
public boolean expire(final String key, final long timeout)
{
public boolean expire(final String key, final long timeout) {
return expire(key, timeout, TimeUnit.SECONDS);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param key Redis键
* @param timeout 超时时间
* @param unit 时间单位
* @param unit 时间单位
* @return true=设置成功;false=设置失败
*/
public boolean expire(final String key, final long timeout, final TimeUnit unit)
{
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
}
......@@ -81,8 +75,7 @@ public class RedisCache
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public <T> T getCacheObject(final String key)
{
public <T> T getCacheObject(final String key) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
......@@ -92,8 +85,7 @@ public class RedisCache
*
* @param key
*/
public boolean deleteObject(final String key)
{
public boolean deleteObject(final String key) {
return redisTemplate.delete(key);
}
......@@ -103,20 +95,18 @@ public class RedisCache
* @param collection 多个对象
* @return
*/
public long deleteObject(final Collection collection)
{
public long deleteObject(final Collection collection) {
return redisTemplate.delete(collection);
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public <T> long setCacheList(final String key, final List<T> dataList)
{
public <T> long setCacheList(final String key, final List<T> dataList) {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
......@@ -127,20 +117,18 @@ public class RedisCache
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public <T> List<T> getCacheList(final String key)
{
public <T> List<T> getCacheList(final String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public <T> long setCacheSet(final String key, final Set<T> dataSet)
{
public <T> long setCacheSet(final String key, final Set<T> dataSet) {
Long count = redisTemplate.opsForSet().add(key, dataSet);
return count == null ? 0 : count;
}
......@@ -151,8 +139,7 @@ public class RedisCache
* @param key
* @return
*/
public <T> Set<T> getCacheSet(final String key)
{
public <T> Set<T> getCacheSet(final String key) {
return redisTemplate.opsForSet().members(key);
}
......@@ -162,8 +149,7 @@ public class RedisCache
* @param key
* @param dataMap
*/
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
{
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
......@@ -175,32 +161,29 @@ public class RedisCache
* @param key
* @return
*/
public <T> Map<String, T> getCacheMap(final String key)
{
public <T> Map<String, T> getCacheMap(final String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* 往Hash中存入数据
*
* @param key Redis键
* @param hKey Hash键
* @param key Redis键
* @param hKey Hash键
* @param value 值
*/
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
{
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
redisTemplate.opsForHash().put(key, hKey, value);
}
/**
* 获取Hash中的数据
*
* @param key Redis键
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public <T> T getCacheMapValue(final String key, final String hKey)
{
public <T> T getCacheMapValue(final String key, final String hKey) {
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
......@@ -208,12 +191,11 @@ public class RedisCache
/**
* 获取多个Hash中的数据
*
* @param key Redis键
* @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
{
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
......@@ -223,8 +205,7 @@ public class RedisCache
* @param pattern 字符串前缀
* @return 对象列表
*/
public Collection<String> keys(final String pattern)
{
public Collection<String> keys(final String pattern) {
return redisTemplate.keys(pattern);
}
......@@ -235,8 +216,151 @@ public class RedisCache
* @param channel 要发布到的频道
* @param message 消息内容
*/
public void convertAndSend(String channel, Object message)
{
redisTemplate.convertAndSend(channel,message);
public void convertAndSend(String channel, Object message) {
redisTemplate.convertAndSend(channel, message);
}
/**
* 添加一个元素, zset与set最大的区别就是每个元素都有一个score,因此有个排序的辅助功能;
*
* @param key
* @param value
* @param score
*/
public Boolean setCacheZSet(String key, String value, double score) {
return redisTemplate.opsForZSet().add(key, value, score);
}
/**
* 删除元素 zrem
*
* @param key
* @param start
* @param end
*/
public Long removeRangeCacheZSet(String key, long start, long end) {
return redisTemplate.opsForZSet().removeRange(key, start,end);
}
/**
* 删除元素 zrem
*
* @param key
* @param value
*/
public long removeCacheZSet(String key, String value) {
return redisTemplate.opsForZSet().remove(key, value);
}
/**
* score的增加or减少 zincrby
*
* @param key
* @param value
* @param score
*/
public Double incrScoreCacheZSet(String key, String value, double score) {
return redisTemplate.opsForZSet().incrementScore(key, value, score);
}
/**
* 查询value对应的score zscore
*
* @param key
* @param value
* @return
*/
public Double getCacheZSetScore(String key, String value) {
return redisTemplate.opsForZSet().score(key, value);
}
/**
* 判断value在zset中的排名 zrank
*
* @param key
* @param value
* @return
*/
public Long rankCacheZSet(String key, String value) {
return redisTemplate.opsForZSet().rank(key, value);
}
/**
* 返回集合的长度
*
* @param key
* @return
*/
public Long getCacheZSetSize(String key) {
return redisTemplate.opsForZSet().zCard(key);
}
/**
* 查询集合中指定顺序的值, 0 -1 表示获取全部的集合内容 zrange
*
* 返回有序的集合,score小的在前面
*
* @param key
* @param start
* @param end
* @return
*/
public Set<String> rangeCacheZSet(String key, int start, int end) {
return redisTemplate.opsForZSet().range(key, start, end);
}
/**
* 查询集合中指定顺序的值和score,0, -1 表示获取全部的集合内容
*
* @param key
* @param start
* @param end
* @return
*/
public Set<ZSetOperations.TypedTuple<String>> rangeWithScore(String key, int start, int end) {
return redisTemplate.opsForZSet().rangeWithScores(key, start, end);
}
/**
* 查询集合中指定顺序的值 zrevrange
*
* 返回有序的集合中,score大的在前面
*
* @param key
* @param start
* @param end
* @return
*/
public Set<String> revRangeCacheZSet(String key, int start, int end) {
return redisTemplate.opsForZSet().reverseRange(key, start, end);
}
/**
* 根据score的值,来获取满足条件的集合 zrangebyscore
*
* @param key
* @param min
* @param max
* @return
*/
public Set<String> sortRangeCacheZSet(String key, double min, double max) {
return redisTemplate.opsForZSet().rangeByScore(key, min, max);
}
/**
* 根据score的值,来获取满足条件的集合
*
* @param key
* @param min
* @param max
* @return
*/
public Set<ZSetOperations.TypedTuple<String>> sortRangeWithScoresCacheZSet(String key, double min, double max) {
return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max);
}
}
......@@ -93,4 +93,8 @@ public enum MessageType {
return Stream.of(values()).filter(s -> s.type.equals(type)).findFirst();
}
public static MessageType messageTypeOf(String messageType) {
return Stream.of(values()).filter(s -> s.messageType.equals(messageType)).findFirst().get();
}
}
......@@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import cn.hutool.core.io.FileUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig;
......@@ -73,6 +74,14 @@ public class FileUploadUtils {
}
}
public static final String upload(InputStream inputStream,String fileName) throws IOException {
try {
return upload(getDefaultBaseDir(), inputStream, fileName);
} catch (Exception e) {
throw new IOException(e.getMessage(), e);
}
}
/**
* 以默认配置进行文件上传
......@@ -135,6 +144,12 @@ public class FileUploadUtils {
return pathFileName;
}
public static final String upload(String baseDir, InputStream inputStream, String fileName) throws IOException {
File desc = getAbsoluteFile(baseDir, fileName);
File file = FileUtil.writeFromStream(inputStream, desc);
return file.getAbsolutePath();
}
/**
* 上传到腾讯对象云存储中
*
......
......@@ -64,7 +64,7 @@ public class RSAUtil {
*/
public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException,
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, NoSuchProviderException {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
Security.addProvider(new BouncyCastleProvider());
Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
rsa.init(Cipher.DECRYPT_MODE, privateKey);
byte[] utf8 = rsa.doFinal(Base64.getDecoder().decode(str));
......
......@@ -16,6 +16,7 @@ import com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery;
import com.linkwechat.wecom.service.IWeGroupMessageAttachmentsService;
import com.linkwechat.wecom.service.IWeGroupMessageListService;
import com.linkwechat.wecom.service.IWeGroupMessageSendResultService;
import com.linkwechat.wecom.service.IWeGroupMessageTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -43,6 +44,9 @@ public class PullGroupMessageTask {
@Autowired
private IWeGroupMessageSendResultService sendResultService;
@Autowired
private IWeGroupMessageTaskService iWeGroupMessageTaskService;
/**
* 同步开始时间
*/
......@@ -180,7 +184,7 @@ public class PullGroupMessageTask {
List<WeGroupMessageSendResult> list = new ArrayList<>();
Optional.ofNullable(groupMsgList).map(WeGroupMsgListDto::getGroupMsgList)
.orElseGet(ArrayList::new).forEach(weGroupMsg -> {
WeGroupMsgListDto groupMsgTask = groupMessageListService.getGroupMsgTask(weGroupMsg.getMsgId(), null);
WeGroupMsgListDto groupMsgTask = iWeGroupMessageTaskService.getGroupMsgTask(weGroupMsg.getMsgId(), null);
Optional.ofNullable(groupMsgTask).map(WeGroupMsgListDto::getTaskList).orElseGet(ArrayList::new).forEach(msgTask -> {
WeGroupMsgListDto groupMsgSendResult = sendResultService.getGroupMsgSendResult(weGroupMsg.getMsgId(), msgTask.getUserId(), null);
Optional.ofNullable(groupMsgSendResult).map(WeGroupMsgListDto::getSendList).orElseGet(ArrayList::new).forEach(sendResult -> {
......
......@@ -43,8 +43,8 @@ public class WeFlowerCustomerTagRel
@TableField(exist = false)
private String tagName;
/**0:移动端打的标签;1:pc端打的标签**/
private Integer relTagType;
// /**0:移动端打的标签;1:pc端打的标签**/
// private Integer relTagType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
......
......@@ -2,8 +2,6 @@ package com.linkwechat.wecom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.wecom.domain.WeGroupMessageAttachments;
import com.linkwechat.wecom.domain.WeGroupMessageSendResult;
import com.linkwechat.wecom.domain.WeGroupMessageTask;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -29,21 +27,25 @@ public class WeGroupMessageDetailVo {
@ApiModelProperty("发送时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date sendTime;
/**
* 附件
*/
@ApiModelProperty("附件")
private List<WeGroupMessageAttachments> attachments;
/**
* 待发送者列表
*/
@ApiModelProperty("待发送者数")
private Integer toBeSendNum;
@ApiModelProperty("待发送者列表")
private List<WeGroupMessageTaskVo> toBeSentList;
private List<WeGroupMessageTaskVo> toBeSendList;
@ApiModelProperty("已发送者数量")
private Integer alreadySendNum;
/**
* 已发送者列表
*/
@ApiModelProperty("已发送者列表")
private List<WeGroupMessageTaskVo> alreadySentList;
private List<WeGroupMessageTaskVo> alreadySendList;
@ApiModelProperty("已送达客户数")
private Integer alreadySendCustomerNum;
@ApiModelProperty("未送达客户数")
private Integer toBeSendCustomerNum;
}
......@@ -3,6 +3,8 @@ package com.linkwechat.wecom.mapper;
import com.linkwechat.wecom.domain.WeGroupMessageSendResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* 群发消息成员执行结果Mapper接口
*
......@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface WeGroupMessageSendResultMapper extends BaseMapper<WeGroupMessageSendResult> {
List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult);
}
......@@ -3,6 +3,8 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeGroupMessageTask;
import java.util.List;
/**
* 群发消息成员发送任务表Mapper接口
*
......@@ -11,4 +13,5 @@ import com.linkwechat.wecom.domain.WeGroupMessageTask;
*/
public interface WeGroupMessageTaskMapper extends BaseMapper<WeGroupMessageTask> {
List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task);
}
......@@ -29,14 +29,14 @@ public interface IWeCustomerService extends IService<WeCustomer>
*/
public WeCustomer selectWeCustomerById(String externalUserId);
/**
* 新增/修改企业微信客户
*
* @param weCustomer 企业微信客户
* @return 修改结果
*/
@Override
public boolean saveOrUpdate(WeCustomer weCustomer);
// /**
// * 新增/修改企业微信客户
// *
// * @param weCustomer 企业微信客户
// * @return 修改结果
// */
// @Override
// public boolean saveOrUpdate(WeCustomer weCustomer);
/**
* 查询企业微信客户列表
......
......@@ -32,4 +32,6 @@ public interface IWeGroupMessageSendResultService extends IService<WeGroupMessag
void addOrUpdateBatchByCondition(List<WeGroupMessageSendResult> taskList);
List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult);
}
......@@ -28,4 +28,6 @@ public interface IWeGroupMessageTaskService extends IService<WeGroupMessageTask>
* @param taskList
*/
void addOrUpdateBatchByCondition(List<WeGroupMessageTask> taskList);
List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeGroupMessageSendResult;
import com.linkwechat.wecom.domain.WeGroupMessageTask;
import com.linkwechat.wecom.domain.WeGroupMessageTemplate;
import com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery;
import com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo;
......@@ -27,6 +29,7 @@ public interface IWeGroupMessageTemplateService extends IService<WeGroupMessageT
*/
WeGroupMessageDetailVo getGroupMsgTemplateDetail(Long id);
/**
* 创建群发消息
* @param query
......@@ -44,4 +47,16 @@ public interface IWeGroupMessageTemplateService extends IService<WeGroupMessageT
* @param asList
*/
void syncGroupMsgSendResultByIds(List<Long> asList);
/**
* 群发成员发送任务列表
* @param task
*/
List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task);
/**
* 企业群发成员执行结果
* @param sendResult
*/
List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult);
}
......@@ -371,9 +371,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Override
public List<WeUser> getCustomersByUserId(String externalUserid) {
String userId=null;
if(Constants.USER_TYPE_WECOME.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
userId=SecurityUtils.getLoginUser().getUser().getWeUserId();
}
// if(Constants.USER_TYPE_WECOME.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
// userId=SecurityUtils.getLoginUser().getUser().getWeUserId();
// }
return this.baseMapper.getCustomersByUserId(externalUserid,userId);
}
......
......@@ -93,4 +93,9 @@ public class WeGroupMessageSendResultServiceImpl extends ServiceImpl<WeGroupMess
});
}
}
@Override
public List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) {
return this.baseMapper.groupMsgSendResultList(sendResult);
}
}
......@@ -64,4 +64,9 @@ public class WeGroupMessageTaskServiceImpl extends ServiceImpl<WeGroupMessageTas
});
}
}
@Override
public List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task) {
return this.baseMapper.groupMsgTaskList(task);
}
}
......@@ -97,6 +97,14 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
List<WeGroupMessageTask> alreadySent = groupMsgDetail.stream().map(WeGroupMessageListVo::getSenders)
.flatMap(Collection::stream).filter(item -> ObjectUtil.equal(2, item.getStatus())).collect(Collectors.toList());
//未发送客户数
Long toBeCustomerNum = groupMsgDetail.stream().map(WeGroupMessageListVo::getExtralInfos).flatMap(Collection::stream)
.filter(item -> ObjectUtil.equal(0, item.getStatus())).count();
detailVo.setToBeSendCustomerNum(toBeCustomerNum.intValue());
//已发送客户数
Long alreadyCustomerNum = groupMsgDetail.stream().map(WeGroupMessageListVo::getExtralInfos).flatMap(Collection::stream)
.filter(item -> !ObjectUtil.equal(1, item.getStatus())).count();
detailVo.setAlreadySendCustomerNum(alreadyCustomerNum.intValue());
//未发送查询每个人员对应客户信息
if (CollectionUtil.isNotEmpty(toBeSent)) {
List<WeGroupMessageTaskVo> toBeSentList = toBeSent.stream().map(userInfo -> {
......@@ -118,7 +126,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
}
return weGroupMessageTaskVo;
}).collect(Collectors.toList());
detailVo.setToBeSentList(toBeSentList);
detailVo.setToBeSendList(toBeSentList);
detailVo.setToBeSendNum(toBeSentList.size());
}
//已发送查询每个人员对应客户信息
if (CollectionUtil.isNotEmpty(alreadySent)) {
......@@ -142,7 +151,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
}
return weGroupMessageTaskVo;
}).collect(Collectors.toList());
detailVo.setAlreadySentList(alreadySentList);
detailVo.setAlreadySendList(alreadySentList);
detailVo.setAlreadySendNum(alreadySentList.size());
}
}
return detailVo;
......@@ -288,4 +298,13 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
messageSendResultService.addOrUpdateBatchByCondition(sendResultlist);
}
@Override
public List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task) {
return messageTaskService.groupMsgTaskList(task);
}
@Override
public List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) {
return messageSendResultService.groupMsgSendResultList(sendResult);
}
}
......@@ -129,23 +129,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userName" column="user_name" />
<result property="userId" column="user_id" />
<result property="isOpenChat" column="is_open_chat" jdbcType="INTEGER" />
<collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel">
<result property="id" column="wfcrId" />
<result property="userId" column="user_id" />
<result property="remark" column="remark" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<result property="remarkCorpName" column="remark_corp_name" />
<result property="operUserid" column="oper_userid" />
<result property="addWay" column="add_way" />
<result property="state" column="state" />
<result property="status" column="status" />
<result property="userName" column="user_name"/>
<result property="department" column="department"/>
<collection property="weFlowerCustomerTagRels" javaType="ArrayList"
column="{id = wfcrId}" select="selectWeCustomerTags">
</collection>
</collection>
<!-- <collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel">-->
<!-- <result property="id" column="wfcrId" />-->
<!-- <result property="userId" column="user_id" />-->
<!-- <result property="remark" column="remark" />-->
<!-- <result property="description" column="description" />-->
<!-- <result property="createTime" column="create_time" />-->
<!-- <result property="remarkCorpName" column="remark_corp_name" />-->
<!-- <result property="operUserid" column="oper_userid" />-->
<!-- <result property="addWay" column="add_way" />-->
<!-- <result property="state" column="state" />-->
<!-- <result property="status" column="status" />-->
<!-- <result property="userName" column="user_name"/>-->
<!-- <result property="department" column="department"/>-->
<!-- <collection property="weFlowerCustomerTagRels" javaType="ArrayList"-->
<!-- column="{id = wfcrId}" select="selectWeCustomerTags">-->
<!-- </collection>-->
<!-- </collection>-->
</resultMap>
......@@ -298,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON 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
<where>
<if test="delFlag != null">
......@@ -407,44 +407,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getCustomersByUserId" resultMap="WeCustomerResult">
SELECT
wc.external_userid,
wc.`name`,
wc.avatar,
wc.type,
wc.gender,
wc.unionid,
wc.birthday,
wc.corp_name,
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wu.user_name,
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
SELECT
wc.external_userid,
wc.`name`,
wc.avatar,
wc.type,
wc.gender,
wc.unionid,
wc.birthday,
wc.corp_name,
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wu.user_name,
wt.tag_id,
wt.create_time,
wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.first_user_id=wfcr.user_id
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
we_customer wc
LEFT JOIN we_user wu ON wu.user_id=wc.first_user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid}
<if test="userId != null and userId !=''">
AND wfcr.user_id=#{userId}
AND wc.first_user_id=#{userId}
</if>
ORDER BY wfcr.create_time ASC limit 1
ORDER BY wc.create_time ASC limit 1
</select>
......
......@@ -9,15 +9,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="msgTemplateId" column="msg_template_id" />
<result property="msgId" column="msg_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="externalUserid" column="external_userid" />
<result property="customerName" column="customer_name" />
<result property="chatId" column="chat_id" />
<result property="chatName" column="chat_name" />
<result property="status" column="status" />
<result property="sendTime" column="send_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<select id="groupMsgSendResultList" resultMap="WeGroupMessageSendResultResult">
select
wgmsr.id,
wgmsr.msg_id,
wgmsr.msg_template_id,
wgmsr.external_userid,
wc.name as customer_name,
wgmsr.user_id,
wu.user_name,
wgmsr.chat_id,
wg.group_name as chat_name,
wgmsr.status,
wgmsr.send_time
from
we_group_message_send_result wgmsr
left join we_user wu on
wu.user_id = wgmsr.user_id
left join we_customer wc on
wc.external_userid = wgmsr.external_userid
left join we_group wg on
wg.chat_id = wgmsr.chat_id
<where>
<if test="id !=null">
and wgmsr.id = #{id}
</if>
<if test="msgTemplateId != null and msgTemplateId != ''">
and wgmsr.msg_template_id = #{msgTemplateId}
</if>
<if test="msgId != null and msgId != ''">
and wgmsr.msg_id = #{msgId}
</if>
<if test="status != null and status != ''">
and wgmsr.status = #{status}
</if>
<if test="customerName != null and customerName != ''">
and wc.name like concat('%', #{customerName}, '%')
</if>
<if test="userName != null and userName != ''">
and wu.user_name like concat('%', #{userName}, '%')
</if>
<if test="chatName != null and chatName != ''">
and wg.group_name like concat('%', #{chatName}, '%')
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wgmsr.send_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wgmsr.send_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -9,13 +9,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="msgTemplateId" column="msg_template_id" />
<result property="msgId" column="msg_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="sendTime" column="send_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<select id="groupMsgTaskList" resultMap="WeGroupMessageTaskResult">
select
wgmt.id,
wgmt.msg_template_id,
wgmt.msg_id,
wgmt.user_id,
wu.user_name,
wgmt.status,
wgmt.send_time
from we_group_message_task wgmt
left join we_user wu on wu.user_id = wgmt.user_id
<where>
<if test="id != null">
and wgmt.id = #{id}
</if>
<if test="msgId != null and msgId != ''">
and wgmt.msg_id = #{msgId}
</if>
<if test="msgTemplateId != null and msgTemplateId != ''">
and wgmt.msg_template_id = #{msgTemplateId}
</if>
<if test="userName != null and userName != ''">
and wu.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null">
and wgmt.status = #{status}
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wgmt.send_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wgmt.send_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
</select>
</mapper>
\ 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!