同步群与群成员相关bug修复

1 parent a07062b1
Showing 20 changed files with 299 additions and 39 deletions
...@@ -4,18 +4,17 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,18 +4,17 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil; import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService; import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeCustomerTrajectoryService;
import com.linkwechat.wecom.service.IWeFlowerCustomerRelService; import com.linkwechat.wecom.service.IWeFlowerCustomerRelService;
import com.linkwechat.wecom.service.IWeFlowerCustomerTagRelService; import com.linkwechat.wecom.service.IWeFlowerCustomerTagRelService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -49,6 +48,9 @@ public class WeCustomerController extends BaseController ...@@ -49,6 +48,9 @@ public class WeCustomerController extends BaseController
@Autowired @Autowired
private IWeFlowerCustomerRelService weFlowerCustomerRelService; private IWeFlowerCustomerRelService weFlowerCustomerRelService;
@Autowired
private IWeCustomerTrajectoryService iWeCustomerTrajectoryService;
/** /**
...@@ -198,24 +200,44 @@ public class WeCustomerController extends BaseController ...@@ -198,24 +200,44 @@ public class WeCustomerController extends BaseController
} }
/*************************************************************************
******************************客户详情相关*********************************
*************************************************************************/
/** /**
* 查询企业微信客户列表(六感) * 客户详情基础数据
* @return
*/ */
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')") @ApiOperation("客户详情基础数据")
@GetMapping("/listConcise") @GetMapping(value = "/findCustomerDetailBaseInfo")
public TableDataInfo listConcise(WeCustomer weCustomer) public AjaxResult findCustomerDetailBaseInfo(String externalUserid){
{
startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer); return AjaxResult.success(
if(CollectionUtil.isNotEmpty(list)){ weCustomerService.findWeCustomerDetail(externalUserid)
);
list.stream().forEach(k->{
k.setWeFlowerCustomerRels(new ArrayList<>());
});
} }
return getDataTable(list);
/**
* 获取客户轨迹信息
* @param trajectoryType
* @return
*/
@GetMapping(value = "/findTrajectory")
@ApiOperation("获取客户轨迹信息")
public TableDataInfo findTrajectory(String userId,Integer trajectoryType){
startPage();
LambdaQueryWrapper<WeCustomerTrajectory> ne = new LambdaQueryWrapper<WeCustomerTrajectory>()
.ne(WeCustomerTrajectory::getStatus, Constants.DELETE_CODE)
.eq(WeCustomerTrajectory::getUserId,userId);
if(trajectoryType != null){
ne.eq(WeCustomerTrajectory::getTrajectoryType, trajectoryType);
} }
return getDataTable(
iWeCustomerTrajectoryService.list(ne)
);
}
} }
...@@ -55,11 +55,10 @@ import java.util.Objects; ...@@ -55,11 +55,10 @@ import java.util.Objects;
@RestController @RestController
@RequestMapping("/wecom/fission") @RequestMapping("/wecom/fission")
public class WeTaskFissionController extends BaseController { public class WeTaskFissionController extends BaseController {
@Autowired @Autowired
private IWeTaskFissionService weTaskFissionService; private IWeTaskFissionService weTaskFissionService;
@Autowired
private CosConfig cosConfig;
@Autowired @Autowired
private FileService fileService; private FileService fileService;
......
...@@ -2,10 +2,12 @@ package com.linkwechat.wecom.domain; ...@@ -2,10 +2,12 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; 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 lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.sql.Time; import java.sql.Time;
import java.util.Date; import java.util.Date;
...@@ -18,7 +20,7 @@ import java.util.Date; ...@@ -18,7 +20,7 @@ import java.util.Date;
@SuperBuilder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class WeCustomerTrajectory { public class WeCustomerTrajectory extends BaseEntity {
@TableId @TableId
private String id; private String id;
//轨迹类型(1:信息动态;2:社交动态;3:活动规则;4:待办动态) //轨迹类型(1:信息动态;2:社交动态;3:活动规则;4:待办动态)
...@@ -31,10 +33,14 @@ public class WeCustomerTrajectory { ...@@ -31,10 +33,14 @@ public class WeCustomerTrajectory {
private Date createDate; private Date createDate;
//处理开始时间 //处理开始时间
private Time startTime; private String startTime;
//处理结束时间 //处理结束时间
private Time endTime; private String endTime;
//文案子内容
private String contentSub;
...@@ -49,9 +55,12 @@ public class WeCustomerTrajectory { ...@@ -49,9 +55,12 @@ public class WeCustomerTrajectory {
private String agentId; private String agentId;
//创建时间 //1:跟踪中;2:待跟进;3:已拒绝;4:已成交;
private Date createTime; private Integer trackState;
//跟进内容
private String trackContent;
//跟进时间
private Date trackTime;
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain; ...@@ -2,6 +2,7 @@ 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.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
...@@ -114,4 +115,7 @@ public class WeGroup extends BaseEntity{ ...@@ -114,4 +115,7 @@ public class WeGroup extends BaseEntity{
* 群管理员id * 群管理员id
*/ */
private String adminUserId; private String adminUserId;
@TableLogic
private Integer delFlag=new Integer(0);
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
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;
...@@ -65,4 +62,8 @@ public class WeGroupMember extends BaseEntity{ ...@@ -65,4 +62,8 @@ public class WeGroupMember extends BaseEntity{
@ApiModelProperty("邀请人userId") @ApiModelProperty("邀请人userId")
private String invitorUserId; private String invitorUserId;
@TableLogic
private Integer delFlag=new Integer(0);
} }
...@@ -76,6 +76,12 @@ public class CustomerMessagePushDto implements Cloneable{ ...@@ -76,6 +76,12 @@ public class CustomerMessagePushDto implements Cloneable{
/** /**
* 是否立即发送
*/
private boolean isSendNow=false;
/**
* 消息内容 * 消息内容
* *
* @param customerMessagePushDto * @param customerMessagePushDto
......
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
import java.util.Date;
/**
* 客户所属员工相关信息
*/
@Data
public class CusertomerBelongUserInfo {
//当前所属员工
private String belongUserName;
//首次添加员工
private String userName;
//首次添加时间
private Date createTime;
}
...@@ -82,6 +82,12 @@ public class WeCommunityNewGroupVo { ...@@ -82,6 +82,12 @@ public class WeCommunityNewGroupVo {
*/ */
private String createBy; private String createBy;
/**
* 实际群名
*/
private String actualGroupName;
/** /**
* 创建时间 * 创建时间
*/ */
......
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 客户详情
*/
@Data
public class WeCustomerDetailVo {
//客户昵称
private String name;
//客户头像
private String avatar;
//当前跟踪状态(1:跟踪中;2:待跟进;3:已拒绝;4:已成交;)
private Integer trackState;
//手机号
private String phone;
//生日
private Date birthday;
//邮箱
private String email;
//地址
private String address;
//qq
private String qq;
//公司
private String corpName;
//职业
private String position;
//其他描述
private String otherDescr;
//外部联系人性别 0-未知 1-男性 2-女
private Integer gender;
//群标签,用逗号隔开
private String groupTags;
//添加的员工,名称用逗号隔开
private String addWeuserNames;
//添加的群,群名用逗号隔开
private String addWeGroupNames;
//客户所属员工信息
private List<CusertomerBelongUserInfo> belongUserInfos;
}
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.vo.CusertomerBelongUserInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -115,4 +116,25 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -115,4 +116,25 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
List<WeCustomerList> findWeCustomerList(WeCustomerList weCustomerList); List<WeCustomerList> findWeCustomerList(WeCustomerList weCustomerList);
/**
* 客户添加的员工名称
* @return
*/
String findAddWeUserNames(@Param("externalUserId") String externalUserId);
/**
* 客户添加的群标签
* @return
*/
String findCustomerGroupTag(@Param("externalUserId") String externalUserId);
/**
* 客户所属员工相关
* @return
*/
List<CusertomerBelongUserInfo> findCusertomerBelongUserInfo(@Param("externalUserId") String externalUserId);
} }
...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeCustomerList; ...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerPortrait; import com.linkwechat.wecom.domain.WeCustomerPortrait;
import com.linkwechat.wecom.domain.WeUser; import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.dto.WeWelcomeMsg; import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
import com.linkwechat.wecom.domain.vo.WeCustomerDetailVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
...@@ -155,6 +156,10 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -155,6 +156,10 @@ public interface IWeCustomerService extends IService<WeCustomer>
WeCustomerDetailVo findWeCustomerDetail(String externalUserid);
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.enums.WeEmpleCodeType; import com.linkwechat.common.enums.WeEmpleCodeType;
...@@ -13,6 +14,7 @@ import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo; ...@@ -13,6 +14,7 @@ import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
import com.linkwechat.wecom.domain.vo.WeGroupCodeVo; import com.linkwechat.wecom.domain.vo.WeGroupCodeVo;
import com.linkwechat.wecom.mapper.*; import com.linkwechat.wecom.mapper.*;
import com.linkwechat.wecom.service.IWeCommunityNewGroupService; import com.linkwechat.wecom.service.IWeCommunityNewGroupService;
import com.linkwechat.wecom.service.IWeGroupCodeActualService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -57,6 +59,9 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -57,6 +59,9 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
@Autowired @Autowired
private WeUserMapper weUserMapper; private WeUserMapper weUserMapper;
@Autowired
private IWeGroupCodeActualService weGroupCodeActualService;
/** /**
* 添加新客自动拉群信息 * 添加新客自动拉群信息
...@@ -300,6 +305,15 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr ...@@ -300,6 +305,15 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
List<WeEmpleCodeUseScop> empleCodeUseScopList = empleCodeUseScopMapper.selectWeEmpleCodeUseScopListById(vo.getEmplCodeId()); List<WeEmpleCodeUseScop> empleCodeUseScopList = empleCodeUseScopMapper.selectWeEmpleCodeUseScopListById(vo.getEmplCodeId());
vo.setEmplList(empleCodeUseScopList); vo.setEmplList(empleCodeUseScopList);
List<WeGroupCodeActual> codeActuals = weGroupCodeActualService.list(new LambdaQueryWrapper<WeGroupCodeActual>()
.eq(WeGroupCodeActual::getGroupCodeId, vo.getGroupCodeId()));
if(CollectionUtil.isNotEmpty(codeActuals)){
vo.setActualGroupName(
String.join(",", codeActuals.stream().map(WeGroupCodeActual::getGroupName).collect(Collectors.toList()))
);
}
// 获取相关群聊信息 // 获取相关群聊信息
List<WeGroup> groupList = weGroupCodeMapper.selectWeGroupListByGroupCodeId(vo.getGroupCodeId()); List<WeGroup> groupList = weGroupCodeMapper.selectWeGroupListByGroupCodeId(vo.getGroupCodeId());
vo.setGroupList(groupList); vo.setGroupList(groupList);
......
...@@ -83,12 +83,17 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -83,12 +83,17 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException, CloneNotSupportedException { public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException, CloneNotSupportedException {
if(!customerMessagePushDto.isSendNow()){
if(StrUtil.isNotBlank(customerMessagePushDto.getSettingTime())){ if(StrUtil.isNotBlank(customerMessagePushDto.getSettingTime())){
if(DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0){ if(DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0){
throw new WeComException("发送时间不能小于当前时间"); throw new WeComException("发送时间不能小于当前时间");
} }
} }
}
if(customerMessagePushDto.getMessageType().equals("1")){//等于图片或者图文,根据图片URL,获取新的media_id if(customerMessagePushDto.getMessageType().equals("1")){//等于图片或者图文,根据图片URL,获取新的media_id
......
...@@ -27,6 +27,7 @@ import com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagDto; ...@@ -27,6 +27,7 @@ import com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagDto;
import com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagListDto; import com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagListDto;
import com.linkwechat.wecom.domain.dto.tag.WeCropTagDto; import com.linkwechat.wecom.domain.dto.tag.WeCropTagDto;
import com.linkwechat.wecom.domain.dto.tag.WeFindCropTagParam; import com.linkwechat.wecom.domain.dto.tag.WeFindCropTagParam;
import com.linkwechat.wecom.domain.vo.WeCustomerDetailVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.mapper.WeCustomerMapper; import com.linkwechat.wecom.mapper.WeCustomerMapper;
...@@ -875,4 +876,20 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -875,4 +876,20 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
} }
@Override
public WeCustomerDetailVo findWeCustomerDetail(String externalUserid) {
WeCustomerDetailVo weCustomerDetailVo=new WeCustomerDetailVo();
WeCustomer weCustomer
= this.getById(externalUserid);
BeanUtils.copyBeanProp(weCustomer,weCustomerDetailVo);
weCustomerDetailVo.setAddWeGroupNames(this.baseMapper.findAddWeUserNames(externalUserid));
weCustomerDetailVo.setAddWeuserNames(this.baseMapper.findAddWeUserNames(externalUserid));
weCustomerDetailVo.setGroupTags(this.baseMapper.findCustomerGroupTag(externalUserid));
weCustomerDetailVo.setBelongUserInfos(this.baseMapper.findCusertomerBelongUserInfo(externalUserid));
return weCustomerDetailVo;
}
} }
...@@ -144,9 +144,11 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl ...@@ -144,9 +144,11 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
.owner(kk.getOwner()) .owner(kk.getOwner())
.addTime(new Date(kk.getCreateTime() * 1000L)) .addTime(new Date(kk.getCreateTime() * 1000L))
.status(k.getStatus()) .status(k.getStatus())
.delFlag(new Integer(0))
.adminUserId(Optional.ofNullable(kk.getAdminList()).orElseGet(ArrayList::new).stream().map(admin -> admin.getString("userid")).collect(Collectors.joining(","))) .adminUserId(Optional.ofNullable(kk.getAdminList()).orElseGet(ArrayList::new).stream().map(admin -> admin.getString("userid")).collect(Collectors.joining(",")))
.build() .build()
); );
List<CustomerGroupMember> memberLists = kk.getMemberList(); List<CustomerGroupMember> memberLists = kk.getMemberList();
if (CollectionUtil.isNotEmpty(memberLists)) { if (CollectionUtil.isNotEmpty(memberLists)) {
memberLists.stream().forEach(member -> { memberLists.stream().forEach(member -> {
...@@ -160,6 +162,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl ...@@ -160,6 +162,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
.unionId(member.getUnionId()) .unionId(member.getUnionId())
.groupNickName(member.getGroupNickName()) .groupNickName(member.getGroupNickName())
.name(member.getName()) .name(member.getName())
.delFlag(new Integer(0))
.invitorUserId(member.getInvitor() == null ? null : member.getInvitor().getString("userid")) .invitorUserId(member.getInvitor() == null ? null : member.getInvitor().getString("userid"))
.build() .build()
); );
...@@ -270,18 +273,46 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl ...@@ -270,18 +273,46 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
* @param weGroupMembers 群成员 * @param weGroupMembers 群成员
*/ */
private void insertBatchGroupAndMember(List<WeGroup> weGroups, List<WeGroupMember> weGroupMembers) { private void insertBatchGroupAndMember(List<WeGroup> weGroups, List<WeGroupMember> weGroupMembers) {
if (CollectionUtil.isNotEmpty(weGroups)) { if (CollectionUtil.isNotEmpty(weGroups)) {
List<List<WeGroup>> lists = Lists.partition(weGroups, 500); List<List<WeGroup>> lists = Lists.partition(weGroups, 500);
for (List<WeGroup> groupList : lists) { for (List<WeGroup> groupList : lists) {
this.baseMapper.insertBatch(groupList); this.baseMapper.insertBatch(groupList);
this.remove(new LambdaQueryWrapper<WeGroup>()
.notIn(WeGroup::getChatId, groupList.stream().map(WeGroup::getChatId).collect(Collectors.toList())));
}
}else{
List<WeGroup> oldWeGroups = this.list();
if(CollectionUtil.isNotEmpty(oldWeGroups)){
this.removeByIds(
oldWeGroups.stream().map(WeGroup::getChatId).collect(Collectors.toList())
);
}
//无群无人
List<WeGroupMember> oldWeGroupMembers = iWeGroupMemberService.list();
if(CollectionUtil.isNotEmpty(oldWeGroupMembers)){
iWeGroupMemberService.removeByIds(
oldWeGroupMembers.stream().map(WeGroupMember::getId).collect(Collectors.toList())
);
} }
} }
if (CollectionUtil.isNotEmpty(weGroupMembers)) { if (CollectionUtil.isNotEmpty(weGroupMembers)) {
List<List<WeGroupMember>> lists = Lists.partition(weGroupMembers, 500); List<List<WeGroupMember>> lists = Lists.partition(weGroupMembers, 500);
for (List<WeGroupMember> groupMemberList : lists) { for (List<WeGroupMember> groupMemberList : lists) {
iWeGroupMemberService.remove(
new LambdaQueryWrapper<WeGroupMember>()
.notIn(WeGroupMember::getUserId,groupMemberList.stream().map(WeGroupMember::getUserId).collect(Collectors.toList()))
);
iWeGroupMemberService.insertBatch(groupMemberList); iWeGroupMemberService.insertBatch(groupMemberList);
} }
} }
} }
......
...@@ -214,9 +214,10 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -214,9 +214,10 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
linkMessageDto.setUrl(pageUrlBuilder.toString()); linkMessageDto.setUrl(pageUrlBuilder.toString());
CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto(); CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto();
if (weTaskFission.getStartTime() != null) { // if (weTaskFission.getStartTime() != null) {
customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime())); // customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime()));
} // }
customerMessagePushDto.setSendNow(true);
customerMessagePushDto.setLinkMessage(linkMessageDto); customerMessagePushDto.setLinkMessage(linkMessageDto);
customerMessagePushDto.setPushType("0"); customerMessagePushDto.setPushType("0");
customerMessagePushDto.setPushRange("1"); customerMessagePushDto.setPushRange("1");
......
...@@ -513,4 +513,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -513,4 +513,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findCusertomerBelongUserInfo" resultType="com.linkwechat.wecom.domain.vo.CusertomerBelongUserInfo">
SELECT
wu.user_name as belongUserName,
wu.user_name,
wfcr.create_time
FROM
we_flower_customer_rel wfcr
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
WHERE wfcr.external_userid=#{externalUserId}
ORDER BY wfcr.create_time DESC
LIMIT 1
</select>
<select id="findCustomerGroupTag" resultType="string">
SELECT
GROUP_CONCAT(wt.`name`) AS wtName
FROM
we_group_member wgm
LEFT JOIN we_group_tag_rel wgtr ON wgtr.chat_id=wgm.chat_id
LEFT JOIN we_tag wt ON wt.tag_id=wgtr.tag_id
WHERE wgm.user_id=#{externalUserId}
</select>
<select id="findAddWeUserNames" resultType="string">
SELECT
GROUP_CONCAT(wu.user_name) as addWeUserNames
FROM
we_flower_customer_rel wfcr
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
WHERE wfcr.external_userid=#{externalUserId}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
we_group wg we_group wg
LEFT JOIN we_user wu ON wg.`owner`=wu.user_id LEFT JOIN we_user wu ON wg.`owner`=wu.user_id
<where> <where>
<if test="delFlag !=null"> wg.del_flag=#{delFlag}</if>
<if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if> <if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if>
<if test="groupLeader != null and groupLeader != ''"> and wu.user_name like concat('%', #{groupLeader}, '%')</if> <if test="groupLeader != null and groupLeader != ''"> and wu.user_name like concat('%', #{groupLeader}, '%')</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 --> <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
...@@ -63,14 +64,14 @@ ...@@ -63,14 +64,14 @@
<insert id="insertBatch"> <insert id="insertBatch">
insert into we_group (chat_id, group_name, owner, add_time, notice, status,admin_user_id, create_by, create_time,update_by, update_time) insert into we_group (chat_id, group_name, owner, add_time, notice, status,admin_user_id, create_by, create_time,update_by, update_time,del_flag)
values values
<foreach collection="weGroups" item="weGroup" index="index" separator=","> <foreach collection="weGroups" item="weGroup" index="index" separator=",">
(#{weGroup.chatId},#{weGroup.groupName},#{weGroup.owner},#{weGroup.addTime},#{weGroup.notice},#{weGroup.status},#{weGroup.adminUserId}, (#{weGroup.chatId},#{weGroup.groupName},#{weGroup.owner},#{weGroup.addTime},#{weGroup.notice},#{weGroup.status},#{weGroup.adminUserId},
#{weGroup.createBy},#{weGroup.createTime},#{weGroup.updateBy},#{weGroup.updateTime}) #{weGroup.createBy},#{weGroup.createTime},#{weGroup.updateBy},#{weGroup.updateTime},#{weGroup.delFlag})
</foreach> </foreach>
on duplicate key update group_name= values(group_name),owner= values(owner), on duplicate key update group_name= values(group_name),owner= values(owner),
notice= values(notice),status= values(status),admin_user_id= values(admin_user_id), notice= values(notice),status= values(status),admin_user_id= values(admin_user_id),
update_by= values(update_by),update_time= values(update_time) update_by= values(update_by),update_time= values(update_time),del_flag=values(del_flag)
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
FROM FROM
we_group_member wgm we_group_member wgm
<where> <where>
<if test="delFlag !=null">
and wgm.del_flag=#{delFlag}
</if>
<if test="chatId != null "> <if test="chatId != null ">
and wgm.chat_id = #{chatId} and wgm.chat_id = #{chatId}
</if> </if>
...@@ -47,18 +50,18 @@ ...@@ -47,18 +50,18 @@
<insert id="insertBatch"> <insert id="insertBatch">
insert into we_group_member (chat_id, user_id, union_id, join_time, join_scene, `type`, insert into we_group_member (chat_id, user_id, union_id, join_time, join_scene, `type`,
group_nick_name,`name`,invitor_user_id, group_nick_name,`name`,invitor_user_id,
create_by, create_time,update_by, update_time) create_by, create_time,update_by, update_time,del_flag)
values values
<foreach collection="weGroupMembers" item="weGroupMember" index="index" separator=","> <foreach collection="weGroupMembers" item="weGroupMember" index="index" separator=",">
(#{weGroupMember.chatId},#{weGroupMember.userId},#{weGroupMember.unionId}, (#{weGroupMember.chatId},#{weGroupMember.userId},#{weGroupMember.unionId},
#{weGroupMember.joinTime},#{weGroupMember.joinScene},#{weGroupMember.type}, #{weGroupMember.joinTime},#{weGroupMember.joinScene},#{weGroupMember.type},
#{weGroupMember.groupNickName},#{weGroupMember.name},#{weGroupMember.invitorUserId}, #{weGroupMember.groupNickName},#{weGroupMember.name},#{weGroupMember.invitorUserId},
#{weGroupMember.createBy},#{weGroupMember.createTime}, #{weGroupMember.createBy},#{weGroupMember.createTime},
#{weGroupMember.updateBy},#{weGroupMember.updateTime}) #{weGroupMember.updateBy},#{weGroupMember.updateTime},#{weGroupMember.delFlag})
</foreach> </foreach>
on duplicate key update on duplicate key update
join_time= values(join_time),join_scene= values(join_scene), join_time= values(join_time),join_scene= values(join_scene),
group_nick_name= values(group_nick_name),`name`= values(`name`),invitor_user_id= values(invitor_user_id), group_nick_name= values(group_nick_name),`name`= values(`name`),invitor_user_id= values(invitor_user_id),
`type`= values(`type`),update_by= values(update_by),update_time= values(update_time) `type`= values(`type`),update_by= values(update_by),update_time= values(update_time),del_flag=values(del_flag)
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -84,7 +84,8 @@ ...@@ -84,7 +84,8 @@
LEFT JOIN we_pres_tag_group_scope wptgs ON wptgs.task_id = wptg.task_id LEFT JOIN we_pres_tag_group_scope wptgs ON wptgs.task_id = wptg.task_id
WHERE wptgs.we_user_id = #{emplId} WHERE wptgs.we_user_id = #{emplId}
AND wptgs.is_done = #{isDone} AND wptgs.is_done = #{isDone}
AND wptg.send_type = 1 AND wptg.`del_flag` = 0; AND wptg.send_type = 1 AND wptg.`del_flag` = 0
ORDER BY wptg.create_time DESC
</select> </select>
<select id="selectStaffList" parameterType="WePresTagGroupTask" resultType="String"> <select id="selectStaffList" parameterType="WePresTagGroupTask" resultType="String">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!