Commit 5c165903 by 徐高华

社群群发

parent 5c8e6fe8
...@@ -6,7 +6,7 @@ public class ContentMaterialDTO implements Serializable { ...@@ -6,7 +6,7 @@ public class ContentMaterialDTO implements Serializable {
private static final long serialVersionUID = -8114034921530488238L; private static final long serialVersionUID = -8114034921530488238L;
// 素材类型, 1文本, 2图片, 3网页, 4视频, 5文件,6小程序 // 素材类型, 1文本, 2图片, 3网页, 4视频, 5文件,6小程序 7 卡券
private int materialType; private int materialType;
private String imgUrl; private String imgUrl;
...@@ -19,6 +19,36 @@ public class ContentMaterialDTO implements Serializable { ...@@ -19,6 +19,36 @@ public class ContentMaterialDTO implements Serializable {
*/ */
private String videoImgUrl; private String videoImgUrl;
private String appid ;
private int type ;
private String materialTitle ;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getMaterialTitle() {
return materialTitle;
}
public void setMaterialTitle(String materialTitle) {
this.materialTitle = materialTitle;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public int getMediaType() { public int getMediaType() {
return mediaType; return mediaType;
} }
......
...@@ -62,6 +62,16 @@ public class GroupChatPlanDTO implements Serializable { ...@@ -62,6 +62,16 @@ public class GroupChatPlanDTO implements Serializable {
private int sendAllFlag ; private int sendAllFlag ;
// 所有的群发条件 // 所有的群发条件
private String allSearchParams ; private String allSearchParams ;
// 执行方式 0企微1好办小程序
private int execType ;
public int getExecType() {
return execType;
}
public void setExecType(int execType) {
this.execType = execType;
}
public String getAllSearchParams() { public String getAllSearchParams() {
return allSearchParams; return allSearchParams;
......
...@@ -139,4 +139,10 @@ public interface HaobanTimerApiService { ...@@ -139,4 +139,10 @@ public interface HaobanTimerApiService {
* @param params * @param params
*/ */
void groupChatActivityTime(String params); void groupChatActivityTime(String params);
/**
* 群群发获取msgid
* @param params
*/
void groupChatMsgidTimer(String params) ;
} }
...@@ -27,6 +27,7 @@ public class NoticeMessageUtil { ...@@ -27,6 +27,7 @@ public class NoticeMessageUtil {
private static final Logger logger = getLogger(NoticeMessageUtil.class); private static final Logger logger = getLogger(NoticeMessageUtil.class);
//com.gic.haoban.manage.api.service.notify.NoticeMessageApiService#run
private static final String NOTICE_MESSAGE = "haobanNoticeMessage"; private static final String NOTICE_MESSAGE = "haobanNoticeMessage";
private static final String NOTICE_MESSAGE_BATCH = "haobanNoticeMessageBatch"; private static final String NOTICE_MESSAGE_BATCH = "haobanNoticeMessageBatch";
......
...@@ -53,4 +53,10 @@ public interface GroupChatPlanOwnerLogMapper { ...@@ -53,4 +53,10 @@ public interface GroupChatPlanOwnerLogMapper {
* @return * @return
*/ */
Integer getTotalCount(@Param("enterpriseId")String enterpriseId,@Param("clerkId")String clerkId,@Param("storeId")String storeId); Integer getTotalCount(@Param("enterpriseId")String enterpriseId,@Param("clerkId")String clerkId,@Param("storeId")String storeId);
void updateExecType(@Param("planId")Long planId , @Param("execType")int execType) ;
List<GroupChatPlanOwnerLogDTO> listForMsgid() ;
void updateMsgid(@Param("planId")Long id , @Param("msgid")String msgid) ;
} }
\ No newline at end of file
...@@ -32,6 +32,7 @@ public class TabMaterialContent implements Serializable { ...@@ -32,6 +32,7 @@ public class TabMaterialContent implements Serializable {
private java.util.Date createTime; private java.util.Date createTime;
/**修改时间*/ /**修改时间*/
private java.util.Date updateTime; private java.util.Date updateTime;
// 1群发 2朋友圈
private int mediaType ; private int mediaType ;
/** /**
...@@ -39,6 +40,26 @@ public class TabMaterialContent implements Serializable { ...@@ -39,6 +40,26 @@ public class TabMaterialContent implements Serializable {
*/ */
private String videoImgUrl; private String videoImgUrl;
private String appid ;
private String materialTitle ;
public String getMaterialTitle() {
return materialTitle;
}
public void setMaterialTitle(String materialTitle) {
this.materialTitle = materialTitle;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public int getMediaType() { public int getMediaType() {
return mediaType; return mediaType;
} }
......
...@@ -58,6 +58,17 @@ public class TabGroupChatPlan implements Serializable { ...@@ -58,6 +58,17 @@ public class TabGroupChatPlan implements Serializable {
// 所有的群发条件 // 所有的群发条件
private String allSearchParams ; private String allSearchParams ;
// 执行方式 0企微1好办小程序
private int execType ;
public int getExecType() {
return execType;
}
public void setExecType(int execType) {
this.execType = execType;
}
public String getAllSearchParams() { public String getAllSearchParams() {
return allSearchParams; return allSearchParams;
} }
......
...@@ -34,6 +34,15 @@ public class TabGroupChatPlanOwnerLog implements Serializable { ...@@ -34,6 +34,15 @@ public class TabGroupChatPlanOwnerLog implements Serializable {
private Integer doneFlag; private Integer doneFlag;
private Integer deleteFlag; private Integer deleteFlag;
private Date sendTime; private Date sendTime;
private int execType ;
public int getExecType() {
return execType;
}
public void setExecType(int execType) {
this.execType = execType;
}
public Integer getFailCount() { public Integer getFailCount() {
return failCount; return failCount;
......
...@@ -57,6 +57,16 @@ public class GroupChatPlanBO implements Serializable{ ...@@ -57,6 +57,16 @@ public class GroupChatPlanBO implements Serializable{
private int sendAllFlag ; private int sendAllFlag ;
// 所有的群发条件 // 所有的群发条件
private String allSearchParams ; private String allSearchParams ;
// 执行方式 0企微1好办小程序
private int execType ;
public int getExecType() {
return execType;
}
public void setExecType(int execType) {
this.execType = execType;
}
public String getAllSearchParams() { public String getAllSearchParams() {
return allSearchParams; return allSearchParams;
......
...@@ -56,7 +56,8 @@ public interface MaterialService { ...@@ -56,7 +56,8 @@ public interface MaterialService {
public MaterialDTO getHasChangeMadieMaterialById(String materialId,int from) ; public MaterialDTO getHasChangeMadieMaterialById(String materialId,int from) ;
public JSONResponse reUpdalodMetailJson(String materialId,int from) ; public JSONResponse reUpdalodMetailJson(String materialId,int from) ;
//mediaType1群发 2朋友圈
public List<String> getImageMediaId(String wxEnterpriseId, List<ContentMaterialDTO> imageList, int mediaType) ; public List<String> getImageMediaId(String wxEnterpriseId, List<ContentMaterialDTO> imageList, int mediaType) ;
List<MaterialDTO> listContentMaterialByIds(List<String> materialIds,Integer mediaType); List<MaterialDTO> listContentMaterialByIds(List<String> materialIds,Integer mediaType);
......
...@@ -29,4 +29,5 @@ public interface GroupChatPlanService { ...@@ -29,4 +29,5 @@ public interface GroupChatPlanService {
public void updateRemark(GroupChatPlanDTO dto); public void updateRemark(GroupChatPlanDTO dto);
void groupChatMsgidTimer(String params);
} }
\ No newline at end of file
...@@ -128,6 +128,7 @@ public class GroupChatPlanOwnerLogServiceImpl implements GroupChatPlanOwnerLogSe ...@@ -128,6 +128,7 @@ public class GroupChatPlanOwnerLogServiceImpl implements GroupChatPlanOwnerLogSe
log.setUpdateTime(new Date()); log.setUpdateTime(new Date());
log.setSendCount(0); log.setSendCount(0);
log.setStaffId(staffId); log.setStaffId(staffId);
log.setExecType(entity.getExecType());
logList.add(log); logList.add(log);
} }
this.groupChatPlanOwnerLogMapper.batchInsert(logList); this.groupChatPlanOwnerLogMapper.batchInsert(logList);
......
...@@ -11,16 +11,19 @@ import com.gic.enterprise.api.dto.EnterpriseDTO; ...@@ -11,16 +11,19 @@ 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.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.chat.ChatContentDTO; import com.gic.haoban.manage.api.dto.chat.*;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerMapper; import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerMapper;
import com.gic.haoban.manage.service.service.content.impl.GroupMessageServiceImpl;
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;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum; import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo; import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import com.gic.wechat.api.dto.qdto.group.QywxGroupMessageQDTO;
import com.gic.wechat.api.dto.qywx.group.QywxGroupMessageInfoDTO;
import com.gic.wechat.api.dto.qywx.group.QywxGroupMsgResp;
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.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -46,8 +49,6 @@ import com.gic.enterprise.api.dto.StoreDTO; ...@@ -46,8 +49,6 @@ import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.utils.DingUtils; import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatPlanDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatPlanLogDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO;
import com.gic.haoban.manage.api.enums.PendingTaskTypeEnum; import com.gic.haoban.manage.api.enums.PendingTaskTypeEnum;
import com.gic.haoban.manage.api.enums.chat.PlanSendStatusEnum; import com.gic.haoban.manage.api.enums.chat.PlanSendStatusEnum;
...@@ -185,6 +186,9 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -185,6 +186,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());
if(old.getExecType() != dto.getExecType()) {
this.groupChatPlanOwnerLogMapper.updateExecType(planId,dto.getExecType());
}
} }
// 新增群主日志 // 新增群主日志
this.groupChatPlanOwnerLogService.batchAdd(staffIdList, entity); this.groupChatPlanOwnerLogService.batchAdd(staffIdList, entity);
...@@ -347,7 +351,6 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -347,7 +351,6 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
} }
} }
} }
int pageNum = 0;
List<TabGroupChatPlanOwnerLog> ownerList = null; List<TabGroupChatPlanOwnerLog> ownerList = null;
int sendAlFlag = plan.getSendAllFlag() ; int sendAlFlag = plan.getSendAllFlag() ;
String allSearchParams = plan.getAllSearchParams() ; String allSearchParams = plan.getAllSearchParams() ;
...@@ -387,6 +390,22 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -387,6 +390,22 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
} }
this.groupChatPlanMapper.updateStaffCount(planId,totalCount); this.groupChatPlanMapper.updateStaffCount(planId,totalCount);
} }
int pageNum = 0;
if(plan.getExecType() == 1) {
logger.info("好办小程序执行={}",planId);
// 发送消息
while (true) {
ownerList = this.groupChatPlanOwnerLogMapper.listForDoPlan(planId, pageNum * pageSize, pageSize);
if (CollectionUtils.isEmpty(ownerList)) {
break;
}
pageNum++;
for (TabGroupChatPlanOwnerLog ownerLog : ownerList) {
}
}
return;
}
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)) {
...@@ -670,4 +689,69 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -670,4 +689,69 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
this.groupChatPlanMapper.updateRemark(dto); this.groupChatPlanMapper.updateRemark(dto);
} }
@Override
public void groupChatMsgidTimer(String params) {
logger.info("社群群发获取msgid");
List<GroupChatPlanOwnerLogDTO> list = this.groupChatPlanOwnerLogMapper.listForMsgid();
if(CollectionUtils.isNotEmpty(list)) {
for(GroupChatPlanOwnerLogDTO dto : list) {
this.updateMsgid(dto);
}
}
}
private void updateMsgid(GroupChatPlanOwnerLogDTO dto) {
Long ownerLogId = dto.getOwnerLogId() ;
String staffId = dto.getStaffId() ;
Date sendTime = dto.getSendTime() ;
String msgid = this.getQwMsgId(staffId,sendTime,GroupMessageServiceImpl.GroupMsgChatType.group) ;
if(null != msgid) {
logger.info("获取msgid={},{}",ownerLogId,msgid);
this.groupChatPlanOwnerLogMapper.updateMsgid(ownerLogId,msgid);
}
}
private String getQwMsgId(String staffId , Date sendTime, GroupMessageServiceImpl.GroupMsgChatType groupMsgChatType) {
Date startTime = DateUtil.addNumForMinute(sendTime,-5) ;
Date endTime = DateUtil.addNumForMinute(sendTime,5) ;
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId) ;
String wxEnterpriseId = staff.getWxEnterpriseId() ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
String wxUserId = staff.getWxUserId() ;
if(qwDTO.needOpenUserId3th()) {
wxUserId = staff.getWxOpenUseId() ;
}
// 发送到群
List<QywxGroupMessageInfoDTO> msgList = this.queryGroupMsg(GroupMessageServiceImpl.GroupMsgChatType.single,
startTime, endTime, qwDTO, wxUserId);
System.out.println("查询到={}"+JSONObject.toJSONString(msgList));
if(CollectionUtils.isNotEmpty(msgList)) {
return msgList.get(0).getMsgId() ;
}
return null ;
}
private List<QywxGroupMessageInfoDTO> queryGroupMsg(GroupMessageServiceImpl.GroupMsgChatType groupMsgChatType, Date startTime, Date endTime , WxEnterpriseQwDTO qwDTO , String qwUserId) {
List<QywxGroupMessageInfoDTO> groupMessageInfos = new ArrayList<>();
QywxGroupMessageQDTO qdto = new QywxGroupMessageQDTO();
qdto.setCorpid(qwDTO.getThirdCorpid());
qdto.setCreator(qwUserId);
qdto.setStartTime(startTime.getTime() / 1000);
qdto.setEndTime(endTime.getTime() / 1000);
qdto.setSuiteid(qwDTO.getSelf3thSecret());
qdto.setChatType(groupMsgChatType.getCode());
qdto.setPageSize(100);
ServiceResponse<QywxGroupMsgResp> serviceResponse =
qywxSuiteApiService.queryQywxGroupMessageList(qdto,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("{},{}",JSONObject.toJSONString(qdto),JSONObject.toJSONString(serviceResponse));
if (!serviceResponse.isSuccess() || CollectionUtils.isEmpty(serviceResponse.getResult().getGroupMessageInfos())) {
logger.info("获取群发任务记录异常 {}", JSON.toJSONString(serviceResponse));
return Collections.emptyList();
}
QywxGroupMsgResp groupMsgResp = serviceResponse.getResult();
List<QywxGroupMessageInfoDTO> tempMessageInfos = groupMsgResp.getGroupMessageInfos();
groupMessageInfos.addAll(tempMessageInfos);
return groupMessageInfos;
}
} }
\ No newline at end of file
...@@ -141,7 +141,7 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -141,7 +141,7 @@ public class MaterialServiceImpl implements MaterialService {
Integer materialType = materialDTO.getMaterialType(); Integer materialType = materialDTO.getMaterialType();
String madiaId = materialDTO.getMediaId(); String madiaId = materialDTO.getMediaId();
//需要上传的类型 //需要上传的类型
List<Integer> typeList = Arrays.asList(2, 4, 5, 6); List<Integer> typeList = Arrays.asList(2, 4, 5, 6 , 7);
if (typeList.contains(materialType)) { if (typeList.contains(materialType)) {
madiaId = this.reUpdalodMetail(materialId,from); madiaId = this.reUpdalodMetail(materialId,from);
} }
...@@ -201,7 +201,7 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -201,7 +201,7 @@ public class MaterialServiceImpl implements MaterialService {
if (type == 5) { if (type == 5) {
fileType = QywxMediaTypeEnum.FILE; fileType = QywxMediaTypeEnum.FILE;
url = old.getLink(); url = old.getLink();
} else if (type == 6) { } else if (type == 6 || type ==7) {
fileType = QywxMediaTypeEnum.IMAGE; fileType = QywxMediaTypeEnum.IMAGE;
url = old.getImgUrl(); url = old.getImgUrl();
} }
...@@ -299,7 +299,7 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -299,7 +299,7 @@ public class MaterialServiceImpl implements MaterialService {
imageList.forEach(dto -> { imageList.forEach(dto -> {
String imageUrl = dto.getImgUrl(); String imageUrl = dto.getImgUrl();
int type = dto.getMaterialType(); int type = dto.getMaterialType();
String md5 = Md5Util.MD5(imageUrl); String md5 = Md5Util.MD5(imageUrl+type);
TabMaterialContent tab = this.materialContentMapper.selectByUrl(wxEnterpriseId, md5, mediaType); TabMaterialContent tab = this.materialContentMapper.selectByUrl(wxEnterpriseId, md5, mediaType);
if (null != tab) { if (null != tab) {
Integer materialType = tab.getMaterialType(); Integer materialType = tab.getMaterialType();
...@@ -318,6 +318,7 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -318,6 +318,7 @@ public class MaterialServiceImpl implements MaterialService {
tab.setMediaType(mediaType); tab.setMediaType(mediaType);
tab.setWxEnterpriseId(wxEnterpriseId); tab.setWxEnterpriseId(wxEnterpriseId);
tab.setVideoImgUrl(dto.getVideoImgUrl()); tab.setVideoImgUrl(dto.getVideoImgUrl());
tab.setAppid(dto.getAppid());
this.materialContentMapper.insert(tab); this.materialContentMapper.insert(tab);
materialIdList.add(id); materialIdList.add(id);
} }
......
...@@ -4,6 +4,10 @@ import java.util.ArrayList; ...@@ -4,6 +4,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.gic.commons.util.DateUtil;
import com.gic.enterprise.api.dto.EnterpriseWxaRelationDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.EnterpriseWxaLinkService;
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.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -67,6 +71,10 @@ public class QywxSendServiceImpl implements QywxSendService { ...@@ -67,6 +71,10 @@ public class QywxSendServiceImpl implements QywxSendService {
private QywxExternalUserService qywxExternalUserService; private QywxExternalUserService qywxExternalUserService;
@Autowired @Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper; private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Autowired
private EnterpriseWxaLinkService enterpriseWxaLinkService ;
@Autowired
private EnterpriseService enterpriseService ;
private static final String single = "single" ; private static final String single = "single" ;
private static final String group = "group" ; private static final String group = "group" ;
...@@ -221,12 +229,23 @@ public class QywxSendServiceImpl implements QywxSendService { ...@@ -221,12 +229,23 @@ public class QywxSendServiceImpl implements QywxSendService {
videoMaterialDTO.setMediaId(maerialId); videoMaterialDTO.setMediaId(maerialId);
dto.setMsgType(QywxMediaTypeEnum.VIDEO.getName()); dto.setMsgType(QywxMediaTypeEnum.VIDEO.getName());
dto.setVideo(videoMaterialDTO); dto.setVideo(videoMaterialDTO);
} else if (materialType == 6) { } else if (materialType == 6 || materialType == 7) {
QywxMiniprogramMaterialDTO miniprogramMaterialDTO = new QywxMiniprogramMaterialDTO(); QywxMiniprogramMaterialDTO miniprogramMaterialDTO = new QywxMiniprogramMaterialDTO();
miniprogramMaterialDTO.setTitle(material.getMaterialTitle()); miniprogramMaterialDTO.setTitle(material.getMaterialTitle());
miniprogramMaterialDTO.setPicMediaId(maerialId); miniprogramMaterialDTO.setPicMediaId(maerialId);
miniprogramMaterialDTO.setAppid(material.getAppId()); miniprogramMaterialDTO.setAppid(material.getAppId());
miniprogramMaterialDTO.setPage(material.getLink()); miniprogramMaterialDTO.setPage(material.getLink());
// 卡券
if(materialType==7) {
String nodeId = "736591066084777985";
String canvasId = "1123" ;
String execLogId = "111" ;
Long sendTime = DateUtil.getStartTimeOfDay().getTime() ;
String str = "{\"id\":48,\"url\":\"/pages/member-center/coupon/coupon-group-get/coupon-group-get?execLogId="+execLogId+"&canvasId="+canvasId+"&time="+sendTime+"&nodeId="+nodeId+"\"}" ;
EnterpriseWxaRelationDTO en = this.enterpriseService.getByWxappkey(material.getAppId()) ;
Map<String, Object> map = this.enterpriseWxaLinkService.getWxaLinkAndQrCode(en.getEnterpriseId(),str) ;
miniprogramMaterialDTO.setPage(map.get("link").toString());
}
if(null != planType && StringUtils.isNotBlank(planId)) { if(null != planType && StringUtils.isNotBlank(planId)) {
String url = "qtActivityType="+planType+"&qtActivityId="+planId ; String url = "qtActivityType="+planType+"&qtActivityId="+planId ;
if(material.getLink().contains("?")) { if(material.getLink().contains("?")) {
......
...@@ -8,9 +8,7 @@ import com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper; ...@@ -8,9 +8,7 @@ import com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated; import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog; import com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.chat.GroupChatActivityInviteLogService; import com.gic.haoban.manage.service.service.chat.*;
import com.gic.haoban.manage.service.service.chat.GroupChatActivityService;
import com.gic.haoban.manage.service.service.chat.GroupChatDataService;
import com.gic.haoban.manage.service.util.DingUtils; import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.haoban.manage.service.util.HBQwMonitorUtils; import com.gic.haoban.manage.service.util.HBQwMonitorUtils;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
...@@ -24,7 +22,6 @@ import org.springframework.stereotype.Service; ...@@ -24,7 +22,6 @@ import org.springframework.stereotype.Service;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.service.HaobanTimerApiService; import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService; import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import java.util.*; import java.util.*;
...@@ -58,6 +55,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService { ...@@ -58,6 +55,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
private OpenStaffService openStaffService ; private OpenStaffService openStaffService ;
@Autowired @Autowired
private GroupChatActivityService groupChatActivityService; private GroupChatActivityService groupChatActivityService;
@Autowired
private GroupChatPlanService groupChatPlanService ;
@Override @Override
...@@ -195,4 +194,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService { ...@@ -195,4 +194,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
public void groupChatActivityTime(String params) { public void groupChatActivityTime(String params) {
groupChatActivityService.activityQuartzUpdateStatus(); groupChatActivityService.activityQuartzUpdateStatus();
} }
@Override
public void groupChatMsgidTimer(String params) {
this.groupChatPlanService.groupChatMsgidTimer(params) ;
}
} }
...@@ -251,5 +251,6 @@ ...@@ -251,5 +251,6 @@
<dubbo:reference id="memberTagEsApiService" interface="com.gic.member.tag.api.service.MemberTagEsApiService" timeout="100000" retries="0" check="false"/> <dubbo:reference id="memberTagEsApiService" interface="com.gic.member.tag.api.service.MemberTagEsApiService" timeout="100000" retries="0" check="false"/>
<dubbo:reference id="memberCrowdApiService" interface="com.gic.member.ext.api.service.MemberCrowdApiService" timeout="10000" retries="0" check="false"/> <dubbo:reference id="memberCrowdApiService" interface="com.gic.member.ext.api.service.MemberCrowdApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference id="coupCardDistributionService" interface="com.gic.marketing.api.service.CoupCardDistributionService" timeout="30000" retries="0" check="false"/> <dubbo:reference id="coupCardDistributionService" interface="com.gic.marketing.api.service.CoupCardDistributionService" timeout="30000" retries="0" check="false"/>
<dubbo:reference id="enterpriseWxaLinkService" interface="com.gic.enterprise.api.service.EnterpriseWxaLinkService" timeout="30000" retries="0" check="false"/>
</beans> </beans>
\ No newline at end of file
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="media_type" property="mediaType" /> <result column="media_type" property="mediaType" />
<result column="video_img_url" property="videoImgUrl" /> <result column="video_img_url" property="videoImgUrl" />
<result column="app_id" property="appid" />
<result column="material_title" property="materialTitle" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
material_id, material_id,
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
status_flag, status_flag,
create_time, create_time,
update_time , media_type, update_time , media_type,
video_img_url video_img_url , app_id , material_title
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabMaterialContent" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabMaterialContent" useGeneratedKeys="true" keyProperty="id">
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
create_time, create_time,
update_time , update_time ,
media_type, media_type,
video_img_url video_img_url , app_id , material_title
)VALUES( )VALUES(
#{materialId,jdbcType=VARCHAR}, #{materialId,jdbcType=VARCHAR},
#{materialType,jdbcType=INTEGER}, #{materialType,jdbcType=INTEGER},
...@@ -54,7 +56,7 @@ ...@@ -54,7 +56,7 @@
#{urlMd5,jdbcType=VARCHAR}, #{urlMd5,jdbcType=VARCHAR},
1, 1,
now(), now(),
now() , #{mediaType},#{videoImgUrl} now() , #{mediaType},#{videoImgUrl} , #{appid} , #{materialTitle}
) )
]]> ]]>
</insert> </insert>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<result column="material_from" property="materialFrom" /> <result column="material_from" property="materialFrom" />
<result column="send_all_flag" property="sendAllFlag" /> <result column="send_all_flag" property="sendAllFlag" />
<result column="all_search_params" property="allSearchParams" /> <result column="all_search_params" property="allSearchParams" />
<result column="exec_type" property="execType" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
plan_id, plan_id,
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,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 , send_all_flag , all_search_params material_from , send_all_flag , all_search_params , exec_type
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" <insert id="insert"
...@@ -80,7 +81,7 @@ ...@@ -80,7 +81,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 , send_all_flag , all_search_params material_from , send_all_flag , all_search_params , exec_type
)VALUES( )VALUES(
#{planId}, #{planId},
#{name}, #{name},
...@@ -102,7 +103,7 @@ ...@@ -102,7 +103,7 @@
#{sendCount}, #{sendCount},
#{successChatCount}, #{successChatCount},
#{failChatCount} , #{wxEnterpriseId} , #{enterpriseId} , 0 , 1, #{failChatCount} , #{wxEnterpriseId} , #{enterpriseId} , 0 , 1,
#{materialFrom} , #{sendAllFlag} , #{allSearchParams} #{materialFrom} , #{sendAllFlag} , #{allSearchParams} , #{execType}
) )
]]> ]]>
</insert> </insert>
...@@ -147,7 +148,8 @@ ...@@ -147,7 +148,8 @@
expire_days=#{expireDays}, expire_days=#{expireDays},
material_from=#{materialFrom} , material_from=#{materialFrom} ,
send_all_flag = #{sendAllFlag} , send_all_flag = #{sendAllFlag} ,
all_search_params = #{allSearchParams} all_search_params = #{allSearchParams} ,
exec_type = #{execType}
where plan_id = #{planId} where plan_id = #{planId}
]]> ]]>
</update> </update>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
send_status, send_status,
send_count, send_count,
create_time, create_time,
update_time , remark , msgid , delete_flag , done_flag , send_time , fail_count update_time , remark , msgid , delete_flag , done_flag , send_time , fail_count , exec_type
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
send_count, send_count,
fail_count, fail_count,
create_time, create_time,
update_time , remark , msgid , delete_flag , done_flag update_time , remark , msgid , delete_flag , done_flag , exec_type
)VALUES )VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator="," >
( #{item.ownerLogId,jdbcType=BIGINT}, ( #{item.ownerLogId,jdbcType=BIGINT},
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
0, 0,
0, 0,
#{item.createTime}, #{item.createTime},
#{item.updateTime} , #{item.remark} , #{item.msgid} , 0 , 0 #{item.updateTime} , #{item.remark} , #{item.msgid} , 0 , 0 , #{execType}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -96,8 +96,15 @@ ...@@ -96,8 +96,15 @@
update_time = now() where owner_log_id = #{id} update_time = now() where owner_log_id = #{id}
]]> ]]>
</update> </update>
<update id="updateExecType">
<!-- ============ 查询=============--> update tab_haoban_group_chat_plan_owner_log set exec_type =#{execType} where plan_id=#{planId} and delete_flag = 0
</update>
<update id="updateMsgid">
update tab_haoban_group_chat_plan_owner_log set msg_id=#{msgid} where owner_log_id = #{id}
</update>
<!-- ============ 查询=============-->
<select id="selectById" parameterType="long" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog"> <select id="selectById" parameterType="long" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog">
SELECT <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE owner_log_id = #{ownerLogId} and delete_flag = 0 SELECT <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE owner_log_id = #{ownerLogId} and delete_flag = 0
</select> </select>
...@@ -128,7 +135,7 @@ ...@@ -128,7 +135,7 @@
a.send_time sendTime , a.send_time sendTime ,
a.create_time createTime , a.create_time createTime ,
a.done_flag doneFlag , a.done_flag doneFlag ,
a.msgid msgid a.msgid msgid , a.exec_type execType
from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_staff b on a.staff_id = b.staff_id from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_staff b on a.staff_id = b.staff_id
where where
a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and a.delete_flag = 0 a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and a.delete_flag = 0
...@@ -149,7 +156,7 @@ ...@@ -149,7 +156,7 @@
b.plan_id planId , b.plan_id planId ,
b.name planName , b.name planName ,
b.start_time startTime , b.start_time startTime ,
b.end_time endTime , b.end_time endTime ,
<!-- 已发送 --> <!-- 已发送 -->
SUM(CASE a.send_status WHEN 2 THEN 1 ELSE 0 END ) sendCount, SUM(CASE a.send_status WHEN 2 THEN 1 ELSE 0 END ) sendCount,
<!-- 待发送 --> <!-- 待发送 -->
...@@ -256,7 +263,16 @@ ...@@ -256,7 +263,16 @@
AND b.status_flag = 1 AND b.status_flag = 1
AND b.end_time >= now() AND b.end_time >= now()
</select> </select>
<select id="listForMsgid" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO">
SELECT
</mapper> a.owner_log_id ownerLogId ,
\ No newline at end of file b.plan_id planId ,
a.staff_id staffId ,
a.send_time sendTime
FROM tab_haoban_group_chat_plan_owner_log a LEFT JOIN tab_haoban_group_chat_plan b ON a.plan_id = b.plan_id
WHERE b.exec_type = 1 AND a.send_status = 2 AND a.msgid IS NULL
</select>
</mapper>
\ No newline at end of file
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