Quellcode durchsuchen

sop查询接口添加数据和内容

yuhongqi vor 1 Woche
Ursprung
Commit
937b44e6ac

+ 3 - 3
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -113,8 +113,8 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
     @Select("select * from fs_course_watch_log " +
             "where user_id = #{userId} " +
             "and video_id = #{videoId} " +
-            "and qw_user_id = #{qwUserId} " +
-            "and qw_external_contact_id = #{externalId}")
+            "and qw_external_contact_id = #{externalId} " +
+            "and qw_user_id = #{qwUserId} " )
     FsCourseWatchLog getWatchCourseVideo(@Param("userId") Long userId, @Param("videoId") Long videoId,@Param("qwUserId") String qwUserId,@Param("externalId") Long externalId);
 
     @Select("select * from fs_course_watch_log " +
@@ -927,7 +927,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
             "    SELECT user_id, MAX(create_time) \n" +
             "    FROM fs_course_watch_log \n" +
             "    WHERE send_type = 1 \n" +
-            "      AND create_time <= DATE_SUB(NOW(), INTERVAL 15 DAY)\n" +
+            "      \n" +
             "    GROUP BY user_id\n" +
             "  )")
     List<Long> selectWatchLogOutdatedInfo();

+ 5 - 6
fs-service/src/main/java/com/fs/course/param/newfs/FsUserCourseVideoRemainTimeParam.java

@@ -8,28 +8,27 @@ import java.io.Serializable;
 
 @Data
 public class FsUserCourseVideoRemainTimeParam implements Serializable {
-    @NotNull(message = "视频id不能为空")
     @ApiModelProperty(value = "视频id")
     private Integer videoId;
 
-    @NotNull(message = "用户id不能为空")
     @ApiModelProperty(value = "用户id")
     private Long fsUserId;
 
-    @NotNull(message = "课程id不能为空")
     @ApiModelProperty(value = "课程id")
     private Integer courseId;
 
-    @NotNull(message = "销售id不能为空")
     @ApiModelProperty(value = "销售id")
     private Long companyUserId;
 
-    @NotNull(message = "项目id不能为空")
     @ApiModelProperty(value = "项目id")
     private Long projectId;
 
-    @NotNull(message = "营期id不能为空")
     @ApiModelProperty(value = "营期id")
     private Long periodId;
 
+    @ApiModelProperty(value = "外部联系人id")
+    private Long qwExternalId;
+    @ApiModelProperty(value = "企微用户id")
+    private Long qwUserId;
+
 }

+ 9 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserCourseVideoH5DVO.java

@@ -64,4 +64,13 @@ public class FsUserCourseVideoH5DVO extends BaseEntity
      * 商品列表
      */
     private List<FsStoreProductScrm> fsStoreProductScrms;
+
+
+    /**
+     * 视频展示类型:landscape-横屏,portrait-竖屏
+     */
+    private String displayType;
+
+    private String fileKey;//文件key 对用存储桶
+
 }

+ 16 - 3
fs-user-app/src/main/java/com/fs/app/controller/course/CourseFsUserController.java

@@ -37,6 +37,7 @@ import com.fs.his.enums.FsUserOperationEnum;
 import com.fs.im.dto.OpenImResponseDTO;
 import com.fs.im.service.OpenIMService;
 import com.fs.system.service.ISysConfigService;
+import com.github.pagehelper.util.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
@@ -128,13 +129,25 @@ public class CourseFsUserController extends AppBaseController {
         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
         Integer remainTime = 0;
         if (config.getCompletionCountdown() != null && config.getCompletionCountdown()) {
-            FsCourseWatchLog fsCourseWatchLog = fsCourseWatchLogMapper.selectFsCourseWatchLogWithUCCV(param);
+            FsCourseWatchLog fsCourseWatchLog;
+            if (param.getQwExternalId() != null && StringUtil.isNotEmpty(String.valueOf(param.getQwExternalId()))) {
+                fsCourseWatchLog = fsCourseWatchLogMapper.getWatchCourseVideo(
+                    param.getFsUserId(),
+                    param.getVideoId() != null ? param.getVideoId().longValue() : null,
+                    param.getQwUserId() != null ? String.valueOf(param.getQwUserId()) : null,
+                    param.getQwExternalId()
+                );
+           
+            } else {
+                fsCourseWatchLog = fsCourseWatchLogMapper.selectFsCourseWatchLogWithUCCV(param);
+            }
+
             if (fsCourseWatchLog == null) {
-                return R.error("");
+                return R.error("未查询到看课记录,暂无法提供倒计时完课功能!");
             }
             
             // 如果已经完课,剩余时间为0
-            if (fsCourseWatchLog != null && fsCourseWatchLog.getLogType() != null && fsCourseWatchLog.getLogType() == 2) {
+            if (fsCourseWatchLog.getLogType() != null && fsCourseWatchLog.getLogType() == 2) {
                 remainTime = 0;
             } else {
                 // 获取已观看时长(优先从Redis获取,因为可能还未同步到数据库)

+ 66 - 9
fs-user-app/src/main/java/com/fs/app/controller/course/CourseQwController.java

@@ -18,8 +18,10 @@ 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.domain.FsVideoResource;
 import com.fs.course.mapper.FsDepVideoShowMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
+import com.fs.course.mapper.FsVideoResourceMapper;
 import com.fs.course.param.*;
 import com.fs.course.service.*;
 import com.fs.course.service.impl.TencentCloudCosService;
@@ -28,6 +30,7 @@ import com.fs.fastGpt.service.IFastgptEventLogTotalService;
 import com.fs.his.enums.FsUserOperationEnum;
 import com.fs.his.service.IFsIntegralGoodsService;
 import com.fs.hisStore.domain.FsStoreProductScrm;
+import com.fs.hisStore.mapper.FsStoreProductScrmMapper;
 import com.fs.sop.domain.QwSop;
 import com.fs.sop.service.IQwSopService;
 import com.fs.system.service.ISysConfigService;
@@ -91,6 +94,13 @@ public class CourseQwController extends AppBaseController {
     @Autowired
     private IQwSopService qwSopService;
 
+    @Autowired
+    private FsStoreProductScrmMapper fsStoreProductScrmMapper;
+
+
+    @Autowired
+    private IFsVideoResourceService fsvideoResourceService;
+
     @Autowired
     private FsDepVideoShowMapper fsDepVideoShowMapper;
     @Autowired
@@ -154,6 +164,18 @@ public class CourseQwController extends AppBaseController {
             }
         }
 
+        // 默认展示横屏
+        if (StringUtils.isNotEmpty(course.getFileKey())) {
+            FsVideoResource fsVideoResource = fsvideoResourceService.selectByFileKey(course.getFileKey());
+            if (fsVideoResource != null) {
+                course.setDisplayType(fsVideoResource.getDisplayType());
+            } else {
+                course.setDisplayType("landscape");
+            }
+        } else {
+            course.setDisplayType("landscape");
+        }
+
         if(param.getIsOpen() == null || param.getIsOpen() == 0){
             Long duration = 0L;
             long tipsTime = 0L;
@@ -530,18 +552,53 @@ public class CourseQwController extends AppBaseController {
                 throw new RuntimeException(e);
             }
             if (jsonNode.isArray()) {
-                List<FsStoreProductScrm> fsStoreProductScrms = new ArrayList<>();
+                // 第一步:收集所有 productId
+                List<Long> productIds = new ArrayList<>();
+                Map<Long, JsonNode> productIdToJsonNodeMap = new HashMap<>();
                 for (JsonNode node : jsonNode) {
+                    Long productId = node.path("productId").asLong();
+                    if (productId != null && productId > 0) {
+                        productIds.add(productId);
+                        productIdToJsonNodeMap.put(productId, node);
+                    }
+                }
+                // 第二步:批量从数据库查询满足条件的产品(已上架、未删除、审核通过)
+                List<FsStoreProductScrm> validProducts = new ArrayList<>();
+                if (!productIds.isEmpty()) {
+                    // 使用 getStoreProductInProductIdsForApp 查询,该方法已过滤 is_del=0 和 is_show=1
+                    // 但还需要在内存中过滤 is_audit='1'
+                    validProducts = fsStoreProductScrmMapper.getStoreProductInProductIdsForApp(productIds);
+                }
+                // 第四步:根据查询结果构建 VO 对象
+                List<FsStoreProductScrm> fsPackageListVOS = new ArrayList<>();
+                for (FsStoreProductScrm validProduct : validProducts) {
                     FsStoreProductScrm fsStoreProductScrm = new FsStoreProductScrm();
-                    fsStoreProductScrm.setProductId(node.path("productId").asLong());
-                    fsStoreProductScrm.setImages(node.path("image").asText());
-                    fsStoreProductScrm.setImgUrl(node.path("imgUrl").asText());
-                    fsStoreProductScrm.setBarCode(node.path("barCode").asText());
-                    fsStoreProductScrm.setPrice(new BigDecimal(node.path("price").asText()));
-                    fsStoreProductScrm.setProductName(node.path("productName").asText());
-                    fsStoreProductScrms.add(fsStoreProductScrm);
+                    JsonNode originalNode = productIdToJsonNodeMap.get(validProduct.getProductId());
+
+                    fsStoreProductScrm.setProductId(validProduct.getProductId());
+                    fsStoreProductScrm.setImages(validProduct.getImage() != null ? validProduct.getImage() :
+                            (originalNode != null ? originalNode.path("image").asText() : ""));
+                    fsStoreProductScrm.setImgUrl(validProduct.getSliderImage() != null ? validProduct.getSliderImage() :
+                            (originalNode != null ? originalNode.path("imgUrl").asText() : ""));
+                    fsStoreProductScrm.setBarCode(validProduct.getBarCode());
+                    fsStoreProductScrm.setPrice(validProduct.getPrice());
+                    fsStoreProductScrm.setProductName(validProduct.getProductName());
+
+
+
+                    String onShelfTime = originalNode != null ? originalNode.path("onShelfTime").asText("00:00:00") : "00:00:00";
+                    String offShelfTime = originalNode != null ? originalNode.path("offShelfTime").asText("00:00:00") : "00:00:00";
+                    String cardPopupTime = originalNode != null ? originalNode.path("cardPopupTime").asText("00:00:00") : "00:00:00";
+                    String cardCloseTime = originalNode != null ? originalNode.path("cardCloseTime").asText("00:00:00") : "00:00:00";
+                    fsStoreProductScrm.setOnShelfTime(onShelfTime);
+                    fsStoreProductScrm.setOffShelfTime(offShelfTime);
+                    fsStoreProductScrm.setCardPopupTime(cardPopupTime);
+                    fsStoreProductScrm.setCardCloseTime(cardCloseTime);
+
+
+                    fsPackageListVOS.add(fsStoreProductScrm);
                 }
-                course.setFsStoreProductScrms(fsStoreProductScrms);
+                course.setFsStoreProductScrms(fsPackageListVOS);
             }
         } else {
             course.setFsStoreProductScrms(new ArrayList<>());