Commit 24466341 by 徐高华

朋友圈

parent 170940fc
......@@ -31,6 +31,8 @@ public interface QwMomentPlanAttendService {
ServiceResponse<Void> finishTask(SendResultQDTO qdto);
void updateMomentId(Long attendId) ;
void updateStatusFlag(TabQwMomentPlan plan) ;
void finishTaskUpdateData(Long attendId , Long planId , Date sendDate) ;
......
......@@ -8,6 +8,7 @@ import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.CommonMQDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.moment.QwMomentPlanAttendDTO;
......@@ -16,6 +17,7 @@ import com.gic.haoban.manage.api.dto.moment.TaskListWxaDTO;
import com.gic.haoban.manage.api.qdto.moment.PlanClerkListQDTO;
import com.gic.haoban.manage.api.qdto.moment.SendResultQDTO;
import com.gic.haoban.manage.api.qdto.moment.TaskListWxaQDTO;
import com.gic.haoban.manage.api.service.HaobanCommonMQApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanAttendMapper;
......@@ -38,10 +40,8 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service("qwMomentPlanAttendService")
......@@ -67,6 +67,8 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService
private QwMomentPlanService qwMomentPlanService ;
@Autowired
private PendingTaskService pendingTaskService ;
@Autowired
private HaobanCommonMQApiService haobanCommonMQApiService ;
@Override
public ServiceResponse<Page<QwMomentPlanAttendDTO>> attendList(PlanClerkListQDTO qdto) {
......@@ -216,11 +218,28 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService
String momentId = this.getMomentId(qdto.getStaffId() , qdto.getSendTime()) ;
if(StringUtils.isNotBlank(momentId)) {
this.qwMomentPlanAttendMapper.updateMomentId(dto.getAttendId(),momentId);
}else {
logger.info("未获取到,延迟获取={},{}",planId,qdto.getStaffId()) ;
CommonMQDTO mq = new CommonMQDTO() ;
mq.setType(7) ;
Map<String,String> map = new HashMap<>() ;
map.put("attendId",dto.getAttendId()+"") ;
mq.setParams(map);
this.haobanCommonMQApiService.putCommonDelayMessage(mq, 60);
}
return ServiceResponse.success() ;
}
@Override
public void updateMomentId(Long attendId) {
TabQwMomentPlanAttend tab = this.qwMomentPlanAttendMapper.getById(attendId) ;
String momentId = this.getMomentId(tab.getStaffId() , tab.getSendTime()) ;
if(StringUtils.isNotBlank(momentId)) {
this.qwMomentPlanAttendMapper.updateMomentId(attendId, momentId);
}
}
@Override
public void finishTaskUpdateData(Long attendId , Long planId , Date sendDate) {
TabQwMomentPlanAttend attend = this.qwMomentPlanAttendMapper.getById(attendId) ;
if(attend.getTaskStatus()==2) {
......
......@@ -12,6 +12,7 @@ import com.gic.commons.util.StringUtil;
import com.gic.haoban.manage.api.dto.MemberUnionidWechatAccountQDTO;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.service.service.chat.GroupChatPlanService;
import com.gic.haoban.manage.service.service.moment.QwMomentPlanAttendService;
import com.gic.haoban.manage.service.service.moment.QwMomentPlanService;
import com.gic.haoban.manage.service.service.role.HaobanMenuService;
import com.gic.haoban.manage.service.util.EventUtils;
......@@ -62,6 +63,8 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
private GroupChatPlanService groupChatPlanService ;
@Autowired
private QwMomentPlanService qwMomentPlanService ;
@Autowired
private QwMomentPlanAttendService qwMomentPlanAttendService;
@Override
public void putCommonMessage(CommonMQDTO dto) {
......@@ -158,6 +161,10 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
Long momentPlanId = Long.valueOf(map.get("planId")) ;
this.qwMomentPlanService.getMomentId(momentPlanId);
break;
case 7 :
Long attendId = Long.valueOf(map.get("attendId")) ;
this.qwMomentPlanAttendService.updateMomentId(attendId);
break;
default:
break;
}
......
......@@ -10,15 +10,21 @@ import com.gic.haoban.manage.api.qdto.moment.PlanDataListQDTO;
import com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO;
import com.gic.haoban.manage.api.qdto.moment.SendResultQDTO;
import com.gic.haoban.manage.api.service.moment.QwMomentApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanAttendMapper;
import com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlan;
import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatPlanService;
import com.gic.haoban.manage.service.service.content.impl.GroupMessageServiceImpl;
import com.gic.haoban.manage.service.service.moment.QwMomentPlanService;
import com.gic.wechat.api.dto.qdto.group.QywxMomentInfoQDTO;
import com.gic.wechat.api.dto.qywx.group.QywxMomentRespDTO;
import com.gic.wechat.api.service.qywx.QywxExternalUserService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -135,15 +141,40 @@ public class MomentTest {
}
@Autowired
private StaffMapper staffMapper ;
@Autowired
private QywxSuiteApiService qywxSuiteApiService ;
@Test
public void finish() {
SendResultQDTO q = new SendResultQDTO() ;
/*SendResultQDTO q = new SendResultQDTO() ;
q.setClerkId("2dd543ad1f2e4feab2e5a5c767197858");
q.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
q.setStaffId("2c0d179610a04016bf8971ac0f158442");
q.setPlanId(772845323461615680L);
q.setSendTime(new Date(1741760727397l));
this.qwMomentApiService.finishTask(q) ;
this.qwMomentApiService.finishTask(q) ;*/
String staffId = "92a1edc7147e411c9b13ba9e815a6efb";
Date sendTime = DateUtil.strToDate("2025-03-24 13:47:29","yyyy-MM-dd HH:mm:ss") ;
Date startTime = DateUtil.addNumForSecond(sendTime,-10) ;
Date endTime = DateUtil.addNumForMinute(sendTime,1) ;
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() ;
}
QywxMomentInfoQDTO qywxMomentInfoQDTO = new QywxMomentInfoQDTO();
qywxMomentInfoQDTO.setCorpid(qwDTO.getThirdCorpid());
qywxMomentInfoQDTO.setSuiteid(qwDTO.getSelf3thSecret());
qywxMomentInfoQDTO.setStartTime(startTime.getTime() / 1000);
qywxMomentInfoQDTO.setEndTime(endTime.getTime() / 1000);
qywxMomentInfoQDTO.setCreatorId(wxUserId);
qywxMomentInfoQDTO.setPageSize(1);
ServiceResponse<QywxMomentRespDTO> serviceResponse = qywxSuiteApiService.queryQywxMomentList(qywxMomentInfoQDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
System.out.println(JSONObject.toJSONString(serviceResponse));
}
}
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