|
|
@@ -42,6 +42,7 @@ import com.fs.course.param.newfs.FsUserCourseAddCompanyUserParam;
|
|
|
import com.fs.course.param.newfs.FsUserCourseVideoLinkParam;
|
|
|
import com.fs.course.param.newfs.FsUserCourseVideoUParam;
|
|
|
import com.fs.course.param.newfs.UserCourseVideoPageParam;
|
|
|
+import com.fs.course.service.IFsCourseLinkService;
|
|
|
import com.fs.course.service.IFsUserCompanyBindService;
|
|
|
import com.fs.course.service.IFsUserCompanyUserService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
@@ -82,14 +83,12 @@ import com.fs.system.mapper.SysDictDataMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
import com.github.binarywang.wxpay.bean.transfer.TransferBillsResult;
|
|
|
+import com.volcengine.helper.VodUploadProgressListener;
|
|
|
+import com.volcengine.model.beans.Functions;
|
|
|
import com.volcengine.service.vod.IVodService;
|
|
|
import com.volcengine.service.vod.model.business.VodUrlUploadURLSet;
|
|
|
-import com.volcengine.service.vod.model.request.VodGetMediaInfosRequest;
|
|
|
-import com.volcengine.service.vod.model.request.VodQueryUploadTaskInfoRequest;
|
|
|
-import com.volcengine.service.vod.model.request.VodUrlUploadRequest;
|
|
|
-import com.volcengine.service.vod.model.response.VodGetMediaInfosResponse;
|
|
|
-import com.volcengine.service.vod.model.response.VodQueryUploadTaskInfoResponse;
|
|
|
-import com.volcengine.service.vod.model.response.VodUrlUploadResponse;
|
|
|
+import com.volcengine.service.vod.model.request.*;
|
|
|
+import com.volcengine.service.vod.model.response.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.redisson.api.RLock;
|
|
|
@@ -100,9 +99,12 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@@ -249,6 +251,11 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
|
|
|
@Autowired
|
|
|
private IFsUserIntegralLogsService iFsUserIntegralLogsService;
|
|
|
+ @Autowired
|
|
|
+ private RedisTemplate redisTemplate;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsCourseLinkService linkService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -968,26 +975,46 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
return R.error(567, "群聊通用链接").put("qwExternalId", contact.getId());
|
|
|
}
|
|
|
}
|
|
|
- if ("今正科技".equals(cloudHostProper.getCompanyName())) {
|
|
|
- QwExternalContact UnionEXt = qwExternalContactMapper.selectQwExternalByUnionID(user.getUnionId());
|
|
|
- if (UnionEXt != null) {
|
|
|
- log.info("匹配到的第一个企微用户:" + UnionEXt.getUserId());
|
|
|
- log.info("企微id:" + UnionEXt.getId());
|
|
|
- log.info("用户:" + param.getVideoId());
|
|
|
- log.info("企微用户:" + param.getQwUserId());
|
|
|
- param.setQwExternalId(UnionEXt.getId());
|
|
|
- FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(UnionEXt.getId(), param.getVideoId(), param.getQwUserId());
|
|
|
- if (log == null) {
|
|
|
- param.setUserId(user.getUserId());
|
|
|
- createWatchLog(param);
|
|
|
- } else {
|
|
|
- if (log.getUserId() == null || log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())) {
|
|
|
- log.setUserId(param.getUserId());
|
|
|
+
|
|
|
+ boolean bool1 = "今正科技".equals(cloudHostProper.getCompanyName());
|
|
|
+ boolean bool2 = "弘珍医药".equals(cloudHostProper.getCompanyName());
|
|
|
+ if (bool1 || bool2) {
|
|
|
+ //一个都找不到
|
|
|
+ List<QwExternalContact> qwExternalContactList = qwExternalContactMapper.selectQwExternalByUnionID(user.getUnionId());
|
|
|
+
|
|
|
+ if (qwExternalContactList != null && !qwExternalContactList.isEmpty()) {
|
|
|
+ QwExternalContact UnionEXt = qwExternalContactList.get(0);
|
|
|
+ for (QwExternalContact qwExternalContact : qwExternalContactList) {
|
|
|
+ if (qwExternalContact.getFsUserId() == null || qwExternalContact.getFsUserId() != 0L) {
|
|
|
+ qwExternalContact.setFsUserId(user.getUserId());
|
|
|
+ qwExternalContactMapper.updateQwExternalContact(qwExternalContact);
|
|
|
}
|
|
|
- log.setUpdateTime(new Date());
|
|
|
- courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
+ try {
|
|
|
+ if (qwExternalContact.getQwUserId().equals(Long.parseLong(param.getQwUserId()))) {
|
|
|
+ UnionEXt = qwExternalContact;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("群聊链接匹配销售失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("匹配到的第一个企微用户:" + UnionEXt.getUserId());
|
|
|
+ log.info("企微id:" + UnionEXt.getId());
|
|
|
+ log.info("用户:" + param.getVideoId());
|
|
|
+ log.info("企微用户:" + param.getQwUserId());
|
|
|
+ param.setQwExternalId(UnionEXt.getId());
|
|
|
+ FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(UnionEXt.getId(), param.getVideoId(), param.getQwUserId());
|
|
|
+ if (log == null) {
|
|
|
+ param.setUserId(user.getUserId());
|
|
|
+ createWatchLog(param);
|
|
|
+ } else {
|
|
|
+ if (log.getUserId() == null || log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())) {
|
|
|
+ log.setUserId(param.getUserId());
|
|
|
+ }
|
|
|
+ log.setUpdateTime(new Date());
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
+ }
|
|
|
+ return R.error(567, "群聊通用链接").put("qwExternalId", UnionEXt.getId());
|
|
|
}
|
|
|
- return R.error(567, "群聊通用链接").put("qwExternalId", UnionEXt.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1877,6 +1904,10 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}else {
|
|
|
redPacketLog.setOutBatchNo(sendRedPacket.get("orderCode").toString());
|
|
|
}
|
|
|
+ //存储商户ID
|
|
|
+ if (StringUtils.isNotEmpty(sendRedPacket.get("mchId").toString())){
|
|
|
+ redPacketLog.setMchId(sendRedPacket.get("mchId").toString());
|
|
|
+ }
|
|
|
// 添加红包记录
|
|
|
redPacketLog.setCourseId(param.getCourseId());
|
|
|
redPacketLog.setCompanyId(param.getCompanyId());
|
|
|
@@ -4192,6 +4223,37 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R createRoomMiniLinkByCourse(FsCourseLinkRoomNewParam param) {
|
|
|
+
|
|
|
+ QwUser qwUser = qwUserMapper.selectQwUserById(param.getQwUserId());
|
|
|
+
|
|
|
+ if (qwUser == null || qwUser.getCompanyId() == null || qwUser.getCompanyUserId() == null) {
|
|
|
+ return R.error("员工未绑定 销售公司 或 销售 请先绑定");
|
|
|
+ }
|
|
|
+
|
|
|
+ QwCompany qwCompany = iQwCompanyService.getQwCompanyByRedis(param.getCorpId());
|
|
|
+
|
|
|
+ if (qwCompany == null) {
|
|
|
+ return R.error().put("msg", "企业不存在,请联系管理员");
|
|
|
+ }
|
|
|
+ if (qwCompany.getMiniAppId() == null) {
|
|
|
+ return R.error().put("msg", "当前企业未绑定小程序,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ //生成小程序链接
|
|
|
+ String linkByMiniApp = createLinkByMiniApp(new Date(), param.getCourseId(), param.getVideoId(), qwUser, null, 2, null, 1);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(linkByMiniApp)){
|
|
|
+ linkByMiniApp = linkByMiniApp.replaceAll(".html", "");
|
|
|
+ }
|
|
|
+ String link = linkService.getGotoWxAppLink(linkByMiniApp, qwCompany.getMiniAppId());
|
|
|
+
|
|
|
+ System.out.println("生成课程通链: " + link + " :" + param);
|
|
|
+
|
|
|
+ return R.ok().put("link", link);
|
|
|
+ }
|
|
|
+
|
|
|
private final ExecutorService uploadExecutor = new ThreadPoolExecutor(
|
|
|
8, // core
|
|
|
16, // max
|
|
|
@@ -4228,6 +4290,9 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
System.out.println(resp.getResponseMetadata().getError());
|
|
|
System.exit(-1);
|
|
|
}else {
|
|
|
+ if (StringUtils.isEmpty(resp.getResult().getData().getMediaInfoList(0).getVid())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
FsUserCourseVideo video = new FsUserCourseVideo();
|
|
|
video.setVideoId(courseVideo.getVideoId());
|
|
|
video.setVid(resp.getResult().getData().getMediaInfoList(0).getVid());
|
|
|
@@ -4250,6 +4315,15 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
System.out.println(resp.getResponseMetadata().getError());
|
|
|
System.exit(-1);
|
|
|
}else {
|
|
|
+ //如果路径是空的直接返回
|
|
|
+ if (StringUtils.isEmpty(resp.getResult().getMediaInfoList(0).getSourceInfo().getStoreUri())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //如果是未发布状态修改发布状态
|
|
|
+ if (resp.getResult().getMediaInfoList(0).getBasicInfo().getPublishStatus().equals("Unpublished")){
|
|
|
+ updateMediaPublishStatus(courseVideo.getVid());
|
|
|
+ }
|
|
|
+
|
|
|
//更新小节
|
|
|
FsUserCourseVideo video = new FsUserCourseVideo();
|
|
|
video.setVideoId(courseVideo.getVideoId());
|
|
|
@@ -4267,6 +4341,26 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //修改发布状态
|
|
|
+ public void updateMediaPublishStatus(String vid){
|
|
|
+ String statusPublished = "Published";
|
|
|
+
|
|
|
+ try {
|
|
|
+ // publish
|
|
|
+ VodUpdateMediaPublishStatusRequest.Builder req = VodUpdateMediaPublishStatusRequest.newBuilder();
|
|
|
+ req.setVid(vid);
|
|
|
+ req.setStatus(statusPublished);
|
|
|
+
|
|
|
+ VodUpdateMediaPublishStatusResponse resp = vodService.updateMediaPublishStatus(req.build());
|
|
|
+ System.out.println(resp);
|
|
|
+
|
|
|
+ Thread.sleep(1000);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void uploadSingleTaskWithRetry(FsUserCourseVideo courseVideo,Integer type) {
|
|
|
int maxRetry = 3;
|