|
@@ -8,6 +8,7 @@ import com.fs.common.exception.base.BaseException;
|
|
|
import com.fs.common.utils.PubFun;
|
|
import com.fs.common.utils.PubFun;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.date.DateUtil;
|
|
import com.fs.common.utils.date.DateUtil;
|
|
|
|
|
+import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsCourseWatchLog;
|
|
import com.fs.course.domain.FsCourseWatchLog;
|
|
|
import com.fs.course.mapper.FsCourseWatchLogMapper;
|
|
import com.fs.course.mapper.FsCourseWatchLogMapper;
|
|
|
import com.fs.course.param.FsCourseLinkCreateParam;
|
|
import com.fs.course.param.FsCourseLinkCreateParam;
|
|
@@ -16,18 +17,18 @@ import com.fs.crm.domain.CrmMsg;
|
|
|
import com.fs.crm.mapper.CrmMsgMapper;
|
|
import com.fs.crm.mapper.CrmMsgMapper;
|
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
|
import com.fs.qw.domain.QwGroupChat;
|
|
import com.fs.qw.domain.QwGroupChat;
|
|
|
|
|
+import com.fs.qw.domain.QwGroupChatUser;
|
|
|
import com.fs.qw.domain.QwUser;
|
|
import com.fs.qw.domain.QwUser;
|
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
|
|
+import com.fs.qw.mapper.QwGroupChatMapper;
|
|
|
|
|
+import com.fs.qw.mapper.QwGroupChatUserMapper;
|
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
|
import com.fs.qw.param.SopUserLogsVO;
|
|
import com.fs.qw.param.SopUserLogsVO;
|
|
|
import com.fs.qw.service.IQwGroupChatService;
|
|
import com.fs.qw.service.IQwGroupChatService;
|
|
|
import com.fs.qw.service.IQwUserService;
|
|
import com.fs.qw.service.IQwUserService;
|
|
|
import com.fs.qw.vo.*;
|
|
import com.fs.qw.vo.*;
|
|
|
import com.fs.qwApi.service.QwApiService;
|
|
import com.fs.qwApi.service.QwApiService;
|
|
|
-import com.fs.sop.domain.QwSop;
|
|
|
|
|
-import com.fs.sop.domain.QwSopLogs;
|
|
|
|
|
-import com.fs.sop.domain.SopUserLogs;
|
|
|
|
|
-import com.fs.sop.domain.SopUserLogsInfo;
|
|
|
|
|
|
|
+import com.fs.sop.domain.*;
|
|
|
import com.fs.sop.mapper.QwSopMapper;
|
|
import com.fs.sop.mapper.QwSopMapper;
|
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.mapper.SopUserLogsMapper;
|
|
import com.fs.sop.mapper.SopUserLogsMapper;
|
|
@@ -35,9 +36,7 @@ import com.fs.sop.params.QwRatingConfig;
|
|
|
import com.fs.sop.params.SopUserLogsList;
|
|
import com.fs.sop.params.SopUserLogsList;
|
|
|
import com.fs.sop.params.SopUserLogsParam;
|
|
import com.fs.sop.params.SopUserLogsParam;
|
|
|
import com.fs.sop.params.SopUserLogsParamByDate;
|
|
import com.fs.sop.params.SopUserLogsParamByDate;
|
|
|
-import com.fs.sop.service.IQwSopLogsService;
|
|
|
|
|
-import com.fs.sop.service.IQwSopTempDayService;
|
|
|
|
|
-import com.fs.sop.service.ISopUserLogsService;
|
|
|
|
|
|
|
+import com.fs.sop.service.*;
|
|
|
import com.fs.sop.vo.QwRatingVO;
|
|
import com.fs.sop.vo.QwRatingVO;
|
|
|
import com.fs.sop.vo.ReplaceUserDto;
|
|
import com.fs.sop.vo.ReplaceUserDto;
|
|
|
import com.fs.sop.vo.SopUserLogsInfoVo;
|
|
import com.fs.sop.vo.SopUserLogsInfoVo;
|
|
@@ -96,6 +95,24 @@ public class SopUserLogsServiceImpl implements ISopUserLogsService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private QwExternalContactMapper qwExternalContactMapper;
|
|
private QwExternalContactMapper qwExternalContactMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IQwSopTempService sopTempService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IQwSopTempRulesService qwSopTempRulesService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QwGroupChatMapper qwGroupChatMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QwGroupChatUserMapper qwGroupChatUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SopUserLogsInfoServiceImpl sopUserLogsInfoService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsCourseLinkService linkService;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IQwSopTempDayService qwSopTempDayService;
|
|
private IQwSopTempDayService qwSopTempDayService;
|
|
|
|
|
|
|
@@ -152,6 +169,57 @@ public class SopUserLogsServiceImpl implements ISopUserLogsService {
|
|
|
sopUserLogsMapper.replaceUser(vo);
|
|
sopUserLogsMapper.replaceUser(vo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R getShortLink(String id, String sopId, String appId) {
|
|
|
|
|
+ QwSop qwSop = sopMapper.selectQwSopById(sopId);
|
|
|
|
|
+ QwSopTemp qwSopTemp = sopTempService.selectQwSopTempById(qwSop.getTempId());
|
|
|
|
|
+ SopUserLogs sopUserLogs = sopUserLogsMapper.selectSopUserLogsById(id);
|
|
|
|
|
+ String[] userKey = sopUserLogs.getUserId().split("\\|");
|
|
|
|
|
+ String qwUserId = userKey[0].trim();
|
|
|
|
|
+ QwUser qwUser = qwUserMapper.selectById(qwUserId);
|
|
|
|
|
+ Optional<QwSopTempDay> dayOptional = qwSopTemp.getList().stream().filter(e -> Objects.equals(e.getDayNum(), sopUserLogs.getCountDays())).findFirst();
|
|
|
|
|
+ if (dayOptional.isPresent()) {
|
|
|
|
|
+ List<QwSopTempRules> rulesList = qwSopTempRulesService.selectListByDayId(dayOptional.get().getId());
|
|
|
|
|
+ Optional<QwSopTempRules> rulesOptional = rulesList.stream().filter(r -> r.getCourseId() != null).findFirst();
|
|
|
|
|
+ if (rulesOptional.isPresent()) {
|
|
|
|
|
+ QwSopTempRules rules = rulesOptional.get();
|
|
|
|
|
+ QwGroupChat groupChat = qwGroupChatMapper.selectQwGroupChatByChatId(sopUserLogs.getChatId());
|
|
|
|
|
+ List<QwGroupChatUser> groupUserList = qwGroupChatUserMapper.selectQwGroupChatUserByChatIds(new String[]{sopUserLogs.getChatId()});
|
|
|
|
|
+ List<String> groupChatUserIds = PubFun.listToNewList(groupUserList, QwGroupChatUser::getUserId);
|
|
|
|
|
+ if (!groupChatUserIds.isEmpty()) {
|
|
|
|
|
+ List<GroupUserExternalVo> userList = qwExternalContactMapper.selectByGroupUser(groupChatUserIds);
|
|
|
|
|
+ Map<String, List<GroupUserExternalVo>> userMap = PubFun.listToMapByGroupList(userList, GroupUserExternalVo::getExternalUserId);
|
|
|
|
|
+ groupUserList.forEach(e -> {
|
|
|
|
|
+ e.setUserList(userMap.getOrDefault(e.getUserId(), Collections.emptyList()));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ groupUserList.stream().filter(e -> e.getUserList() != null && !e.getUserList().isEmpty()).forEach(e -> {
|
|
|
|
|
+ Map<String, GroupUserExternalVo> userMap = PubFun.listToMapByGroupObject(e.getUserList(), GroupUserExternalVo::getUserId);
|
|
|
|
|
+ GroupUserExternalVo vo = userMap.get(groupChat.getOwner());
|
|
|
|
|
+ if (vo != null && vo.getId() != null) {
|
|
|
|
|
+ sopUserLogsInfoService.addWatchLogIfNeeded(sopId, rules.getVideoId().intValue(), rules.getCourseId().intValue(), vo.getFsUserId(), qwUser.getId().toString(), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(), vo.getId(), sopUserLogs.getStartTime(), new Date());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("群聊创建看课记录失败!", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ QwSopCourseFinishTempSetting.Setting st = new QwSopCourseFinishTempSetting.Setting();
|
|
|
|
|
+ st.setExpiresDays(1);
|
|
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ CourseConfig config = JSON.parseObject(json, CourseConfig.class);
|
|
|
|
|
+ String linkByMiniApp = sopUserLogsInfoService.createLinkByMiniApp(st, sopUserLogs.getCorpId(), new Date(), rules.getCourseId().intValue(), rules.getVideoId().intValue(),
|
|
|
|
|
+ qwUser.getId(), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(), null, config, sopUserLogs.getChatId());
|
|
|
|
|
+ if(StringUtils.isNotEmpty(linkByMiniApp)){
|
|
|
|
|
+ linkByMiniApp = linkByMiniApp.replaceAll(".html", "");
|
|
|
|
|
+ }
|
|
|
|
|
+ String link = linkService.getGotoWxAppLink(linkByMiniApp, appId);
|
|
|
|
|
+ return R.ok().put("urlLink", link);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.error("系统错误❌");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public int deleteSopUserLogsBySopId(String sopId) {
|
|
public int deleteSopUserLogsBySopId(String sopId) {
|
|
|
return sopUserLogsMapper.deleteSopUserLogsBySopId(sopId);
|
|
return sopUserLogsMapper.deleteSopUserLogsBySopId(sopId);
|