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

Commit 54249b71 authored by 胡佳晨's avatar 胡佳晨

提交订单详情 是否有退款订单的判断

parent b9df4d2c
......@@ -102,6 +102,7 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_ORDER_UN_PAY = PREFIX.concat("order:un:pay:");//未支付订单id列表 key:$randomKey
public static final String REDIS_GOBLIN_ORDER_LIST = PREFIX.concat("order:id:list:");//用户订单id列表 key:$uid
public static final String REDIS_GOBLIN_ORDER_MASTER = PREFIX.concat("order:masterCode:");//用户订单id列表 key:$masterCode
public static final String REDIS_GOBLIN_BACK_ORDER_ID = PREFIX.concat("order:backIds:");//用户订单下的退款订单id key:$orderId
/* ----------------------------------------------------------------- */
/**
* SKU剩余库存
......
......@@ -29,6 +29,8 @@ public class GoblinAppOrderDetailsVo implements Serializable, Cloneable {
private Long restTime;
@ApiModelProperty(value = "是否可退款")
private int canRefund;
@ApiModelProperty(value = "退款订单数量")
private int refundSize;
private static final GoblinAppOrderDetailsVo obj = new GoblinAppOrderDetailsVo();
public static GoblinAppOrderDetailsVo getNew() {
......
......@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinAppOrderDetailsVo;
import com.liquidnet.service.goblin.dto.vo.GoblinAppOrderListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinBackOrderVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo;
import com.liquidnet.service.goblin.param.GoblinAppOrderRefundParam;
......@@ -17,4 +18,6 @@ public interface IGoblinOrderAppService {
ResponseDto<GoblinAppOrderDetailsVo> orderDetails(String orderId,String uid);
ResponseDto<Boolean> applyRefund(GoblinAppOrderRefundParam param);
ResponseDto<GoblinBackOrderVo> refundDetails(String orderId);
}
......@@ -112,6 +112,8 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
vo.setCanRefund(1);
}
}
int isRefund = redisUtils.getBackOrderByOrderId(orderId).size();
vo.setRefundSize(isRefund);
vo.setRestTime(getRestTime(orderVo));
vo.setStoreOrderVo(orderVo);
vo.setOrderSkuVos(skuVos);
......@@ -239,6 +241,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
//redis
redisUtils.setBackOrderVo(backOrder.getBackOrderId(), vo);
redisUtils.setGoblinOrder(orderVo.getOrderId(), orderVo);
redisUtils.addBackOrderByOrderId(orderVo.getOrderId(), backOrder.getBackOrderId());
//mongo
mongoUtils.insertGoblinBackOrderVo(vo);
mongoUtils.updateGoblinStoreOrderVo(orderVo.getOrderId(), orderVo);
......@@ -260,6 +263,11 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
return ResponseDto.success();
}
@Override
public ResponseDto<GoblinBackOrderVo> refundDetails(String orderId) {
return null;
}
private GoblinBackOrderLog initBackLog(String orderId, String uid, LocalDateTime now) {
GoblinBackOrderLog log = GoblinBackOrderLog.getNew();
log.setBackOrderId(orderId);
......
......@@ -410,6 +410,7 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
}
//redis
redisUtils.setBackOrderVo(backOrderVo.getBackOrderId(), backOrderVo);
redisUtils.addBackOrderByOrderId(orderVo.getOrderId(),backOrderVo.getBackOrderId());
//mongo
mongoUtils.insertGoblinBackOrderVo(backOrderVo);
//添加退款
......
......@@ -172,7 +172,7 @@ public class GoblinRedisUtils {
public GoblinStoreNoticeVo getStoreNoticeVo(String storeId, LocalDateTime nowTime) {
List<GoblinStoreNoticeVo> noticeVos = this.getStoreNoticeVos(storeId, nowTime);
int size = noticeVos.size();
for (int i = size-1; i >= 0; i--) {
for (int i = size - 1; i >= 0; i--) {
GoblinStoreNoticeVo noticeVo = noticeVos.get(i);
if (noticeVo.getReleaseTime().isBefore(nowTime)) {
noticeVos.removeIf(r -> (
......@@ -590,16 +590,16 @@ public class GoblinRedisUtils {
}
// 增加 sku销量
public int incrSkuSaleCount(String spuId,String skuId, int number) {
public int incrSkuSaleCount(String spuId, String skuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_COUNT.concat(skuId);
incrSpuSaleCount(spuId,number);
incrSpuSaleCount(spuId, number);
return (int) redisUtil.incr(redisKey, number);
}
// 减少 sku销量
public int decrSkuSaleCount(String spuId,String skuId, int number) {
public int decrSkuSaleCount(String spuId, String skuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_COUNT.concat(skuId);
decrSpuSaleCount(spuId,number);
decrSpuSaleCount(spuId, number);
return (int) redisUtil.decr(redisKey, number);
}
......@@ -761,4 +761,23 @@ public class GoblinRedisUtils {
return (GoblinBackOrderVo) obj;
}
}
// 获取 订单id下的退款订单id
public List<String> getBackOrderByOrderId(String orderId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_BACK_ORDER_ID.concat(orderId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return CollectionUtil.arrayListString();
} else {
return (List<String>) obj;
}
}
// 添加 订单id下的退款订单id
public void addBackOrderByOrderId(String orderId, String backOrderId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_BACK_ORDER_ID.concat(orderId);
List<String> list = getBackOrderByOrderId(orderId);
list.add(backOrderId);
redisUtil.set(redisKey, list);
}
}
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