diff --git a/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishQueueService.java b/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishQueueService.java index c818d1e9..4fded312 100644 --- a/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishQueueService.java +++ b/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishQueueService.java @@ -35,5 +35,7 @@ public interface MoveProductPublishQueueService { MoveProductPublishQueue selectByMoveCollectTaskDetailId(long taskDetailId); - int deleteByShopId(Long moveCollectTaskDetailId, Long shopId); + int deleteByShopId(Long shopId, Long moveCollectTaskDetailId); + + Long getLockedQueueId(Long shopId, Long moveCollectTaskDetailId); } diff --git a/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishToPicQueueService.java b/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishToPicQueueService.java index cb36cf36..c33460e5 100644 --- a/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishToPicQueueService.java +++ b/ms-biz/src/main/java/com/ms/api/service/MoveProductPublishToPicQueueService.java @@ -19,6 +19,8 @@ public interface MoveProductPublishToPicQueueService { int updateByPrimaryKey(MoveProductPublishToPicQueue record); - int deleteByShopId(Long moveCollectTaskDetailId, Long shopId); + int deleteByShopId(Long shopId, Long moveCollectTaskDetailId); + + Long getLockedQueueId(Long shopId, Long moveCollectTaskDetailId); } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishQueueServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishQueueServiceImpl.java index 0371c449..dc34f224 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishQueueServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishQueueServiceImpl.java @@ -141,10 +141,14 @@ public class MoveProductPublishQueueServiceImpl implements MoveProductPublishQue } @Override - public int deleteByShopId(Long moveCollectTaskDetailId, Long shopId) { - return moveProductPublishQueueMapper.deleteByShopId(moveCollectTaskDetailId, shopId); + public int deleteByShopId(Long shopId, Long moveCollectTaskDetailId) { + return moveProductPublishQueueMapper.deleteByShopId(shopId, moveCollectTaskDetailId); } + @Override + public Long getLockedQueueId(Long shopId, Long moveCollectTaskDetailId) { + return moveProductPublishQueueMapper.getLockedQueueId(shopId, moveCollectTaskDetailId); + } } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishToPicQueueServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishToPicQueueServiceImpl.java index f659c54b..03e68a1f 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishToPicQueueServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/MoveProductPublishToPicQueueServiceImpl.java @@ -47,8 +47,13 @@ public class MoveProductPublishToPicQueueServiceImpl implements MoveProductPubli } @Override - public int deleteByShopId(Long moveCollectTaskDetailId, Long shopId) { - return moveProductPublishToPicQueueMapper.deleteByShopId(moveCollectTaskDetailId, shopId); + public int deleteByShopId(Long shopId, Long moveCollectTaskDetailId) { + return moveProductPublishToPicQueueMapper.deleteByShopId(shopId, moveCollectTaskDetailId); + } + + @Override + public Long getLockedQueueId(Long shopId, Long moveCollectTaskDetailId) { + return moveProductPublishToPicQueueMapper.getLockedQueueId(shopId, moveCollectTaskDetailId); } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/CancelCollectTaskService.java b/ms-biz/src/main/java/com/ms/api/spi/move/CancelCollectTaskService.java index 39ad8643..0985a035 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/CancelCollectTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/CancelCollectTaskService.java @@ -1,5 +1,6 @@ package com.ms.api.spi.move; +import cn.hutool.core.util.ObjectUtil; import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.ExtensionService; @@ -80,11 +81,11 @@ public class CancelCollectTaskService extends SPIBaseService implements Extensio if (!Arrays.toString(statusArray).contains(moveCollectTaskDetail.getStatus())) { continue; } -// $moveDetailExt = $this->getMoveCollectTaskDetailExt($shopId, $detailId); -// if ($this->checkMoveQueueIsProcessing($shopId, $detailId)) { -// $skipCancelDetailIds[] = $detailId; -// continue; -// } +// $moveDetailExt = $this->getMoveCollectTaskDetailExt($shopId, $detailId); // 扩展表,目前没用到 + if (this.checkMoveQueueIsProcessing(shopId, detailId)) { + skipCancelDetailIds.add(detailId); + continue; + } try { int delRow = this.delQueueByDetailId(shopId, detailId); // $delPicRow = $this->delToPicQueueByDetailId($shopId, $detailId); // 和上面重复了,可能不需要 ??? @@ -142,4 +143,14 @@ public class CancelCollectTaskService extends SPIBaseService implements Extensio private int delBufferByDetailId(Long shopId, Long detailId) { return moveProductPublishBufferService.deleteByShopId(shopId, detailId); } + + private Boolean checkMoveQueueIsProcessing(Long shopId, Long detailId) { + Long toPicQueueId = moveProductPublishToPicQueueService.getLockedQueueId(shopId, detailId); + Long picQueueId = moveProductPublishQueueService.getLockedQueueId(shopId, detailId); + if (!ObjectUtil.isEmpty(toPicQueueId) || !ObjectUtil.isEmpty(picQueueId)) { + return true; + } else { + return false; + } + } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/timer/RefreshTokenTimerService.java b/ms-biz/src/main/java/com/ms/api/spi/timer/RefreshTokenTimerService.java index 65eee6a3..9f352abf 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/timer/RefreshTokenTimerService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/timer/RefreshTokenTimerService.java @@ -9,7 +9,7 @@ import com.ms.api.common.Ret; import com.ms.api.common.TimerBaseService; import com.ms.api.dto.ItemDTO; import com.ms.api.task.CheckAuditStatusTimeoutTaskService; -import com.ms.api.task.RefreshTokenTimerTaskService; +import com.ms.api.task.RefreshTokenTaskService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -17,11 +17,11 @@ import org.springframework.beans.factory.annotation.Autowired; @Slf4j public class RefreshTokenTimerService extends TimerBaseService implements ExtensionServiceHandler { @Autowired - RefreshTokenTimerTaskService refreshTokenTimerTaskService; + RefreshTokenTaskService refreshTokenTaskService; @Override public BaseResponse handle(BaseRequest req) { - refreshTokenTimerTaskService.runTask(); + refreshTokenTaskService.runTask(); return R.ok(Ret.success()); } } diff --git a/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java b/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTaskService.java similarity index 98% rename from ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java rename to ms-biz/src/main/java/com/ms/api/task/RefreshTokenTaskService.java index 21d9f391..3715fa21 100644 --- a/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTaskService.java @@ -37,7 +37,7 @@ import java.util.concurrent.Executor; @Configuration @Component @Slf4j -public class RefreshTokenTimerTaskService extends TaskBaseService { +public class RefreshTokenTaskService extends TaskBaseService { @Autowired ShopService shopService; diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishQueueMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishQueueMapper.java index 455a0171..114d44e1 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishQueueMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishQueueMapper.java @@ -33,5 +33,7 @@ public interface MoveProductPublishQueueMapper { int updateByMoveCollectTaskDetailIdForUnlock(MoveProductPublishQueue moveProductPublishQueue); - int deleteByShopId(Long moveCollectTaskDetailId, Long shopId); + int deleteByShopId(Long shopId, Long moveCollectTaskDetailId); + + Long getLockedQueueId(Long shopId, Long moveCollectTaskDetailId); } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishToPicQueueMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishToPicQueueMapper.java index 424be23f..bcbee76a 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishToPicQueueMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/MoveProductPublishToPicQueueMapper.java @@ -21,6 +21,7 @@ public interface MoveProductPublishToPicQueueMapper { int updateByPrimaryKey(MoveProductPublishToPicQueue record); - int deleteByShopId(Long moveCollectTaskDetailId, Long shopId); + int deleteByShopId(Long shopId, Long moveCollectTaskDetailId); + Long getLockedQueueId(Long shopId, Long moveCollectTaskDetailId); } diff --git a/ms-dal/src/main/resources/mapper/MoveProductPublishQueueMapper.xml b/ms-dal/src/main/resources/mapper/MoveProductPublishQueueMapper.xml index 4f1a8b6a..7e027382 100644 --- a/ms-dal/src/main/resources/mapper/MoveProductPublishQueueMapper.xml +++ b/ms-dal/src/main/resources/mapper/MoveProductPublishQueueMapper.xml @@ -170,4 +170,11 @@ gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} where move_product_publish_queue_id = #{moveProductPublishQueueId,jdbcType=INTEGER} + diff --git a/ms-dal/src/main/resources/mapper/MoveProductPublishToPicQueueMapper.xml b/ms-dal/src/main/resources/mapper/MoveProductPublishToPicQueueMapper.xml index a788b6a1..507daf7a 100644 --- a/ms-dal/src/main/resources/mapper/MoveProductPublishToPicQueueMapper.xml +++ b/ms-dal/src/main/resources/mapper/MoveProductPublishToPicQueueMapper.xml @@ -140,4 +140,11 @@ gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} where move_product_publish_to_pic_queue_id = #{moveProductPublishToPicQueueId,jdbcType=INTEGER} +