com.feingto.cloud.dto.tcc.Participant Maven / Gradle / Ivy
package com.feingto.cloud.dto.tcc;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.feingto.cloud.kit.DateKit;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 参与者
*
* @author longfei
*/
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Participant implements Serializable {
private static final long serialVersionUID = -3971390276878398717L;
/**
* 分支事务ID
*/
private String id;
/**
* 请求url
*/
private String url;
/**
* 请求headers头
*/
@Builder.Default
private Map headers = new HashMap<>();
/**
* 重试次数, 默认3次
*/
@Builder.Default
private Integer retry = 3;
/**
* 发起时间
*/
@Builder.Default
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdDate = new Date();
/**
* 过期时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date expiredDate;
/**
* 事务状态
*/
@Builder.Default
private TccStatus status = TccStatus.TRY;
public Date getExpiredDate() {
return this.expiredDate != null ? this.expiredDate : DateKit.getAfterOf(this.createdDate, 30, Calendar.SECOND);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy