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

Commit 6372d186 authored by 胡佳晨's avatar 胡佳晨

订单详情 增加逻辑是否可退款

增加拦截 sku退款
parent 2a8f6210
......@@ -130,6 +130,13 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
if (orderRefundIds.size() > 0) {
GoblinBackOrderVo backOrderVo = redisUtils.getBackOrderVo(orderRefundIds.get(orderRefundIds.size() - 1));
vo.setRefundStatus(backOrderVo.getStatus());
if(vo.getCanRefund()==1&&
(backOrderVo.getStatus()==2||backOrderVo.getStatus()==3||backOrderVo.getStatus()==5)&&
(vo.getStoreOrderVo().getStatus()==GoblinStatusConst.Status.ORDER_STATUS_2.getValue() || vo.getStoreOrderVo().getStatus()==GoblinStatusConst.Status.ORDER_STATUS_4.getValue())){
}else{
vo.setCanRefund(0);
}
} else {
vo.setRefundStatus(-1);
}
......
......@@ -876,7 +876,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinBackOrderSkuVo backOrderSkuVo : backOrderSkuVos) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(backOrderSkuVo.getOrderSkuId());
orderSkuVo.setPriceRefund(orderSkuVo.getPriceRefund() == null ? price : orderSkuVo.getPriceRefund().add(price));
if (orderSkuVo.getPriceRefund().compareTo(orderSkuVo.getSkuPriceActual()) == 0) {
if (orderSkuVo.getPriceRefund().compareTo(orderSkuVo.getSkuPriceActual()) >= 0) {
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_6.getValue());
String pre = GoblinStatusConst.MarketPreStatus.getPre(orderSkuVo.getSkuId());
String skuId = orderSkuVo.getSkuId();
......
......@@ -195,11 +195,11 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
log.setRemark("商铺取消订单");
//回退平台券
if (!(orderVo.getUcouponId() == null||orderVo.getUcouponId().equals(""))) {
if (!(orderVo.getUcouponId() == null || orderVo.getUcouponId().equals(""))) {
orderUtils.backCoupon(orderVo.getUcouponId(), orderVo.getUserId());
}
//回退店铺券
if (!(orderVo.getStoreCouponId() == null||orderVo.getStoreCouponId().equals(""))) {
if (!(orderVo.getStoreCouponId() == null || orderVo.getStoreCouponId().equals(""))) {
List<BackCouponParam> params = ObjectUtil.getBackCouponParam();
BackCouponParam backCouponParam = BackCouponParam.getNew();
backCouponParam.setuCouponIds(orderVo.getStoreCouponId());
......@@ -387,7 +387,7 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
if (orderVo == null || !orderVo.getStoreId().equals(storeInfoVo.getStoreId())) {
return ResponseDto.failure("无法查看");
}
if(orderSkuId!=null) {
if (orderSkuId != null) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuId);
if (orderSkuVo == null) {
return ResponseDto.failure("不存在");
......@@ -402,9 +402,13 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
backOrderSkuVo.setSkuSpecs(orderSkuVo.getSkuSpecs());
backOrderSkuVo.setCreatedAt(nowStr);
orderSkuVoList.add(backOrderSkuVo);
}else{
BigDecimal backOrderSkuVoPrice = mongoUtils.getRefundOrderSkuVoPrice(orderSkuId);
if (price.compareTo(orderSkuVo.getSkuPriceActual().subtract(backOrderSkuVoPrice)) > 0) {
return ResponseDto.failure("退款价格超过商品可退价格");
}
} else {
refundPrice = BigDecimal.ZERO;
for (String orderSkuIdItem: orderVo.getOrderSkuVoIds()) {
for (String orderSkuIdItem : orderVo.getOrderSkuVoIds()) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuIdItem);
GoblinBackOrderSkuVo backOrderSkuVo = GoblinBackOrderSkuVo.getNew();
backOrderSkuVo.setOrderSkuId(orderSkuIdItem);
......@@ -416,7 +420,7 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
backOrderSkuVo.setSkuSpecs(orderSkuVo.getSkuSpecs());
backOrderSkuVo.setCreatedAt(nowStr);
orderSkuVoList.add(backOrderSkuVo);
refundPrice = refundPrice.add(orderSkuVo.getSkuPriceActual());
refundPrice = refundPrice.add(orderSkuVo.getSkuPriceActual().subtract(orderSkuVo.getPriceRefund()));
}
}
//记录退款单
......
......@@ -49,6 +49,8 @@ public class GoblinMongoUtils {
MongoTemplate mongoTemplate;
@Autowired
MongoConverter mongoConverter;
@Autowired
GoblinRedisUtils redisUtils;
/* ---------------------------------------- 平台分类数据源 ---------------------------------------- */
......@@ -1145,6 +1147,19 @@ public class GoblinMongoUtils {
}
//获取退款sku订单价格
public BigDecimal getRefundOrderSkuVoPrice(String orderSkuId) {
BigDecimal refundPrice = BigDecimal.ZERO;
List<GoblinBackOrderVo> backOrderVos = mongoTemplate.find(Query.query(Criteria.where("backOrderSkuVos.orderSkuId").is(orderSkuId).and("status").in(3, 5, 9)),
GoblinBackOrderVo.class, GoblinBackOrderVo.class.getSimpleName());
for (GoblinBackOrderVo vo : backOrderVos) {
for (GoblinBackOrderSkuVo orderSkuVo : vo.getBackOrderSkuVos()) {
refundPrice = refundPrice.add(orderSkuVo.getRefundPrice());
}
}
return refundPrice;
}
;
/* ---------------------------------------- 商城:用户优惠券 ---------------------------------------- */
......
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