|
|
@@ -17,6 +17,7 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.exception.ServiceException;
|
|
|
+import com.fs.common.param.BaseQueryParam;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.company.cache.ICompanyCacheService;
|
|
|
import com.fs.config.cloud.CloudHostProper;
|
|
|
@@ -236,15 +237,15 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
|
|
|
log.info("批量删除商品:{}", productIds);
|
|
|
int result = fsStoreProductMapper.deleteFsStoreProductByIds(productIds);
|
|
|
-
|
|
|
+
|
|
|
// 清除缓存
|
|
|
clearProductDetailCache(productIds);
|
|
|
-
|
|
|
+
|
|
|
// 异步处理商品删除联动逻辑
|
|
|
if (result > 0) {
|
|
|
handleProductDeleteAsync(productIds);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -258,7 +259,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
public void handleProductDeleteAsync(Long[] productIds) {
|
|
|
try {
|
|
|
log.info("开始异步处理商品删除联动,商品IDs: {}", Arrays.toString(productIds));
|
|
|
-
|
|
|
+
|
|
|
// 查询所有未直播(1)、直播中(2)和直播回放(4)的直播间
|
|
|
// 使用 LiveMapper 查询状态为1,2,4的直播间(包括所有类型)
|
|
|
List<Live> allLiveList = liveMapper.liveListAll();
|
|
|
@@ -283,19 +284,19 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (targetLiveList.isEmpty()) {
|
|
|
log.info("没有找到需要处理的直播间");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("找到 {} 个需要处理的直播间", targetLiveList.size());
|
|
|
-
|
|
|
+
|
|
|
// 遍历每个被删除的商品
|
|
|
for (Long productId : productIds) {
|
|
|
processProductDeleteForLives(productId, targetLiveList);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("商品删除联动处理完成");
|
|
|
} catch (Exception e) {
|
|
|
log.error("异步处理商品删除联动失败", e);
|
|
|
@@ -315,19 +316,19 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
if (liveId == null) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 1. 删除直播商品
|
|
|
deleteLiveGoodsByProductId(productId, liveId);
|
|
|
-
|
|
|
+
|
|
|
// 2. 删除直播定时任务(直播上下架、直播卡片)
|
|
|
deleteLiveAutoTasksByProductId(productId, liveId);
|
|
|
-
|
|
|
+
|
|
|
// 3. 删除直播抽奖(产品关联被删除的商品)
|
|
|
deleteLiveLotteryProductConfByProductId(productId, liveId);
|
|
|
-
|
|
|
+
|
|
|
// 4. 删除直播定时任务(抽奖,里面关联了这个商品的)
|
|
|
deleteLiveAutoTasksByLotteryProductId(productId, liveId);
|
|
|
-
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理直播间 {} 的商品 {} 删除联动失败", live.getLiveId(), productId, e);
|
|
|
}
|
|
|
@@ -346,7 +347,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
queryGoods.setProductId(productId);
|
|
|
queryGoods.setLiveId(liveId);
|
|
|
List<LiveGoods> goodsList = liveGoodsService.selectLiveGoodsList(queryGoods);
|
|
|
-
|
|
|
+
|
|
|
if (!goodsList.isEmpty()) {
|
|
|
Long[] goodsIds = goodsList.stream()
|
|
|
.map(LiveGoods::getGoodsId)
|
|
|
@@ -370,9 +371,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
LiveAutoTask queryTask = new LiveAutoTask();
|
|
|
queryTask.setLiveId(liveId);
|
|
|
List<LiveAutoTask> taskList = liveAutoTaskService.selectLiveAutoTaskList(queryTask);
|
|
|
-
|
|
|
+
|
|
|
List<Long> taskIdsToDelete = new ArrayList<>();
|
|
|
-
|
|
|
+
|
|
|
for (LiveAutoTask task : taskList) {
|
|
|
// 任务类型:1-定时推送卡片商品 6-自动上下架
|
|
|
if (task.getTaskType() != null && (task.getTaskType() == 1L || task.getTaskType() == 6L)) {
|
|
|
@@ -396,7 +397,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!taskIdsToDelete.isEmpty()) {
|
|
|
Long[] ids = taskIdsToDelete.toArray(new Long[0]);
|
|
|
liveAutoTaskService.deleteLiveAutoTaskByIds(ids);
|
|
|
@@ -419,7 +420,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
queryConf.setProductId(productId);
|
|
|
queryConf.setLiveId(liveId);
|
|
|
List<LiveLotteryProductConf> confList = liveLotteryProductConfMapper.selectLiveLotteryProductConfList(queryConf);
|
|
|
-
|
|
|
+
|
|
|
if (!confList.isEmpty()) {
|
|
|
Long[] ids = confList.stream()
|
|
|
.map(LiveLotteryProductConf::getId)
|
|
|
@@ -445,23 +446,23 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
queryConf.setProductId(productId);
|
|
|
queryConf.setLiveId(liveId);
|
|
|
List<LiveLotteryProductConf> confList = liveLotteryProductConfMapper.selectLiveLotteryProductConfList(queryConf);
|
|
|
-
|
|
|
+
|
|
|
if (confList.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 获取所有相关的抽奖ID
|
|
|
Set<Long> lotteryIds = confList.stream()
|
|
|
.map(LiveLotteryProductConf::getLotteryId)
|
|
|
.collect(Collectors.toSet());
|
|
|
-
|
|
|
+
|
|
|
// 查询该直播间的所有定时任务
|
|
|
LiveAutoTask queryTask = new LiveAutoTask();
|
|
|
queryTask.setLiveId(liveId);
|
|
|
List<LiveAutoTask> taskList = liveAutoTaskService.selectLiveAutoTaskList(queryTask);
|
|
|
-
|
|
|
+
|
|
|
List<Long> taskIdsToDelete = new ArrayList<>();
|
|
|
-
|
|
|
+
|
|
|
for (LiveAutoTask task : taskList) {
|
|
|
// 任务类型:4-抽奖
|
|
|
if (task.getTaskType() != null && task.getTaskType() == 4L) {
|
|
|
@@ -475,7 +476,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!taskIdsToDelete.isEmpty()) {
|
|
|
Long[] ids = taskIdsToDelete.toArray(new Long[0]);
|
|
|
liveAutoTaskService.deleteLiveAutoTaskByIds(ids);
|
|
|
@@ -1078,8 +1079,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery() {
|
|
|
- return fsStoreProductMapper.selectFsStoreProductTuiListQuery(medicalMallConfig);
|
|
|
+ public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(BaseQueryParam param) {
|
|
|
+ return fsStoreProductMapper.selectFsStoreProductTuiListQuery(medicalMallConfig, param);
|
|
|
}
|
|
|
|
|
|
@Override
|