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

Commit 9dc07321 authored by 胡佳晨's avatar 胡佳晨

修复 拒绝退款 用户订单详情报错

用券逻辑修改
parent f2e25ed3
...@@ -112,6 +112,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService { ...@@ -112,6 +112,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
return ResponseDto.failure(ErrorMapping.get("20003")); return ResponseDto.failure(ErrorMapping.get("20003"));
} }
GoblinAppOrderDetailsVo vo = GoblinAppOrderDetailsVo.getNew(); GoblinAppOrderDetailsVo vo = GoblinAppOrderDetailsVo.getNew();
vo.setStoreOrderVo(orderVo);
List<GoblinOrderSkuVo> skuVos = ObjectUtil.getGoblinOrderSkuVoArrayList(); List<GoblinOrderSkuVo> skuVos = ObjectUtil.getGoblinOrderSkuVoArrayList();
for (String orderSkuId : orderVo.getOrderSkuVoIds()) { for (String orderSkuId : orderVo.getOrderSkuVoIds()) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuId); GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuId);
......
...@@ -316,16 +316,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -316,16 +316,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
//商铺券 //商铺券
BigDecimal storeVoucherPrice = BigDecimal.ZERO; BigDecimal storeVoucherPrice = BigDecimal.ZERO;
if (storeVoucherCode != null && !storeVoucherCode.equals("")) { if (storeVoucherCode != null && !storeVoucherCode.equals("")) {
String spuIds = ""; GoblinUseResultVo storeCouponVo = orderUtils.useStoreCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, goblinOrderSkuList, uid);
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) {
spuIds = spuIds.concat(item.getSpuId().split(pre)[0] + ",");
} else {
spuIds = spuIds.concat(item.getSpuId() + ",");
}
}
GoblinUseResultVo storeCouponVo = orderUtils.useStoreCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid);
String typeVoucher; String typeVoucher;
if (storeCouponVo != null) { if (storeCouponVo != null) {
storeVoucherPrice = storeCouponVo.getValue(); storeVoucherPrice = storeCouponVo.getValue();
......
...@@ -16,6 +16,8 @@ import com.liquidnet.service.goblin.dto.vo.*; ...@@ -16,6 +16,8 @@ import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinBackOrder; import com.liquidnet.service.goblin.entity.GoblinBackOrder;
import com.liquidnet.service.goblin.entity.GoblinBackOrderLog; import com.liquidnet.service.goblin.entity.GoblinBackOrderLog;
import com.liquidnet.service.goblin.entity.GoblinOrderOperationLog; import com.liquidnet.service.goblin.entity.GoblinOrderOperationLog;
import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import com.liquidnet.service.goblin.param.CouponCanUse2Param;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -188,7 +190,7 @@ public class GoblinOrderUtils { ...@@ -188,7 +190,7 @@ public class GoblinOrderUtils {
} }
} }
public GoblinUseResultVo useStoreCoupon(String ucouponId, String content, BigDecimal totalPrice, String spuId, String uid) { public GoblinUseResultVo useStoreCoupon(String ucouponId, String content, BigDecimal totalPrice, List<GoblinOrderSku> goblinOrderSkuList, String uid) {
try { try {
List<GoblinUserCouponVo> voList = redisUtils.getUserCouponVos(uid); List<GoblinUserCouponVo> voList = redisUtils.getUserCouponVos(uid);
GoblinUseResultVo returnVo = GoblinUseResultVo.getNew(); GoblinUseResultVo returnVo = GoblinUseResultVo.getNew();
...@@ -222,13 +224,19 @@ public class GoblinOrderUtils { ...@@ -222,13 +224,19 @@ public class GoblinOrderUtils {
break; break;
} else { } else {
List<String> spuIds = redisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); List<String> spuIds = redisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
if (spuId == null) { if (spuIds == null) {
continue; break;
} }
//判断是否在可用商品内 //判断是否在可用商品内
List<String> spuList = Arrays.asList(spuId.split(",")); BigDecimal contentPrice = BigDecimal.ZERO;
for (String item : spuIds) { for (String item : spuIds) {
if (spuList.contains(item)) { for (GoblinOrderSku param : goblinOrderSkuList) {
if (param.getSpuId().equals(item)) {
contentPrice = contentPrice.add(param.getSkuPriceActual());
}
}
}
if (vo.getTriggers().compareTo(contentPrice) <= 0) {
if (vo.getType().equals("1")) {//代金券 if (vo.getType().equals("1")) {//代金券
returnVo.setValue(vo.getValFace()); returnVo.setValue(vo.getValFace());
returnVo.setCouType(vo.getType()); returnVo.setCouType(vo.getType());
...@@ -249,8 +257,7 @@ public class GoblinOrderUtils { ...@@ -249,8 +257,7 @@ public class GoblinOrderUtils {
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId())); SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId()));
} }
break;
}
} }
} }
break; break;
......
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