|
|
@@ -18,10 +18,7 @@ import com.fs.course.domain.FsCoursePlaySourceConfig;
|
|
|
import com.fs.course.service.IFsCoursePlaySourceConfigService;
|
|
|
import com.fs.framework.aspectj.SopTenantDataSourceAspect;
|
|
|
import com.fs.ipad.vo.BaseVo;
|
|
|
-import com.fs.qw.domain.QwIpadServer;
|
|
|
-import com.fs.qw.domain.QwPushCount;
|
|
|
-import com.fs.qw.domain.QwRestrictionPushRecord;
|
|
|
-import com.fs.qw.domain.QwUser;
|
|
|
+import com.fs.qw.domain.*;
|
|
|
import com.fs.qw.mapper.QwIpadServerMapper;
|
|
|
import com.fs.qw.mapper.QwPushCountMapper;
|
|
|
import com.fs.qw.mapper.QwRestrictionPushRecordMapper;
|
|
|
@@ -29,6 +26,7 @@ import com.fs.qw.mapper.QwUserMapper;
|
|
|
import com.fs.qw.service.impl.AsyncSopTestService;
|
|
|
import com.fs.qw.vo.QwSopCourseFinishTempSetting;
|
|
|
import com.fs.qw.vo.QwSopTempSetting;
|
|
|
+import com.fs.qwApi.Result.QwGetMomentTaskGResult;
|
|
|
import com.fs.sop.domain.QwSopLogs;
|
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
|
import com.fs.sop.service.IQwSopLogsService;
|
|
|
@@ -425,36 +423,65 @@ public class SendMsg {
|
|
|
log.info("销售执行完成:{}, 耗时:{}", user.getQwUserName(), end3 - start3);
|
|
|
}
|
|
|
|
|
|
- @Scheduled(fixedDelay = 10000*60*30) // 每30min执行一次
|
|
|
+ private static final Integer LOBSTER_EXECUTE_STATUS = 0;
|
|
|
+ @Scheduled(fixedDelay = 1000*60
|
|
|
+ *30
|
|
|
+ ) // 每30mIn执行一次
|
|
|
public void sendLobsterQwMsg(){
|
|
|
log.info("开始龙虾发送企微消息");
|
|
|
+// sopTenantDataSourceAspect.switchTenant(tenantId);
|
|
|
List<CompanyWorkflowLobsterTask> companyWorkflowLobsterTasks = companyWorkflowLobsterTaskMapper.selectList(new LambdaQueryWrapper<CompanyWorkflowLobsterTask>().eq(CompanyWorkflowLobsterTask::getDelFlag, 0)
|
|
|
- .between(CompanyWorkflowLobsterTask::getSendTime, LocalDateTime.now().minusMinutes(30), LocalDateTime.now())
|
|
|
+ .between(CompanyWorkflowLobsterTask::getSendTime, LocalDateTime.now().minusMinutes(30), LocalDateTime.now()
|
|
|
+ ).eq(CompanyWorkflowLobsterTask::getExecuteStatus, LOBSTER_EXECUTE_STATUS)
|
|
|
);
|
|
|
+ log.info("开始龙虾发送企微消息,数量:{}",companyWorkflowLobsterTasks.size());
|
|
|
+ if (companyWorkflowLobsterTasks.isEmpty()){
|
|
|
+ log.info("龙虾没有需要发送的qw消息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
for (CompanyWorkflowLobsterTask task : companyWorkflowLobsterTasks){
|
|
|
- QwUser qwUser = qwUserMapper.selectQwUserById(task.getQwUserId());
|
|
|
- WxLoginResp login = isLogin(qwUser.getUid(), qwUser.getServerId());
|
|
|
- WxWorkSendTextMsgDTO dto = new WxWorkSendTextMsgDTO();
|
|
|
+ QwUser qwUser = qwUserMapper.selectById(task.getQwUserId());
|
|
|
+
|
|
|
+ //只拼一个发消息的逻辑
|
|
|
+ QwSopCourseFinishTempSetting.Setting content = new QwSopCourseFinishTempSetting.Setting();
|
|
|
+ content.setValue(task.getTaskContent());
|
|
|
+ content.setContentType("1");
|
|
|
+
|
|
|
+ QwSopLogs qwSopLogs = new QwSopLogs();
|
|
|
+ qwSopLogs.setId(String.valueOf(task.getId()));
|
|
|
+ qwSopLogs.setSendType(1);
|
|
|
+ qwSopLogs.setExternalUserId(task.getExternalUserId());
|
|
|
+
|
|
|
BaseVo vo = new BaseVo();
|
|
|
- vo.setUuid(qwUser.getUid());
|
|
|
+ vo.setCorpCode(qwUser.getCorpId());
|
|
|
vo.setCorpId(qwUser.getCorpId());
|
|
|
- vo.setCorpCode(login.getUser_info().getObject().getScorp_id());
|
|
|
- vo.setServerId(qwUser.getServerId());
|
|
|
- dto.setUuid(qwUser.getUid());
|
|
|
- dto.setSend_userid(userIds(vo));//目前没接群聊
|
|
|
- dto.setContent(task.getTaskContent());
|
|
|
- dto.setIsRoom(false);
|
|
|
- WxWorkResponseDTO<WxWorkSendTextMsgRespDTO> wxWorkSendTextMsgRespDTOWxWorkResponseDTO = wxWorkService.SendTextMsg(dto, qwUser.getServerId());
|
|
|
+ // 判断这个企微是否需要发送
|
|
|
+ if (!sendServer.isSend(qwUser, vo)) {
|
|
|
+ log.info("当前这个企微不需要发送 数据{}",qwUser);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- log.info("开始发送企微消息,内容:{}", wxWorkSendTextMsgRespDTOWxWorkResponseDTO);
|
|
|
- //todo 发企微,
|
|
|
- if (wxWorkSendTextMsgRespDTOWxWorkResponseDTO.getErrcode()==0){
|
|
|
+ sendServer.send(content, qwUser, qwSopLogs, null, vo);
|
|
|
+// WxLoginResp login = isLogin(qwUser.getUid(), qwUser.getServerId());
|
|
|
+// WxWorkSendTextMsgDTO dto = new WxWorkSendTextMsgDTO();
|
|
|
+// vo.setUuid(qwUser.getUid());
|
|
|
+// vo.setCorpId(qwUser.getCorpId());
|
|
|
+// vo.setCorpCode(login.getUser_info().getObject().getScorp_id());
|
|
|
+// vo.setServerId(qwUser.getServerId());
|
|
|
+// dto.setUuid(qwUser.getUid());
|
|
|
+// dto.setSend_userid(userIds(vo));//目前没接群聊
|
|
|
+// dto.setContent(task.getTaskContent());
|
|
|
+// dto.setIsRoom(false);
|
|
|
+// WxWorkResponseDTO<WxWorkSendTextMsgRespDTO> wxWorkSendTextMsgRespDTOWxWorkResponseDTO = wxWorkService.SendTextMsg(dto, qwUser.getServerId());
|
|
|
+ if (content.getSendStatus() != 2) {
|
|
|
+ //todo 发送成功记录日志 insert日志表!!!
|
|
|
task.setExecuteStatus(2);
|
|
|
- log.info("企微发送成功:{}", task.getId());
|
|
|
}else {
|
|
|
task.setExecuteStatus(3);
|
|
|
- log.info("企微发送失败:{}", task.getId());
|
|
|
+
|
|
|
}
|
|
|
+ log.info("开始发送企微消息,内容:{}",content );
|
|
|
+
|
|
|
}
|
|
|
companyWorkflowLobsterTaskMapper.updateTaskListExecuteStatus(companyWorkflowLobsterTasks);
|
|
|
|