|
@@ -24,6 +24,7 @@ import com.fs.company.mapper.CompanyTagMapper;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.*;
|
|
import com.fs.course.domain.*;
|
|
|
|
|
+import com.fs.course.dto.BatchSendCourseDTO;
|
|
|
import com.fs.course.mapper.*;
|
|
import com.fs.course.mapper.*;
|
|
|
import com.fs.course.param.*;
|
|
import com.fs.course.param.*;
|
|
|
import com.fs.course.param.newfs.FsUserCourseListParam;
|
|
import com.fs.course.param.newfs.FsUserCourseListParam;
|
|
@@ -41,6 +42,8 @@ import com.fs.his.param.FsUserAddIntegralTemplateParam;
|
|
|
import com.fs.his.service.IFsUserIntegralLogsService;
|
|
import com.fs.his.service.IFsUserIntegralLogsService;
|
|
|
import com.fs.his.service.IFsUserNewTaskService;
|
|
import com.fs.his.service.IFsUserNewTaskService;
|
|
|
import com.fs.his.vo.OptionsVO;
|
|
import com.fs.his.vo.OptionsVO;
|
|
|
|
|
+import com.fs.im.domain.FsImMsgSendDetail;
|
|
|
|
|
+import com.fs.im.dto.OpenImBatchResponseDataDTO;
|
|
|
import com.fs.qw.domain.QwCompany;
|
|
import com.fs.qw.domain.QwCompany;
|
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
|
import com.fs.qw.service.impl.AsyncUploadQwCourseImageService;
|
|
import com.fs.qw.service.impl.AsyncUploadQwCourseImageService;
|
|
@@ -56,7 +59,6 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
|
import com.google.zxing.common.BitMatrix;
|
|
import com.google.zxing.common.BitMatrix;
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.checkerframework.checker.units.qual.A;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
@@ -605,11 +607,11 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
|
String sortLink = domainName+ link.getRealLink().replace("/#","");
|
|
String sortLink = domainName+ link.getRealLink().replace("/#","");
|
|
|
sortLink = sortLink.replaceAll("\\\\", "");
|
|
sortLink = sortLink.replaceAll("\\\\", "");
|
|
|
- return R.ok().put("url", sortLink).put("link", random);
|
|
|
|
|
|
|
+ return R.ok().put("url", sortLink).put("link", random).put("linkId", link.getLinkId());
|
|
|
}else {
|
|
}else {
|
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
|
String sortLink = domainName + shortLink + link.getLink();
|
|
String sortLink = domainName + shortLink + link.getLink();
|
|
|
- return R.ok().put("url", sortLink).put("link", random);
|
|
|
|
|
|
|
+ return R.ok().put("url", sortLink).put("link", random).put("linkId", link.getLinkId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return R.error("生成链接失败!");
|
|
return R.error("生成链接失败!");
|
|
@@ -793,11 +795,11 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
if (CloudHostUtils.hasCloudHostName("中康")){
|
|
if (CloudHostUtils.hasCloudHostName("中康")){
|
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
|
String sortLink = domainName + link.getRealLink().replace("/#","");
|
|
String sortLink = domainName + link.getRealLink().replace("/#","");
|
|
|
- return R.ok().put("url", sortLink).put("link", random);
|
|
|
|
|
|
|
+ return R.ok().put("url", sortLink).put("link", random).put("linkId", link.getLinkId());
|
|
|
}
|
|
}
|
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
String domainName = getDomainName(param.getCompanyUserId(), config);
|
|
|
String sortLink = domainName + appShortLink + link.getLink();
|
|
String sortLink = domainName + appShortLink + link.getLink();
|
|
|
- return R.ok().put("url", sortLink).put("link", random);
|
|
|
|
|
|
|
+ return R.ok().put("url", sortLink).put("link", random).put("linkId", link.getLinkId());
|
|
|
}
|
|
}
|
|
|
return R.error("生成链接失败!");
|
|
return R.error("生成链接失败!");
|
|
|
}
|
|
}
|
|
@@ -813,6 +815,91 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
fsUserCourseMapper.editConfig(id, configJson);
|
|
fsUserCourseMapper.editConfig(id, configJson);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R getAppCourseList(FsUserCourseAppListParam param) {
|
|
|
|
|
+ // 查询看课记录
|
|
|
|
|
+ List<FsUserCourseAppListVO> list;
|
|
|
|
|
+ if("2".equals(param.getLogType())){ // 完课
|
|
|
|
|
+ list=fsCourseWatchLogMapper.selectCourseByUserIdForStatusFinish(param.getUserId());
|
|
|
|
|
+ }else if("3".equals(param.getLogType())){ // 待看课
|
|
|
|
|
+ list=fsCourseWatchLogMapper.selectCourseByUserIdForStatusNotFinish(param.getUserId());
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return R.error("参数错误!");
|
|
|
|
|
+ }
|
|
|
|
|
+ list.forEach(item -> {
|
|
|
|
|
+ String redisKey = "h5wxuser:watch:duration:" + item.getUserId() + ":" + item.getVideoId() + ":" + item.getCompanyUserId();
|
|
|
|
|
+ String durationCurrent = redisCache.getCacheObject(redisKey);
|
|
|
|
|
+ if(durationCurrent != null && !durationCurrent.isEmpty()){
|
|
|
|
|
+ item.setDuration(Long.parseLong(durationCurrent));
|
|
|
|
|
+ }
|
|
|
|
|
+ item.setVideoDuration(getFsUserVideoDuration(item.getVideoId()));
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return R.ok().put("data", list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public Long getFsUserVideoDuration(Long videoId){
|
|
|
|
|
+ //将视频时长也存到redis
|
|
|
|
|
+ String videoRedisKey = "h5wxuser:video:duration:" + videoId;
|
|
|
|
|
+ Long videoDuration=0L;
|
|
|
|
|
+ try {
|
|
|
|
|
+ videoDuration = redisCache.getCacheObject(videoRedisKey);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ String string = redisCache.getCacheObject(videoRedisKey);
|
|
|
|
|
+ videoDuration=Long.parseLong(string);
|
|
|
|
|
+ log.error("key中id为S:{}", videoDuration);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (videoDuration==null){
|
|
|
|
|
+ FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
|
|
|
|
|
+ videoDuration=video.getDuration();
|
|
|
|
|
+ redisCache.setCacheObject(videoRedisKey,video.getDuration());
|
|
|
|
|
+ }
|
|
|
|
|
+ return videoDuration;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R getLinkData(Long linkId) {
|
|
|
|
|
+ FsCourseLink fsCourseLink = fsCourseLinkMapper.selectFsCourseLinkByLinkId(linkId);
|
|
|
|
|
+ if (fsCourseLink == null){
|
|
|
|
|
+ return R.error("视频已过期!");
|
|
|
|
|
+ }
|
|
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
+ String domainName = getDomainName(fsCourseLink.getCompanyUserId(), config);
|
|
|
|
|
+ String sortLink = domainName+ fsCourseLink.getRealLink().replace("/#","");
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
|
|
+ data.put("url", sortLink);
|
|
|
|
|
+ return R.ok().put("data", data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R batchCreateCourseRecord(BatchSendCourseDTO batchSendCourseDTO) {
|
|
|
|
|
+ if(batchSendCourseDTO.getUserIds()== null|| batchSendCourseDTO.getUserIds().isEmpty()){
|
|
|
|
|
+ return R.error("请选择用户!");
|
|
|
|
|
+ }
|
|
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(batchSendCourseDTO.getCourseId());
|
|
|
|
|
+ Long project = fsUserCourse != null ? fsUserCourse.getProject() : null;
|
|
|
|
|
+ List<FsCourseWatchLog> watchLogsInsertList = new LinkedList<>();
|
|
|
|
|
+ for (Long userId : batchSendCourseDTO.getUserIds()) {
|
|
|
|
|
+ FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
|
|
|
|
|
+ BeanUtils.copyProperties(batchSendCourseDTO, fsCourseWatchLog);
|
|
|
|
|
+ fsCourseWatchLog.setUserId(userId);
|
|
|
|
|
+ fsCourseWatchLog.setSendType(1);
|
|
|
|
|
+ fsCourseWatchLog.setDuration(0L);
|
|
|
|
|
+ fsCourseWatchLog.setCreateTime(new Date());
|
|
|
|
|
+ fsCourseWatchLog.setLogType(3);
|
|
|
|
|
+ fsCourseWatchLog.setProject(project);
|
|
|
|
|
+ fsCourseWatchLog.setWatchType(1); // app
|
|
|
|
|
+ fsCourseWatchLog.setLinkId(batchSendCourseDTO.getLinkId());
|
|
|
|
|
+ watchLogsInsertList.add(fsCourseWatchLog);
|
|
|
|
|
+ }
|
|
|
|
|
+ fsCourseWatchLogMapper.insertFsCourseWatchLogBatch(watchLogsInsertList);
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private Graphics2D initializeGraphics(BufferedImage combined) {
|
|
private Graphics2D initializeGraphics(BufferedImage combined) {
|
|
|
Graphics2D graphics = combined.createGraphics();
|
|
Graphics2D graphics = combined.createGraphics();
|