|
|
@@ -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<>());
|