更新了写真预约模块

This commit is contained in:
chen-xin-zhi 2025-02-19 14:03:43 +08:00
parent 8026b76afe
commit 5f75e5dada
9 changed files with 134 additions and 8 deletions

View File

@ -191,6 +191,11 @@
<artifactId>spring-boot-starter-amqp</artifactId> <artifactId>spring-boot-starter-amqp</artifactId>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-devtools</artifactId>-->
<!-- <version>2.5.6</version>-->
<!-- </dependency>-->
@ -212,6 +217,7 @@
</excludes> </excludes>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -329,9 +329,12 @@ public class GoodController {
if (resourcePrice.compareTo(targetPrice) != 0) { if (resourcePrice.compareTo(targetPrice) != 0) {
// 更新购物车中的小计 // 更新购物车中的小计
List<CartRecord> cartRecordList = goodService.updateCartGoodPrice(id, targetPrice); List<CartRecord> cartRecords = commonService.findByFieldEqTargetField("goodId", id, cartRecordService);
boolean update = cartRecordService.updateBatchById(cartRecordList); if (!cartRecords.isEmpty()) {
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败"); List<CartRecord> cartRecordList = goodService.updateCartGoodPrice(id, targetPrice);
boolean update = cartRecordService.updateBatchById(cartRecordList);
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
}
} }
return ResultUtils.success(true); return ResultUtils.success(true);
} }
@ -798,10 +801,13 @@ public class GoodController {
BigDecimal targetPrice = good.getPrice(); BigDecimal targetPrice = good.getPrice();
if (resourcePrice.compareTo(targetPrice) != 0) { if (resourcePrice.compareTo(targetPrice) != 0) {
// 更新购物车中的小计 List<CartExperience> cartExperiences = commonService.findByFieldEqTargetField("goodId", id, cartExperienceService);
List<CartExperience> cartExperienceList = goodService.updateCartExperienceGoodPrice(id, targetPrice); if (!cartExperiences.isEmpty()) {
boolean update = cartExperienceService.updateBatchById(cartExperienceList); // 更新购物车中的小计
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败"); List<CartExperience> cartExperienceList = goodService.updateCartExperienceGoodPrice(id, targetPrice);
boolean update = cartExperienceService.updateBatchById(cartExperienceList);
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
}
} }
return ResultUtils.success(true); return ResultUtils.success(true);
} }

View File

@ -169,7 +169,7 @@ public class OrderController {
// 创建通用订单(常规类和服务类商品) // 创建通用订单(常规类和服务类商品)
List<Long> cartIds = cartOrderItemAddRequestList.stream().map(CartOrderItemAddRequest::getCartRecordId).toList(); List<Long> 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); orderService.sendCreateOrderMessage(orderId);

View File

@ -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<Page<RefundRecord>> listRefundRecord(@RequestBody RefundRecordQueryRequest refundRecordQueryRequest) {
if (refundRecordQueryRequest == null) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
long current = refundRecordQueryRequest.getCurrent();
long pageSize = refundRecordQueryRequest.getPageSize();
QueryWrapper<RefundRecord> queryWrapper = refundRecordService.getQueryWrapper(refundRecordQueryRequest);
Page<RefundRecord> page = refundRecordService.page(new Page<>(current, pageSize), queryWrapper);
return ResultUtils.success(page);
}
}

View File

@ -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;
}

View File

@ -3,6 +3,7 @@ package com.cultural.heritage.model.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.io.Serial; 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; private Date createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
/** /**

View File

@ -1,7 +1,15 @@
package com.cultural.heritage.service.order; package com.cultural.heritage.service.order;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.cultural.heritage.model.dto.refund.RefundRecordQueryRequest;
import com.cultural.heritage.model.entity.RefundRecord; import com.cultural.heritage.model.entity.RefundRecord;
public interface RefundRecordService extends IService<RefundRecord> { public interface RefundRecordService extends IService<RefundRecord> {
/**
* 获取查询条件
*/
QueryWrapper<RefundRecord> getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest);
} }

View File

@ -1,11 +1,27 @@
package com.cultural.heritage.service.order.impl; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cultural.heritage.mapper.RefundRecordMapper; 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.model.entity.RefundRecord;
import com.cultural.heritage.service.order.RefundRecordService; import com.cultural.heritage.service.order.RefundRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class RefundRecordServiceImpl extends ServiceImpl<RefundRecordMapper, RefundRecord> implements RefundRecordService { public class RefundRecordServiceImpl extends ServiceImpl<RefundRecordMapper, RefundRecord> implements RefundRecordService {
/**
* 获取查询条件
*/
@Override
public QueryWrapper<RefundRecord> getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest) {
String outTradeNo = refundRecordQueryRequest.getOutTradeNo();
QueryWrapper<RefundRecord> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtils.isNotBlank(outTradeNo), "outTradeNo", outTradeNo);
return queryWrapper;
}
} }

View File

@ -51,6 +51,7 @@ server:
session: session:
cookie: cookie:
max-age: 2592000 max-age: 2592000
timeout: 720h
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml