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

Commit 6b3525c4 authored by 胡佳晨's avatar 胡佳晨

修改券列表

parent 2e5a3cb2
...@@ -9,6 +9,7 @@ import lombok.Data; ...@@ -9,6 +9,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 商城:用户优惠券展示信息(缓存) * 商城:用户优惠券展示信息(缓存)
...@@ -61,6 +62,8 @@ public class GoblinUserCouponVo implements Serializable, Cloneable { ...@@ -61,6 +62,8 @@ public class GoblinUserCouponVo implements Serializable, Cloneable {
@ApiModelProperty(position = 35, value = "店铺ID") @ApiModelProperty(position = 35, value = "店铺ID")
private String storeId; private String storeId;
@ApiModelProperty(position = 36, value = "spuIds")
private List<String> spuIds;
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
......
...@@ -211,6 +211,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -211,6 +211,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getDuedAt().isAfter(now) && vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) { if (vo.getDuedAt().isAfter(now) && vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
if (vo.getUseScope().equals("0")) { if (vo.getUseScope().equals("0")) {
vo.setSpuIds(CollectionUtil.linkedListString());
returnList.add(vo); returnList.add(vo);
} else { } else {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
...@@ -221,6 +222,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -221,6 +222,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
for (String item : spuIds) { for (String item : spuIds) {
List<String> spuList = Arrays.asList(spuId.split(",")); List<String> spuList = Arrays.asList(spuId.split(","));
if (spuList.contains(item)) { if (spuList.contains(item)) {
vo.setSpuIds(spuIds);
returnList.add(vo); returnList.add(vo);
break; break;
} }
...@@ -242,6 +244,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -242,6 +244,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getDuedAt().isAfter(now) && vo.getState().equals(1)) { if (vo.getDuedAt().isAfter(now) && vo.getState().equals(1)) {
if (vo.getUseScope().equals("0")) { if (vo.getUseScope().equals("0")) {
vo.setSpuIds(CollectionUtil.linkedListString());
returnList.add(vo); returnList.add(vo);
} else { } else {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
...@@ -249,6 +252,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -249,6 +252,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
for (String item : spuIds) { for (String item : spuIds) {
List<String> spuList = param.getSpuIds(); List<String> spuList = param.getSpuIds();
if (spuList.contains(item)) { if (spuList.contains(item)) {
vo.setSpuIds(spuIds);
returnList.add(vo); returnList.add(vo);
break; break;
} }
...@@ -273,6 +277,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -273,6 +277,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getDuedAt().isAfter(now) && vo.getState().equals(1)) {//&& vo.getTriggers().compareTo(totalPrice) <= 0 if (vo.getDuedAt().isAfter(now) && vo.getState().equals(1)) {//&& vo.getTriggers().compareTo(totalPrice) <= 0
if (vo.getUseScope().equals("0") && vo.getTriggers().compareTo(totalPrice) <= 0) { if (vo.getUseScope().equals("0") && vo.getTriggers().compareTo(totalPrice) <= 0) {
vo.setSpuIds(CollectionUtil.linkedListString());
returnList.add(vo); returnList.add(vo);
} else { } else {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
...@@ -283,12 +288,18 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -283,12 +288,18 @@ public class GoblinCouponImpl implements GoblinCouponService {
BigDecimal contentPrice = BigDecimal.ZERO; BigDecimal contentPrice = BigDecimal.ZERO;
for (String item : spuIds) { for (String item : spuIds) {
for (CouponCanUse2Param param2 : param.getParam()) { for (CouponCanUse2Param param2 : param.getParam()) {
if (param2.getSpuId().equals(item)) { String pre = GoblinStatusConst.MarketPreStatus.getPre(param2.getSpuId());
String spuId = param2.getSpuId();
if (pre != null) {
spuId = param2.getSpuId().split(pre)[0];
}
if (spuId.equals(item)) {
contentPrice = contentPrice.add(param2.getPrice()); contentPrice = contentPrice.add(param2.getPrice());
} }
} }
} }
if (vo.getTriggers().compareTo(contentPrice) <= 0) { if (vo.getTriggers().compareTo(contentPrice) <= 0) {
vo.setSpuIds(spuIds);
returnList.add(vo); returnList.add(vo);
} }
} }
......
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