diff --git a/src/main/java/com/cultural/heritage/controller/order/AdvanceOrderController.java b/src/main/java/com/cultural/heritage/controller/order/AdvanceOrderController.java index af3b4fd..ba330fb 100644 --- a/src/main/java/com/cultural/heritage/controller/order/AdvanceOrderController.java +++ b/src/main/java/com/cultural/heritage/controller/order/AdvanceOrderController.java @@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; +import java.util.Collections; import java.util.List; @RestController @@ -114,6 +115,7 @@ public class AdvanceOrderController { advanceOrder.setPhotoProductsSnapshot(photoProductsSnapshot); advanceOrder.setTotalAmount(totalAmount); advanceOrder.setOrderNumber(orderNumber); + advanceOrder.setOrderStatus(OrderStatusConstant.PENDING_PAYMENT); // 校验 advanceOrderService.validAdvanceOrder(advanceOrder); boolean result = advanceOrderService.save(advanceOrder); @@ -201,6 +203,7 @@ public class AdvanceOrderController { List advanceOrderList = advanceOrderService.list(queryWrapper); // 封装成写真预约订单VO List advanceOrderVOS = commonService.convertList(advanceOrderList, AdvanceOrderVO.class); + Collections.reverse(advanceOrderList); return ResultUtils.success(advanceOrderVOS); } 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 27eeecf..d1fc7f6 100644 --- a/src/main/java/com/cultural/heritage/controller/order/OrderController.java +++ b/src/main/java/com/cultural/heritage/controller/order/OrderController.java @@ -20,6 +20,7 @@ import com.cultural.heritage.model.dto.order.OrderQueryRequest; import com.cultural.heritage.model.dto.order.OrderUpdateRequest; import com.cultural.heritage.model.dto.order.capital.GeneralGoodSingleBuyAddRequest; import com.cultural.heritage.model.dto.order.capital.OrderMainInfoAddRequest; +import com.cultural.heritage.model.dto.snapshot.CouponSnapshot; import com.cultural.heritage.model.dto.snapshot.GoodSnapshot; import com.cultural.heritage.model.entity.*; import com.cultural.heritage.model.vo.order.OrderVO; @@ -411,8 +412,9 @@ public class OrderController { ThrowUtils.throwIf(!updateBatch, ErrorCode.SYSTEM_ERROR, "商品库存恢复失败"); // 如果使用了优惠券,则退还优惠券 - Long userCouponId = order.getCouponSnapshot().getId(); - if (userCouponId != null) { + CouponSnapshot couponSnapshot = order.getCouponSnapshot(); + if (couponSnapshot != null) { + Long userCouponId = couponSnapshot.getId(); UserCoupon userCoupon = userCouponService.getById(userCouponId); ThrowUtils.throwIf(userCoupon == null, ErrorCode.OPERATION_ERROR, "优惠券不存在"); // 更新优惠券状态 @@ -458,8 +460,9 @@ public class OrderController { // 如果使用了优惠券,则退还优惠券 - Long userCouponId = order.getCouponSnapshot().getId(); - if (userCouponId != null) { + CouponSnapshot couponSnapshot = order.getCouponSnapshot(); + if (couponSnapshot != null) { + Long userCouponId = couponSnapshot.getId(); UserCoupon userCoupon = userCouponService.getById(userCouponId); ThrowUtils.throwIf(userCoupon == null, ErrorCode.OPERATION_ERROR, "优惠券不存在"); // 更新优惠券状态 diff --git a/src/main/java/com/cultural/heritage/model/dto/advanceOrder/AdvanceOrderAddRequest.java b/src/main/java/com/cultural/heritage/model/dto/advanceOrder/AdvanceOrderAddRequest.java index 719322d..0270bf2 100644 --- a/src/main/java/com/cultural/heritage/model/dto/advanceOrder/AdvanceOrderAddRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/advanceOrder/AdvanceOrderAddRequest.java @@ -61,13 +61,6 @@ public class AdvanceOrderAddRequest implements Serializable { private Integer isPhotography; - /** - * 订单状态 - */ - @Schema(description = "订单状态", example = "待付款") - private String orderStatus; - - /** * 购买数量 */ diff --git a/src/main/java/com/cultural/heritage/model/vo/advanceorder/AdvanceOrderVO.java b/src/main/java/com/cultural/heritage/model/vo/advanceorder/AdvanceOrderVO.java index 06d03d9..d467868 100644 --- a/src/main/java/com/cultural/heritage/model/vo/advanceorder/AdvanceOrderVO.java +++ b/src/main/java/com/cultural/heritage/model/vo/advanceorder/AdvanceOrderVO.java @@ -20,6 +20,11 @@ public class AdvanceOrderVO implements Serializable { private Long id; + /** + * 订单号 + */ + private String orderNumber; + /** * 写真产品信息快照 @@ -81,6 +86,12 @@ public class AdvanceOrderVO implements Serializable { private String orderStatus; + /** + * 购买数量 + */ + private Integer quantity; + + /** * 创建时间 */ diff --git a/src/main/java/com/cultural/heritage/service/book/impl/AdvanceOrderServiceImpl.java b/src/main/java/com/cultural/heritage/service/book/impl/AdvanceOrderServiceImpl.java index 3de8eb3..00dfe4b 100644 --- a/src/main/java/com/cultural/heritage/service/book/impl/AdvanceOrderServiceImpl.java +++ b/src/main/java/com/cultural/heritage/service/book/impl/AdvanceOrderServiceImpl.java @@ -121,9 +121,9 @@ public class AdvanceOrderServiceImpl extends ServiceImpl= 0, ErrorCode.OPERATION_ERROR, "当前预约时间已过期"); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1eff7bc..738775c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -93,8 +93,8 @@ wx: #商户APIv3密钥 apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t #通知地址 - notifyUrl: https://winning-mouse-internally.ngrok-free.app -# notifyUrl: http://123.249.108.160:8888 +# notifyUrl: https://winning-mouse-internally.ngrok-free.app + notifyUrl: http://123.249.108.160:8888 #微信服务器地址 domain: https://api.mch.weixin.qq.com