客户详情编辑bug修复

1 parent 3633c89d
Showing 24 changed files with 274 additions and 169 deletions
...@@ -111,14 +111,17 @@ public class WeCustomerController extends BaseController ...@@ -111,14 +111,17 @@ public class WeCustomerController extends BaseController
/** /**
* 修改企业微信客户 * 修改企业微信客户(目前只更新生日)
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:customer:edit')") // @PreAuthorize("@ss.hasPermi('wecom:customer:edit')")
@Log(title = "企业微信客户", businessType = BusinessType.UPDATE) @Log(title = "企业微信客户", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody WeCustomer weCustomer) 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(); return AjaxResult.success();
} }
......
/* package com.linkwechat.common.config;/*
package com.linkwechat.common.config; package com.linkwechat.common.config;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
......
...@@ -408,4 +408,14 @@ public class WeConstans { ...@@ -408,4 +408,14 @@ public class WeConstans {
* 会话消息订阅的频道 * 会话消息订阅的频道
*/ */
public static final String CONVERSATION_MSG_CHANNEL = "CONVERSATION_MSG_CHANNEL"; 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; ...@@ -16,7 +16,7 @@ import javax.validation.constraints.NotBlank;
/** /**
* 企业id相关配置对象 wx_corp_account * 企业id相关配置对象 wx_corp_account
* *
* @author ruoyi * @author ruoyi
* @date 2020-08-24 * @date 2020-08-24
*/ */
...@@ -35,105 +35,45 @@ public class WeCorpAccount extends BaseEntity ...@@ -35,105 +35,45 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty("主键") @ApiModelProperty("主键")
private Long id= SnowFlakeUtil.nextId(); private Long id= SnowFlakeUtil.nextId();
/*****************************************
*******************企业配置****************
******************************************/
/** 企业ID */
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空")
private String corpId;
/** 企业名称 */ /** 企业名称 */
@ApiModelProperty("企业名称") @ApiModelProperty("企业名称")
@NotBlank(message = "企业名称不能为空") @NotBlank(message = "企业名称不能为空")
private String companyName; private String companyName;
/** 企业ID */
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空")
private String corpId;
/** 应用的密钥凭证 */
/*****************************************
*******************通讯录配置****************
******************************************/
/** 通讯录 Secret */
@ApiModelProperty("企业为corpSecret") @ApiModelProperty("企业为corpSecret")
@NotBlank(message = "应用的密钥凭证不能为空") @NotBlank(message = "应用的密钥凭证不能为空")
private String corpSecret; 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 = "外部联系人密钥凭证不能为空") @NotBlank(message = "外部联系人密钥凭证不能为空")
private String contactSecret; private String contactSecret;
/*****************************************
*******************应用配置****************
******************************************/
@ApiModelProperty("应用id") @ApiModelProperty("应用id")
private String agentId; private String agentId;
@ApiModelProperty("应用密钥") @ApiModelProperty("应用密钥")
private String agentSecret; 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("服务商密钥") @ApiModelProperty("服务商密钥")
private String providerSecret; private String providerSecret;
@ApiModelProperty("会话存档密钥")
private String chatSecret;
@ApiModelProperty("企业微信扫码登陆回调地址") @ApiModelProperty("企业微信扫码登陆回调地址")
...@@ -142,7 +82,8 @@ public class WeCorpAccount extends BaseEntity ...@@ -142,7 +82,8 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启") @ApiModelProperty("客户流失通知开关 0:关闭 1:开启")
private String customerChurnNoticeSwitch = Constants.NORMAL_CODE; private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
@ApiModelProperty("会话存档私钥")
private String financePrivateKey;
@ApiModelProperty("企业管理员账号") @ApiModelProperty("企业管理员账号")
private String corpAccount; private String corpAccount;
......
...@@ -93,4 +93,8 @@ public enum MessageType { ...@@ -93,4 +93,8 @@ public enum MessageType {
return Stream.of(values()).filter(s -> s.type.equals(type)).findFirst(); 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; ...@@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import cn.hutool.core.io.FileUtil;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.linkwechat.common.config.CosConfig; import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
...@@ -73,6 +74,14 @@ public class FileUploadUtils { ...@@ -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 { ...@@ -135,6 +144,12 @@ public class FileUploadUtils {
return pathFileName; 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 { ...@@ -64,7 +64,7 @@ public class RSAUtil {
*/ */
public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException, public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException,
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, NoSuchProviderException { 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"); Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
rsa.init(Cipher.DECRYPT_MODE, privateKey); rsa.init(Cipher.DECRYPT_MODE, privateKey);
byte[] utf8 = rsa.doFinal(Base64.getDecoder().decode(str)); byte[] utf8 = rsa.doFinal(Base64.getDecoder().decode(str));
......
...@@ -16,6 +16,7 @@ import com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery; ...@@ -16,6 +16,7 @@ import com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery;
import com.linkwechat.wecom.service.IWeGroupMessageAttachmentsService; import com.linkwechat.wecom.service.IWeGroupMessageAttachmentsService;
import com.linkwechat.wecom.service.IWeGroupMessageListService; import com.linkwechat.wecom.service.IWeGroupMessageListService;
import com.linkwechat.wecom.service.IWeGroupMessageSendResultService; import com.linkwechat.wecom.service.IWeGroupMessageSendResultService;
import com.linkwechat.wecom.service.IWeGroupMessageTaskService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -43,6 +44,9 @@ public class PullGroupMessageTask { ...@@ -43,6 +44,9 @@ public class PullGroupMessageTask {
@Autowired @Autowired
private IWeGroupMessageSendResultService sendResultService; private IWeGroupMessageSendResultService sendResultService;
@Autowired
private IWeGroupMessageTaskService iWeGroupMessageTaskService;
/** /**
* 同步开始时间 * 同步开始时间
*/ */
...@@ -180,7 +184,7 @@ public class PullGroupMessageTask { ...@@ -180,7 +184,7 @@ public class PullGroupMessageTask {
List<WeGroupMessageSendResult> list = new ArrayList<>(); List<WeGroupMessageSendResult> list = new ArrayList<>();
Optional.ofNullable(groupMsgList).map(WeGroupMsgListDto::getGroupMsgList) Optional.ofNullable(groupMsgList).map(WeGroupMsgListDto::getGroupMsgList)
.orElseGet(ArrayList::new).forEach(weGroupMsg -> { .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 -> { Optional.ofNullable(groupMsgTask).map(WeGroupMsgListDto::getTaskList).orElseGet(ArrayList::new).forEach(msgTask -> {
WeGroupMsgListDto groupMsgSendResult = sendResultService.getGroupMsgSendResult(weGroupMsg.getMsgId(), msgTask.getUserId(), null); WeGroupMsgListDto groupMsgSendResult = sendResultService.getGroupMsgSendResult(weGroupMsg.getMsgId(), msgTask.getUserId(), null);
Optional.ofNullable(groupMsgSendResult).map(WeGroupMsgListDto::getSendList).orElseGet(ArrayList::new).forEach(sendResult -> { Optional.ofNullable(groupMsgSendResult).map(WeGroupMsgListDto::getSendList).orElseGet(ArrayList::new).forEach(sendResult -> {
......
...@@ -43,8 +43,8 @@ public class WeFlowerCustomerTagRel ...@@ -43,8 +43,8 @@ public class WeFlowerCustomerTagRel
@TableField(exist = false) @TableField(exist = false)
private String tagName; private String tagName;
/**0:移动端打的标签;1:pc端打的标签**/ // /**0:移动端打的标签;1:pc端打的标签**/
private Integer relTagType; // private Integer relTagType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
......
...@@ -2,8 +2,6 @@ package com.linkwechat.wecom.domain.vo; ...@@ -2,8 +2,6 @@ package com.linkwechat.wecom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.wecom.domain.WeGroupMessageAttachments; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -29,21 +27,25 @@ public class WeGroupMessageDetailVo { ...@@ -29,21 +27,25 @@ public class WeGroupMessageDetailVo {
@ApiModelProperty("发送时间") @ApiModelProperty("发送时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date sendTime; private Date sendTime;
/**
* 附件
*/
@ApiModelProperty("附件") @ApiModelProperty("附件")
private List<WeGroupMessageAttachments> attachments; private List<WeGroupMessageAttachments> attachments;
/** @ApiModelProperty("待发送者数")
* 待发送者列表 private Integer toBeSendNum;
*/
@ApiModelProperty("待发送者列表") @ApiModelProperty("待发送者列表")
private List<WeGroupMessageTaskVo> toBeSentList; private List<WeGroupMessageTaskVo> toBeSendList;
@ApiModelProperty("已发送者数量")
private Integer alreadySendNum;
/**
* 已发送者列表
*/
@ApiModelProperty("已发送者列表") @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; ...@@ -3,6 +3,8 @@ package com.linkwechat.wecom.mapper;
import com.linkwechat.wecom.domain.WeGroupMessageSendResult; import com.linkwechat.wecom.domain.WeGroupMessageSendResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/** /**
* 群发消息成员执行结果Mapper接口 * 群发消息成员执行结果Mapper接口
* *
...@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface WeGroupMessageSendResultMapper extends BaseMapper<WeGroupMessageSendResult> { public interface WeGroupMessageSendResultMapper extends BaseMapper<WeGroupMessageSendResult> {
List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult);
} }
...@@ -3,6 +3,8 @@ package com.linkwechat.wecom.mapper; ...@@ -3,6 +3,8 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeGroupMessageTask; import com.linkwechat.wecom.domain.WeGroupMessageTask;
import java.util.List;
/** /**
* 群发消息成员发送任务表Mapper接口 * 群发消息成员发送任务表Mapper接口
* *
...@@ -11,4 +13,5 @@ import com.linkwechat.wecom.domain.WeGroupMessageTask; ...@@ -11,4 +13,5 @@ import com.linkwechat.wecom.domain.WeGroupMessageTask;
*/ */
public interface WeGroupMessageTaskMapper extends BaseMapper<WeGroupMessageTask> { public interface WeGroupMessageTaskMapper extends BaseMapper<WeGroupMessageTask> {
List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task);
} }
...@@ -29,14 +29,14 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -29,14 +29,14 @@ public interface IWeCustomerService extends IService<WeCustomer>
*/ */
public WeCustomer selectWeCustomerById(String externalUserId); public WeCustomer selectWeCustomerById(String externalUserId);
/** // /**
* 新增/修改企业微信客户 // * 新增/修改企业微信客户
* // *
* @param weCustomer 企业微信客户 // * @param weCustomer 企业微信客户
* @return 修改结果 // * @return 修改结果
*/ // */
@Override // @Override
public boolean saveOrUpdate(WeCustomer weCustomer); // public boolean saveOrUpdate(WeCustomer weCustomer);
/** /**
* 查询企业微信客户列表 * 查询企业微信客户列表
......
...@@ -32,4 +32,6 @@ public interface IWeGroupMessageSendResultService extends IService<WeGroupMessag ...@@ -32,4 +32,6 @@ public interface IWeGroupMessageSendResultService extends IService<WeGroupMessag
void addOrUpdateBatchByCondition(List<WeGroupMessageSendResult> taskList); void addOrUpdateBatchByCondition(List<WeGroupMessageSendResult> taskList);
List<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult);
} }
...@@ -28,4 +28,6 @@ public interface IWeGroupMessageTaskService extends IService<WeGroupMessageTask> ...@@ -28,4 +28,6 @@ public interface IWeGroupMessageTaskService extends IService<WeGroupMessageTask>
* @param taskList * @param taskList
*/ */
void addOrUpdateBatchByCondition(List<WeGroupMessageTask> taskList); void addOrUpdateBatchByCondition(List<WeGroupMessageTask> taskList);
List<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService; 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.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;
...@@ -27,6 +29,7 @@ public interface IWeGroupMessageTemplateService extends IService<WeGroupMessageT ...@@ -27,6 +29,7 @@ public interface IWeGroupMessageTemplateService extends IService<WeGroupMessageT
*/ */
WeGroupMessageDetailVo getGroupMsgTemplateDetail(Long id); WeGroupMessageDetailVo getGroupMsgTemplateDetail(Long id);
/** /**
* 创建群发消息 * 创建群发消息
* @param query * @param query
...@@ -44,4 +47,16 @@ public interface IWeGroupMessageTemplateService extends IService<WeGroupMessageT ...@@ -44,4 +47,16 @@ public interface IWeGroupMessageTemplateService extends IService<WeGroupMessageT
* @param asList * @param asList
*/ */
void syncGroupMsgSendResultByIds(List<Long> 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 ...@@ -371,9 +371,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Override @Override
public List<WeUser> getCustomersByUserId(String externalUserid) { public List<WeUser> getCustomersByUserId(String externalUserid) {
String userId=null; String userId=null;
if(Constants.USER_TYPE_WECOME.equals(SecurityUtils.getLoginUser().getUser().getUserType())){ // if(Constants.USER_TYPE_WECOME.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
userId=SecurityUtils.getLoginUser().getUser().getWeUserId(); // userId=SecurityUtils.getLoginUser().getUser().getWeUserId();
} // }
return this.baseMapper.getCustomersByUserId(externalUserid,userId); return this.baseMapper.getCustomersByUserId(externalUserid,userId);
} }
......
...@@ -93,4 +93,9 @@ public class WeGroupMessageSendResultServiceImpl extends ServiceImpl<WeGroupMess ...@@ -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 ...@@ -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 ...@@ -97,6 +97,14 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
List<WeGroupMessageTask> alreadySent = groupMsgDetail.stream().map(WeGroupMessageListVo::getSenders) List<WeGroupMessageTask> alreadySent = groupMsgDetail.stream().map(WeGroupMessageListVo::getSenders)
.flatMap(Collection::stream).filter(item -> ObjectUtil.equal(2, item.getStatus())).collect(Collectors.toList()); .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)) { if (CollectionUtil.isNotEmpty(toBeSent)) {
List<WeGroupMessageTaskVo> toBeSentList = toBeSent.stream().map(userInfo -> { List<WeGroupMessageTaskVo> toBeSentList = toBeSent.stream().map(userInfo -> {
...@@ -118,7 +126,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -118,7 +126,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
} }
return weGroupMessageTaskVo; return weGroupMessageTaskVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
detailVo.setToBeSentList(toBeSentList); detailVo.setToBeSendList(toBeSentList);
detailVo.setToBeSendNum(toBeSentList.size());
} }
//已发送查询每个人员对应客户信息 //已发送查询每个人员对应客户信息
if (CollectionUtil.isNotEmpty(alreadySent)) { if (CollectionUtil.isNotEmpty(alreadySent)) {
...@@ -142,7 +151,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -142,7 +151,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
} }
return weGroupMessageTaskVo; return weGroupMessageTaskVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
detailVo.setAlreadySentList(alreadySentList); detailVo.setAlreadySendList(alreadySentList);
detailVo.setAlreadySendNum(alreadySentList.size());
} }
} }
return detailVo; return detailVo;
...@@ -288,4 +298,13 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag ...@@ -288,4 +298,13 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
messageSendResultService.addOrUpdateBatchByCondition(sendResultlist); 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" ...@@ -129,23 +129,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userName" column="user_name" /> <result property="userName" column="user_name" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="isOpenChat" column="is_open_chat" jdbcType="INTEGER" /> <result property="isOpenChat" column="is_open_chat" jdbcType="INTEGER" />
<collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel"> <!-- <collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel">-->
<result property="id" column="wfcrId" /> <!-- <result property="id" column="wfcrId" />-->
<result property="userId" column="user_id" /> <!-- <result property="userId" column="user_id" />-->
<result property="remark" column="remark" /> <!-- <result property="remark" column="remark" />-->
<result property="description" column="description" /> <!-- <result property="description" column="description" />-->
<result property="createTime" column="create_time" /> <!-- <result property="createTime" column="create_time" />-->
<result property="remarkCorpName" column="remark_corp_name" /> <!-- <result property="remarkCorpName" column="remark_corp_name" />-->
<result property="operUserid" column="oper_userid" /> <!-- <result property="operUserid" column="oper_userid" />-->
<result property="addWay" column="add_way" /> <!-- <result property="addWay" column="add_way" />-->
<result property="state" column="state" /> <!-- <result property="state" column="state" />-->
<result property="status" column="status" /> <!-- <result property="status" column="status" />-->
<result property="userName" column="user_name"/> <!-- <result property="userName" column="user_name"/>-->
<result property="department" column="department"/> <!-- <result property="department" column="department"/>-->
<collection property="weFlowerCustomerTagRels" javaType="ArrayList" <!-- <collection property="weFlowerCustomerTagRels" javaType="ArrayList"-->
column="{id = wfcrId}" select="selectWeCustomerTags"> <!-- column="{id = wfcrId}" select="selectWeCustomerTags">-->
</collection> <!-- </collection>-->
</collection> <!-- </collection>-->
</resultMap> </resultMap>
...@@ -298,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -298,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM FROM
we_customer wc we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id 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 LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where> <where>
<if test="delFlag != null"> <if test="delFlag != null">
...@@ -407,44 +407,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -407,44 +407,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getCustomersByUserId" resultMap="WeCustomerResult"> <select id="getCustomersByUserId" resultMap="WeCustomerResult">
SELECT SELECT
wc.external_userid, wc.external_userid,
wc.`name`, wc.`name`,
wc.avatar, wc.avatar,
wc.type, wc.type,
wc.gender, wc.gender,
wc.unionid, wc.unionid,
wc.birthday, wc.birthday,
wc.corp_name, wc.corp_name,
wc.corp_full_name, wc.corp_full_name,
wc.position, wc.position,
wc.is_open_chat, wc.is_open_chat,
wfcr.id as wfcrId, wu.user_name,
wfcr.user_id, wt.tag_id,
wfcr.remark, wt.create_time,
wfcr.description, wt.`name` as tagName,
wfcr.create_time, (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
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
FROM FROM
we_customer wc 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=wc.first_user_id
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id 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.flower_customer_rel_id = wfcr.id
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} WHERE wc.external_userid=#{externalUserid}
<if test="userId != null and userId !=''"> <if test="userId != null and userId !=''">
AND wfcr.user_id=#{userId} AND wc.first_user_id=#{userId}
</if> </if>
ORDER BY wfcr.create_time ASC limit 1 ORDER BY wc.create_time ASC limit 1
</select> </select>
......
...@@ -9,15 +9,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -9,15 +9,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="msgTemplateId" column="msg_template_id" /> <result property="msgTemplateId" column="msg_template_id" />
<result property="msgId" column="msg_id" /> <result property="msgId" column="msg_id" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="externalUserid" column="external_userid" /> <result property="externalUserid" column="external_userid" />
<result property="customerName" column="customer_name" />
<result property="chatId" column="chat_id" /> <result property="chatId" column="chat_id" />
<result property="chatName" column="chat_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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap> </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> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -9,13 +9,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -9,13 +9,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="msgTemplateId" column="msg_template_id" /> <result property="msgTemplateId" column="msg_template_id" />
<result property="msgId" column="msg_id" /> <result property="msgId" column="msg_id" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap> </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> </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!