|
|
|
@ -236,22 +236,22 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
|
// 锁定任务并获取一条任务
|
|
|
|
|
log.info("lockPublishTaskQueue start lockPublishTask");
|
|
|
|
|
MoveProductPublishQueueBO queueMsg = lockProductPublishQueue();
|
|
|
|
|
log.info("MoveProductPublishQueueBO taskDetailId" + queueMsg.getMoveProductPublishQueueId());
|
|
|
|
|
if (Objects.isNull(queueMsg)) {
|
|
|
|
|
E.throwMSException("locked empty, wait");
|
|
|
|
|
}
|
|
|
|
|
log.info("MoveProductPublishQueueBO taskDetailId" + queueMsg.getMoveProductPublishQueueId());
|
|
|
|
|
|
|
|
|
|
// 更新move_task_detail
|
|
|
|
|
MoveCollectTaskDetail moveCollectTaskDetail = moveCollectTaskDetailService.selectByPrimaryKey(queueMsg.getMoveCollectTaskDetailId());
|
|
|
|
|
if(ObjectUtil.isEmpty(moveCollectTaskDetail)){
|
|
|
|
|
E.throwMSException("moveCollectTaskDetail is null");
|
|
|
|
|
}
|
|
|
|
|
log.info("来源商品id:" + moveCollectTaskDetail.getSourceItemId(), " 标题: "+ moveCollectTaskDetail.getSourceItemId());
|
|
|
|
|
log.info("sourceItemId" + moveCollectTaskDetail.getSourceItemId(), "title"+ moveCollectTaskDetail.getSourceItemId());
|
|
|
|
|
long publishWaitSeconds = startTime - queueMsg.getGmtCreate().getTime();
|
|
|
|
|
moveCollectTaskDetail.setPublishWaitSeconds((int) publishWaitSeconds);
|
|
|
|
|
int affect = moveCollectTaskDetailService.updateByPrimaryKeySelective(moveCollectTaskDetail);
|
|
|
|
|
log.info("locked success " + queueMsg.getMoveCollectTaskDetailId() + affect);
|
|
|
|
|
log.info("end getCollectTaskQueue");
|
|
|
|
|
log.info("end getProductPublishQueue");
|
|
|
|
|
Ret ret = CommonTool.successResult();
|
|
|
|
|
ret.setQueueMsg(queueMsg);
|
|
|
|
|
return ret;
|
|
|
|
@ -2600,15 +2600,14 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
|
|
|
|
|
}
|
|
|
|
|
Ret processRet = (Ret) params;
|
|
|
|
|
MoveProductPublishQueueBO queueMsg = (MoveProductPublishQueueBO) processRet.getQueueMsg();
|
|
|
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
|
|
|
TransactionStatus status = transactionManager.getTransaction(def);
|
|
|
|
|
// DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
|
|
|
// TransactionStatus status = transactionManager.getTransaction(def);
|
|
|
|
|
try {
|
|
|
|
|
processMovePublishQueueRet(processRet);
|
|
|
|
|
deleteQueueMsg(queueMsg);
|
|
|
|
|
transactionManager.commit(status);
|
|
|
|
|
// transactionManager.commit(status);
|
|
|
|
|
} catch (Throwable e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
transactionManager.rollback(status);
|
|
|
|
|
// transactionManager.rollback(status);
|
|
|
|
|
log.info("任务执行失败 数据回滚: ", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|