售后问题修复

This commit is contained in:
taozi
2023-04-05 19:43:33 +08:00
parent 61382e277c
commit 631f584494
6 changed files with 64 additions and 26 deletions

View File

@ -298,5 +298,10 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
Map<String,Object> chartCount();
void retrunStock(String orderId);
/**
* 回滚库存、退积分、优惠券
*
* @param orderId 订单id
*/
void returnStock(String orderId);
}

View File

@ -690,7 +690,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
price.doubleValue(),
NumberUtil.add(price, userQueryVo.getNowMoney()).doubleValue(),
"订单退款到余额" + price + "", orderQueryVo.getId().toString());
this.retrunStock(orderQueryVo.getOrderId());
this.returnStock(orderQueryVo.getOrderId());
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId()).one();
@ -707,7 +707,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
yxStoreOrderMapper.updateById(storeOrder);
orderStatusService.create(orderQueryVo.getId(), OrderLogEnum.ORDER_EDIT.getValue(), "退款给用户:" + orderQueryVo.getPayIntegral() + "");
this.retrunStock(orderQueryVo.getOrderId());
this.returnStock(orderQueryVo.getOrderId());
}
orderStatusService.create(orderQueryVo.getId(), OrderLogEnum.REFUND_ORDER_SUCCESS.getValue(), "退款给用户:" + price + "");
@ -1380,7 +1380,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
wrapperSeven.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
.in(YxStoreOrder::getRefundStatus, Arrays.asList(strArr));
Long refundCount = yxStoreOrderMapper.selectCount(wrapperSeven);
//售后退款
Long salesCount = storeAfterSalesService.lambdaQuery()
.eq(Objects.nonNull(uid),StoreAfterSales::getUserId, uid)
.count();
return UserOrderCountVo.builder()
.orderCount(orderCount)
@ -1390,7 +1393,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
.receivedCount(receivedCount)
.evaluatedCount(evaluatedCount)
.completeCount(completeCount)
.refundCount(refundCount)
.refundCount(salesCount)
.build();
}
@ -2258,7 +2261,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
}
@Override
public void retrunStock(String orderId) {
public void returnStock(String orderId) {
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, null);
this.regressionIntegral(order, 1);
this.regressionStock(order, 1);

View File

@ -237,21 +237,25 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
@Override
public Boolean revoke(String key, Long uid, Long id) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getId, id).eq(StoreAfterSales::getOrderCode, key));
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().
eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getId, id)
.eq(StoreAfterSales::getOrderCode, key));
if (storeAfterSales == null) {
throw new YshopException("未查询到售后订单信息");
}
if (storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_2.getValue()) || storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_3.getValue())) {
if (storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_2.getValue())
|| storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_3.getValue())) {
throw new YshopException("订单不能撤销");
}
storeAfterSales.setSalesState(1);
YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.<YxStoreOrder>lambdaQuery().eq(YxStoreOrder::getOrderId, key));
// yxStoreOrder.setStatus(OrderInfoEnum.STATUS_0.getValue());
yxStoreOrder.setStatus(OrderInfoEnum.STATUS_0.getValue());
yxStoreOrder.setRefundStatus(OrderInfoEnum.STATUS_0.getValue());
storeOrderMapper.updateById(yxStoreOrder);
List<YxStoreOrderCartInfo> yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.<YxStoreOrderCartInfo>lambdaQuery().eq(YxStoreOrderCartInfo::getOid, yxStoreOrder.getId()));
List<YxStoreOrderCartInfo> yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.<YxStoreOrderCartInfo>lambdaQuery()
.eq(YxStoreOrderCartInfo::getOid, yxStoreOrder.getId()));
for (YxStoreOrderCartInfo yxStoreOrderCartInfo : yxStoreOrderCartInfos) {
yxStoreOrderCartInfo.setIsAfterSales(1);
storeOrderCartInfoMapper.updateById(yxStoreOrderCartInfo);
@ -261,7 +265,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
storeAfterSalesStatus.setChangeType(5);
storeAfterSalesStatus.setChangeMessage("售后订单生成");
storeAfterSalesStatus.setChangeMessage("售后订单撤回");
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
storeAfterSalesStatus.setOperator("用户操作");
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
@ -310,8 +314,6 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSales.setConsignee(consignee);
storeAfterSales.setPhoneNumber(phoneNumber);
storeAfterSales.setAddress(address);
} else {
this.makeMoney(storeAfterSales.getId(),storeAfterSales.getOrderCode());
}
//操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();