fix 修复售后bug
This commit is contained in:
@ -30,6 +30,11 @@ public class YxStoreOrderCartInfo implements Serializable {
|
||||
/** 订单id */
|
||||
private Long oid;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
|
||||
/** 购物车id */
|
||||
private Long cartId;
|
||||
|
@ -26,9 +26,10 @@ public interface YxStoreOrderCartInfoService extends BaseService<YxStoreOrderCa
|
||||
/**
|
||||
* 添加购物车商品信息
|
||||
* @param oid 订单id
|
||||
* @param orderId 订单号
|
||||
* @param cartInfo 购物车信息
|
||||
*/
|
||||
void saveCartInfo(Long oid, List<YxStoreCartQueryVo> cartInfo);
|
||||
void saveCartInfo(Long oid, String orderId,List<YxStoreCartQueryVo> cartInfo);
|
||||
|
||||
YxStoreOrderCartInfo findByUni(String unique);
|
||||
|
||||
|
@ -21,6 +21,11 @@ public class YxStoreOrderCartInfoDto implements Serializable {
|
||||
/** 订单id */
|
||||
private Integer oid;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/** 购物车id */
|
||||
private Integer cartId;
|
||||
|
||||
|
@ -55,15 +55,17 @@ public class YxStoreOrderCartInfoServiceImpl extends BaseServiceImpl<StoreOrderC
|
||||
/**
|
||||
* 添加购物车商品信息
|
||||
* @param oid 订单id
|
||||
* @param orderId
|
||||
* @param cartInfo 购物车信息
|
||||
*/
|
||||
@Override
|
||||
public void saveCartInfo(Long oid, List<YxStoreCartQueryVo> cartInfo) {
|
||||
public void saveCartInfo(Long oid, String orderId, List<YxStoreCartQueryVo> cartInfo) {
|
||||
|
||||
List<YxStoreOrderCartInfo> list = new ArrayList<>();
|
||||
for (YxStoreCartQueryVo cart : cartInfo) {
|
||||
YxStoreOrderCartInfo info = new YxStoreOrderCartInfo();
|
||||
info.setOid(oid);
|
||||
info.setOrderId(orderId);
|
||||
info.setCartId(cart.getId());
|
||||
info.setProductId(cart.getProductId());
|
||||
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);
|
||||
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.setOrderCode(storeAfterSalesParam.getOrderCode());
|
||||
@ -170,7 +172,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
}
|
||||
baseMapper.selectPage(storeAfterSalesPage, Wrappers.<StoreAfterSales>lambdaQuery()
|
||||
.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)
|
||||
.orderByDesc(StoreAfterSales::getCreateTime)
|
||||
.eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue()));
|
||||
@ -346,7 +348,9 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
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("订单状态不能售后");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user