新增:优化小程序菜单管理功能,支持管理中心分类图标
This commit is contained in:
@@ -35,7 +35,11 @@ public class CardController extends BaseController {
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Card>> page(CardParam param) {
|
||||
// 使用关联查询
|
||||
return success(cardService.pageRel(param));
|
||||
final User loginUser = getLoginUser();
|
||||
if(loginUser != null){
|
||||
param.setBuyUserId(loginUser.getUserId());
|
||||
}
|
||||
return success(cardService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部会员卡")
|
||||
|
||||
@@ -41,6 +41,12 @@ public class Card implements Serializable {
|
||||
@ApiModelProperty(value = "会员卡介绍")
|
||||
private String cardDesc;
|
||||
|
||||
@ApiModelProperty(value = "IC卡类型:1年卡,2次卡,3月卡,4会员IC卡,5充值卡 ")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "成人/儿童")
|
||||
private Integer cardType;
|
||||
|
||||
@ApiModelProperty(value = "会员卡图片")
|
||||
private String image;
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ public class UserCard implements Serializable {
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "会员卡ID")
|
||||
private Integer cardId;
|
||||
|
||||
@ApiModelProperty(value = "sid场馆id集合,适用的场馆")
|
||||
private String sid;
|
||||
|
||||
|
||||
@@ -2,78 +2,90 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.booking.mapper.CardMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
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>
|
||||
<if test="param.cardId != null">
|
||||
AND a.card_id = #{param.cardId}
|
||||
</if>
|
||||
<if test="param.cardName != null">
|
||||
AND a.card_name LIKE CONCAT('%', #{param.cardName}, '%')
|
||||
</if>
|
||||
<if test="param.cardCode != null">
|
||||
AND a.card_code = #{param.cardCode}
|
||||
</if>
|
||||
<if test="param.merchantType != null">
|
||||
AND a.merchant_type = #{param.merchantType}
|
||||
</if>
|
||||
<if test="param.image != null">
|
||||
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
||||
</if>
|
||||
<if test="param.price != null">
|
||||
AND a.price = #{param.price}
|
||||
</if>
|
||||
<if test="param.number != null">
|
||||
AND a.number = #{param.number}
|
||||
</if>
|
||||
<if test="param.month != null">
|
||||
AND a.month = #{param.month}
|
||||
</if>
|
||||
<if test="param.discount != null">
|
||||
AND a.discount = #{param.discount}
|
||||
</if>
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.merchantId != null">
|
||||
AND a.merchant_id = #{param.merchantId}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
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>
|
||||
<if test="param.cardId != null">
|
||||
AND a.card_id = #{param.cardId}
|
||||
</if>
|
||||
<if test="param.cardName != null">
|
||||
AND a.card_name LIKE CONCAT('%', #{param.cardName}, '%')
|
||||
</if>
|
||||
<if test="param.cardCode != null">
|
||||
AND a.card_code = #{param.cardCode}
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.cardType != null">
|
||||
AND a.card_type = #{param.cardType}
|
||||
</if>
|
||||
<if test="param.merchantType != null">
|
||||
AND a.merchant_type = #{param.merchantType}
|
||||
</if>
|
||||
<if test="param.image != null">
|
||||
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
||||
</if>
|
||||
<if test="param.price != null">
|
||||
AND a.price = #{param.price}
|
||||
</if>
|
||||
<if test="param.number != null">
|
||||
AND a.number = #{param.number}
|
||||
</if>
|
||||
<if test="param.month != null">
|
||||
AND a.month = #{param.month}
|
||||
</if>
|
||||
<if test="param.discount != null">
|
||||
AND a.discount = #{param.discount}
|
||||
</if>
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.merchantId != null">
|
||||
AND a.merchant_id = #{param.merchantId}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.cardIds != null">
|
||||
AND a.card_id NOT IN
|
||||
<foreach collection="param.cardIds" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.Card">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.Card">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Card">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Card">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.gxwebsoft.booking.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
@@ -34,6 +37,13 @@ public class CardParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String cardCode;
|
||||
|
||||
@ApiModelProperty(value = "IC卡类型:1年卡,2次卡,3月卡,4会员IC卡,5充值卡 ")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "成人/儿童")
|
||||
private Integer cardType;
|
||||
|
||||
@ApiModelProperty(value = "会员卡图片")
|
||||
private String image;
|
||||
|
||||
@@ -79,4 +89,12 @@ public class CardParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "会员卡ID集合")
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> cardIds;
|
||||
|
||||
@ApiModelProperty(value = "买家用户ID")
|
||||
@TableField(exist = false)
|
||||
private Integer buyUserId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.gxwebsoft.booking.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
@@ -30,6 +33,10 @@ public class UserCardParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "会员卡ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer cardId;
|
||||
|
||||
@ApiModelProperty(value = "sid场馆id集合,适用的场馆")
|
||||
private String sid;
|
||||
|
||||
@@ -187,4 +194,8 @@ public class UserCardParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "会员卡ID集合")
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> cardIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package com.gxwebsoft.booking.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.booking.entity.UserCard;
|
||||
import com.gxwebsoft.booking.mapper.CardMapper;
|
||||
import com.gxwebsoft.booking.service.CardService;
|
||||
import com.gxwebsoft.booking.entity.Card;
|
||||
import com.gxwebsoft.booking.param.CardParam;
|
||||
import com.gxwebsoft.booking.service.UserCardService;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 会员卡Service实现
|
||||
@@ -19,11 +25,21 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements CardService {
|
||||
@Resource
|
||||
private UserCardService userCardService;
|
||||
|
||||
@Override
|
||||
public PageResult<Card> pageRel(CardParam param) {
|
||||
PageParam<Card, CardParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, price asc, create_time desc");
|
||||
|
||||
// 只显示可购买的会员卡
|
||||
if(param.getSceneType() != null && param.getSceneType().equals("showCanBuyVipCard")){
|
||||
final List<UserCard> userCardList = userCardService.list(new LambdaUpdateWrapper<UserCard>().eq(UserCard::getUserId, param.getBuyUserId()));
|
||||
final Set<Integer> collect = userCardList.stream().map(UserCard::getCardId).collect(Collectors.toSet());
|
||||
param.setCardIds(collect);
|
||||
}
|
||||
|
||||
List<Card> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@@ -95,6 +95,9 @@ public class MpMenu implements Serializable {
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "是否管理人员可见")
|
||||
private Integer adminShow;
|
||||
|
||||
@ApiModelProperty(value = "设为首页")
|
||||
private Integer home;
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.adminShow != null">
|
||||
AND a.admin_show = #{param.adminShow}
|
||||
</if>
|
||||
<if test="param.home != null">
|
||||
AND a.home = #{param.home}
|
||||
</if>
|
||||
|
||||
@@ -106,6 +106,10 @@ public class MpMenuParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "是否管理人员可见")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer adminShow;
|
||||
|
||||
@ApiModelProperty(value = "设为首页")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer home;
|
||||
|
||||
@@ -168,6 +168,7 @@ public class OrderController extends BaseController {
|
||||
final UserCard userCard = new UserCard();
|
||||
userCard.setUserId(loginUser.getUserId());
|
||||
// 适用场馆
|
||||
userCard.setCardId(Integer.valueOf(order.getCardId()));
|
||||
userCard.setSid(card.getMerchantIds());
|
||||
userCard.setCardNum(CommonUtil.createCardNo());
|
||||
userCard.setName(card.getCardName());
|
||||
@@ -188,6 +189,7 @@ public class OrderController extends BaseController {
|
||||
userCard.setMonth(card.getMonth());
|
||||
userCard.setMerchantId(card.getMerchantId());
|
||||
userCard.setPayType(1);
|
||||
userCard.setType(card.getType());
|
||||
userCard.setTenantId(card.getTenantId());
|
||||
userCard.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.MONTH, card.getMonth()));
|
||||
userCardService.save(userCard);
|
||||
@@ -206,7 +208,7 @@ public class OrderController extends BaseController {
|
||||
}
|
||||
|
||||
// 会员卡支付
|
||||
if(!Integer.valueOf(order.getCardId()).equals(0)){
|
||||
if(order.getPayType().equals(7)){
|
||||
order.setAccessToken(access_token);
|
||||
order.setLoginUser(loginUser);
|
||||
return success("下单成功", orderService.payByUserCard(order));
|
||||
|
||||
@@ -48,6 +48,9 @@ public class Merchant implements Serializable {
|
||||
@ApiModelProperty(value = "店铺类型")
|
||||
private String shopType;
|
||||
|
||||
@ApiModelProperty(value = "项目类型")
|
||||
private String itemType;
|
||||
|
||||
@ApiModelProperty(value = "商户分类")
|
||||
private String category;
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
<if test="param.shopType != null">
|
||||
AND a.shop_type LIKE CONCAT('%', #{param.shopType}, '%')
|
||||
</if>
|
||||
<if test="param.itemType != null">
|
||||
AND a.item_type = #{param.merchantId}
|
||||
</if>
|
||||
<if test="param.category != null">
|
||||
AND a.category LIKE CONCAT('%', #{param.category}, '%')
|
||||
</if>
|
||||
|
||||
@@ -49,6 +49,9 @@ public class MerchantParam extends BaseParam {
|
||||
@ApiModelProperty(value = "店铺类型")
|
||||
private String shopType;
|
||||
|
||||
@ApiModelProperty(value = "项目类型")
|
||||
private String itemType;
|
||||
|
||||
@ApiModelProperty(value = "商户分类")
|
||||
private String category;
|
||||
|
||||
|
||||
@@ -302,6 +302,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
public Boolean payByUserCard(Order order) {
|
||||
final User loginUser = order.getLoginUser();
|
||||
final UserCardLog userCardLog = new UserCardLog();
|
||||
if(order.getCardId() == null){
|
||||
throw new BusinessException("会员卡ID不存在");
|
||||
}
|
||||
// 查询会员卡信息
|
||||
final UserCard userCard = userCardService.getById(order.getCardId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user