fix 修复售后bug
This commit is contained in:
@ -18,6 +18,8 @@ import java.util.stream.Stream;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum OrderInfoEnum {
|
public enum OrderInfoEnum {
|
||||||
|
|
||||||
|
STATUS_ne1(-1,"申请退款"),
|
||||||
|
STATUS_ne2(-2,"退款成功"),
|
||||||
STATUS_0(0,"默认"),
|
STATUS_0(0,"默认"),
|
||||||
STATUS_1(1,"待收货"),
|
STATUS_1(1,"待收货"),
|
||||||
STATUS_2(2,"已收货"),
|
STATUS_2(2,"已收货"),
|
||||||
|
|||||||
@ -30,6 +30,11 @@ public class YxStoreOrderCartInfo implements Serializable {
|
|||||||
/** 订单id */
|
/** 订单id */
|
||||||
private Long oid;
|
private Long oid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
|
||||||
/** 购物车id */
|
/** 购物车id */
|
||||||
private Long cartId;
|
private Long cartId;
|
||||||
|
|||||||
@ -26,9 +26,10 @@ public interface YxStoreOrderCartInfoService extends BaseService<YxStoreOrderCa
|
|||||||
/**
|
/**
|
||||||
* 添加购物车商品信息
|
* 添加购物车商品信息
|
||||||
* @param oid 订单id
|
* @param oid 订单id
|
||||||
|
* @param orderId 订单号
|
||||||
* @param cartInfo 购物车信息
|
* @param cartInfo 购物车信息
|
||||||
*/
|
*/
|
||||||
void saveCartInfo(Long oid, List<YxStoreCartQueryVo> cartInfo);
|
void saveCartInfo(Long oid, String orderId,List<YxStoreCartQueryVo> cartInfo);
|
||||||
|
|
||||||
YxStoreOrderCartInfo findByUni(String unique);
|
YxStoreOrderCartInfo findByUni(String unique);
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,11 @@ public class YxStoreOrderCartInfoDto implements Serializable {
|
|||||||
/** 订单id */
|
/** 订单id */
|
||||||
private Integer oid;
|
private Integer oid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
/** 购物车id */
|
/** 购物车id */
|
||||||
private Integer cartId;
|
private Integer cartId;
|
||||||
|
|
||||||
|
|||||||
@ -55,15 +55,17 @@ public class YxStoreOrderCartInfoServiceImpl extends BaseServiceImpl<StoreOrderC
|
|||||||
/**
|
/**
|
||||||
* 添加购物车商品信息
|
* 添加购物车商品信息
|
||||||
* @param oid 订单id
|
* @param oid 订单id
|
||||||
|
* @param orderId
|
||||||
* @param cartInfo 购物车信息
|
* @param cartInfo 购物车信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void saveCartInfo(Long oid, List<YxStoreCartQueryVo> cartInfo) {
|
public void saveCartInfo(Long oid, String orderId, List<YxStoreCartQueryVo> cartInfo) {
|
||||||
|
|
||||||
List<YxStoreOrderCartInfo> list = new ArrayList<>();
|
List<YxStoreOrderCartInfo> list = new ArrayList<>();
|
||||||
for (YxStoreCartQueryVo cart : cartInfo) {
|
for (YxStoreCartQueryVo cart : cartInfo) {
|
||||||
YxStoreOrderCartInfo info = new YxStoreOrderCartInfo();
|
YxStoreOrderCartInfo info = new YxStoreOrderCartInfo();
|
||||||
info.setOid(oid);
|
info.setOid(oid);
|
||||||
|
info.setOrderId(orderId);
|
||||||
info.setCartId(cart.getId());
|
info.setCartId(cart.getId());
|
||||||
info.setProductId(cart.getProductId());
|
info.setProductId(cart.getProductId());
|
||||||
info.setCartInfo(JSONObject.toJSON(cart).toString());
|
info.setCartInfo(JSONObject.toJSON(cart).toString());
|
||||||
|
|||||||
@ -536,7 +536,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
|
|
||||||
//保存购物车商品信息
|
//保存购物车商品信息
|
||||||
orderCartInfoService.saveCartInfo(storeOrder.getId(), cartInfo);
|
orderCartInfoService.saveCartInfo(storeOrder.getId(), storeOrder.getOrderId(),cartInfo);
|
||||||
|
|
||||||
|
|
||||||
//购物车状态修改
|
//购物车状态修改
|
||||||
|
|||||||
@ -86,10 +86,12 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
|||||||
yxStoreOrderCartInfo.setIsAfterSales(0);
|
yxStoreOrderCartInfo.setIsAfterSales(0);
|
||||||
storeOrderCartInfoMapper.updateById(yxStoreOrderCartInfo);
|
storeOrderCartInfoMapper.updateById(yxStoreOrderCartInfo);
|
||||||
|
|
||||||
yxStoreOrder.setStatus(-1);
|
|
||||||
storeOrderMapper.updateById(yxStoreOrder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//更新订单状态
|
||||||
|
yxStoreOrder.setStatus(-1);
|
||||||
|
yxStoreOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue());
|
||||||
|
storeOrderMapper.updateById(yxStoreOrder);
|
||||||
//生成售后订单
|
//生成售后订单
|
||||||
StoreAfterSales storeAfterSales = new StoreAfterSales();
|
StoreAfterSales storeAfterSales = new StoreAfterSales();
|
||||||
storeAfterSales.setOrderCode(storeAfterSalesParam.getOrderCode());
|
storeAfterSales.setOrderCode(storeAfterSalesParam.getOrderCode());
|
||||||
@ -170,7 +172,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
|||||||
}
|
}
|
||||||
baseMapper.selectPage(storeAfterSalesPage, Wrappers.<StoreAfterSales>lambdaQuery()
|
baseMapper.selectPage(storeAfterSalesPage, Wrappers.<StoreAfterSales>lambdaQuery()
|
||||||
.eq(uid != null, StoreAfterSales::getUserId, uid).in(status == 1, StoreAfterSales::getState, integers)
|
.eq(uid != null, StoreAfterSales::getUserId, uid).in(status == 1, StoreAfterSales::getState, integers)
|
||||||
.in(status == 2, StoreAfterSales::getState, integers)
|
.in(status != 0, StoreAfterSales::getState, integers)
|
||||||
.eq(StringUtils.isNotBlank(orderCode), StoreAfterSales::getOrderCode, orderCode)
|
.eq(StringUtils.isNotBlank(orderCode), StoreAfterSales::getOrderCode, orderCode)
|
||||||
.orderByDesc(StoreAfterSales::getCreateTime)
|
.orderByDesc(StoreAfterSales::getCreateTime)
|
||||||
.eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue()));
|
.eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue()));
|
||||||
@ -346,7 +348,9 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
|||||||
throw new YshopException("未查询到订单信息");
|
throw new YshopException("未查询到订单信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!yxStoreOrder.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue()) || !yxStoreOrder.getRefundStatus().equals(OrderInfoEnum.REFUND_STATUS_0.getValue()) || !yxStoreOrder.getStatus().equals(OrderInfoEnum.STATUS_2.getValue())) {
|
if (!yxStoreOrder.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
|
|| !yxStoreOrder.getRefundStatus().equals(OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
|
|| yxStoreOrder.getStatus() < OrderInfoEnum.STATUS_0.getValue()) {
|
||||||
throw new YshopException("订单状态不能售后");
|
throw new YshopException("订单状态不能售后");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user