记得上下班打卡 | git大法好,push需谨慎

Commit d50cd351 authored by 胡佳晨's avatar 胡佳晨

用券接口增加店铺id

parent 5bcabf4a
...@@ -23,7 +23,7 @@ public interface GoblinCouponService { ...@@ -23,7 +23,7 @@ public interface GoblinCouponService {
List<GoblinUserCouponVo> getList(String type); List<GoblinUserCouponVo> getList(String type);
//是否可用券 [价格] [spuId逗号隔开] [uid] //是否可用券 [价格] [spuId逗号隔开] [uid]
GoblinUserCouponVo canUse(BigDecimal totalPrice, String spuId, String uid); GoblinUserCouponVo canUse(BigDecimal totalPrice, String spuId, String uid,String storeId);
//可用券列表 [价格] [spuId逗号隔开] [uid] //可用券列表 [价格] [spuId逗号隔开] [uid]
List<GoblinUserCouponVo> useList(BigDecimal totalPrice, String spuId, String uid); List<GoblinUserCouponVo> useList(BigDecimal totalPrice, String spuId, String uid);
......
...@@ -118,7 +118,7 @@ public class GoblinCouponController { ...@@ -118,7 +118,7 @@ public class GoblinCouponController {
}) })
public ResponseDto<GoblinUserCouponVo> fetched(@NotBlank(message = "店铺ID不能为空") @RequestParam("storeId") String storeId, public ResponseDto<GoblinUserCouponVo> fetched(@NotBlank(message = "店铺ID不能为空") @RequestParam("storeId") String storeId,
@NotBlank(message = "平台券ID不能为空") @RequestParam("storeCouponId") String storeCouponId, @NotBlank(message = "平台券ID不能为空") @RequestParam("storeCouponId") String storeCouponId,
@NotBlank(message = "UID不能为空")@RequestParam("uid") String uid) { @NotBlank(message = "UID不能为空") @RequestParam("uid") String uid) {
// if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeId)) { // if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeId)) {
// return ResponseDto.failure(ErrorMapping.get("149002")); // return ResponseDto.failure(ErrorMapping.get("149002"));
// } // }
...@@ -172,14 +172,16 @@ public class GoblinCouponController { ...@@ -172,14 +172,16 @@ public class GoblinCouponController {
@ApiImplicitParam(type = "form", required = true, dataType = "Number", name = "totalPrice", value = "spuId"), @ApiImplicitParam(type = "form", required = true, dataType = "Number", name = "totalPrice", value = "spuId"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "逗号隔开"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "逗号隔开"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "uid", value = "用户id"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "uid", value = "用户id"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺id"),
}) })
public ResponseDto<GoblinUserCouponVo> canUse(@RequestParam("totalPrice") @Valid BigDecimal totalPrice, public ResponseDto<GoblinUserCouponVo> canUse(@RequestParam("totalPrice") @Valid BigDecimal totalPrice,
@RequestParam("spuId") @Valid String spuId, @RequestParam("spuId") @Valid String spuId,
@RequestParam("storeId") @Valid String storeId,
@RequestParam(value = "uid", required = false) @Valid String uid) { @RequestParam(value = "uid", required = false) @Valid String uid) {
if (uid == null) { if (uid == null) {
uid = CurrentUtil.getCurrentUid(); uid = CurrentUtil.getCurrentUid();
} }
return ResponseDto.success(goblinCouponService.canUse(totalPrice, spuId, uid)); return ResponseDto.success(goblinCouponService.canUse(totalPrice, spuId, uid,storeId));
} }
@PostMapping("useList") @PostMapping("useList")
......
...@@ -130,13 +130,13 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -130,13 +130,13 @@ public class GoblinCouponImpl implements GoblinCouponService {
} }
@Override @Override
public GoblinUserCouponVo canUse(BigDecimal totalPrice, String spuId, String uid) { public GoblinUserCouponVo canUse(BigDecimal totalPrice, String spuId, String uid, String storeId) {
BigDecimal maxPrice = BigDecimal.ZERO; BigDecimal maxPrice = BigDecimal.ZERO;
GoblinUserCouponVo returnVo = GoblinUserCouponVo.getNew(); GoblinUserCouponVo returnVo = GoblinUserCouponVo.getNew();
List<GoblinUserCouponVo> voList = goblinRedisUtils.getUserCouponVos(uid); List<GoblinUserCouponVo> voList = goblinRedisUtils.getUserCouponVos(uid);
for (GoblinUserCouponVo vo : voList) { for (GoblinUserCouponVo vo : voList) {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) { if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0 && vo.getStoreId().equals(storeId)) {
if (vo.getUseScope().equals("0")) { if (vo.getUseScope().equals("0")) {
BigDecimal tempPrice = BigDecimal.ZERO; BigDecimal tempPrice = BigDecimal.ZERO;
if (vo.getType().equals("1")) {//代金券 if (vo.getType().equals("1")) {//代金券
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment