From c1a4e06c9ca2c6a020ff6dc9c20b9d02027d3940 Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Wed, 15 May 2024 20:16:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=A2=E5=8D=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E8=AF=BB=E5=8F=96=E5=8F=8A=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../booking/controller/PeriodController.java | 11 ++++++++++- .../java/com/gxwebsoft/booking/entity/Field.java | 10 +++++----- .../com/gxwebsoft/booking/entity/Period.java | 4 ++-- .../com/gxwebsoft/booking/param/FieldParam.java | 16 ++++++++-------- .../com/gxwebsoft/booking/param/PeriodParam.java | 8 ++++---- .../shop/controller/OrderController.java | 3 +++ .../shop/controller/WxPayNotifyController.java | 1 - .../java/com/gxwebsoft/shop/entity/Order.java | 15 ++++++++++++++- .../com/gxwebsoft/shop/entity/OrderInfo.java | 3 +++ .../gxwebsoft/shop/mapper/xml/OrderMapper.xml | 7 ++++++- .../com/gxwebsoft/shop/param/OrderParam.java | 4 ++++ 11 files changed, 59 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/gxwebsoft/booking/controller/PeriodController.java b/src/main/java/com/gxwebsoft/booking/controller/PeriodController.java index ab0e9d8..570978a 100644 --- a/src/main/java/com/gxwebsoft/booking/controller/PeriodController.java +++ b/src/main/java/com/gxwebsoft/booking/controller/PeriodController.java @@ -30,6 +30,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -84,13 +85,21 @@ public class PeriodController extends BaseController { // 今日订单信息 按Key分组(组合规则:日期+时间段+场馆id+场地id) Map> collectKey; - List orderInfoList = orderInfoService.list(new LambdaQueryWrapper().eq(OrderInfo::getDateTime, param.getDateTime()).eq(OrderInfo::getMerchantId,param.getMerchantId())); + List orderInfoList = orderInfoService.list(new LambdaQueryWrapper().eq(OrderInfo::getDateTime, param.getDateTime()).eq(OrderInfo::getMerchantId,param.getMerchantId()).gt(OrderInfo::getExpirationTime, LocalDateTime.now())); collectKey = orderInfoList.stream().collect(Collectors.groupingBy(OrderInfo::getOrderCode)); final FieldParam fieldParam = new FieldParam(); fieldParam.setIsStatus(param.getIsStatus()); fieldParam.setMerchantId(param.getMerchantId()); + fieldParam.setIsHalf(param.getHalf()); + System.out.println("fieldParam = " + fieldParam); List fields = fieldService.listRel(fieldParam); + System.out.println("fields = " + fields); + + // 为空处理 + if (CollectionUtils.isEmpty(fields)) { + return fail("该场馆没有添加场地,或不支持半场",null); + } redisUtil.set(param.getMerchantId().toString(),fields); diff --git a/src/main/java/com/gxwebsoft/booking/entity/Field.java b/src/main/java/com/gxwebsoft/booking/entity/Field.java index eb54e9f..c3670d4 100644 --- a/src/main/java/com/gxwebsoft/booking/entity/Field.java +++ b/src/main/java/com/gxwebsoft/booking/entity/Field.java @@ -37,19 +37,19 @@ public class Field extends CloneSupport implements Serializable { @ApiModelProperty(value = "场地名称") private String fieldName; - @ApiModelProperty(value = "是否有卫生间,1有,2没有") + @ApiModelProperty(value = "是否有卫生间,1有,0没有") private Integer isToilet; - @ApiModelProperty(value = "是否关闭,1开启,2关闭") + @ApiModelProperty(value = "是否关闭,0开启,1关闭") private Integer isStatus; - @ApiModelProperty(value = "是否重复预订,1可以,2不可以") + @ApiModelProperty(value = "是否重复预订,1可以,0不可以") private Integer isRepeat; - @ApiModelProperty(value = "是否可预定半场,1可以,2不可以") + @ApiModelProperty(value = "是否可预定半场,1可以,0不可以") private Integer isHalf; - @ApiModelProperty(value = "是否支持儿童价:1支持,2不支持") + @ApiModelProperty(value = "是否支持儿童价:1支持,0不支持") private Integer isChildren; @ApiModelProperty(value = "可重复预订次数") diff --git a/src/main/java/com/gxwebsoft/booking/entity/Period.java b/src/main/java/com/gxwebsoft/booking/entity/Period.java index b5745f5..d14075b 100644 --- a/src/main/java/com/gxwebsoft/booking/entity/Period.java +++ b/src/main/java/com/gxwebsoft/booking/entity/Period.java @@ -57,10 +57,10 @@ public class Period implements Serializable { @ApiModelProperty(value = "关联id") private Integer merchantId; - @ApiModelProperty(value = "是否关闭,1开启,2关闭") + @ApiModelProperty(value = "是否关闭,0开启,1关闭") private Integer isStatus; - @ApiModelProperty(value = "是否免费:1免费,2收费") + @ApiModelProperty(value = "是否免费:1免费,0收费") private Integer isFree; @ApiModelProperty(value = "开始时间") diff --git a/src/main/java/com/gxwebsoft/booking/param/FieldParam.java b/src/main/java/com/gxwebsoft/booking/param/FieldParam.java index 9b59182..50ea780 100644 --- a/src/main/java/com/gxwebsoft/booking/param/FieldParam.java +++ b/src/main/java/com/gxwebsoft/booking/param/FieldParam.java @@ -29,25 +29,25 @@ public class FieldParam extends BaseParam { @ApiModelProperty(value = "场地名称") private String fieldName; - @ApiModelProperty(value = "是否有卫生间,1有,2没有") + @ApiModelProperty(value = "是否有卫生间,1有,0没有") @QueryField(type = QueryType.EQ) - private Integer isToilet; + private Boolean isToilet; - @ApiModelProperty(value = "是否关闭,1开启,2关闭") + @ApiModelProperty(value = "是否关闭,0开启,1关闭") @QueryField(type = QueryType.EQ) private Integer isStatus; - @ApiModelProperty(value = "是否重复预订,1可以,2不可以") + @ApiModelProperty(value = "是否重复预订,1可以,0不可以") @QueryField(type = QueryType.EQ) - private Integer isRepeat; + private Boolean isRepeat; - @ApiModelProperty(value = "是否可预定半场,1可以,2不可以") + @ApiModelProperty(value = "是否可预定半场,1可以,0不可以") @QueryField(type = QueryType.EQ) private Integer isHalf; - @ApiModelProperty(value = "是否支持儿童价:1支持,2不支持") + @ApiModelProperty(value = "是否支持儿童价:1支持,0不支持") @QueryField(type = QueryType.EQ) - private Integer isChildren; + private Boolean isChildren; @ApiModelProperty(value = "可重复预订次数") @QueryField(type = QueryType.EQ) diff --git a/src/main/java/com/gxwebsoft/booking/param/PeriodParam.java b/src/main/java/com/gxwebsoft/booking/param/PeriodParam.java index 9661c94..442c1e1 100644 --- a/src/main/java/com/gxwebsoft/booking/param/PeriodParam.java +++ b/src/main/java/com/gxwebsoft/booking/param/PeriodParam.java @@ -58,13 +58,13 @@ public class PeriodParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer merchantId; - @ApiModelProperty(value = "是否关闭,1开启,2关闭") + @ApiModelProperty(value = "是否关闭,0开启,1关闭") @QueryField(type = QueryType.EQ) private Integer isStatus; - @ApiModelProperty(value = "是否免费:1免费,2收费") + @ApiModelProperty(value = "是否免费:0免费,1收费") @QueryField(type = QueryType.EQ) - private Integer isFree; + private Boolean isFree; @ApiModelProperty(value = "开始时间") private String startTime; @@ -82,6 +82,6 @@ public class PeriodParam extends BaseParam { @ApiModelProperty(value = "是否半场") @QueryField(type = QueryType.EQ) - private Boolean half; + private Integer half; } diff --git a/src/main/java/com/gxwebsoft/shop/controller/OrderController.java b/src/main/java/com/gxwebsoft/shop/controller/OrderController.java index c22d25f..f3360e3 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/OrderController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/OrderController.java @@ -1,5 +1,6 @@ package com.gxwebsoft.shop.controller; +import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; @@ -95,6 +96,7 @@ public class OrderController extends BaseController { order.setRealName(loginUser.getRealName()); order.setPhone(loginUser.getPhone()); order.setUserId(loginUser.getUserId()); + order.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.MINUTE, 10)); // List collect = order.getOrderInfoList().stream().map(OrderInfo::getStartTime).collect(Collectors.toList()); // OrderInfo orderInfo = order.getOrderInfoList().get(0); // order.setStartTime(DateUtil.formatTime(orderInfo.getStartTime())); @@ -107,6 +109,7 @@ public class OrderController extends BaseController { d.setVersion(10); d.setUserId(getLoginUser().getUserId()); d.setDateTime(d.getDateTime()); + d.setExpirationTime(order.getExpirationTime()); }); orderInfoService.saveBatch(order.getOrderInfoList()); // 创建微信订单 diff --git a/src/main/java/com/gxwebsoft/shop/controller/WxPayNotifyController.java b/src/main/java/com/gxwebsoft/shop/controller/WxPayNotifyController.java index 829dc5d..850d0b7 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/WxPayNotifyController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/WxPayNotifyController.java @@ -8,7 +8,6 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.shop.entity.Order; import com.gxwebsoft.shop.entity.Payment; import com.gxwebsoft.shop.service.OrderService; -import com.sun.xml.internal.bind.v2.TODO; import com.wechat.pay.java.core.notification.NotificationConfig; import com.wechat.pay.java.core.notification.NotificationParser; import com.wechat.pay.java.core.notification.RSANotificationConfig; diff --git a/src/main/java/com/gxwebsoft/shop/entity/Order.java b/src/main/java/com/gxwebsoft/shop/entity/Order.java index f2995c9..811d1af 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/Order.java +++ b/src/main/java/com/gxwebsoft/shop/entity/Order.java @@ -4,7 +4,6 @@ import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.*; -import java.time.LocalDateTime; import java.io.Serializable; import java.util.Date; import java.util.List; @@ -43,6 +42,17 @@ public class Order implements Serializable { @ApiModelProperty(value = "商户ID") private Integer merchantId; + @ApiModelProperty(value = "商户编号") + private String merchantCode; + + @ApiModelProperty(value = "商户名称") + @TableField(exist = false) + private String merchantName; + + @ApiModelProperty(value = "商户图标") + @TableField(exist = false) + private String merchantAvatar; + @ApiModelProperty(value = "使用的优惠券id") private Integer couponId; @@ -127,6 +137,9 @@ public class Order implements Serializable { @ApiModelProperty(value = "申请退款时间") private Date refundApplyTime; + @ApiModelProperty(value = "订单过期时间") + private Date expirationTime; + @ApiModelProperty(value = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") private Integer checkBill; diff --git a/src/main/java/com/gxwebsoft/shop/entity/OrderInfo.java b/src/main/java/com/gxwebsoft/shop/entity/OrderInfo.java index 3d6c7c3..ddfc553 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/OrderInfo.java +++ b/src/main/java/com/gxwebsoft/shop/entity/OrderInfo.java @@ -94,6 +94,9 @@ public class OrderInfo implements Serializable { @ApiModelProperty(value = "毫秒时间戳") private Long timeFlag; + @ApiModelProperty(value = "过期时间") + private Date expirationTime; + @ApiModelProperty(value = "备注") private String comments; diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/OrderMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/OrderMapper.xml index b1f0fbb..972f1dc 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/xml/OrderMapper.xml +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/OrderMapper.xml @@ -4,8 +4,9 @@ - SELECT a.* + SELECT a.*,b.merchant_name,b.image as merchantAvatar FROM shop_order a + LEFT JOIN shop_merchant b ON a.merchant_id = b.merchant_id AND a.order_id = #{param.orderId} @@ -22,6 +23,9 @@ AND a.merchant_id = #{param.merchantId} + + AND a.merchant_code = #{param.merchantCode} + AND a.coupon_id = #{param.couponId} @@ -142,6 +146,7 @@ OR a.phone = #{param.keywords} OR a.user_id = #{param.keywords} OR a.merchant_id = #{param.keywords} + OR a.merchant_code =#{param.keywords} ) diff --git a/src/main/java/com/gxwebsoft/shop/param/OrderParam.java b/src/main/java/com/gxwebsoft/shop/param/OrderParam.java index 340320b..d9a09c4 100644 --- a/src/main/java/com/gxwebsoft/shop/param/OrderParam.java +++ b/src/main/java/com/gxwebsoft/shop/param/OrderParam.java @@ -41,6 +41,10 @@ public class OrderParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer merchantId; + @ApiModelProperty(value = "商户编号") + @QueryField(type = QueryType.EQ) + private String merchantCode; + @ApiModelProperty(value = "使用的优惠券id") @QueryField(type = QueryType.EQ) private Integer couponId;