diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/PropCouponConvertor.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/PropCouponConvertor.java index 41bac69f..e8eb47f5 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/PropCouponConvertor.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/PropCouponConvertor.java @@ -10,6 +10,10 @@ import com.red.circle.other.infra.database.rds.entity.props.PropCouponDO; import com.red.circle.other.infra.database.rds.entity.props.PropCouponUseRecordDO; import com.red.circle.other.infra.utils.ZonedDateTimeUtils; +import java.sql.Timestamp; +import java.time.Duration; +import java.time.LocalDateTime; + /** * 道具券对象转换器 * @@ -40,7 +44,9 @@ public class PropCouponConvertor { co.setSource(propCoupon.getSource().getCode()); co.setSourceName(propCoupon.getSource().getDesc()); - co.setExpireTime(ZonedDateTimeUtils.toTimestamp(propCoupon.getExpireTime())); + Timestamp timestamp = ZonedDateTimeUtils.toTimestamp(propCoupon.getExpireTime()); + co.setExpireTime(timestamp); + co.setExpireSeconds(Math.abs(Duration.between(propCoupon.getExpireTime(), LocalDateTime.now()).getSeconds())); co.setUseTime(ZonedDateTimeUtils.toTimestamp(propCoupon.getUseTime())); co.setCreateTime(ZonedDateTimeUtils.toTimestamp(propCoupon.getCreateTime())); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/PropCouponCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/PropCouponCO.java index 16ae3fe5..fb6977bd 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/PropCouponCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/PropCouponCO.java @@ -75,6 +75,11 @@ public class PropCouponCO { */ private String sourceName; + /** + * 过期秒数 + */ + private Long expireSeconds; + /** * 过期时间 */