|
@@ -10,13 +10,16 @@ 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.Order;
|
|
|
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.service.IOrderService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsRefundVo;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -42,7 +45,11 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
@Autowired
|
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
|
@Autowired
|
|
|
+ private IOrderService iOrderService;
|
|
|
+ @Autowired
|
|
|
private IGoodsService iGoodsService;
|
|
|
+ @Autowired
|
|
|
+ private IWxPayService iWxPayService;
|
|
|
|
|
|
@Override
|
|
|
public OrderGoodsRefundVo queryById(Long refundId){
|
|
@@ -93,7 +100,7 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, String> placeRefundOrder(OrderGoodsRefundAddBo bo) {
|
|
|
+ public Map<String, String> placeRefundSmallOrder(OrderGoodsRefundAddBo bo) {
|
|
|
OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderSn,bo.getOrderSn())
|
|
|
.eq(OrderGoods::getGoodsId, bo.getGoodsId()));
|
|
|
if(Validator.isEmpty(orderGoods)){
|
|
@@ -109,9 +116,28 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
throw new CustomException("订单商品目前无法退款");
|
|
|
}
|
|
|
//订单商品
|
|
|
+ Order order = iOrderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn,bo.getOrderSn()));
|
|
|
+ if(order.getStatus()==0){
|
|
|
+ throw new CustomException("订单无效");
|
|
|
+ }
|
|
|
+ if(order.getOrderFrom()!=2){
|
|
|
+ throw new CustomException("不支持非小程序订单退款");
|
|
|
+ }
|
|
|
+ //订单商品
|
|
|
Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId,bo.getGoodsId()));
|
|
|
-
|
|
|
-
|
|
|
+ if(goods.getGoodsType()==1){
|
|
|
+ //视频商品
|
|
|
+ }
|
|
|
+ OrderGoodsRefund add = BeanUtil.toBean(bo, OrderGoodsRefund.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ //退款单号
|
|
|
+ String out_trade_no = DateUtils.getDateOrderSn();
|
|
|
+ add.setRefundSn(out_trade_no);
|
|
|
+ add.setRefundFee(orderGoods.getGoodsReceived());
|
|
|
+ add.setUserId(order.getUserId());
|
|
|
+ Map<String, String> payResult = iWxPayService.refund(out_trade_no,order.getTransid(),order.getPayPrice().toString(),"1");
|
|
|
return null;
|
|
|
}
|
|
|
|