Commit 305146d3 by songyinghui

feat: 素材分享日志 及客户触达日志

parent 29e4d6bc
...@@ -17,6 +17,12 @@ public class ClerkShareMaterialLogDTO implements Serializable { ...@@ -17,6 +17,12 @@ public class ClerkShareMaterialLogDTO implements Serializable {
*/ */
private String enterpriseId; private String enterpriseId;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/** /**
* 导购id * 导购id
*/ */
...@@ -91,4 +97,12 @@ public class ClerkShareMaterialLogDTO implements Serializable { ...@@ -91,4 +97,12 @@ public class ClerkShareMaterialLogDTO implements Serializable {
public void setBizType(Integer bizType) { public void setBizType(Integer bizType) {
this.bizType = bizType; this.bizType = bizType;
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
} }
package com.gic.haoban.manage.api.dto.content.log;
import com.tencentcloudapi.vpc.v20170312.models.LocalGateway;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2023/3/20 4:27 PM
* @Description
* @Version
**/
public class TriggerCustomerDetailLogDTO implements Serializable {
private static final long serialVersionUID = -5149812263567137819L;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 导购id
*/
private String clerkId;
/**
* 类型
*
* @see com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType
*/
private Integer shareType;
/**
* 分享到朋友圈
*/
private SharePYQ sharePYQ;
public static class SharePYQ implements Serializable {
private static final long serialVersionUID = 273212828851672738L;
/**
* 导购分享日志id
*/
private Long shareLogId;
public Long getShareLogId() {
return shareLogId;
}
public void setShareLogId(Long shareLogId) {
this.shareLogId = shareLogId;
}
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public Integer getShareType() {
return shareType;
}
public void setShareType(Integer shareType) {
this.shareType = shareType;
}
public SharePYQ getSharePYQ() {
return sharePYQ;
}
public void setSharePYQ(SharePYQ sharePYQ) {
this.sharePYQ = sharePYQ;
}
}
...@@ -11,7 +11,7 @@ public enum TriggerCustomerChannelType { ...@@ -11,7 +11,7 @@ public enum TriggerCustomerChannelType {
PYQ(1, "朋友圈"), PYQ(1, "朋友圈"),
CUSTOMER_GROUP(2, "客户群"), CUSTOMER_GROUP(2, "客户群"),
DIALOG_BOX(3, "对话框"), DIALOG_BOX(3, "对话框/群发给客户"),
CONTENT_COPY(4, "复制文案"), CONTENT_COPY(4, "复制文案"),
CONTENT_DOWNLOAD(5, "下载素材") CONTENT_DOWNLOAD(5, "下载素材")
; ;
......
...@@ -19,4 +19,11 @@ public interface QywxGroupMsgTaskApiService { ...@@ -19,4 +19,11 @@ public interface QywxGroupMsgTaskApiService {
* @return * @return
*/ */
ServiceResponse<Void> groupMsgTaskJob(String params); ServiceResponse<Void> groupMsgTaskJob(String params);
/**
* 处理客户触达日志明细
* @param params
* @return
*/
ServiceResponse<Void> handlerTriggerCustomerDetailLog(String params);
} }
...@@ -389,4 +389,9 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -389,4 +389,9 @@ public interface TabHaobanExternalClerkRelatedMapper {
TabHaobanExternalClerkRelated getMemberForExternalId(@Param("wxEnterpriseId") String wxEnterpriseId, TabHaobanExternalClerkRelated getMemberForExternalId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("externalUserId") String externalUserId); @Param("externalUserId") String externalUserId);
/**
* 查询成员的好友列表
*/
List<String> queryExternalUserIdWithStaffId(@Param("staffId") String staffId);
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.dao.mapper.chat; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.service.pojo.qo.chat.GroupChatUserQO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.chat.GroupChatUserDTO; import com.gic.haoban.manage.api.dto.chat.GroupChatUserDTO;
...@@ -55,4 +56,11 @@ public interface GroupChatUserMapper { ...@@ -55,4 +56,11 @@ public interface GroupChatUserMapper {
@Param("enterpriseId") String enterpriseId, @Param("externalUserid") String externalUserid, @Param("enterpriseId") String enterpriseId, @Param("externalUserid") String externalUserid,
@Param("memberId") String memberId); @Param("memberId") String memberId);
/**
* 查询群组成员列表
* @param groupChatUserQO
* @return
*/
List<TabGroupChatUser> queryGroupChatUserList(GroupChatUserQO groupChatUserQO);
} }
\ No newline at end of file
...@@ -79,5 +79,13 @@ public interface TabHaobanClerkShareLogMapper { ...@@ -79,5 +79,13 @@ public interface TabHaobanClerkShareLogMapper {
*/ */
int deleteById(Long id); int deleteById(Long id);
/**
* 标记分享日志为已处理
* @param enterpriseId
* @param ids
* @return
*/
int markShareLogWithDone(@Param("enterpriseId") String enterpriseId, @Param("ids") List<Long> ids);
} }
package com.gic.haoban.manage.service.pojo.bo.chat;
/**
* @Author MUSI
* @Date 2023/3/20 8:00 PM
* @Description
* @Version
**/
public class GroupChatUserBO {
private Long chatUserId;
/**微信企业id*/
private String wxEnterpriseId;
private String enterpriseId;
/**1企业成员2外部联系人3客户*/
private Integer userType;
/**群成员id*/
private String userId;
/**群id*/
private Long groupChatId;
public Long getChatUserId() {
return chatUserId;
}
public void setChatUserId(Long chatUserId) {
this.chatUserId = chatUserId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Long getGroupChatId() {
return groupChatId;
}
public void setGroupChatId(Long groupChatId) {
this.groupChatId = groupChatId;
}
}
package com.gic.haoban.manage.service.pojo.bo.content; package com.gic.haoban.manage.service.pojo.bo.content;
import java.util.Date;
/** /**
* @Author MUSI * @Author MUSI
* @Date 2023/3/18 9:02 PM * @Date 2023/3/18 9:02 PM
...@@ -8,6 +10,8 @@ package com.gic.haoban.manage.service.pojo.bo.content; ...@@ -8,6 +10,8 @@ package com.gic.haoban.manage.service.pojo.bo.content;
**/ **/
public class ClerkShareLogBO { public class ClerkShareLogBO {
private Long id;
/** /**
* 企业id * 企业id
*/ */
...@@ -45,6 +49,11 @@ public class ClerkShareLogBO { ...@@ -45,6 +49,11 @@ public class ClerkShareLogBO {
*/ */
private Integer bizType; private Integer bizType;
/**
* 创建时间
*/
private Date createTime;
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
...@@ -100,4 +109,20 @@ public class ClerkShareLogBO { ...@@ -100,4 +109,20 @@ public class ClerkShareLogBO {
public void setWxEnterpriseId(String wxEnterpriseId) { public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
} }
...@@ -30,6 +30,11 @@ public class GroupMessageInfoBo { ...@@ -30,6 +30,11 @@ public class GroupMessageInfoBo {
*/ */
private Date endTime; private Date endTime;
/**
* 分享日志
*/
private Long shareLogId;
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
...@@ -61,4 +66,12 @@ public class GroupMessageInfoBo { ...@@ -61,4 +66,12 @@ public class GroupMessageInfoBo {
public void setWxEnterpriseId(String wxEnterpriseId) { public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public Long getShareLogId() {
return shareLogId;
}
public void setShareLogId(Long shareLogId) {
this.shareLogId = shareLogId;
}
} }
package com.gic.haoban.manage.service.pojo.qo.chat;
import com.gic.haoban.base.api.common.BasePageInfo;
/**
* @Author MUSI
* @Date 2023/3/20 8:07 PM
* @Description
* @Version
**/
public class GroupChatUserQO extends BasePageInfo {
private String wxEnterpriseId;
private String enterpriseId;
private Long chatId;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Long getChatId() {
return chatId;
}
public void setChatId(Long chatId) {
this.chatId = chatId;
}
}
...@@ -15,6 +15,11 @@ public class ClerkShareLogQO extends BasePageInfo { ...@@ -15,6 +15,11 @@ public class ClerkShareLogQO extends BasePageInfo {
private static final long serialVersionUID = -2919045329617420361L; private static final long serialVersionUID = -2919045329617420361L;
/** /**
* 分享日志id
*/
private Long shareLogId;
/**
* 企业id * 企业id
*/ */
private String enterpriseId; private String enterpriseId;
...@@ -83,4 +88,13 @@ public class ClerkShareLogQO extends BasePageInfo { ...@@ -83,4 +88,13 @@ public class ClerkShareLogQO extends BasePageInfo {
this.clerkId = clerkId; this.clerkId = clerkId;
return this; return this;
} }
public Long getShareLogId() {
return shareLogId;
}
public ClerkShareLogQO setShareLogId(Long shareLogId) {
this.shareLogId = shareLogId;
return this;
}
} }
...@@ -83,4 +83,11 @@ public interface ExternalClerkRelatedService { ...@@ -83,4 +83,11 @@ public interface ExternalClerkRelatedService {
void updateClerkInfo(String staffId, String oldClerkId, String newClerkId); void updateClerkInfo(String staffId, String oldClerkId, String newClerkId);
/**
* 外部联系人
* @param staffId
* @return
*/
List<String> queryExternalRelatedWithStaffId(String staffId);
} }
...@@ -136,5 +136,11 @@ public interface StaffService { ...@@ -136,5 +136,11 @@ public interface StaffService {
Integer getOccupyNum(String wxEnterpriseId); Integer getOccupyNum(String wxEnterpriseId);
/**
* 查询成员列表
* @param wxEnterpriseId
* @param staffIds
* @return
*/
List<TabHaobanStaff> listStaffWithIds(List<String> staffIds);
} }
...@@ -4,9 +4,16 @@ import com.gic.api.base.commons.BasePageInfo; ...@@ -4,9 +4,16 @@ import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.chat.GroupChatUserDTO; import com.gic.haoban.manage.api.dto.chat.GroupChatUserDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO;
import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatUserBO;
import java.util.List;
public interface GroupChatUserService { public interface GroupChatUserService {
Page<GroupChatUserDTO> listPage(GroupChatUserSearchQDTO qdto, BasePageInfo basePageInfo); Page<GroupChatUserDTO> listPage(GroupChatUserSearchQDTO qdto, BasePageInfo basePageInfo);
/**
* 查询群组内群成员
*/
List<GroupChatUserBO> queryGroupMemberWithChatId(String enterpriseId, String wxEnterpriseId, Long groupChatId);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.service.chat.impl; package com.gic.haoban.manage.service.service.chat.impl;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatUserBO;
import com.gic.haoban.manage.service.pojo.qo.chat.GroupChatUserQO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -34,4 +41,30 @@ public class GroupChatUserServiceImpl implements GroupChatUserService { ...@@ -34,4 +41,30 @@ public class GroupChatUserServiceImpl implements GroupChatUserService {
return retPage; return retPage;
} }
/**
* 查询群组内群成员
*
* @param enterpriseId
* @param wxEnterpriseId
* @param groupChatId
*/
@Override
public List<GroupChatUserBO> queryGroupMemberWithChatId(String enterpriseId, String wxEnterpriseId, Long groupChatId) {
GroupChatUserQO search = new GroupChatUserQO();
search.setChatId(groupChatId);
search.setEnterpriseId(enterpriseId);
search.setWxEnterpriseId(wxEnterpriseId);
List<TabGroupChatUser> tabGroupChatUsers = groupChatUserMapper.queryGroupChatUserList(search);
if (CollectionUtils.isEmpty(tabGroupChatUsers)) {
return Collections.emptyList();
}
return tabGroupChatUsers
.stream()
.map(item -> {
GroupChatUserBO temp = new GroupChatUserBO();
BeanUtils.copyProperties(item, temp);
return temp;
})
.collect(Collectors.toList());
}
} }
\ No newline at end of file
...@@ -26,4 +26,9 @@ public interface ClerkShareLogService { ...@@ -26,4 +26,9 @@ public interface ClerkShareLogService {
* @return * @return
*/ */
List<ClerkShareLogBO> queryClerkShareLog(ClerkShareLogQO clerkShareLogQO); List<ClerkShareLogBO> queryClerkShareLog(ClerkShareLogQO clerkShareLogQO);
/**
* 标记分享日志已处理
*/
void markClerkShareDone(String enterpriseId, List<Long> ids);
} }
...@@ -7,7 +7,9 @@ import com.gic.haoban.manage.service.entity.content.TabHaobanClerkShareLog; ...@@ -7,7 +7,9 @@ import com.gic.haoban.manage.service.entity.content.TabHaobanClerkShareLog;
import com.gic.haoban.manage.service.pojo.bo.content.ClerkShareLogBO; import com.gic.haoban.manage.service.pojo.bo.content.ClerkShareLogBO;
import com.gic.haoban.manage.service.pojo.qo.content.ClerkShareLogQO; import com.gic.haoban.manage.service.pojo.qo.content.ClerkShareLogQO;
import com.gic.haoban.manage.service.service.content.ClerkShareLogService; import com.gic.haoban.manage.service.service.content.ClerkShareLogService;
import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -69,4 +71,18 @@ public class ClerkShareLogServiceImpl implements ClerkShareLogService { ...@@ -69,4 +71,18 @@ public class ClerkShareLogServiceImpl implements ClerkShareLogService {
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 标记分享日志已处理
*
* @param enterpriseId
* @param ids
*/
@Override
public void markClerkShareDone(String enterpriseId, List<Long> ids) {
if (StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(ids)) {
return;
}
clerkShareLogMapper.markShareLogWithDone(enterpriseId, ids);
}
} }
...@@ -490,4 +490,15 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ ...@@ -490,4 +490,15 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
ClerkDTO clerk = this.clerkService.getclerkById(newClerkId); ClerkDTO clerk = this.clerkService.getclerkById(newClerkId);
this.mapper.updateClerkInfo(staffId,oldClerkId , newClerkId , clerk.getStoreId()); this.mapper.updateClerkInfo(staffId,oldClerkId , newClerkId , clerk.getStoreId());
} }
/**
* 外部联系人
*
* @param staffId
* @return
*/
@Override
public List<String> queryExternalRelatedWithStaffId(String staffId) {
return this.mapper.queryExternalUserIdWithStaffId(staffId);
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Collection;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -248,5 +250,19 @@ public class StaffServiceImpl implements StaffService { ...@@ -248,5 +250,19 @@ public class StaffServiceImpl implements StaffService {
this.haobanQywxFeeAccountStaffService.save(accountStaff); this.haobanQywxFeeAccountStaffService.save(accountStaff);
} }
} }
/**
* 查询成员列表
*
* @param wxEnterpriseId
* @param staffIds
* @return
*/
@Override
public List<TabHaobanStaff> listStaffWithIds(List<String> staffIds) {
if (CollectionUtils.isEmpty(staffIds)) {
return Collections.emptyList();
}
return this.mapper.listByIds(staffIds);
}
} }
package com.gic.haoban.manage.service.service.out.impl.content; package com.gic.haoban.manage.service.service.out.impl.content;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.content.log.ClerkShareMaterialLogDTO; import com.gic.haoban.manage.api.dto.content.log.ClerkShareMaterialLogDTO;
import com.gic.haoban.manage.api.dto.content.log.TriggerCustomerDetailLogDTO;
import com.gic.haoban.manage.api.enums.content.ClerkShareMaterialType;
import com.gic.haoban.manage.api.service.content.MaterialShareLogApiService; import com.gic.haoban.manage.api.service.content.MaterialShareLogApiService;
import com.gic.haoban.manage.service.pojo.bo.content.ClerkShareLogBO; import com.gic.haoban.manage.service.pojo.bo.content.ClerkShareLogBO;
import com.gic.haoban.manage.service.service.content.ClerkShareLogService; import com.gic.haoban.manage.service.service.content.ClerkShareLogService;
...@@ -21,6 +25,12 @@ import org.springframework.stereotype.Component; ...@@ -21,6 +25,12 @@ import org.springframework.stereotype.Component;
public class MaterialShareLogApiServiceImpl implements MaterialShareLogApiService { public class MaterialShareLogApiServiceImpl implements MaterialShareLogApiService {
private static final Logger log = LoggerFactory.getLogger(MaterialShareLogApiServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(MaterialShareLogApiServiceImpl.class);
/**
* 导购分享素材 客户触达日志
* @see com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService#handlerTriggerCustomerDetailLog(String)
*/
private static final String SHARE_MATERIAL_DETAIL_LOG = "SHARE_MATERIAL_DETAIL_LOG";
@Autowired @Autowired
private ClerkShareLogService clerkShareLogService; private ClerkShareLogService clerkShareLogService;
...@@ -30,6 +40,21 @@ public class MaterialShareLogApiServiceImpl implements MaterialShareLogApiServic ...@@ -30,6 +40,21 @@ public class MaterialShareLogApiServiceImpl implements MaterialShareLogApiServic
ClerkShareLogBO clerkShareLogBO = new ClerkShareLogBO(); ClerkShareLogBO clerkShareLogBO = new ClerkShareLogBO();
BeanUtils.copyProperties(clerkShareMaterialLogDTO, clerkShareLogBO); BeanUtils.copyProperties(clerkShareMaterialLogDTO, clerkShareLogBO);
Long logId = clerkShareLogService.saveClerkShareLog(clerkShareLogBO); Long logId = clerkShareLogService.saveClerkShareLog(clerkShareLogBO);
if (logId != null){
// MQ 通知处理导购分享日志
TriggerCustomerDetailLogDTO triggerCustomerDetailLog = new TriggerCustomerDetailLogDTO();
triggerCustomerDetailLog.setEnterpriseId(clerkShareLogBO.getEnterpriseId());
triggerCustomerDetailLog.setClerkId(clerkShareLogBO.getClerkId());
triggerCustomerDetailLog.setShareType(ClerkShareMaterialType.SHARE_PYQ.getCode());
TriggerCustomerDetailLogDTO.SharePYQ sharePYQ = new TriggerCustomerDetailLogDTO.SharePYQ();
sharePYQ.setShareLogId(logId);
triggerCustomerDetailLog.setSharePYQ(sharePYQ);
try{
GICMQClientUtil.getClientInstance().sendMessage(SHARE_MATERIAL_DETAIL_LOG, JSON.toJSONString(triggerCustomerDetailLog));
}catch (Exception ex){
log.warn("客户分享素材 触达日志MQ异常 {}", JSON.toJSONString(triggerCustomerDetailLog), ex);
}
}
return ServiceResponse.success(logId); return ServiceResponse.success(logId);
} }
} }
package com.gic.haoban.manage.service.service.out.impl.content.task; package com.gic.haoban.manage.service.service.out.impl.content.task;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.haoban.manage.api.dto.content.log.TriggerCustomerDetailLogDTO;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService; import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
import com.gic.haoban.manage.service.pojo.bo.content.GroupMessageInfoBo;
import com.gic.haoban.manage.service.service.content.GroupMessageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -16,14 +26,52 @@ import java.util.List; ...@@ -16,14 +26,52 @@ import java.util.List;
@Component("qywxGroupMsgTaskApiServiceImpl") @Component("qywxGroupMsgTaskApiServiceImpl")
public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiService { public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiService {
private static final Logger log = LoggerFactory.getLogger(QywxGroupMsgTaskApiServiceImpl.class);
@Autowired
private GroupMessageService groupMessageService;
@Override @Override
public ServiceResponse<Void> groupMsgTaskJob(String params) { public ServiceResponse<Void> groupMsgTaskJob(String params) {
// 获取开启【内容】权限的企业id // 获取开启【内容】权限的企业id
List<String> enterpriseIds = new ArrayList<>(); List<String> enterpriseIds = new ArrayList<>();
// 获取企业 (当前时间 - 30分钟, 当前时间)范围内的 导购分享记录。按创建时间排序 // 获取企业 (当前时间 - 30分钟, 当前时间)范围内的 导购分享记录。按创建时间排序
Date currentTime = new Date();
for (String enterpriseId : enterpriseIds) {
GroupMessageInfoBo groupMessageInfoBo = new GroupMessageInfoBo();
groupMessageInfoBo.setEnterpriseId(enterpriseId);
groupMessageInfoBo.setStartTime(DateUtil.addNumForMinute(currentTime, -30));
groupMessageInfoBo.setEndTime(currentTime);
groupMessageService.handlerGroupMessage(groupMessageInfoBo);
}
// 获取当前时间段内的数据 // 获取当前时间段内的数据
return ServiceResponse.success(); return ServiceResponse.success();
} }
/**
* 处理客户触达日志明细
*
* @param params
* @return
*/
@Override
public ServiceResponse<Void> handlerTriggerCustomerDetailLog(String params) {
log.info("处理客户触达日志 {}", params);
TriggerCustomerDetailLogDTO customerDetailLog = JSON.parseObject(params, TriggerCustomerDetailLogDTO.class);
if (customerDetailLog == null) {
return ServiceResponse.success();
}
GroupMessageInfoBo groupMessageInfoBo = new GroupMessageInfoBo();
groupMessageInfoBo.setEnterpriseId(customerDetailLog.getEnterpriseId());
if (TriggerCustomerChannelType.PYQ.getCode().equals(customerDetailLog.getShareType())) {
if (customerDetailLog.getSharePYQ() == null) {
log.info("handlerTriggerCustomerDetailLog 分享朋友圈类型 参数异常 {}", params);
return ServiceResponse.success();
}
groupMessageInfoBo.setShareLogId(customerDetailLog.getSharePYQ().getShareLogId());
}
groupMessageService.handlerGroupMessage(groupMessageInfoBo);
return ServiceResponse.success();
}
} }
...@@ -751,4 +751,10 @@ ...@@ -751,4 +751,10 @@
limit 1 limit 1
</select> </select>
<select id="queryExternalUserIdWithStaffId" resultType="java.lang.String">
SELECT external_user_id from tab_haoban_external_clerk_related
WHERE staff_id = #{staffId}
and status_flag in (1, 3, 4);
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -282,5 +282,22 @@ ...@@ -282,5 +282,22 @@
</otherwise> </otherwise>
</choose> </choose>
</select> </select>
<select id="queryGroupChatUserList" resultMap="result-map-tabHaobanGroupChatUser">
select <include refid="Base_Column_List"/>
from tab_haoban_group_chat_user
<where>
status_flag = 1 and delete_flag = 0
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
<if test="chatId != null and chatId != ''">
and group_chat_id = #{chatId}
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -61,8 +61,10 @@ ...@@ -61,8 +61,10 @@
<if test="endTime != null"> <if test="endTime != null">
and create_time <![CDATA[ <= ]]> #{endTime} and create_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="shareLogId != null">
and id = #{shareLogId}
</if>
</where> </where>
limit #{pageable.offset}, #{pageable.pageSize}
</select> </select>
<!--统计总行数--> <!--统计总行数-->
...@@ -187,5 +189,13 @@ ...@@ -187,5 +189,13 @@
where id = #{id} where id = #{id}
</delete> </delete>
<update id="markShareLogWithDone">
update tab_haoban_clerk_share_log set delete_flag = 1
where enterprise_id = #{enterpriseId} and id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
</mapper> </mapper>
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.DateUtil;
import com.gic.haoban.manage.api.dto.content.log.TriggerCustomerDetailLogDTO;
import com.gic.haoban.manage.api.enums.content.ClerkShareMaterialType;
import com.gic.haoban.manage.api.enums.content.ShareBizType;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
import com.gic.haoban.manage.service.pojo.bo.content.ClerkShareLogBO;
import com.gic.haoban.manage.service.pojo.bo.content.GroupMessageInfoBo;
import com.gic.haoban.manage.service.service.content.ClerkShareLogService;
import com.gic.haoban.manage.service.service.content.GroupMessageService;
import com.squareup.moshi.Json;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/20 8:57 PM
* @Description
* @Version
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class GroupMessageServiceTest {
@Autowired
private GroupMessageService groupMessageService;
@Autowired
private ClerkShareLogService clerkShareLogService;
@Autowired
private QywxGroupMsgTaskApiService qywxGroupMsgTaskApiService;
String eid = "ff8080815dacd3a2015dacd3ef5c0000";
String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
@Test
public void shareLogTest() {
ClerkShareLogBO clerkShareLogBO = new ClerkShareLogBO();
clerkShareLogBO.setEnterpriseId(eid);
clerkShareLogBO.setWxEnterpriseId(wxEid);
clerkShareLogBO.setClerkId("fbc508e395f846ef9005852c420e1c4f");
clerkShareLogBO.setStaffId("e608b51b267e4943b87e222a343b4f25");
clerkShareLogBO.setShareType(ClerkShareMaterialType.SHARE_PYQ.getCode());
clerkShareLogBO.setBizId(eid);
clerkShareLogBO.setBizType(ShareBizType.MATERIAL.getCode());
clerkShareLogService.saveClerkShareLog(clerkShareLogBO);
}
@Test
public void shareWithPyq() {
TriggerCustomerDetailLogDTO customerDetailLog = new TriggerCustomerDetailLogDTO();
customerDetailLog.setEnterpriseId(eid);
customerDetailLog.setShareType(TriggerCustomerChannelType.PYQ.getCode());
TriggerCustomerDetailLogDTO.SharePYQ sharePYQ = new TriggerCustomerDetailLogDTO.SharePYQ();
sharePYQ.setShareLogId(511216759709786113L);
customerDetailLog.setSharePYQ(sharePYQ);
qywxGroupMsgTaskApiService.handlerTriggerCustomerDetailLog(JSON.toJSONString(customerDetailLog));
}
@Test
public void groupMessageTest() {
Date currentTime = new Date();
GroupMessageInfoBo groupMessageInfoBo = new GroupMessageInfoBo();
groupMessageInfoBo.setEnterpriseId(eid);
groupMessageInfoBo.setStartTime(DateUtil.addNumForMinute(currentTime, -100));
groupMessageInfoBo.setEndTime(currentTime);
groupMessageService.handlerGroupMessage(groupMessageInfoBo);
}
}
...@@ -43,6 +43,7 @@ public class ClerkMaterialShareController { ...@@ -43,6 +43,7 @@ public class ClerkMaterialShareController {
} }
ClerkShareMaterialLogDTO temp = new ClerkShareMaterialLogDTO(); ClerkShareMaterialLogDTO temp = new ClerkShareMaterialLogDTO();
temp.setEnterpriseId(materialShareLogQo.getEnterpriseId()); temp.setEnterpriseId(materialShareLogQo.getEnterpriseId());
temp.setWxEnterpriseId(materialShareLogQo.getWxEnterpriseId());
temp.setClerkId(materialShareLogQo.getClerkId()); temp.setClerkId(materialShareLogQo.getClerkId());
temp.setStaffId(materialShareLogQo.getStaffId()); temp.setStaffId(materialShareLogQo.getStaffId());
temp.setShareType(materialShareLogQo.getShareType()); temp.setShareType(materialShareLogQo.getShareType());
......
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