优化订单模块及会员卡模块
This commit is contained in:
@@ -38,6 +38,9 @@ public class Card implements Serializable {
|
||||
@ApiModelProperty(value = "会员卡标识")
|
||||
private String cardCode;
|
||||
|
||||
@ApiModelProperty(value = "会员卡介绍")
|
||||
private String cardDesc;
|
||||
|
||||
@ApiModelProperty(value = "会员卡图片")
|
||||
private String image;
|
||||
|
||||
@@ -62,6 +65,17 @@ public class Card implements Serializable {
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
private Integer merchantId;
|
||||
|
||||
@ApiModelProperty(value = "商户ID集")
|
||||
private String merchantIds;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
@TableField(exist = false)
|
||||
private String merchantName;
|
||||
|
||||
@ApiModelProperty(value = "商户头像")
|
||||
@TableField(exist = false)
|
||||
private String merchantAvatar;
|
||||
|
||||
@ApiModelProperty(value = "商户类型")
|
||||
private String merchantType;
|
||||
|
||||
@@ -80,8 +94,4 @@ public class Card implements Serializable {
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
@TableField(exist = false)
|
||||
private String merchantName;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.booking.entity;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -37,7 +38,8 @@ public class Integral implements Serializable {
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
@ApiModelProperty("手机号(脱敏)")
|
||||
@TableField(exist = false)
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "获得积分")
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -117,7 +119,7 @@ public class UserCard implements Serializable {
|
||||
private Integer isInvoice;
|
||||
|
||||
@ApiModelProperty(value = "vip卡到期时间")
|
||||
private Integer expireTime;
|
||||
private Date expireTime;
|
||||
|
||||
@ApiModelProperty(value = "紧急联系人")
|
||||
private String urgentName;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*,b.merchant_name
|
||||
SELECT a.*,b.merchant_name,b.image as merchant_avatar
|
||||
FROM booking_card a
|
||||
LEFT JOIN shop_merchant b ON a.merchant_id = b.merchant_id
|
||||
<where>
|
||||
|
||||
@@ -138,7 +138,7 @@ public class UserCardParam extends BaseParam {
|
||||
|
||||
@ApiModelProperty(value = "vip卡到期时间")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer expireTime;
|
||||
private String expireTime;
|
||||
|
||||
@ApiModelProperty(value = "紧急联系人")
|
||||
private String urgentName;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
|
||||
@Override
|
||||
public PageResult<Card> pageRel(CardParam param) {
|
||||
PageParam<Card, CardParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
page.setDefaultOrder("sort_number asc, price asc, create_time desc");
|
||||
List<Card> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
|
||||
List<Card> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Card, CardParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
page.setDefaultOrder("sort_number asc, price asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,12 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.booking.entity.Card;
|
||||
import com.gxwebsoft.booking.entity.UserCard;
|
||||
import com.gxwebsoft.booking.param.UserCardParam;
|
||||
import com.gxwebsoft.booking.service.CardService;
|
||||
import com.gxwebsoft.booking.service.UserCardService;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.entity.OrderInfo;
|
||||
import com.gxwebsoft.shop.service.OrderGoodsService;
|
||||
@@ -46,6 +52,10 @@ public class OrderController extends BaseController {
|
||||
private OrderInfoService orderInfoService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private UserCardService userCardService;
|
||||
@Resource
|
||||
private CardService cardService;
|
||||
|
||||
@ApiOperation("分页查询订单")
|
||||
@GetMapping("/page")
|
||||
@@ -124,8 +134,20 @@ public class OrderController extends BaseController {
|
||||
}
|
||||
|
||||
if (orderService.save(order)) {
|
||||
// 商城订单
|
||||
if (order.getType().equals(0)) {
|
||||
order.getGoodsList().forEach(d -> {
|
||||
d.setOrderId(order.getOrderId());
|
||||
d.setTimeFlag(timeMillis);
|
||||
d.setVersion(10);
|
||||
d.setDateTime(DateUtil.date());
|
||||
d.setUserId(getLoginUser().getUserId());
|
||||
d.setExpirationTime(order.getExpirationTime());
|
||||
});
|
||||
orderGoodsService.saveBatch(order.getGoodsList());
|
||||
}
|
||||
// 预定订单
|
||||
if (!CollectionUtils.isEmpty(order.getOrderInfoList())) {
|
||||
if (order.getType().equals(1)) {
|
||||
order.getOrderInfoList().forEach(d -> {
|
||||
d.setOrderId(order.getOrderId());
|
||||
d.setTimeFlag(timeMillis);
|
||||
@@ -136,17 +158,37 @@ public class OrderController extends BaseController {
|
||||
});
|
||||
orderInfoService.saveBatch(order.getOrderInfoList());
|
||||
}
|
||||
// 商城订单
|
||||
if (!CollectionUtils.isEmpty(order.getGoodsList())) {
|
||||
order.getGoodsList().forEach(d -> {
|
||||
d.setOrderId(order.getOrderId());
|
||||
d.setTimeFlag(timeMillis);
|
||||
d.setVersion(10);
|
||||
d.setDateTime(DateUtil.date());
|
||||
d.setUserId(getLoginUser().getUserId());
|
||||
d.setExpirationTime(order.getExpirationTime());
|
||||
});
|
||||
orderGoodsService.saveBatch(order.getGoodsList());
|
||||
// 会员卡订单
|
||||
if (order.getType().equals(2)) {
|
||||
// 会员卡信息
|
||||
final Card card = cardService.getByIdRel(Integer.valueOf(order.getCardId()));
|
||||
System.out.println("card = " + card);
|
||||
final UserCard userCard = new UserCard();
|
||||
userCard.setUserId(loginUser.getUserId());
|
||||
// 适用场馆
|
||||
userCard.setSid(card.getMerchantIds());
|
||||
userCard.setCardNum(CommonUtil.randomUUID8());
|
||||
userCard.setName(card.getCardName());
|
||||
userCard.setUsername(loginUser.getRealName());
|
||||
userCard.setPhone(loginUser.getPhone());
|
||||
userCard.setPrice(card.getPrice());
|
||||
userCard.setDesc(card.getCardDesc());
|
||||
userCard.setInfo(card.getComments());
|
||||
userCard.setUid(loginUser.getUserId());
|
||||
userCard.setVid(0);
|
||||
userCard.setAid(0);
|
||||
userCard.setCode(CommonUtil.randomUUID8());
|
||||
userCard.setDiscount(card.getDiscount());
|
||||
userCard.setNumber(1);
|
||||
userCard.setNum(card.getNumber());
|
||||
userCard.setTerm(1);
|
||||
userCard.setTerm(card.getMonth()/12);
|
||||
userCard.setMonth(card.getMonth());
|
||||
userCard.setPayType(1);
|
||||
userCard.setExpireTime(DateUtil.offset(DateUtil.date(), DateField.MONTH, card.getMonth()));
|
||||
System.out.println("userCard = " + userCard);
|
||||
return fail("下单失败2",userCard);
|
||||
// userCardService.save(userCard);
|
||||
}
|
||||
|
||||
// 微信统一下单接口
|
||||
|
||||
@@ -35,6 +35,9 @@ public class Order implements Serializable {
|
||||
@ApiModelProperty(value = "订单类型,0商城订单 1客户预定 2俱乐部训练场 3活动订场")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "下单渠道,0普通预定 1俱乐部训练场 3活动订场")
|
||||
private Integer channel;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.channel != null">
|
||||
AND a.type = #{param.channel}
|
||||
</if>
|
||||
<if test="param.orderNo != null">
|
||||
AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%')
|
||||
</if>
|
||||
|
||||
@@ -32,6 +32,10 @@ public class OrderParam extends BaseParam {
|
||||
@ApiModelProperty(value = "订单类型,0商城订单 1客户预定 2俱乐部训练场 3活动订场")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "下单渠道,0普通预定 1俱乐部训练场 3活动订场")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer channel;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String orderNo;
|
||||
|
||||
Reference in New Issue
Block a user