Merge pull request #25 from 81519434/fix_primary_key_error

修复补偿纪录插入可能会爆 主键重复 的问题
This commit is contained in:
纳兰丶 2018-08-24 10:37:38 +08:00 committed by GitHub
commit 1d86772916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ import com.raincat.common.constant.CommonConstant;
import com.raincat.common.enums.CompensationActionEnum;
import com.raincat.common.enums.CompensationOperationTypeEnum;
import com.raincat.common.enums.TransactionStatusEnum;
import com.raincat.common.holder.IdWorkerUtils;
import com.raincat.core.disruptor.publisher.TxTransactionEventPublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -57,7 +58,7 @@ public class TxCompensationManager {
TransactionRecover recover = new TransactionRecover();
recover.setRetriedCount(1);
recover.setStatus(TransactionStatusEnum.BEGIN.getCode());
recover.setId(groupId);
recover.setId(String.valueOf(IdWorkerUtils.getInstance().randomUUID()));
recover.setTransactionInvocation(invocation);
recover.setGroupId(groupId);
recover.setTaskId(taskId);