Commit 0452a961 by 徐高华

10月零散需求

parent 1595a409
...@@ -37,8 +37,19 @@ public class GroupChatDataDTO implements Serializable{ ...@@ -37,8 +37,19 @@ public class GroupChatDataDTO implements Serializable{
private Integer msgTotal; private Integer msgTotal;
/**截至当天新增迁移群数(仅教培行业返回)*/ /**截至当天新增迁移群数(仅教培行业返回)*/
private Integer migrateTraineeChatCnt; private Integer migrateTraineeChatCnt;
private Integer quitUserCount ;
private java.util.Date createTime; private java.util.Date createTime;
public Integer getQuitUserCount() {
return quitUserCount;
}
public void setQuitUserCount(Integer quitUserCount) {
this.quitUserCount = quitUserCount;
}
public String getStaffName() { public String getStaffName() {
return staffName; return staffName;
} }
......
...@@ -58,6 +58,17 @@ public class GroupChatPlanDTO implements Serializable { ...@@ -58,6 +58,17 @@ public class GroupChatPlanDTO implements Serializable {
*/ */
private Integer materialFrom; private Integer materialFrom;
// 是否发送全部
private int sendAllFlag ;
public int getSendAllFlag() {
return sendAllFlag;
}
public void setSendAllFlag(int sendAllFlag) {
this.sendAllFlag = sendAllFlag;
}
public String getDelStaffIdList() { public String getDelStaffIdList() {
return delStaffIdList; return delStaffIdList;
} }
......
...@@ -54,10 +54,28 @@ public class GroupChatUserDTO implements Serializable{ ...@@ -54,10 +54,28 @@ public class GroupChatUserDTO implements Serializable{
private String joinState; private String joinState;
private Integer adminFlag ; private Integer adminFlag ;
private String chatName ; private String chatName ;
private String staffId ;
private String staffName ; private String staffName ;
private String wxChatId ; private String wxChatId ;
// 退群时的群主门店
private String quitStaffStore ;
public String getQuitStaffStore() {
return quitStaffStore;
}
public void setQuitStaffStore(String quitStaffStore) {
this.quitStaffStore = quitStaffStore;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxChatId() { public String getWxChatId() {
return wxChatId; return wxChatId;
} }
......
...@@ -14,12 +14,14 @@ public enum ChannelCodeEnum { ...@@ -14,12 +14,14 @@ public enum ChannelCodeEnum {
ADMIN_UNBIND(2001,"后台管理员解绑"), ADMIN_UNBIND(2001,"后台管理员解绑"),
SELF_UNBIND(2002,"好办小程序解绑"), SELF_UNBIND(2002,"好办小程序解绑"),
SYNC_UNBIND(2003,"GIC同步解绑"), SYNC_UNBIND(2003,"门店同步解绑"),
WEIXIN_DEL(2004,"员工离职解绑"), WEIXIN_DEL(2004,"员工离职解绑"),
AUDIT_UNBIND(2005,"后台审核解绑"), AUDIT_UNBIND(2005,"后台审核解绑"),
RIGHT_CHANGE_UNBIND(2006, "好办门店权限变更解绑"), RIGHT_CHANGE_UNBIND(2006, "好办门店权限变更解绑"),
STORE_CHANGE_UNBIND(2007, "GIC门店变更解绑"), STORE_CHANGE_UNBIND(2007, "导购变更门店解绑"),
GIC_CLERK_DEL_UNBIND(2008, "GIC导购删除解绑"), GIC_CLERK_DEL_UNBIND(2008, "导购删除解绑"),
QW_DEL_UNBIND(2009, "企微通讯录成员删除解绑"),
; ;
private int code; private int code;
private String name; private String name;
......
package com.gic.haoban.manage.service.dao.mapper.chat; package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.Date;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO; import com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatData; import com.gic.haoban.manage.service.entity.chat.TabGroupChatData;
import org.apache.ibatis.annotations.Param;
/** /**
* *
...@@ -24,4 +26,7 @@ public interface GroupChatDataMapper { ...@@ -24,4 +26,7 @@ public interface GroupChatDataMapper {
public List<GroupChatDataDTO> listForChat(ChatDataSearchQDTO qdto); public List<GroupChatDataDTO> listForChat(ChatDataSearchQDTO qdto);
public List<GroupChatDataDTO> listStaffData(ChatDataSearchQDTO qdto); public List<GroupChatDataDTO> listStaffData(ChatDataSearchQDTO qdto);
public void updateQuitCount(@Param("wxEnterpriseId") String wxEnterpriseId , @Param("date") Date date ,
@Param("staffId") String staffId , @Param("quitCount")int quitCount) ;
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper.chat; package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.Date;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.service.pojo.bo.chat.UserQuitBO;
import com.gic.haoban.manage.service.pojo.qo.chat.GroupChatUserQO; import com.gic.haoban.manage.service.pojo.qo.chat.GroupChatUserQO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -24,7 +26,7 @@ public interface GroupChatUserMapper { ...@@ -24,7 +26,7 @@ public interface GroupChatUserMapper {
public int batchInsert(@Param("list")List<TabGroupChatUser> userList); public int batchInsert(@Param("list")List<TabGroupChatUser> userList);
public int dismiss(@Param("idList") List<Long> chatUserIdList, @Param("ownerId") String ownerId); public int dismiss(@Param("idList") List<Long> chatUserIdList, @Param("ownerId") String ownerId , @Param("quitStaffStore")String quitStaffStore);
public int update(TabGroupChatUser tabHaobanGroupChatUser); public int update(TabGroupChatUser tabHaobanGroupChatUser);
...@@ -63,4 +65,13 @@ public interface GroupChatUserMapper { ...@@ -63,4 +65,13 @@ public interface GroupChatUserMapper {
*/ */
List<TabGroupChatUser> queryGroupChatUserList(GroupChatUserQO groupChatUserQO); List<TabGroupChatUser> queryGroupChatUserList(GroupChatUserQO groupChatUserQO);
/**
* 退群统计
* @param wxEnterpriseId
* @param start
* @param end
* @return
*/
List<UserQuitBO> listQuitNum(@Param("wxEnterpriseId") String wxEnterpriseId ,@Param("start") Date start ,@Param("end") Date end) ;
} }
\ No newline at end of file
...@@ -37,7 +37,17 @@ public class TabGroupChatData implements Serializable{ ...@@ -37,7 +37,17 @@ public class TabGroupChatData implements Serializable{
/**截至当天新增迁移群数(仅教培行业返回)*/ /**截至当天新增迁移群数(仅教培行业返回)*/
private Integer migrateTraineeChatCnt; private Integer migrateTraineeChatCnt;
private java.util.Date createTime; private java.util.Date createTime;
private Integer quitUserCount ;
public Integer getQuitUserCount() {
return quitUserCount;
}
public void setQuitUserCount(Integer quitUserCount) {
this.quitUserCount = quitUserCount;
}
public void setDataId(Long dataId){ public void setDataId(Long dataId){
this.dataId = dataId; this.dataId = dataId;
} }
......
...@@ -53,6 +53,17 @@ public class TabGroupChatPlan implements Serializable { ...@@ -53,6 +53,17 @@ public class TabGroupChatPlan implements Serializable {
*/ */
private Integer materialFrom; private Integer materialFrom;
// 是否发送全部
private int sendAllFlag ;
public int getSendAllFlag() {
return sendAllFlag;
}
public void setSendAllFlag(int sendAllFlag) {
this.sendAllFlag = sendAllFlag;
}
public Integer getSendFlag() { public Integer getSendFlag() {
return sendFlag; return sendFlag;
} }
......
...@@ -55,6 +55,15 @@ public class TabGroupChatUser implements Serializable { ...@@ -55,6 +55,15 @@ public class TabGroupChatUser implements Serializable {
// 0 成员 1群主 2管理员 // 0 成员 1群主 2管理员
private Integer adminFlag = 0; private Integer adminFlag = 0;
private String quitStaffId ; private String quitStaffId ;
private String quitStaffStore ;
public String getQuitStaffStore() {
return quitStaffStore;
}
public void setQuitStaffStore(String quitStaffStore) {
this.quitStaffStore = quitStaffStore;
}
public String getQuitStaffId() { public String getQuitStaffId() {
return quitStaffId; return quitStaffId;
......
package com.gic.haoban.manage.service.pojo.bo.chat;
import java.io.Serializable;
public class UserQuitBO implements Serializable {
private String staffId ;
private int num ;
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
...@@ -27,7 +27,7 @@ public interface StaffClerkBindLogService { ...@@ -27,7 +27,7 @@ public interface StaffClerkBindLogService {
* @param optStaffId * @param optStaffId
* @param optType * @param optType
* @param channelCode * @param channelCode
* @param relationId * @param relationId 导购成员关联表主键
*/ */
public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId); public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId);
......
...@@ -7,6 +7,8 @@ import java.util.List; ...@@ -7,6 +7,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatUserMapper;
import com.gic.haoban.manage.service.pojo.bo.chat.UserQuitBO;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -57,6 +59,8 @@ public class GroupChatDataServiceImpl implements GroupChatDataService { ...@@ -57,6 +59,8 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
private GroupChatDataMapper groupChatDataMapper; private GroupChatDataMapper groupChatDataMapper;
@Autowired @Autowired
private WxEnterpriseMapper wxEnterpriseMapper; private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired
private GroupChatUserMapper groupChatUserMapper ;
@Override @Override
public List<GroupChatDataDTO> listForChat(ChatDataSearchQDTO qdto) { public List<GroupChatDataDTO> listForChat(ChatDataSearchQDTO qdto) {
...@@ -107,6 +111,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService { ...@@ -107,6 +111,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
} }
int pageNum = 0; int pageNum = 0;
List<GroupChatOwnerDTO> list = null; List<GroupChatOwnerDTO> list = null;
Date date = DateUtil.addDay(DateUtil.getStartTimeOfDay(), -1);
while (true) { while (true) {
list = this.groupChatOwnerMapper.listOwnerForStatistic(wxEnterpriseId, pageNum * pageSize, pageSize); list = this.groupChatOwnerMapper.listOwnerForStatistic(wxEnterpriseId, pageNum * pageSize, pageSize);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
...@@ -125,8 +130,6 @@ public class GroupChatDataServiceImpl implements GroupChatDataService { ...@@ -125,8 +130,6 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
staffIdMap = list.stream().collect(Collectors.toMap(GroupChatOwnerDTO::getWxUserId, staffIdMap = list.stream().collect(Collectors.toMap(GroupChatOwnerDTO::getWxUserId,
GroupChatOwnerDTO::getStaffId, (k1, k2) -> k1)); GroupChatOwnerDTO::getStaffId, (k1, k2) -> k1));
} }
Date date = DateUtil.addDay(DateUtil.getStartTimeOfDay(), -1);
Long time = date.getTime() / 1000; Long time = date.getTime() / 1000;
ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), userIdList, time, time , qwDTO.isSelf() , qwDTO.getUrlHost()); ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), userIdList, time, time , qwDTO.isSelf() , qwDTO.getUrlHost());
List<GroupChatQwDataDTO> dataList = resp.getResult(); List<GroupChatQwDataDTO> dataList = resp.getResult();
...@@ -165,5 +168,14 @@ public class GroupChatDataServiceImpl implements GroupChatDataService { ...@@ -165,5 +168,14 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
break; break;
} }
} }
Date end = DateUtil.getEndTimeOfDay(date) ;
List<UserQuitBO> quitList = this.groupChatUserMapper.listQuitNum(wxEnterpriseId,date,end) ;
if(CollectionUtils.isNotEmpty(quitList)) {
for(UserQuitBO bo : quitList) {
if(StringUtils.isNotBlank(bo.getStaffId())) {
this.groupChatDataMapper.updateQuitCount(wxEnterpriseId,date,bo.getStaffId(),bo.getNum());
}
}
}
} }
} }
\ No newline at end of file
...@@ -11,6 +11,9 @@ import com.gic.enterprise.api.dto.EnterpriseDTO; ...@@ -11,6 +11,9 @@ import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.ContentMaterialDTO; import com.gic.haoban.manage.api.dto.ContentMaterialDTO;
import com.gic.haoban.manage.api.dto.chat.ChatContentDTO; import com.gic.haoban.manage.api.dto.chat.ChatContentDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerMapper;
import com.gic.haoban.manage.service.util.StreamUtils; import com.gic.haoban.manage.service.util.StreamUtils;
import com.gic.thirdparty.cloudfile.CloudFileUtil; import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum; import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
...@@ -108,6 +111,8 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -108,6 +111,8 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
private PendingTaskService pendingTaskService; private PendingTaskService pendingTaskService;
@Autowired @Autowired
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Autowired
private GroupChatOwnerMapper groupChatOwnerMapper ;
private static GicMQClient mqClient = GICMQClientUtil.getClientInstance(); private static GicMQClient mqClient = GICMQClientUtil.getClientInstance();
...@@ -154,13 +159,15 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -154,13 +159,15 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
planId = UniqueIdUtils.uniqueLong(); planId = UniqueIdUtils.uniqueLong();
entity.setPlanId(planId); entity.setPlanId(planId);
entity.setStatusFlag(1); entity.setStatusFlag(1);
entity.setStaffCount(staffIdList.split(",").length); if(StringUtils.isNotEmpty(staffIdList)) {
entity.setStaffCount(staffIdList.split(",").length);
}else {
entity.setStaffCount(0);
}
entity.setSendCount(0); entity.setSendCount(0);
entity.setSuccessChatCount(0); entity.setSuccessChatCount(0);
entity.setFailChatCount(0); entity.setFailChatCount(0);
this.groupChatPlanMapper.insert(entity); this.groupChatPlanMapper.insert(entity);
// 新增群主日志
this.groupChatPlanOwnerLogService.batchAdd(dto.getStaffIdList(), entity);
} else { } else {
TabGroupChatPlan old = this.groupChatPlanMapper.selectById(planId); TabGroupChatPlan old = this.groupChatPlanMapper.selectById(planId);
int staffCount = old.getStaffCount(); int staffCount = old.getStaffCount();
...@@ -174,9 +181,9 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -174,9 +181,9 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
this.groupChatPlanMapper.updateById(entity); this.groupChatPlanMapper.updateById(entity);
// 删除本次删除的 // 删除本次删除的
this.groupChatPlanOwnerLogService.deleteByStaffIds(planId, dto.getDelStaffIdList()); this.groupChatPlanOwnerLogService.deleteByStaffIds(planId, dto.getDelStaffIdList());
// 新增本次新增的
this.groupChatPlanOwnerLogService.batchAdd(staffIdList, entity);
} }
// 新增群主日志
this.groupChatPlanOwnerLogService.batchAdd(staffIdList, entity);
// 立即发送 // 立即发送
if (entity.getSendType() == 1) { if (entity.getSendType() == 1) {
this.addOrDelTimer(planId, entity.getSendTime(), 0); this.addOrDelTimer(planId, entity.getSendTime(), 0);
...@@ -329,6 +336,23 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -329,6 +336,23 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
} }
int pageNum = 0; int pageNum = 0;
List<TabGroupChatPlanOwnerLog> ownerList = null; List<TabGroupChatPlanOwnerLog> ownerList = null;
int sendAlFlag = plan.getSendAllFlag() ;
// 发送全部群主
if(sendAlFlag==1) {
int ownerPageNo = 0;
int ownerPageSize = 500 ;
List<GroupChatOwnerDTO> list = null;
while (true) {
list = this.groupChatOwnerMapper.listOwnerForStatistic(wxEnterpriseId, ownerPageNo * ownerPageSize, ownerPageSize);
if (CollectionUtils.isEmpty(list)) {
break;
}
logger.info("全部,群主数={},{}", wxEnterpriseId,list.size());
ownerPageNo++;
String staffIds = list.stream().map(o->o.getStaffId()).collect(Collectors.joining(",")) ;
this.groupChatPlanOwnerLogService.batchAdd(staffIds, plan);
}
}
while (true) { while (true) {
ownerList = this.groupChatPlanOwnerLogMapper.listForDoPlan(planId, pageNum * pageSize, pageSize); ownerList = this.groupChatPlanOwnerLogMapper.listForDoPlan(planId, pageNum * pageSize, pageSize);
if (CollectionUtils.isEmpty(ownerList)) { if (CollectionUtils.isEmpty(ownerList)) {
......
...@@ -10,6 +10,8 @@ import java.util.Map; ...@@ -10,6 +10,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -122,6 +124,8 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -122,6 +124,8 @@ public class GroupChatServiceImpl implements GroupChatService {
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private GroupChatInitMapper groupChatInitMapper; private GroupChatInitMapper groupChatInitMapper;
@Autowired
private StoreService storeService ;
private static GicMQClient mqClient = GICMQClientUtil.getClientInstance(); private static GicMQClient mqClient = GICMQClientUtil.getClientInstance();
...@@ -685,6 +689,24 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -685,6 +689,24 @@ public class GroupChatServiceImpl implements GroupChatService {
if (RedisUtil.isLocked(lockKeyDetail)) { if (RedisUtil.isLocked(lockKeyDetail)) {
return; return;
} }
String staffId = chat.getStaffId() ;
String storeName = "";
if(null != staffId) {
List<StaffClerkRelationDTO> staffList = this.staffClerkRelationService.listByStaffId(wxEnterpriseId,staffId) ;
if(CollectionUtils.isNotEmpty(staffList)) {
List<String> storeIdList = staffList.stream().filter(o->StringUtils.isNotEmpty(o.getStoreId())).map(o->o.getEnterpriseId()).collect(Collectors.toList()) ;
if(CollectionUtils.isNotEmpty(storeIdList)) {
String[] arr = (String[]) storeIdList.toArray();
List<StoreDTO> storeList = this.storeService.getStores(arr) ;
if(CollectionUtils.isNotEmpty(storeList)) {
storeName = storeList.stream().map(o->o.getStoreName()).collect(Collectors.joining("、")) ;
}
}
}
}
RedisUtil.lock(lockKeyDetail, 30L); RedisUtil.lock(lockKeyDetail, 30L);
List<GroupChatDetailMemberDTO> qwUserList = detail.getMember_list(); List<GroupChatDetailMemberDTO> qwUserList = detail.getMember_list();
// 当前群列表 // 当前群列表
...@@ -730,7 +752,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -730,7 +752,7 @@ public class GroupChatServiceImpl implements GroupChatService {
// 流水会员数 // 流水会员数
int quitMemberCount = 0; int quitMemberCount = 0;
if (CollectionUtils.isNotEmpty(deleteIdList)) { if (CollectionUtils.isNotEmpty(deleteIdList)) {
this.groupChatUserMapper.dismiss(deleteIdList, chat.getStaffId()); this.groupChatUserMapper.dismiss(deleteIdList, chat.getStaffId(),storeName);
quitCount = deleteIdList.size(); quitCount = deleteIdList.size();
for (String userId : deleteUserIdList) { for (String userId : deleteUserIdList) {
TabGroupChatUser user = nowUserMap.get(userId); TabGroupChatUser user = nowUserMap.get(userId);
......
...@@ -47,8 +47,8 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService { ...@@ -47,8 +47,8 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService {
public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId) { public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId) {
StaffClerkBindLogInfoDTO infoDTO = new StaffClerkBindLogInfoDTO(); StaffClerkBindLogInfoDTO infoDTO = new StaffClerkBindLogInfoDTO();
infoDTO.setChannelCode(channelCode);
infoDTO.setOptStaffId(optStaffId); infoDTO.setOptStaffId(optStaffId);
infoDTO.setChannelCode(channelCode);
infoDTO.setOptType(optType); infoDTO.setOptType(optType);
infoDTO.setRelationId(relationId); infoDTO.setRelationId(relationId);
......
...@@ -396,7 +396,7 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -396,7 +396,7 @@ public class MessageApiServiceImpl implements MessageApiService {
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) { if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) { for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, staffClerkRelationDTO.getClerkId(), staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, staffClerkRelationDTO.getClerkId(),
ChannelCodeEnum.ADMIN_UNBIND.getCode(), wxEnterpriseId); ChannelCodeEnum.QW_DEL_UNBIND.getCode(), wxEnterpriseId);
} }
} }
// 群状态刷新 // 群状态刷新
......
...@@ -79,7 +79,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -79,7 +79,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public void bindLogMq(String params) { public void bindLogMq(String params) {
logger.info("绑定日志mq:{}", params); logger.info("成员绑定导购mq={}", params);
StaffClerkBindLogInfoDTO infoDTO = JSONObject.parseObject(params, StaffClerkBindLogInfoDTO.class); StaffClerkBindLogInfoDTO infoDTO = JSONObject.parseObject(params, StaffClerkBindLogInfoDTO.class);
if (null == infoDTO) { if (null == infoDTO) {
logger.info("数据不存在"); logger.info("数据不存在");
...@@ -98,16 +98,18 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -98,16 +98,18 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
clerkName = clerkDTO.getClerkName(); clerkName = clerkDTO.getClerkName();
} }
String operClerkId = infoDTO.getOptStaffId(); String operClerkId = infoDTO.getOptStaffId();
ClerkDTO operClerkDTO = clerkService.getClerkByClerkIdNoStatus(operClerkId);
String operName = null; String operName = null;
if (null != operClerkDTO) { if(StringUtils.isNotEmpty(operClerkId)) {
operName = operClerkDTO.getClerkName(); ClerkDTO operClerkDTO = clerkService.getClerkByClerkIdNoStatus(operClerkId);
} if (null != operClerkDTO) {
//如果是小程序解绑,需要存储staffName operName = operClerkDTO.getClerkName();
if(infoDTO.getChannelCode() != null &&(infoDTO.getChannelCode().equals(ChannelCodeEnum.SELF_UNBIND.getCode()) || infoDTO.getChannelCode().equals(ChannelCodeEnum.SELF_BIND.getCode()))){ }
TabHaobanStaff tabHaobanStaff = staffService.selectById(operClerkId); //如果是小程序解绑,需要存储staffName
if (null != tabHaobanStaff) { if(infoDTO.getChannelCode() != null &&(infoDTO.getChannelCode().equals(ChannelCodeEnum.SELF_UNBIND.getCode()) || infoDTO.getChannelCode().equals(ChannelCodeEnum.SELF_BIND.getCode()))){
operName =tabHaobanStaff.getStaffName(); TabHaobanStaff tabHaobanStaff = staffService.selectById(operClerkId);
if (null != tabHaobanStaff) {
operName =tabHaobanStaff.getStaffName();
}
} }
} }
TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog(); TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog();
......
...@@ -75,7 +75,6 @@ public class GroupChatPlanApiServiceImpl implements GroupChatPlanApiService { ...@@ -75,7 +75,6 @@ public class GroupChatPlanApiServiceImpl implements GroupChatPlanApiService {
* @Title: doPlan * @Title: doPlan
* @Description: 定时执行计划 * @Description: 定时执行计划
* @author xugh * @author xugh
* @param planId
* @return * @return
* @throws * @throws
*/ */
......
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
<import resource="classpath:dubbo-setting-test.xml"/> <import resource="classpath:dubbo-setting-test.xml"/>
<import resource="classpath:jdbc-haoban-manage-service.xml" /> <import resource="classpath:jdbc-haoban-manage-service.xml" />
<import resource="classpath*:log-record-init.xml" /> <import resource="classpath*:log-record-init.xml" />
<import resource="classpath*:kafka-setting-data.xml" /> <!-- <import resource="classpath*:kafka-setting-data.xml" />-->
</beans> </beans>
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<result column="msg_total" property="msgTotal" /> <result column="msg_total" property="msgTotal" />
<result column="migrate_trainee_chat_cnt" property="migrateTraineeChatCnt" /> <result column="migrate_trainee_chat_cnt" property="migrateTraineeChatCnt" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="quit_user_count" property="quitUserCount" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
data_id, data_id,
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
member_has_msg, member_has_msg,
msg_total, msg_total,
migrate_trainee_chat_cnt, migrate_trainee_chat_cnt,
create_time create_time , quit_user_count
</sql> </sql>
<insert id="batchInsert"> <insert id="batchInsert">
...@@ -48,7 +49,7 @@ ...@@ -48,7 +49,7 @@
member_has_msg, member_has_msg,
msg_total, msg_total,
migrate_trainee_chat_cnt, migrate_trainee_chat_cnt,
create_time create_time , quit_user_count
)VALUES )VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator="," >
( #{item.dataId}, ( #{item.dataId},
...@@ -63,27 +64,31 @@ ...@@ -63,27 +64,31 @@
#{item.memberHasMsg}, #{item.memberHasMsg},
#{item.msgTotal}, #{item.msgTotal},
#{item.migrateTraineeChatCnt}, #{item.migrateTraineeChatCnt},
now() now() , 0
) )
</foreach> </foreach>
</insert> </insert>
<update id="updateQuitCount">
update tab_haoban_group_chat_data set quit_user_count = #{quitCount} where wx_enterprise_id=#{wxEnterpriseId}
and date = #{date} and staff_id = #{staffId}
</update>
<select id="listTotalData" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO" <select id="listTotalData" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.ChatDataSearchQDTO"
resultType="com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO"> resultType="com.gic.haoban.manage.api.dto.chat.GroupChatDataDTO">
select sum(chatTotal) chatTotal , sum(memberTotal) memberTotal, select sum(chatTotal) chatTotal , sum(memberTotal) memberTotal,
SUM(newChatCnt) newChatCnt, SUM(chatHasMsg) chatHasMsg, SUM(newMemberCnt) newMemberCnt, SUM(newChatCnt) newChatCnt, SUM(chatHasMsg) chatHasMsg, SUM(newMemberCnt) newMemberCnt,
SUM(memberHasMsg) memberHasMsg, SUM(msgTotal) msgTotal SUM(memberHasMsg) memberHasMsg, SUM(msgTotal) msgTotal , sum(quitUserCount) quitUserCount
from ( from (
SELECT SELECT
staffId, `date`, chatTotal, memberTotal, staffId, `date`, chatTotal, memberTotal,
SUM(newChatCnt) newChatCnt, SUM(chatHasMsg) chatHasMsg, SUM(newMemberCnt) newMemberCnt, SUM(newChatCnt) newChatCnt, SUM(chatHasMsg) chatHasMsg, SUM(newMemberCnt) newMemberCnt,
SUM(memberHasMsg) memberHasMsg, SUM(msgTotal) msgTotal SUM(memberHasMsg) memberHasMsg, SUM(msgTotal) msgTotal , sum(quitUserCount) quitUserCount
FROM FROM
(SELECT (SELECT
a.staff_id staffId, a.date `date`, a.staff_id staffId, a.date `date`,
a.chat_total chatTotal, a.member_total memberTotal, a.chat_total chatTotal, a.member_total memberTotal,
a.new_chat_cnt newChatCnt, a.chat_has_msg chatHasMsg, a.new_member_cnt newMemberCnt, a.new_chat_cnt newChatCnt, a.chat_has_msg chatHasMsg, a.new_member_cnt newMemberCnt,
a.member_has_msg memberHasMsg, a.msg_total msgTotal a.member_has_msg memberHasMsg, a.msg_total msgTotal , a.quit_user_count quitUserCount
FROM tab_haoban_group_chat_data a FROM tab_haoban_group_chat_data a
where a.wx_enterprise_id = #{wxEnterpriseId} where a.wx_enterprise_id = #{wxEnterpriseId}
and a.date >= #{startDate} and a.date <![CDATA[ <= ]]> #{endDate} and a.date >= #{startDate} and a.date <![CDATA[ <= ]]> #{endDate}
...@@ -106,7 +111,8 @@ ...@@ -106,7 +111,8 @@
sum(a.chat_has_msg) chatHasMsg , sum(a.chat_has_msg) chatHasMsg ,
sum(a.new_member_cnt) newMemberCnt , sum(a.new_member_cnt) newMemberCnt ,
sum(a.member_has_msg) memberHasMsg , sum(a.member_has_msg) memberHasMsg ,
sum(a.msg_total) msgTotal sum(a.msg_total) msgTotal ,
sum(a.quit_user_count) quitUserCount
from tab_haoban_group_chat_data a from tab_haoban_group_chat_data a
where a.wx_enterprise_id = #{wxEnterpriseId} where a.wx_enterprise_id = #{wxEnterpriseId}
and a.date >= #{startDate} and a.date <![CDATA[ <= ]]> #{endDate} and a.date >= #{startDate} and a.date <![CDATA[ <= ]]> #{endDate}
...@@ -124,13 +130,13 @@ ...@@ -124,13 +130,13 @@
SELECT SELECT
staffId, staffName, `date`, chatTotal, memberTotal, staffId, staffName, `date`, chatTotal, memberTotal,
SUM(newChatCnt) newChatCnt, SUM(chatHasMsg) chatHasMsg, SUM(newMemberCnt) newMemberCnt, SUM(newChatCnt) newChatCnt, SUM(chatHasMsg) chatHasMsg, SUM(newMemberCnt) newMemberCnt,
SUM(memberHasMsg) memberHasMsg, SUM(msgTotal) msgTotal SUM(memberHasMsg) memberHasMsg, SUM(msgTotal) msgTotal , sum(quit_user_count) quitUserCount
FROM FROM
(SELECT (SELECT
b.staff_name staffName, a.staff_id staffId, a.date `date`, b.staff_name staffName, a.staff_id staffId, a.date `date`,
a.chat_total chatTotal, a.member_total memberTotal, a.chat_total chatTotal, a.member_total memberTotal,
a.new_chat_cnt newChatCnt, a.chat_has_msg chatHasMsg, a.new_member_cnt newMemberCnt, a.new_chat_cnt newChatCnt, a.chat_has_msg chatHasMsg, a.new_member_cnt newMemberCnt,
a.member_has_msg memberHasMsg, a.msg_total msgTotal a.member_has_msg memberHasMsg, a.msg_total msgTotal , a.quit_user_count quitUserCount
FROM tab_haoban_group_chat_data a LEFT JOIN tab_haoban_staff b ON a.staff_id = b.staff_id FROM tab_haoban_group_chat_data a LEFT JOIN tab_haoban_staff b ON a.staff_id = b.staff_id
where a.wx_enterprise_id = #{wxEnterpriseId} where a.wx_enterprise_id = #{wxEnterpriseId}
and a.date >= #{startDate} and a.date <![CDATA[ <= ]]> #{endDate} and a.date >= #{startDate} and a.date <![CDATA[ <= ]]> #{endDate}
...@@ -143,4 +149,6 @@ ...@@ -143,4 +149,6 @@
ORDER BY a.date DESC ORDER BY a.date DESC
) tb GROUP BY staffId ) tb GROUP BY staffId
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<result column="fail_chat_count" property="failChatCount" /> <result column="fail_chat_count" property="failChatCount" />
<result column="send_flag" property="sendFlag" /> <result column="send_flag" property="sendFlag" />
<result column="material_from" property="materialFrom" /> <result column="material_from" property="materialFrom" />
<result column="send_all_flag" property="sendAllFlag" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
plan_id, plan_id,
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
success_chat_count, success_chat_count,
fail_chat_count , fail_chat_count ,
wx_enterprise_id , enterprise_id , send_flag , wx_enterprise_id , enterprise_id , send_flag ,
material_from material_from , send_all_flag
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" <insert id="insert"
...@@ -78,7 +79,7 @@ ...@@ -78,7 +79,7 @@
send_count, send_count,
success_chat_count, success_chat_count,
fail_chat_count , wx_enterprise_id , enterprise_id , delete_flag , send_flag, fail_chat_count , wx_enterprise_id , enterprise_id , delete_flag , send_flag,
material_from material_from , send_all_flag
)VALUES( )VALUES(
#{planId}, #{planId},
#{name}, #{name},
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
#{sendCount}, #{sendCount},
#{successChatCount}, #{successChatCount},
#{failChatCount} , #{wxEnterpriseId} , #{enterpriseId} , 0 , 1, #{failChatCount} , #{wxEnterpriseId} , #{enterpriseId} , 0 , 1,
#{materialFrom} #{materialFrom} , #{sendAllFlag}
) )
]]> ]]>
</insert> </insert>
...@@ -115,7 +116,7 @@ ...@@ -115,7 +116,7 @@
<update id="stopById"> <update id="stopById">
UPDATE UPDATE
tab_haoban_group_chat_plan SET status_flag = 0 , modifier_id = tab_haoban_group_chat_plan SET status_flag = 0 , modifier_id =
#{clerkId} , modifier_name = #{clerkName} , end_time = now() , update_time=now() #{clerkId} , modifier_name = #{clerkName} , end_time = now() , update_time=now()
<if test="null != modifyStartTimeFlag"> <if test="null != modifyStartTimeFlag">
, startTime = now() , startTime = now()
</if> </if>
...@@ -143,7 +144,8 @@ ...@@ -143,7 +144,8 @@
start_time=#{startTime}, start_time=#{startTime},
end_time=#{endTime}, end_time=#{endTime},
expire_days=#{expireDays}, expire_days=#{expireDays},
material_from=#{materialFrom} material_from=#{materialFrom} ,
send_all_flag = #{sendAllFlag}
where plan_id = #{planId} where plan_id = #{planId}
]]> ]]>
</update> </update>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<result column="join_state" property="joinState" /> <result column="join_state" property="joinState" />
<result column="admin_flag" property="adminFlag"/> <result column="admin_flag" property="adminFlag"/>
<result column="quit_staff_id" property="quitStaffId"/> <result column="quit_staff_id" property="quitStaffId"/>
<result column="quit_staff_store" property="quitStaffStore" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
chat_user_id, chat_user_id,
...@@ -50,7 +51,7 @@ ...@@ -50,7 +51,7 @@
quit_scene, quit_scene,
join_scene, join_scene,
join_remark, join_remark,
join_state , invitor_user_name , admin_flag , quit_staff_id join_state , invitor_user_name , admin_flag , quit_staff_id , quit_staff_store
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" <insert id="insert"
...@@ -158,7 +159,9 @@ ...@@ -158,7 +159,9 @@
<!-- =====================废弃群==================== --> <!-- =====================废弃群==================== -->
<update id="dismiss"> <update id="dismiss">
UPDATE tab_haoban_group_chat_user SET status_flag = 2 , update_time=now() , user_quit_time = now() , quit_scene = 0 , quit_staff_id = #{ownerId} WHERE chat_user_id in UPDATE tab_haoban_group_chat_user SET status_flag = 2 , update_time=now() , user_quit_time = now() , quit_scene = 0 , quit_staff_id = #{ownerId} ,
quit_staff_store = #{quitStaffStore}
WHERE chat_user_id in
<foreach collection="idList" close=")" open="(" index="index" item="id" separator=","> <foreach collection="idList" close=")" open="(" index="index" item="id" separator=",">
#{id} #{id}
</foreach> </foreach>
...@@ -227,6 +230,7 @@ ...@@ -227,6 +230,7 @@
select select
b.name chatName , b.name chatName ,
b.wx_chat_id wxChatId , b.wx_chat_id wxChatId ,
c.staff_id staffId ,
c.staff_name staffName , c.staff_name staffName ,
a.chat_user_id chatUserId , a.chat_user_id chatUserId ,
a.user_type userType , a.user_type userType ,
...@@ -243,7 +247,7 @@ ...@@ -243,7 +247,7 @@
left join tab_haoban_group_chat b on a.group_chat_id = b.group_chat_id left join tab_haoban_group_chat b on a.group_chat_id = b.group_chat_id
<choose> <choose>
<when test="status==2"> <when test="status==2">
left join tab_haoban_staff c on a.quit_staff_id = c.staff_id left join tab_haoban_staff c on a.quit_staff_id = c.staff_id
</when> </when>
<otherwise> <otherwise>
left join tab_haoban_staff c on b.staff_id = c.staff_id left join tab_haoban_staff c on b.staff_id = c.staff_id
...@@ -299,5 +303,10 @@ ...@@ -299,5 +303,10 @@
</if> </if>
</where> </where>
</select> </select>
<select id="listQuitNum" resultType="com.gic.haoban.manage.service.pojo.bo.chat.UserQuitBO">
select quit_staff_id , count(*) from tab_haoban_group_chat_user where wx_enterprise_id=#{wxEnterpriseId} and user_quit_time >= #{start}
and user_quit_time <![CDATA[<=]]> #{end} and status_flag = 2 group by quit_staff_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -203,8 +203,8 @@ public class GroupChatController { ...@@ -203,8 +203,8 @@ public class GroupChatController {
} }
String s = DateUtil.formatString(new Date(), DateUtil.FORMAT_DATE_10); String s = DateUtil.formatString(new Date(), DateUtil.FORMAT_DATE_10);
String fileName = "退群记录"+s; String fileName = "退群记录"+s;
List<String> titleList = Arrays.asList("群成员姓名", "群成员昵称", "身份", "群名称", "群主", "退群时间"); List<String> titleList = Arrays.asList("群成员姓名", "群成员昵称", "身份", "群名称", "群主", "群主关联门店", "退群时间");
List<String> fileList = Arrays.asList("userName","nickName","userTypeExcel", "chatName", "staffName", "userQuitTimeExcel"); List<String> fileList = Arrays.asList("userName","nickName","userTypeExcel", "chatName", "staffName", "quitStaffStore" , "userQuitTimeExcel");
try { try {
ExcelUtils.xls(response, request, fileName, voList, fileList, titleList); ExcelUtils.xls(response, request, fileName, voList, fileList, titleList);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -26,6 +26,16 @@ public class GroupChatUserQuitVO implements Serializable{ ...@@ -26,6 +26,16 @@ public class GroupChatUserQuitVO implements Serializable{
private String chatName ; private String chatName ;
private String staffName ; private String staffName ;
private String quitStaffStore ;
public String getQuitStaffStore() {
return quitStaffStore;
}
public void setQuitStaffStore(String quitStaffStore) {
this.quitStaffStore = quitStaffStore;
}
public String getUserTypeExcel() { public String getUserTypeExcel() {
return userTypeExcel; return userTypeExcel;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment