搬家调试

20230922-ljl-fixBug
qiushengjie 1 year ago
parent d7d90225ec
commit 0b1791e99c

@ -1544,8 +1544,9 @@ public class MoveService {
String queueIdColumnName = QueueConst.getQueueIdColumnName(tableName);
for (Map<String, Object> queue : queueList) {
String queueIdStr = "";
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
TransactionStatus status = transactionManager.getTransaction(def);
// TODO 测试事务
// DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// TransactionStatus status = transactionManager.getTransaction(def);
try {
queueIdStr = queue.get(queueIdColumnName).toString();
Long queueId = Long.parseLong(queueIdStr);
@ -1582,11 +1583,11 @@ public class MoveService {
redisService.push(RedisKeyConst.MOVE_PRODUCT_PUBLISH_TO_PIC_QUEUE, queueIdStr);
}
}
transactionManager.commit(status);
// transactionManager.commit(status);
} catch (Exception e) {
e.printStackTrace();
log.info("unlock process publish exception : " + queueIdStr);
transactionManager.rollback(status);
// transactionManager.rollback(status);
}
}
return queueList.size();

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

Loading…
Cancel
Save