diff --git a/pom.xml b/pom.xml
index 5d26086..00ecb31 100644
--- a/pom.xml
+++ b/pom.xml
@@ -191,6 +191,11 @@
spring-boot-starter-amqp
+
+
+
+
+
@@ -212,6 +217,7 @@
+
diff --git a/src/main/java/com/cultural/heritage/controller/good/GoodController.java b/src/main/java/com/cultural/heritage/controller/good/GoodController.java
index 3e34444..0405174 100644
--- a/src/main/java/com/cultural/heritage/controller/good/GoodController.java
+++ b/src/main/java/com/cultural/heritage/controller/good/GoodController.java
@@ -329,9 +329,12 @@ public class GoodController {
if (resourcePrice.compareTo(targetPrice) != 0) {
// 更新购物车中的小计
- List cartRecordList = goodService.updateCartGoodPrice(id, targetPrice);
- boolean update = cartRecordService.updateBatchById(cartRecordList);
- ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
+ List cartRecords = commonService.findByFieldEqTargetField("goodId", id, cartRecordService);
+ if (!cartRecords.isEmpty()) {
+ List cartRecordList = goodService.updateCartGoodPrice(id, targetPrice);
+ boolean update = cartRecordService.updateBatchById(cartRecordList);
+ ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
+ }
}
return ResultUtils.success(true);
}
@@ -798,10 +801,13 @@ public class GoodController {
BigDecimal targetPrice = good.getPrice();
if (resourcePrice.compareTo(targetPrice) != 0) {
- // 更新购物车中的小计
- List cartExperienceList = goodService.updateCartExperienceGoodPrice(id, targetPrice);
- boolean update = cartExperienceService.updateBatchById(cartExperienceList);
- ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
+ List cartExperiences = commonService.findByFieldEqTargetField("goodId", id, cartExperienceService);
+ if (!cartExperiences.isEmpty()) {
+ // 更新购物车中的小计
+ List cartExperienceList = goodService.updateCartExperienceGoodPrice(id, targetPrice);
+ boolean update = cartExperienceService.updateBatchById(cartExperienceList);
+ ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
+ }
}
return ResultUtils.success(true);
}
diff --git a/src/main/java/com/cultural/heritage/controller/order/OrderController.java b/src/main/java/com/cultural/heritage/controller/order/OrderController.java
index 7db982f..27eeecf 100644
--- a/src/main/java/com/cultural/heritage/controller/order/OrderController.java
+++ b/src/main/java/com/cultural/heritage/controller/order/OrderController.java
@@ -169,7 +169,7 @@ public class OrderController {
// 创建通用订单(常规类和服务类商品)
List cartIds = cartOrderItemAddRequestList.stream().map(CartOrderItemAddRequest::getCartRecordId).toList();
- Long orderId = orderService.createCommonOrder(orderMainInfoAddRequest, userId, true, cartIds, false);
+ Long orderId = orderService.createCommonOrder(orderMainInfoAddRequest, userId, true, cartIds, true);
// 向消息队列中发送订单创建的消息
orderService.sendCreateOrderMessage(orderId);
diff --git a/src/main/java/com/cultural/heritage/controller/order/RefundRecordController.java b/src/main/java/com/cultural/heritage/controller/order/RefundRecordController.java
new file mode 100644
index 0000000..d10c03c
--- /dev/null
+++ b/src/main/java/com/cultural/heritage/controller/order/RefundRecordController.java
@@ -0,0 +1,59 @@
+package com.cultural.heritage.controller.order;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.cultural.heritage.annotation.AuthCheck;
+import com.cultural.heritage.common.BaseResponse;
+import com.cultural.heritage.common.ErrorCode;
+import com.cultural.heritage.common.ResultUtils;
+import com.cultural.heritage.constant.UserConstant;
+import com.cultural.heritage.exception.BusinessException;
+import com.cultural.heritage.model.dto.refund.RefundRecordQueryRequest;
+import com.cultural.heritage.model.entity.RefundRecord;
+import com.cultural.heritage.service.order.RefundRecordService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/refund")
+@Slf4j
+@Tag(name = "退款管理模块")
+@Transactional(rollbackFor = Exception.class)
+public class RefundRecordController {
+
+
+ @Resource
+ private RefundRecordService refundRecordService;
+
+
+ /**
+ * web端管理员分页查询退款记录
+ * @param refundRecordQueryRequest 退款记录查询请求体
+ * @return 退款记录列表
+ */
+ @PostMapping("/list")
+ @Operation(summary = "web端管理员分页查询退款记录", description = "参数:地址添加请求体,权限:所有人,方法名:addAddress")
+ @AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
+ public BaseResponse> listRefundRecord(@RequestBody RefundRecordQueryRequest refundRecordQueryRequest) {
+ if (refundRecordQueryRequest == null) {
+ throw new BusinessException(ErrorCode.PARAMS_ERROR);
+ }
+ long current = refundRecordQueryRequest.getCurrent();
+ long pageSize = refundRecordQueryRequest.getPageSize();
+ QueryWrapper queryWrapper = refundRecordService.getQueryWrapper(refundRecordQueryRequest);
+ Page page = refundRecordService.page(new Page<>(current, pageSize), queryWrapper);
+
+ return ResultUtils.success(page);
+ }
+
+
+
+}
diff --git a/src/main/java/com/cultural/heritage/model/dto/refund/RefundRecordQueryRequest.java b/src/main/java/com/cultural/heritage/model/dto/refund/RefundRecordQueryRequest.java
new file mode 100644
index 0000000..bf77047
--- /dev/null
+++ b/src/main/java/com/cultural/heritage/model/dto/refund/RefundRecordQueryRequest.java
@@ -0,0 +1,27 @@
+package com.cultural.heritage.model.dto.refund;
+
+import com.cultural.heritage.common.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Schema(description = "退款记录查询请求体", requiredProperties = {"outTradeNo"})
+public class RefundRecordQueryRequest extends PageRequest implements Serializable {
+
+
+ /**
+ * 商户单号
+ */
+ @Schema(description = "商户单号", example = "20250206220922442039734342343")
+ private String outTradeNo;
+
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+}
diff --git a/src/main/java/com/cultural/heritage/model/entity/RefundRecord.java b/src/main/java/com/cultural/heritage/model/entity/RefundRecord.java
index 0c42f41..c7495ea 100644
--- a/src/main/java/com/cultural/heritage/model/entity/RefundRecord.java
+++ b/src/main/java/com/cultural/heritage/model/entity/RefundRecord.java
@@ -3,6 +3,7 @@ package com.cultural.heritage.model.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serial;
@@ -49,11 +50,13 @@ public class RefundRecord implements Serializable {
/**
* 创建时间
*/
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 更新时间
*/
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/**
diff --git a/src/main/java/com/cultural/heritage/service/order/RefundRecordService.java b/src/main/java/com/cultural/heritage/service/order/RefundRecordService.java
index 4f6b86d..90d985a 100644
--- a/src/main/java/com/cultural/heritage/service/order/RefundRecordService.java
+++ b/src/main/java/com/cultural/heritage/service/order/RefundRecordService.java
@@ -1,7 +1,15 @@
package com.cultural.heritage.service.order;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.cultural.heritage.model.dto.refund.RefundRecordQueryRequest;
import com.cultural.heritage.model.entity.RefundRecord;
public interface RefundRecordService extends IService {
+
+
+ /**
+ * 获取查询条件
+ */
+ QueryWrapper getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest);
}
diff --git a/src/main/java/com/cultural/heritage/service/order/impl/RefundRecordServiceImpl.java b/src/main/java/com/cultural/heritage/service/order/impl/RefundRecordServiceImpl.java
index c8f8ad5..21fd7e1 100644
--- a/src/main/java/com/cultural/heritage/service/order/impl/RefundRecordServiceImpl.java
+++ b/src/main/java/com/cultural/heritage/service/order/impl/RefundRecordServiceImpl.java
@@ -1,11 +1,27 @@
package com.cultural.heritage.service.order.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cultural.heritage.mapper.RefundRecordMapper;
+import com.cultural.heritage.model.dto.refund.RefundRecordQueryRequest;
import com.cultural.heritage.model.entity.RefundRecord;
import com.cultural.heritage.service.order.RefundRecordService;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@Service
public class RefundRecordServiceImpl extends ServiceImpl implements RefundRecordService {
+
+
+
+ /**
+ * 获取查询条件
+ */
+ @Override
+ public QueryWrapper getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest) {
+ String outTradeNo = refundRecordQueryRequest.getOutTradeNo();
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq(StringUtils.isNotBlank(outTradeNo), "outTradeNo", outTradeNo);
+ return queryWrapper;
+ }
}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index ef78540..1eff7bc 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -51,6 +51,7 @@ server:
session:
cookie:
max-age: 2592000
+ timeout: 720h
mybatis-plus:
mapper-locations: classpath:mapper/*.xml