|
|
|
@ -8,6 +8,7 @@ import com.jinritemai.cloud.base.api.BaseRequest;
|
|
|
|
|
import com.jinritemai.cloud.base.api.BaseResponse;
|
|
|
|
|
import com.jinritemai.cloud.base.api.ExtensionService;
|
|
|
|
|
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
|
|
|
|
import com.ms.api.biz.SaveBatchMoveTaskBizService;
|
|
|
|
|
import com.ms.api.common.R;
|
|
|
|
|
import com.ms.api.common.Ret;
|
|
|
|
|
import com.ms.api.common.SPIBaseService;
|
|
|
|
@ -47,6 +48,8 @@ public class FailRetryMoveTasksService extends SPIBaseService implements Extensi
|
|
|
|
|
private MoveProductPublishBufferService moveProductPublishBufferService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MoveShopSettingService moveShopSettingService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SaveBatchMoveTaskBizService saveBatchMoveTaskBizService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse<Ret> handle(BaseRequest<FailRetryMoveTasksRequestDTO> req) {
|
|
|
|
@ -61,8 +64,8 @@ public class FailRetryMoveTasksService extends SPIBaseService implements Extensi
|
|
|
|
|
int processCount = 0;
|
|
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
|
|
Long detailId = taskDetailIds.get(i);
|
|
|
|
|
BaseResponse<Void> rsp = this.retryMoveTask(detailId, shopId, "");
|
|
|
|
|
if (Objects.equals(rsp.getCode(), "10000")) {
|
|
|
|
|
Ret retryRet = this.retryMoveTask(detailId, shopId, "");
|
|
|
|
|
if (retryRet.getResult().equals("success")) {
|
|
|
|
|
processCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -86,10 +89,10 @@ public class FailRetryMoveTasksService extends SPIBaseService implements Extensi
|
|
|
|
|
return R.fail("操作失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BaseResponse<Void> retryMoveTask(Long detailId, Long shopId, String reason) {
|
|
|
|
|
BaseResponse<Void> checkAndGetConfigIdRet = this.checkAvailableCopyAndGetMoveConfigId(detailId, 1);
|
|
|
|
|
if (!Objects.equals(checkAndGetConfigIdRet.getCode(), "10000")) {
|
|
|
|
|
//返回失败则直接返回
|
|
|
|
|
private Ret retryMoveTask(Long detailId, Long shopId, String reason) {
|
|
|
|
|
int needAddCnt = 1;
|
|
|
|
|
Ret checkAndGetConfigIdRet = saveBatchMoveTaskBizService.checkAvailableCopyAndGetMoveConfigId(detailId, needAddCnt);
|
|
|
|
|
if (checkAndGetConfigIdRet.getResult().equals("fail")) {
|
|
|
|
|
return checkAndGetConfigIdRet;
|
|
|
|
|
}
|
|
|
|
|
String curMonth = CommonTool.getCurMonthLastTime();
|
|
|
|
@ -97,13 +100,13 @@ public class FailRetryMoveTasksService extends SPIBaseService implements Extensi
|
|
|
|
|
|
|
|
|
|
MoveCollectTaskDetail moveCollectTaskDetail = moveCollectTaskDetailService.getMoveCollectTaskDetail(shopId, detailId);
|
|
|
|
|
if (moveCollectTaskDetail == null) {
|
|
|
|
|
return R.fail("任务不存在");
|
|
|
|
|
return CommonTool.failResult("任务不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MoveCollectTask moveCollectTask = moveCollectTaskService.getMoveCollectTask(moveCollectTaskDetail.getMoveCollectTaskId(), shopId);
|
|
|
|
|
String condition=moveCollectTask.getCondition();
|
|
|
|
|
if (BeanUtil.isEmpty(condition)) {
|
|
|
|
|
return R.fail("未找到配置信息!无法重试,请使用链接重新搬家!");
|
|
|
|
|
return CommonTool.failResult("未找到配置信息!无法重试,请使用链接重新搬家!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MoveShopSetting shopMoveCondition = moveShopSettingService.getDetailByShopId(shopId);
|
|
|
|
@ -137,7 +140,7 @@ public class FailRetryMoveTasksService extends SPIBaseService implements Extensi
|
|
|
|
|
moveProductPublishBuffer.setPriority(priority);
|
|
|
|
|
moveProductPublishBufferService.insertSelective(moveProductPublishBuffer);
|
|
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
return CommonTool.successResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getTaskPriority(long shopId) {
|
|
|
|
|