|
@@ -1347,7 +1347,6 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
public OpenImResponseDTO batchUrgeCourseTaskCreate(BatchUrgeCourseTaskDTO batchUrgeCourseTaskDTO) throws JsonProcessingException {
|
|
public OpenImResponseDTO batchUrgeCourseTaskCreate(BatchUrgeCourseTaskDTO batchUrgeCourseTaskDTO) throws JsonProcessingException {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
|
-
|
|
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
param.put("companyUserId", batchUrgeCourseTaskDTO.getCompanyUserId());
|
|
param.put("companyUserId", batchUrgeCourseTaskDTO.getCompanyUserId());
|
|
|
param.put("projectId", batchUrgeCourseTaskDTO.getProjectId());
|
|
param.put("projectId", batchUrgeCourseTaskDTO.getProjectId());
|
|
@@ -1403,56 +1402,95 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
if (CollectionUtils.isEmpty(userIds)) {
|
|
if (CollectionUtils.isEmpty(userIds)) {
|
|
|
throw new ServiceException("没有符合条件的催课用户");
|
|
throw new ServiceException("没有符合条件的催课用户");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
BatchSendCourseDTO batchSendCourseDTO = new BatchSendCourseDTO();
|
|
BatchSendCourseDTO batchSendCourseDTO = new BatchSendCourseDTO();
|
|
|
BeanUtils.copyProperties(batchUrgeCourseTaskDTO, batchSendCourseDTO);
|
|
BeanUtils.copyProperties(batchUrgeCourseTaskDTO, batchSendCourseDTO);
|
|
|
batchSendCourseDTO.setId(batchUrgeCourseTaskDTO.getPeriodDaysId());
|
|
batchSendCourseDTO.setId(batchUrgeCourseTaskDTO.getPeriodDaysId());
|
|
|
batchSendCourseDTO.setSendType(1);
|
|
batchSendCourseDTO.setSendType(1);
|
|
|
batchSendCourseDTO.setIsUrgeCourse(true);
|
|
batchSendCourseDTO.setIsUrgeCourse(true);
|
|
|
batchSendCourseDTO.setUrgeTime(batchUrgeCourseTaskDTO.getUrgeTime());
|
|
batchSendCourseDTO.setUrgeTime(batchUrgeCourseTaskDTO.getUrgeTime());
|
|
|
- if (Boolean.TRUE.equals(batchUrgeCourseTaskDTO.getSendCourse())) {
|
|
|
|
|
- batchSendCourseDTO.setTitle(batchUrgeCourseTaskDTO.getTitle());
|
|
|
|
|
- } else {
|
|
|
|
|
- batchSendCourseDTO.setTitle(batchUrgeCourseTaskDTO.getUrgeContent());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ batchSendCourseDTO.setTitle(batchUrgeCourseTaskDTO.getTitle());
|
|
|
|
|
+ batchSendCourseDTO.setUrgeContent(batchUrgeCourseTaskDTO.getUrgeContent());
|
|
|
|
|
+
|
|
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(batchUrgeCourseTaskDTO.getCourseId());
|
|
|
|
|
+ Long project = fsUserCourse != null ? fsUserCourse.getProject() : null;
|
|
|
|
|
+ String courseUrl = fsUserCourse != null ? fsUserCourse.getImgUrl() : null;
|
|
|
|
|
+ long planSendTimeStamp = batchUrgeCourseTaskDTO.getUrgeTime().getTime();
|
|
|
|
|
+ String sendUnionId = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
- OpenImBatchMsgDTO openImBatchMsgDTO = makeOpenImBatchMsgDTO(
|
|
|
|
|
|
|
+ OpenImBatchMsgDTO urgeOpenImBatchMsgDTO = makeOpenImBatchMsgDTO(
|
|
|
batchSendCourseDTO,
|
|
batchSendCourseDTO,
|
|
|
- null,
|
|
|
|
|
|
|
+ courseUrl,
|
|
|
objectMapper,
|
|
objectMapper,
|
|
|
userIds,
|
|
userIds,
|
|
|
- batchUrgeCourseTaskDTO.getUrgeTime().getTime(),
|
|
|
|
|
|
|
+ planSendTimeStamp,
|
|
|
"催课"
|
|
"催课"
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- String sendUnionId = UUID.randomUUID().toString();
|
|
|
|
|
- List<FsImMsgSendDetail> imMsgSendDetailList = createImMsgSendLog(
|
|
|
|
|
|
|
+ List<FsImMsgSendDetail> urgeImMsgSendDetailList = createImMsgSendLog(
|
|
|
"催课",
|
|
"催课",
|
|
|
batchSendCourseDTO,
|
|
batchSendCourseDTO,
|
|
|
- batchUrgeCourseTaskDTO.getUrgeTime().getTime(),
|
|
|
|
|
|
|
+ planSendTimeStamp,
|
|
|
1,
|
|
1,
|
|
|
userIds,
|
|
userIds,
|
|
|
sendUnionId
|
|
sendUnionId
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- String redisKey = "openIm:batchSendMsg:urgeCourse";
|
|
|
|
|
- Map<String, Object> redisMap = redisCache.getCacheMap(redisKey);
|
|
|
|
|
- if (redisMap == null) {
|
|
|
|
|
- redisMap = new HashMap<>();
|
|
|
|
|
|
|
+ String urgeRedisKey = "openIm:batchSendMsg:urgeCourse";
|
|
|
|
|
+ Map<String, Object> urgeRedisMap = redisCache.getCacheMap(urgeRedisKey);
|
|
|
|
|
+ if (urgeRedisMap == null) {
|
|
|
|
|
+ urgeRedisMap = new HashMap<>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- BatchSendCourseAllDTO batchSendCourseAllDTO = new BatchSendCourseAllDTO();
|
|
|
|
|
- batchSendCourseAllDTO.setBatchSendCourseDTO(batchSendCourseDTO)
|
|
|
|
|
- .setOpenImBatchMsgDTO(openImBatchMsgDTO)
|
|
|
|
|
- .setImMsgSendDetailList(imMsgSendDetailList);
|
|
|
|
|
|
|
+ BatchSendCourseAllDTO urgeBatchSendCourseAllDTO = new BatchSendCourseAllDTO();
|
|
|
|
|
+ urgeBatchSendCourseAllDTO.setBatchSendCourseDTO(batchSendCourseDTO)
|
|
|
|
|
+ .setOpenImBatchMsgDTO(urgeOpenImBatchMsgDTO)
|
|
|
|
|
+ .setImMsgSendDetailList(urgeImMsgSendDetailList);
|
|
|
|
|
|
|
|
- String batchKey = batchUrgeCourseTaskDTO.getCourseId() + ":"
|
|
|
|
|
- + batchUrgeCourseTaskDTO.getVideoId() + ":"
|
|
|
|
|
- + batchUrgeCourseTaskDTO.getUrgeTime().getTime() + ":"
|
|
|
|
|
- + imMsgSendDetailList.get(0).getLogId();
|
|
|
|
|
- redisMap.put(batchKey, batchSendCourseAllDTO);
|
|
|
|
|
- redisCache.setCacheMap(redisKey, redisMap);
|
|
|
|
|
|
|
+ String urgeBatchKey = batchSendCourseDTO.getCourseId() + ":" +
|
|
|
|
|
+ batchSendCourseDTO.getVideoId() + ":" +
|
|
|
|
|
+ batchSendCourseDTO.getUrgeTime().getTime() + ":" +
|
|
|
|
|
+ urgeImMsgSendDetailList.get(0).getLogId();
|
|
|
|
|
+ urgeRedisMap.put(urgeBatchKey, urgeBatchSendCourseAllDTO);
|
|
|
|
|
+ redisCache.setCacheMap(urgeRedisKey, urgeRedisMap);
|
|
|
|
|
|
|
|
|
|
+ if (Boolean.TRUE.equals(batchUrgeCourseTaskDTO.getSendCourse())) {
|
|
|
|
|
+ OpenImBatchMsgDTO sendCourseOpenImBatchMsgDTO = makeOpenImBatchMsgDTO(
|
|
|
|
|
+ batchSendCourseDTO,
|
|
|
|
|
+ courseUrl,
|
|
|
|
|
+ objectMapper,
|
|
|
|
|
+ userIds,
|
|
|
|
|
+ planSendTimeStamp,
|
|
|
|
|
+ "发课"
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ List<FsImMsgSendDetail> sendCourseImMsgSendDetailList = createImMsgSendLog(
|
|
|
|
|
+ "发课",
|
|
|
|
|
+ batchSendCourseDTO,
|
|
|
|
|
+ planSendTimeStamp,
|
|
|
|
|
+ 1,
|
|
|
|
|
+ userIds,
|
|
|
|
|
+ sendUnionId
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ String sendCourseRedisKey = "openIm:batchSendMsg:sendCourse";
|
|
|
|
|
+ Map<String, Object> sendCourseRedisMap = redisCache.getCacheMap(sendCourseRedisKey);
|
|
|
|
|
+ if (sendCourseRedisMap == null) {
|
|
|
|
|
+ sendCourseRedisMap = new HashMap<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ BatchSendCourseAllDTO sendCourseBatchSendCourseAllDTO = new BatchSendCourseAllDTO();
|
|
|
|
|
+ sendCourseBatchSendCourseAllDTO.setBatchSendCourseDTO(batchSendCourseDTO)
|
|
|
|
|
+ .setOpenImBatchMsgDTO(sendCourseOpenImBatchMsgDTO)
|
|
|
|
|
+ .setProject(project)
|
|
|
|
|
+ .setImMsgSendDetailList(sendCourseImMsgSendDetailList);
|
|
|
|
|
+
|
|
|
|
|
+ String sendCourseBatchKey = batchSendCourseDTO.getCourseId() + ":" +
|
|
|
|
|
+ batchSendCourseDTO.getVideoId() + ":" +
|
|
|
|
|
+ batchSendCourseDTO.getUrgeTime().getTime() + ":" +
|
|
|
|
|
+ sendCourseImMsgSendDetailList.get(0).getLogId();
|
|
|
|
|
+ sendCourseRedisMap.put(sendCourseBatchKey, sendCourseBatchSendCourseAllDTO);
|
|
|
|
|
+ redisCache.setCacheMap(sendCourseRedisKey, sendCourseRedisMap);
|
|
|
|
|
+ }
|
|
|
OpenImResponseDTO responseDTO = new OpenImResponseDTO();
|
|
OpenImResponseDTO responseDTO = new OpenImResponseDTO();
|
|
|
responseDTO.setErrCode(0);
|
|
responseDTO.setErrCode(0);
|
|
|
responseDTO.setErrMsg("催课任务创建成功,待消息发送");
|
|
responseDTO.setErrMsg("催课任务创建成功,待消息发送");
|