|
@@ -1,15 +1,23 @@
|
|
|
package com.zhongzheng.modules.order.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.order.bo.OrderGoodsRefundAddBo;
|
|
|
import com.zhongzheng.modules.order.bo.OrderGoodsRefundEditBo;
|
|
|
import com.zhongzheng.modules.order.bo.OrderGoodsRefundQueryBo;
|
|
|
+import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoodsRefund;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderGoodsRefundMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsRefundService;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsRefundVo;
|
|
|
+import com.zhongzheng.modules.user.domain.User;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -19,6 +27,7 @@ import com.github.pagehelper.Page;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -30,6 +39,11 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMapper, OrderGoodsRefund> implements IOrderGoodsRefundService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IOrderGoodsService iOrderGoodsService;
|
|
|
+ @Autowired
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
+
|
|
|
@Override
|
|
|
public OrderGoodsRefundVo queryById(Long refundId){
|
|
|
OrderGoodsRefund db = this.baseMapper.selectById(refundId);
|
|
@@ -78,6 +92,29 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
return this.save(add);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, String> placeRefundOrder(OrderGoodsRefundAddBo bo) {
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderSn,bo.getOrderSn())
|
|
|
+ .eq(OrderGoods::getGoodsId, bo.getGoodsId()));
|
|
|
+ if(Validator.isEmpty(orderGoods)){
|
|
|
+ throw new CustomException("订单商品数据错误");
|
|
|
+ }
|
|
|
+ if(orderGoods.getPayStatus()!=3){
|
|
|
+ throw new CustomException("订单商品尚未完全收费");
|
|
|
+ }
|
|
|
+ if(orderGoods.getRefundStatus()==2){
|
|
|
+ throw new CustomException("订单商品已退款");
|
|
|
+ }
|
|
|
+ if(orderGoods.getRefundStatus()!=0){
|
|
|
+ throw new CustomException("订单商品目前无法退款");
|
|
|
+ }
|
|
|
+ //订单商品
|
|
|
+ Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId,bo.getGoodsId()));
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean updateByEditBo(OrderGoodsRefundEditBo bo) {
|
|
|
OrderGoodsRefund update = BeanUtil.toBean(bo, OrderGoodsRefund.class);
|