前端订单信息的读取及展示

This commit is contained in:
gxwebsoft
2024-05-15 20:16:52 +08:00
parent 8d9931e46e
commit c1a4e06c9c
11 changed files with 59 additions and 23 deletions
@@ -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<String, List<OrderInfo>> collectKey;
List<OrderInfo> orderInfoList = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getDateTime, param.getDateTime()).eq(OrderInfo::getMerchantId,param.getMerchantId()));
List<OrderInfo> orderInfoList = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().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<Field> fields = fieldService.listRel(fieldParam);
System.out.println("fields = " + fields);
// 为空处理
if (CollectionUtils.isEmpty(fields)) {
return fail("该场馆没有添加场地,或不支持半场",null);
}
redisUtil.set(param.getMerchantId().toString(),fields);
@@ -37,19 +37,19 @@ public class Field extends CloneSupport<Field> 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 = "可重复预订次数")
@@ -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 = "开始时间")
@@ -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)
@@ -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;
}
@@ -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<Date> 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());
// 创建微信订单
@@ -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;
@@ -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;
@@ -94,6 +94,9 @@ public class OrderInfo implements Serializable {
@ApiModelProperty(value = "毫秒时间戳")
private Long timeFlag;
@ApiModelProperty(value = "过期时间")
private Date expirationTime;
@ApiModelProperty(value = "备注")
private String comments;
@@ -4,8 +4,9 @@
<!-- 关联查询sql -->
<sql id="selectSql">
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
<where>
<if test="param.orderId != null">
AND a.order_id = #{param.orderId}
@@ -22,6 +23,9 @@
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.merchantCode != null">
AND a.merchant_code = #{param.merchantCode}
</if>
<if test="param.couponId != null">
AND a.coupon_id = #{param.couponId}
</if>
@@ -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}
)
</if>
</where>
@@ -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;