|
|
@@ -1,8 +1,12 @@
|
|
|
package com.fs.app.controller.course;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.JsonNode;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.annotation.UserOperationLog;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
@@ -10,18 +14,25 @@ import com.fs.common.annotation.RepeatSubmit;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.company.domain.CompanyUser;
|
|
|
+import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.core.utils.OrderCodeUtils;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsCourseQuestionBank;
|
|
|
import com.fs.course.domain.FsCourseWatchLog;
|
|
|
import com.fs.course.domain.FsUserCourseVideo;
|
|
|
+import com.fs.course.mapper.FsCourseWatchLogMapper;
|
|
|
+import com.fs.course.mapper.FsDepVideoShowMapper;
|
|
|
+import com.fs.course.mapper.FsUserCourseVideoMapper;
|
|
|
import com.fs.course.param.*;
|
|
|
import com.fs.course.service.*;
|
|
|
import com.fs.course.service.impl.TencentCloudCosService;
|
|
|
import com.fs.course.vo.*;
|
|
|
import com.fs.fastGpt.service.IFastgptEventLogTotalService;
|
|
|
import com.fs.his.enums.FsUserOperationEnum;
|
|
|
+import com.fs.his.mapper.FsPackageMapper;
|
|
|
import com.fs.his.service.IFsIntegralGoodsService;
|
|
|
+import com.fs.his.vo.FsPackageListVO;
|
|
|
import com.fs.sop.domain.QwSop;
|
|
|
import com.fs.sop.service.IQwSopService;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
@@ -82,6 +93,21 @@ public class CourseQwController extends AppBaseController {
|
|
|
@Autowired
|
|
|
private IQwSopService qwSopService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyUserMapper companyUserMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsCourseWatchLogMapper fsCourseWatchLogMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsDepVideoShowMapper fsDepVideoShowMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsPackageMapper fsPackageMapper;
|
|
|
+
|
|
|
@ApiOperation("查询全部公域的课程")
|
|
|
@GetMapping("/getAppletCourse")
|
|
|
public R getAppletCourse()
|
|
|
@@ -112,13 +138,13 @@ public class CourseQwController extends AppBaseController {
|
|
|
return R.ok().put("data",course);
|
|
|
}
|
|
|
|
|
|
- @Login
|
|
|
+// @Login
|
|
|
@ApiOperation("h5课程详情加问答")
|
|
|
@GetMapping("/getH5CourseVideoDetails")
|
|
|
@UserOperationLog(operationType = FsUserOperationEnum.STUDY)
|
|
|
public R getCourseVideoDetails(FsUserCourseVideoFinishUParam param)
|
|
|
{
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
+// param.setUserId(Long.parseLong(getUserId()));
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
FsUserCourseVideoH5DVO course = courseService.selectFsUserCourseVideoH5DVOByVideoId(param.getVideoId());
|
|
|
@@ -171,6 +197,8 @@ public class CourseQwController extends AppBaseController {
|
|
|
isFinish=1;
|
|
|
}
|
|
|
|
|
|
+ getGoodsAndShow(param,course);
|
|
|
+
|
|
|
//将视频时长也存到redis
|
|
|
String videoRedisKey = "h5user:video:duration:" + param.getVideoId();
|
|
|
Long videoDuration = redisCache.getCacheObject(videoRedisKey);
|
|
|
@@ -206,11 +234,55 @@ public class CourseQwController extends AppBaseController {
|
|
|
isFinish=1;
|
|
|
}
|
|
|
|
|
|
+ getGoodsAndShow(param,course);
|
|
|
+
|
|
|
return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("isFinish",isFinish);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 小黄车商品和展示
|
|
|
+ */
|
|
|
+ private void getGoodsAndShow(FsUserCourseVideoFinishUParam param, FsUserCourseVideoH5DVO course) {
|
|
|
+ FsCourseWatchLog log = fsCourseWatchLogMapper.getWatchCourseVideo(param.getUserId(),param.getVideoId(),param.getQwUserId(),param.getQwExternalId());
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserById(log.getCompanyUserId());
|
|
|
+ Long videoId = param.getVideoId();
|
|
|
+ Long deptId = companyUser.getDeptId();
|
|
|
+ String show = fsDepVideoShowMapper.selectFsDepVideoShowByVideoId(videoId, deptId);
|
|
|
+ course.setShowTreatment(ObjectUtil.isEmpty(show) ? "1" : "show");
|
|
|
+
|
|
|
+ FsUserCourseVideo courseVideo = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
|
|
|
+ String packageJson = courseVideo.getPackageJson();
|
|
|
+ if (StringUtils.isNotEmpty(packageJson)) {
|
|
|
+ List<String> packageIds = new ArrayList<>();
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ JsonNode jsonNode = null;
|
|
|
+ try {
|
|
|
+ jsonNode = objectMapper.readTree(packageJson);
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ if (jsonNode.isArray()) {
|
|
|
+ for (JsonNode node : jsonNode) {
|
|
|
+ String packageId = node.path("packageId").asText();
|
|
|
+ if (StringUtils.isNotEmpty(packageId)) {
|
|
|
+ packageIds.add(packageId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<FsPackageListVO> fsPackageListVOS = new ArrayList<>();
|
|
|
+ if (!packageIds.isEmpty()) {
|
|
|
+ fsPackageListVOS = fsPackageMapper.selectFsPackagesByIds(packageIds);
|
|
|
+ }else {
|
|
|
+ fsPackageListVOS = new ArrayList<>();
|
|
|
+ }
|
|
|
+ course.setTreatmentPackage(fsPackageListVOS);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ course.setTreatmentPackage(new ArrayList<>());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("答题")
|
|
|
@PostMapping("/courseAnswer")
|
|
|
@Login
|