会员积分代码提交

This commit is contained in:
Tankaikai
2025-02-26 15:17:39 +08:00
parent 472d6b8371
commit 200caf120a
3 changed files with 13 additions and 8 deletions

View File

@@ -12,5 +12,8 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PointsExchangeRecordMapper extends BaseMapper<PointsExchangeRecord> {
/**
* 自动取消兑换订单
*/
int authCancel();
}

View File

@@ -29,7 +29,6 @@ import com.czg.validator.group.InsertGroup;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor;
@@ -453,11 +452,6 @@ public class PointsExchangeRecordServiceImpl extends ServiceImpl<PointsExchangeR
@Override
public void authCancel() {
UpdateChain.of(PointsExchangeRecord.class)
.set(PointsExchangeRecord::getStatus, PointsExchangeStatusEnum.CANCEL.value())
.set(PointsExchangeRecord::getCancelOrRefundTime, new Date())
.set(PointsExchangeRecord::getCancelOrRefundReason, "超时未支付,系统自动取消订单")
.eq(PointsExchangeRecord::getStatus, PointsExchangeStatusEnum.UNPAID.value())
.ge("TIMESTAMPDIFF(MINUTE, create_time, NOW())", 5);
super.mapper.authCancel();
}
}

View File

@@ -3,4 +3,12 @@
<mapper namespace="com.czg.service.account.mapper.PointsExchangeRecordMapper">
<update id="authCancel">
update tb_points_exchange_record
set status = 'cancel',
cancel_or_refund_time = now(),
cancel_or_refund_reason = '超时未支付,系统自动取消订单'
where status = 'unpaid'
and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >= 5
</update>
</mapper>