super权限无法获取问题处理,拼团表单校验问题,购物车渲染流程优化
This commit is contained in:
parent
45e65e71e1
commit
f9a18ffbe1
@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
@ -50,8 +52,10 @@ public class DistributionCashBuyerController {
|
||||
@ApiImplicitParam(name = "price", value = "申请金额", required = true, paramType = "query", dataType = "double")
|
||||
})
|
||||
@PostMapping
|
||||
public ResultMessage<Object> cash(@NotNull @ApiIgnore Double price) {
|
||||
if(distributionCashService.cash(price)){
|
||||
public ResultMessage<Object> cash(@Max(value = 1000, message = "充值金额单次最多允许提现1000元")
|
||||
@Min(value = 1, message = "充值金额单次最少提现金额为1元")
|
||||
@NotNull @ApiIgnore Double price) {
|
||||
if (distributionCashService.cash(price)) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cn.lili.modules.order.cart.entity.enums;
|
||||
|
||||
/**
|
||||
* 购物车渲染枚举
|
||||
*/
|
||||
public enum RenderStepEnums {
|
||||
|
||||
CHECK_DATA("校验商品"),
|
||||
CART_SN("交易编号创建"),
|
||||
COUPON("优惠券价格渲染"),
|
||||
SKU_FREIGHT("运费计算"),
|
||||
SKU_PROMOTION("商品促销计算"),
|
||||
CART_PRICE("购物车金额计算"),
|
||||
DISTRIBUTION("分销佣金计算"),
|
||||
FULL_DISCOUNT("满减计算");
|
||||
|
||||
private String distribution;
|
||||
|
||||
RenderStepEnums(String distribution) {
|
||||
this.distribution = distribution;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package cn.lili.modules.order.cart.entity.vo;
|
||||
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
import cn.lili.modules.promotion.entity.dos.MemberCoupon;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -46,6 +47,9 @@ public class CartVO extends CartBase implements Serializable {
|
||||
@ApiModelProperty(value = "使用的优惠券列表")
|
||||
private List<MemberCoupon> couponList;
|
||||
|
||||
@ApiModelProperty(value = "使用的优惠券列表")
|
||||
private List<CouponVO> canReceiveCoupon;
|
||||
|
||||
@ApiModelProperty(value = "赠品列表")
|
||||
private List<String> giftList;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.modules.order.cart.render;
|
||||
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
|
||||
/**
|
||||
* 购物车渲染
|
||||
@ -11,6 +12,13 @@ import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
public interface CartRenderStep {
|
||||
|
||||
|
||||
/**
|
||||
* 渲染价格步骤
|
||||
*
|
||||
* @return 渲染枚举
|
||||
*/
|
||||
RenderStepEnums step();
|
||||
|
||||
/**
|
||||
* 渲染一笔交易
|
||||
* 0-》 校验商品 1-》 满优惠渲染 2-》渲染优惠 3-》优惠券渲染 4-》计算运费 5-》计算价格 6-》分销渲染 7-》其他渲染
|
||||
@ -18,4 +26,6 @@ public interface CartRenderStep {
|
||||
* @param tradeDTO 交易DTO
|
||||
*/
|
||||
void render(TradeDTO tradeDTO);
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.modules.order.cart.render;
|
||||
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.service.CartService;
|
||||
@ -44,20 +45,40 @@ public class TradeBuilder {
|
||||
|
||||
/**
|
||||
* 渲染整比交易
|
||||
* 0-> 校验商品, 1-》 满优惠渲染, 2->渲染优惠, 3->优惠券渲染, 4->计算运费, 5->计算价格, 6->分销渲染, 7->扩展操作
|
||||
* 校验商品 》 满优惠渲染 》 渲染优惠 》 优惠券渲染 》 计算运费 》 计算价格 》 分销渲染 》 订单SN初始化
|
||||
*/
|
||||
int[] defaultRender = {0, 1, 2, 4, 5, 6, 7};
|
||||
RenderStepEnums[] defaultRender = {
|
||||
RenderStepEnums.CHECK_DATA,
|
||||
RenderStepEnums.FULL_DISCOUNT,
|
||||
RenderStepEnums.SKU_PROMOTION,
|
||||
RenderStepEnums.COUPON,
|
||||
RenderStepEnums.SKU_FREIGHT,
|
||||
RenderStepEnums.CART_PRICE,
|
||||
RenderStepEnums.DISTRIBUTION,
|
||||
RenderStepEnums.CART_SN
|
||||
};
|
||||
|
||||
/**
|
||||
* 单个商品优惠,不需要渲染满减优惠
|
||||
* 用于特殊场景:例如积分商品,拼团商品,虚拟商品等等
|
||||
*/
|
||||
int[] singleRender = {0, 2, 4, 5, 6, 7};
|
||||
RenderStepEnums[] singleRender = {
|
||||
RenderStepEnums.CHECK_DATA,
|
||||
RenderStepEnums.SKU_PROMOTION,
|
||||
RenderStepEnums.SKU_FREIGHT,
|
||||
RenderStepEnums.CART_PRICE,
|
||||
RenderStepEnums.DISTRIBUTION,
|
||||
RenderStepEnums.CART_SN};
|
||||
|
||||
/**
|
||||
* 购物车购物车渲染
|
||||
* 0-> 校验商品, 1-》 满优惠渲染, 2->渲染优惠, 5->计算价格
|
||||
* 校验商品 》 满优惠渲染 》 渲染优惠 》计算价格
|
||||
*/
|
||||
int[] cartRender = {0, 1, 2, 5};
|
||||
RenderStepEnums[] cartRender = {
|
||||
RenderStepEnums.CHECK_DATA,
|
||||
RenderStepEnums.FULL_DISCOUNT,
|
||||
RenderStepEnums.SKU_PROMOTION,
|
||||
RenderStepEnums.CART_PRICE};
|
||||
|
||||
|
||||
/**
|
||||
@ -78,11 +99,15 @@ public class TradeBuilder {
|
||||
}
|
||||
|
||||
//按照计划进行渲染
|
||||
for (int index : cartRender) {
|
||||
try {
|
||||
cartRenderSteps.get(index).render(tradeDTO);
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e);
|
||||
for (RenderStepEnums step : cartRender) {
|
||||
for (CartRenderStep render : cartRenderSteps) {
|
||||
try {
|
||||
if (render.step().equals(step)) {
|
||||
render.render(tradeDTO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", render.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tradeDTO;
|
||||
@ -106,20 +131,27 @@ public class TradeBuilder {
|
||||
tradeDTO.setSkuList(collect);
|
||||
if (checkedWay.equals(CartTypeEnum.CART) || checkedWay.equals(CartTypeEnum.BUY_NOW) || checkedWay.equals(CartTypeEnum.VIRTUAL)) {
|
||||
//按照计划进行渲染
|
||||
for (int index : defaultRender) {
|
||||
try {
|
||||
cartRenderSteps.get(index).render(tradeDTO);
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e);
|
||||
for (RenderStepEnums step : defaultRender) {
|
||||
for (CartRenderStep render : cartRenderSteps) {
|
||||
try {
|
||||
if (render.step().equals(step)) {
|
||||
render.render(tradeDTO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", render.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//按照计划进行渲染
|
||||
for (int index : singleRender) {
|
||||
try {
|
||||
cartRenderSteps.get(index).render(tradeDTO);
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", cartRenderSteps.get(index).getClass(), e);
|
||||
for (RenderStepEnums step : singleRender) {
|
||||
for (CartRenderStep render : cartRenderSteps) {
|
||||
try {
|
||||
if (render.step().equals(step)) {
|
||||
render.render(tradeDTO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", render.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.goods.service.CategoryService;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
@ -49,6 +50,10 @@ public class CartPriceRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private KanjiaActivityGoodsService kanjiaActivityGoodsService;
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.CART_PRICE;
|
||||
}
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
//构造cartVO
|
||||
|
@ -3,6 +3,7 @@ package cn.lili.modules.order.cart.render.impl;
|
||||
import cn.lili.common.utils.SnowFlake;
|
||||
import cn.lili.modules.order.cart.entity.dto.StoreRemarkDTO;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -17,6 +18,11 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class CartSnRender implements CartRenderStep {
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.CART_SN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
|
||||
|
@ -14,6 +14,7 @@ import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
@ -58,6 +59,12 @@ public class CheckDataRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private PointsGoodsService pointsGoodsService;
|
||||
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.CHECK_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
//预校验
|
||||
@ -171,7 +178,7 @@ public class CheckDataRender implements CartRenderStep {
|
||||
String skuId = tradeDTO.getSkuList().get(0).getGoodsSku().getId();
|
||||
//获取积分商品VO
|
||||
PointsGoodsVO pointsGoodsVO = pointsGoodsService.getPointsGoodsVOByMongo(skuId);
|
||||
if(pointsGoodsVO==null){
|
||||
if (pointsGoodsVO == null) {
|
||||
throw new ServiceException(ResultCode.POINT_GOODS_ERROR);
|
||||
}
|
||||
Member member = memberService.getUserInfo();
|
||||
|
@ -3,6 +3,7 @@ package cn.lili.modules.order.cart.render.impl;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
import cn.lili.modules.order.order.entity.dto.PriceDetailDTO;
|
||||
@ -21,6 +22,12 @@ import java.util.Map;
|
||||
@Service
|
||||
public class CouponRender implements CartRenderStep {
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.COUPON;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
|
||||
|
@ -4,6 +4,7 @@ import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -25,6 +26,11 @@ public class DistributionPriceRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.DISTRIBUTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
//主要渲染各个优惠的价格
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.modules.order.cart.render.impl;
|
||||
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||
@ -29,6 +30,10 @@ public class FullDiscountRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private FullDiscountService fullDiscountService;
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.FULL_DISCOUNT;
|
||||
}
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
import cn.lili.modules.store.entity.dos.FreightTemplateChild;
|
||||
@ -31,6 +32,11 @@ public class SkuFreightRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private FreightTemplateService freightTemplateService;
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.SKU_FREIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
List<CartSkuVO> cartSkuVOS = tradeDTO.getSkuList();
|
||||
|
@ -5,6 +5,7 @@ import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||
@ -37,6 +38,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@Order(2)
|
||||
public class SkuPromotionRender implements CartRenderStep {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 促销计算
|
||||
*/
|
||||
@ -48,6 +52,11 @@ public class SkuPromotionRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
|
||||
@Override
|
||||
public RenderStepEnums step() {
|
||||
return RenderStepEnums.SKU_PROMOTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
|
||||
|
@ -647,17 +647,16 @@ public class CartServiceImpl implements CartService {
|
||||
* @param num 数量
|
||||
*/
|
||||
private void checkCart(CartTypeEnum cartTypeEnum, CartSkuVO cartSkuVO, String skuId, Integer num) {
|
||||
|
||||
this.checkSetGoodsQuantity(cartSkuVO, skuId, num);
|
||||
//拼团判定
|
||||
if (cartTypeEnum.equals(CartTypeEnum.PINTUAN)) {
|
||||
checkPintuan(cartSkuVO);
|
||||
//砍价判定
|
||||
checkPintuan(cartSkuVO);
|
||||
} else if (cartTypeEnum.equals(CartTypeEnum.KANJIA)) {
|
||||
checkKanjia(cartSkuVO);
|
||||
//检测购物车的数量
|
||||
} else {
|
||||
this.checkSetGoodsQuantity(cartSkuVO, skuId, num);
|
||||
checkKanjia(cartSkuVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -695,7 +694,7 @@ public class CartServiceImpl implements CartService {
|
||||
private void checkKanjia(CartSkuVO cartSkuVO) {
|
||||
|
||||
//根据skuId获取砍价商品
|
||||
KanjiaActivityGoodsDTO kanjiaActivityGoodsDTO=kanjiaActivityGoodsService.getKanjiaGoodsBySkuId(cartSkuVO.getGoodsSku().getId());
|
||||
KanjiaActivityGoodsDTO kanjiaActivityGoodsDTO = kanjiaActivityGoodsService.getKanjiaGoodsBySkuId(cartSkuVO.getGoodsSku().getId());
|
||||
|
||||
//查找当前会员的砍价商品活动
|
||||
KanjiaActivitySearchParams kanjiaActivitySearchParams = new KanjiaActivitySearchParams();
|
||||
|
@ -17,12 +17,12 @@ public class UserMenuVO extends Menu {
|
||||
/**
|
||||
* 是否是超级管理员
|
||||
*/
|
||||
private Boolean isSupper;
|
||||
private Boolean isSuper;
|
||||
|
||||
public Boolean getSupper() {
|
||||
if (this.isSupper == null) {
|
||||
public Boolean getSuper() {
|
||||
if (this.isSuper == null) {
|
||||
return false;
|
||||
}
|
||||
return isSupper;
|
||||
return isSuper;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
|
||||
* @param userId 用户ID
|
||||
* @return 用户菜单VO列表
|
||||
*/
|
||||
@Select("SELECT rm.is_super,m.*FROM li_menu AS m INNER JOIN li_role_menu AS rm ON rm.menu_id=m.id WHERE rm.role_id IN (" +
|
||||
@Select("SELECT rm.is_super as is_super,m.*FROM li_menu AS m INNER JOIN li_role_menu AS rm ON rm.menu_id=m.id WHERE rm.role_id IN (" +
|
||||
"SELECT ur.role_id FROM li_user_role AS ur WHERE ur.user_id=#{userId}) OR rm.role_id IN (" +
|
||||
"SELECT dr.role_id FROM li_department_role AS dr INNER JOIN li_admin_user AS au ON au.department_id=dr.department_id " +
|
||||
"WHERE au.id=#{userId}) GROUP BY m.id,rm.is_super ORDER BY rm.is_super desc")
|
||||
|
@ -8,7 +8,9 @@ import lombok.Data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 拼团活动实体类
|
||||
@ -27,15 +29,19 @@ public class Pintuan extends BasePromotion {
|
||||
private static final long serialVersionUID = -8465716592648602604L;
|
||||
|
||||
|
||||
@Min(message = "成团人数必须为数字", value = 0)
|
||||
@Min(message = "成团人数需大于等于2", value = 2)
|
||||
@Max(message = "成团人数最多10人", value = 10)
|
||||
@NotNull(message = "成团人数必填")
|
||||
@ApiModelProperty(value = "成团人数")
|
||||
private Integer requiredNum;
|
||||
|
||||
@Min(message = "限购数量必须为数字", value = 0)
|
||||
@NotNull(message = "限购数量必填")
|
||||
@ApiModelProperty(value = "限购数量")
|
||||
private Integer limitNum;
|
||||
|
||||
@ApiModelProperty(value = "虚拟成团", required = true)
|
||||
@NotNull(message = "虚拟成团必填")
|
||||
private Boolean fictitious;
|
||||
|
||||
@ApiModelProperty(value = "拼团规则")
|
||||
|
@ -83,7 +83,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate {
|
||||
//for循环路径集合
|
||||
for (String url : permissionUrl) {
|
||||
//如果是超级权限 则计入超级权限
|
||||
if (menu.getSupper()) {
|
||||
if (menu.getSuper()) {
|
||||
//如果已有超级权限,则这里就不做权限的累加
|
||||
if (!superPermissions.contains(url)) {
|
||||
superPermissions.add(url);
|
||||
@ -98,8 +98,8 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate {
|
||||
}
|
||||
}
|
||||
}
|
||||
//去除无效的权限
|
||||
superPermissions.forEach(queryPermissions::remove);
|
||||
//去除重复的权限
|
||||
queryPermissions.removeAll(superPermissions);
|
||||
});
|
||||
permission.put(PermissionEnum.SUPER.name(), superPermissions);
|
||||
permission.put(PermissionEnum.QUERY.name(), queryPermissions);
|
||||
|
@ -99,7 +99,7 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
|
||||
}
|
||||
//非get请求(数据操作) 判定鉴权
|
||||
else {
|
||||
if (PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER.name()).toArray(new String[0]), request.getRequestURI())) {
|
||||
if (PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER.name()).toArray(new String[0]), requestUrl)) {
|
||||
|
||||
} else {
|
||||
ResponseUtil.output(response, ResponseUtil.resultMap(false, 400, "权限不足"));
|
||||
|
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
@ -66,7 +67,7 @@ public class PintuanStoreController {
|
||||
|
||||
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "添加拼团活动")
|
||||
public ResultMessage<String> addPintuan(@RequestBody PintuanVO pintuan) {
|
||||
public ResultMessage<String> addPintuan(@RequestBody @Validated PintuanVO pintuan) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
pintuan.setStoreId(currentUser.getStoreId());
|
||||
pintuan.setStoreName(currentUser.getStoreName());
|
||||
@ -78,7 +79,7 @@ public class PintuanStoreController {
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ApiOperation(value = "修改拼团活动")
|
||||
public ResultMessage<String> editPintuan(@RequestBody PintuanVO pintuan) {
|
||||
public ResultMessage<String> editPintuan(@RequestBody @Validated PintuanVO pintuan) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
pintuan.setStoreId(currentUser.getStoreId());
|
||||
pintuan.setStoreName(currentUser.getStoreName());
|
||||
|
Loading…
x
Reference in New Issue
Block a user