|
@@ -1681,33 +1681,41 @@ public class Task {
|
|
|
String key=entry.getKey();
|
|
String key=entry.getKey();
|
|
|
//执行发送消息任务
|
|
//执行发送消息任务
|
|
|
BatchSendCourseAllDTO batchSendCourseAllDTO = entry.getValue();
|
|
BatchSendCourseAllDTO batchSendCourseAllDTO = entry.getValue();
|
|
|
|
|
+ if (batchSendCourseAllDTO == null) {
|
|
|
|
|
+ logger.error("batchSendCourseAllDTO 为 null,key: {}", entry.getKey());
|
|
|
|
|
+ redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
+ continue; // 跳过当前循环
|
|
|
|
|
+ }
|
|
|
OpenImBatchMsgDTO openImBatchMsgDTO = batchSendCourseAllDTO.getOpenImBatchMsgDTO();
|
|
OpenImBatchMsgDTO openImBatchMsgDTO = batchSendCourseAllDTO.getOpenImBatchMsgDTO();
|
|
|
Integer nowCount=openImBatchMsgDTO.getCount();
|
|
Integer nowCount=openImBatchMsgDTO.getCount();
|
|
|
|
|
+ if (nowCount == null) {
|
|
|
|
|
+ nowCount = 0;
|
|
|
|
|
+ }
|
|
|
OpenImResponseDTO responseDTO=new OpenImResponseDTO();
|
|
OpenImResponseDTO responseDTO=new OpenImResponseDTO();
|
|
|
try {
|
|
try {
|
|
|
responseDTO= openIMService.batchSendCourseTask(batchSendCourseAllDTO.getBatchSendCourseDTO(), batchSendCourseAllDTO.getOpenImBatchMsgDTO(), batchSendCourseAllDTO.getProject(), batchSendCourseAllDTO.getImMsgSendDetailList());
|
|
responseDTO= openIMService.batchSendCourseTask(batchSendCourseAllDTO.getBatchSendCourseDTO(), batchSendCourseAllDTO.getOpenImBatchMsgDTO(), batchSendCourseAllDTO.getProject(), batchSendCourseAllDTO.getImMsgSendDetailList());
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ responseDTO.setErrCode(500);
|
|
|
|
|
+ responseDTO.setErrMsg(e.getMessage());
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
- }finally {
|
|
|
|
|
-
|
|
|
|
|
- if(nowCount<3){ // 重试三次后放弃
|
|
|
|
|
- logger.error("重试三次后放弃,key{}", entry.getKey());
|
|
|
|
|
- redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(responseDTO!=null && responseDTO.getErrCode() == 0){
|
|
|
|
|
- // 执行结束,删除
|
|
|
|
|
- redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
- }else {
|
|
|
|
|
- openImBatchMsgDTO.setCount(openImBatchMsgDTO.getCount() + 1);// 次数加一
|
|
|
|
|
- batchSendCourseAllDTO.setOpenImBatchMsgDTO(openImBatchMsgDTO);
|
|
|
|
|
- // 错误更新次数 重新放入redis中
|
|
|
|
|
- redisTemplate.opsForHash().put(redisKey, key, batchSendCourseAllDTO);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ if(nowCount>3){ // 重试三次后放弃
|
|
|
|
|
+ logger.error("im会员定时发课重试三次后放弃,key{}", entry.getKey());
|
|
|
|
|
+ redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if(responseDTO!=null && responseDTO.getErrCode() == 0){
|
|
|
|
|
+ // 执行结束,删除
|
|
|
|
|
+ redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
+ }else {
|
|
|
|
|
+ openImBatchMsgDTO.setCount(nowCount + 1);// 次数加一
|
|
|
|
|
+ batchSendCourseAllDTO.setOpenImBatchMsgDTO(openImBatchMsgDTO);
|
|
|
|
|
+ // 错误更新次数 重新放入redis中
|
|
|
|
|
+ redisTemplate.opsForHash().put(redisKey, key, batchSendCourseAllDTO);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1737,29 +1745,39 @@ public class Task {
|
|
|
String key=entry.getKey();
|
|
String key=entry.getKey();
|
|
|
//执行发送消息任务
|
|
//执行发送消息任务
|
|
|
BatchSendCourseAllDTO batchSendCourseAllDTO = entry.getValue();
|
|
BatchSendCourseAllDTO batchSendCourseAllDTO = entry.getValue();
|
|
|
|
|
+ if (batchSendCourseAllDTO == null) {
|
|
|
|
|
+ logger.error("batchSendCourseAllDTO 为 null,key: {}", entry.getKey());
|
|
|
|
|
+ redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
+ continue; // 跳过当前循环
|
|
|
|
|
+ }
|
|
|
OpenImBatchMsgDTO openImBatchMsgDTO = batchSendCourseAllDTO.getOpenImBatchMsgDTO();
|
|
OpenImBatchMsgDTO openImBatchMsgDTO = batchSendCourseAllDTO.getOpenImBatchMsgDTO();
|
|
|
- Integer nowCount=openImBatchMsgDTO.getCount();
|
|
|
|
|
|
|
+ Integer nowCount = openImBatchMsgDTO.getCount();
|
|
|
|
|
+ if (nowCount == null) {
|
|
|
|
|
+ nowCount = 0;
|
|
|
|
|
+ }
|
|
|
OpenImResponseDTO responseDTO=new OpenImResponseDTO();
|
|
OpenImResponseDTO responseDTO=new OpenImResponseDTO();
|
|
|
try {
|
|
try {
|
|
|
- openIMService.batchUrgeCourseTask(batchSendCourseAllDTO.getOpenImBatchMsgDTO(), batchSendCourseAllDTO.getImMsgSendDetailList());
|
|
|
|
|
|
|
+ responseDTO=openIMService.batchUrgeCourseTask(batchSendCourseAllDTO.getOpenImBatchMsgDTO(), batchSendCourseAllDTO.getImMsgSendDetailList());
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
|
|
+ responseDTO.setErrCode(500);
|
|
|
|
|
+ responseDTO.setErrMsg(e.getMessage());
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
- }finally {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(nowCount>3){ // 重试三次后放弃
|
|
|
|
|
- logger.error("重试三次后放弃,key{}", entry.getKey());
|
|
|
|
|
- redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if(nowCount>3){ // 重试三次后放弃
|
|
|
|
|
+ logger.error("im 会员催课重试三次后放弃,key{}", entry.getKey());
|
|
|
|
|
+ redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(responseDTO!=null && responseDTO.getErrCode() == 0){
|
|
|
|
|
- // 执行结束,删除
|
|
|
|
|
- redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
- }else {
|
|
|
|
|
- openImBatchMsgDTO.setCount(openImBatchMsgDTO.getCount() + 1);// 次数加一
|
|
|
|
|
- batchSendCourseAllDTO.setOpenImBatchMsgDTO(openImBatchMsgDTO);
|
|
|
|
|
- // 错误更新次数 重新放入redis中
|
|
|
|
|
- redisTemplate.opsForHash().put(redisKey, key, batchSendCourseAllDTO);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if(responseDTO!=null && responseDTO.getErrCode() == 0){
|
|
|
|
|
+ // 执行结束,删除
|
|
|
|
|
+ redisTemplate.opsForHash().delete(redisKey, entry.getKey());
|
|
|
|
|
+ }else {
|
|
|
|
|
+ openImBatchMsgDTO.setCount(nowCount + 1);// 次数加一
|
|
|
|
|
+ batchSendCourseAllDTO.setOpenImBatchMsgDTO(openImBatchMsgDTO);
|
|
|
|
|
+ // 错误更新次数 重新放入redis中
|
|
|
|
|
+ redisTemplate.opsForHash().put(redisKey, key, batchSendCourseAllDTO);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|