|
@@ -1164,7 +1164,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
}
|
|
|
|
|
|
private OpenImBatchMsgDTO makeOpenImBatchMsgDTO(BatchSendCourseDTO batchSendCourseDTO, String courseUrl, ObjectMapper objectMapper, List<String> userIds, long planSendTimeStamp, String logType) throws JsonProcessingException {
|
|
|
- PayloadDTO.Extension extension = new PayloadDTO.Extension();
|
|
|
+ PayloadDTO.Extension extension = new PayloadDTO.Extension();
|
|
|
OpenImBatchMsgDTO openImBatchMsgDTO = new OpenImBatchMsgDTO();
|
|
|
if("发课".equals(logType)){
|
|
|
extension.setTitle(batchSendCourseDTO.getTitle());
|
|
@@ -1172,22 +1172,29 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
extension.setCourseUrl(courseUrl);
|
|
|
extension.setSendTime(new Date(planSendTimeStamp));
|
|
|
openImBatchMsgDTO.setSendTime(planSendTimeStamp);
|
|
|
+
|
|
|
+ PayloadDTO payload = new PayloadDTO();
|
|
|
+ payload.setData("course");
|
|
|
+ payload.setExtension(extension);
|
|
|
+
|
|
|
+ OpenImBatchMsgDTO.ImData imData = new OpenImBatchMsgDTO.ImData();
|
|
|
+ OpenImBatchMsgDTO.Content content = new OpenImBatchMsgDTO.Content();
|
|
|
+ imData.setPayload(payload);
|
|
|
+ String imJson = objectMapper.writeValueAsString(imData);
|
|
|
+ content.setData(imJson);
|
|
|
+ openImBatchMsgDTO.setContent(content);
|
|
|
+ openImBatchMsgDTO.setContentType(110);
|
|
|
} else {
|
|
|
- extension.setTitle(batchSendCourseDTO.getUrgeContent());
|
|
|
- extension.setSendTime(batchSendCourseDTO.getUrgeTime() != null ? batchSendCourseDTO.getUrgeTime() : new Date());
|
|
|
+ // 催课
|
|
|
+// extension.setTitle(batchSendCourseDTO.getUrgeContent());
|
|
|
+// extension.setSendTime(batchSendCourseDTO.getUrgeTime() != null ? batchSendCourseDTO.getUrgeTime() : new Date());
|
|
|
+ OpenImBatchMsgDTO.Content content = new OpenImBatchMsgDTO.Content();
|
|
|
+ content.setContent(batchSendCourseDTO.getUrgeContent());
|
|
|
+ openImBatchMsgDTO.setContent(content);
|
|
|
+ openImBatchMsgDTO.setContentType(101);
|
|
|
openImBatchMsgDTO.setSendTime(batchSendCourseDTO.getUrgeTime() != null ? batchSendCourseDTO.getUrgeTime().getTime() : System.currentTimeMillis());
|
|
|
}
|
|
|
|
|
|
- PayloadDTO payload = new PayloadDTO();
|
|
|
- payload.setData("course");
|
|
|
- payload.setExtension(extension);
|
|
|
-
|
|
|
- OpenImBatchMsgDTO.ImData imData = new OpenImBatchMsgDTO.ImData();
|
|
|
- OpenImBatchMsgDTO.Content content = new OpenImBatchMsgDTO.Content();
|
|
|
- imData.setPayload(payload);
|
|
|
- String imJson = objectMapper.writeValueAsString(imData);
|
|
|
- content.setData(imJson);
|
|
|
-
|
|
|
OpenImBatchMsgDTO.OfflinePushInfo offlinePushInfo = new OpenImBatchMsgDTO.OfflinePushInfo();
|
|
|
offlinePushInfo.setDesc(batchSendCourseDTO.getTitle());
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserById(batchSendCourseDTO.getCompanyUserId());
|
|
@@ -1199,8 +1206,6 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
|
|
|
openImBatchMsgDTO.setSendID("C" + batchSendCourseDTO.getCompanyUserId());
|
|
|
openImBatchMsgDTO.setRecvIDs(userIds);
|
|
|
- openImBatchMsgDTO.setContent(content);
|
|
|
- openImBatchMsgDTO.setContentType(110);
|
|
|
openImBatchMsgDTO.setSessionType(1);
|
|
|
openImBatchMsgDTO.setIsOnlineOnly(false);
|
|
|
openImBatchMsgDTO.setNotOfflinePush(false);
|
|
@@ -1260,7 +1265,7 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
// 过滤掉已完课的用户,已完课的用户不发送;
|
|
|
// 如果全部完课,则提示
|
|
|
List<FsCourseWatchLog> watchCourseByVideoList = fsCourseWatchLogMapper.getWatchCourseByVideoId(fsImMsgSendLog.getVideoId(), userIdList);
|
|
|
- List<String> userIds = watchCourseByVideoList.stream().filter(v -> v.getLogType() != 2).map(v -> "U" + v.getUserId()).collect(Collectors.toList());
|
|
|
+ List<String> userIds = watchCourseByVideoList.stream().filter(v -> v.getLogType() != 2).map(v -> "U" + v.getUserId()).distinct().collect(Collectors.toList());
|
|
|
OpenImResponseDTO openImResponseDTO = new OpenImResponseDTO();
|
|
|
if(userIds.isEmpty()){
|
|
|
openImResponseDTO.setErrCode(400);
|
|
@@ -1288,6 +1293,8 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
BeanUtils.copyProperties(fsImMsgSendLog, batchSendCourseDTO);
|
|
|
batchSendCourseDTO.setUrgeContent(batchUrgeCourseDTO.getUrgeContent());
|
|
|
batchSendCourseDTO.setId(fsImMsgSendLog.getPeriodDaysId());
|
|
|
+ batchSendCourseDTO.setIsUrgeCourse(true);
|
|
|
+ batchSendCourseDTO.setSendType(2);
|
|
|
OpenImBatchMsgDTO openImBatchMsgDTO = makeOpenImBatchMsgDTO(batchSendCourseDTO, courseUrl, objectMapper, userIds, System.currentTimeMillis(), "催课");
|
|
|
log.info("一键催课-催课-批量催课消息: \n{}", JSON.toJSONString(openImBatchMsgDTO));
|
|
|
openImResponseDTO = this.openIMBatchSendMsg(openImBatchMsgDTO);
|