From a21c0b965f85c62bcb9dea9f34dcde5f6d28e1f6 Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com>
Date: 星期三, 18 九月 2024 17:27:49 +0800
Subject: [PATCH] 结算备注新增账号名称
---
src/main/java/com/mzl/flower/service/point/PointGoodsService.java | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/point/PointGoodsService.java b/src/main/java/com/mzl/flower/service/point/PointGoodsService.java
index d0ee148..69c144b 100644
--- a/src/main/java/com/mzl/flower/service/point/PointGoodsService.java
+++ b/src/main/java/com/mzl/flower/service/point/PointGoodsService.java
@@ -19,6 +19,7 @@
import com.mzl.flower.mapper.point.PointGoodsRecordMapper;
import com.mzl.flower.service.BaseService;
import com.mzl.flower.service.payment.RedisLockService;
+import com.mzl.flower.utils.DateUtils;
import com.mzl.flower.utils.UUIDGenerator;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +27,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.util.List;
@Service
@@ -163,6 +165,9 @@
record.setCover(p.getCover());
record.setRedeemCode(UUIDGenerator.getUUID());
record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.A.name());//未使用
+ LocalDate expireDate = LocalDate.now().plusYears(1);
+ String expireDateStr = DateUtils.toString(expireDate,"yyyy-MM-dd");
+ record.setExpireTime(DateUtils.dateToLocalDateTime(expireDateStr,false));
record.create(SecurityUtils.getUserId());
pointGoodsRecordMapper.insert(record);
@@ -215,6 +220,7 @@
record.setOrderId(orderId);
pointGoodsRecordMapper.updateById(record);
}
+
public void revertExchangeGoods(Long recordId) {
PointGoodsRecord record = pointGoodsRecordMapper.selectById(recordId);
if(record == null){
@@ -223,7 +229,7 @@
if(!Constants.POINT_GOODS_RECORD_STATUS.U.name().equals(record.getStatus())){
throw new ValidationException("兑换券未使用或过期");
}
- if(!SecurityUtils.getUserId().equals(record.getUserId())){
+ if(SecurityUtils.getUserId() != null && !SecurityUtils.getUserId().equals(record.getUserId())){
throw new ValidationException("兑换券不属于当前用户");
}
record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.A.name());
--
Gitblit v1.9.3