fix 修复售后bug

This commit is contained in:
pepis
2021-09-23 18:28:13 +08:00
parent 8f793d49a7
commit 32f196a78f
5 changed files with 40 additions and 14 deletions

View File

@ -87,12 +87,9 @@ public class StoreAfterSalesController {
if (StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
}
List<StoreAfterSalesVo> storeInfo = storeAfterSalesService.getStoreInfo(key, id, uid);
if (storeInfo.size() < 1) {
throw new YshopException("售后订单不存在");
}
storeAfterSalesService.handleSales(storeInfo.get(0));
return ApiResult.ok(storeInfo.get(0));
StoreAfterSalesVo storeInfo = storeAfterSalesService.getStoreInfoByOrderCodeAndAfterIdAndUid(key, id, uid);
storeAfterSalesService.handleSales(storeInfo);
return ApiResult.ok(storeInfo);
}
@AppLog(value = "通过订单号搜索", type = 1)
@ -107,10 +104,10 @@ public class StoreAfterSalesController {
if (StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
}
List<StoreAfterSalesVo> storeInfo = storeAfterSalesService.getStoreInfo(key, null, uid);
for (StoreAfterSalesVo storeAfterSalesVo : storeInfo) {
storeAfterSalesService.handleSales(storeAfterSalesVo);
}
List<StoreAfterSalesVo> storeInfo = storeAfterSalesService.getStoreInfoByOrderCodeAndUid(key, uid);
storeInfo.forEach(item ->
storeAfterSalesService.handleSales(item)
);
if (ObjectUtil.isNull(storeInfo)) {
throw new YshopException("售后订单不存在");
}

View File

@ -31,6 +31,7 @@ public interface StoreAfterSalesService extends BaseService<StoreAfterSales> {
/**
* 查询订单详情
* @param key 订单号
* @return
*/
List<YxStoreOrderCartInfoVo> checkOrderDetails(String key);
@ -48,10 +49,17 @@ public interface StoreAfterSalesService extends BaseService<StoreAfterSales> {
/**
* 查询详情
* @param key 订单号
* @param id
* @param id 售后单id
* @param uid 用户id
*/
List<StoreAfterSalesVo> getStoreInfo(String key, Long id, Long uid);
StoreAfterSalesVo getStoreInfoByOrderCodeAndAfterIdAndUid(String key, Long id, Long uid);
/**
* 查询详情
* @param key 订单号
* @param uid 用户id
*/
List<StoreAfterSalesVo> getStoreInfoByOrderCodeAndUid(String key, Long uid);
/**
*

View File

@ -1,5 +1,6 @@
package co.yixiang.modules.sales.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import co.yixiang.api.YshopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
@ -132,6 +133,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
public List<YxStoreOrderCartInfoVo> checkOrderDetails(String key) {
List<YxStoreOrderCartInfo> yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.<YxStoreOrderCartInfo>lambdaQuery().eq(YxStoreOrderCartInfo::getOid, key));
YxStoreOrder yxStoreOrder = storeOrderMapper.selectById(key);
//查询 售后信息
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, yxStoreOrder.getOrderId()));
List<YxStoreOrderCartInfoVo> yxStoreOrderCartInfoVos = new ArrayList<>();
for (YxStoreOrderCartInfo yxStoreOrderCartInfo : yxStoreOrderCartInfos) {
@ -151,6 +154,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
BigDecimal commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice());
yxStoreOrderCartInfoVo.setRefundablePrice(NumberUtil.sub(totalAmountOfGoods, commodityDiscountAmount));
yxStoreOrderCartInfoVo.setReasons(storeAfterSales.getReasons());
yxStoreOrderCartInfoVos.add(yxStoreOrderCartInfoVo);
}
@ -190,8 +195,16 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
}
@Override
public List<StoreAfterSalesVo> getStoreInfo(String key, Long id, Long uid) {
List<StoreAfterSales> storeAfterSales = baseMapper.selectList(Wrappers.<StoreAfterSales>lambdaQuery().eq(id != null, StoreAfterSales::getId, id).eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getOrderCode, key));
public StoreAfterSalesVo getStoreInfoByOrderCodeAndAfterIdAndUid(String key, Long id, Long uid) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(id != null, StoreAfterSales::getId, id).eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getOrderCode, key));
StoreAfterSalesVo salesVo = generator.convert(storeAfterSales, StoreAfterSalesVo.class);
// salesVo.setCloseAfterSaleTime(DateUtil.tomorrow().toTimestamp());
return salesVo;
}
@Override
public List<StoreAfterSalesVo> getStoreInfoByOrderCodeAndUid(String key, Long uid) {
List<StoreAfterSales> storeAfterSales = baseMapper.selectList(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getOrderCode, key));
return generator.convert(storeAfterSales, StoreAfterSalesVo.class);
}

View File

@ -119,4 +119,9 @@ public class StoreAfterSalesVo {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp revocationTime;
/**
* 关闭售后时间
*/
private Timestamp closeAfterSaleTime;
}

View File

@ -43,4 +43,7 @@ public class YxStoreOrderCartInfoVo {
/** 可退價格 */
private BigDecimal refundablePrice;
/** 申请原因 */
private String reasons;
}