| 
														
															@@ -9,7 +9,6 @@ import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.common.constant.SysConfigConstant; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.common.constant.SysConfigConstant; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dto.req.OrderReq; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dto.req.OrderReq; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.yonge.cooleshow.biz.dal.entity.UserOrderDetail; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.entity.UserOrder; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.entity.UserOrder; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.entity.UserOrderPayment; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.entity.UserOrderPayment; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.sdk.PaymentSdk; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.sdk.PaymentSdk; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -30,7 +29,6 @@ import org.springframework.stereotype.Service; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dao.UserOrderDao; 
														 | 
														
														 | 
														
															 import com.yonge.cooleshow.biz.dal.dao.UserOrderDao; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.transaction.annotation.Transactional; 
														 | 
														
														 | 
														
															 import org.springframework.transaction.annotation.Transactional; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import springfox.documentation.spring.web.json.Json; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import javax.annotation.PostConstruct; 
														 | 
														
														 | 
														
															 import javax.annotation.PostConstruct; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.math.BigDecimal; 
														 | 
														
														 | 
														
															 import java.math.BigDecimal; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -39,7 +37,6 @@ import java.util.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.function.Consumer; 
														 | 
														
														 | 
														
															 import java.util.function.Consumer; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.function.Function; 
														 | 
														
														 | 
														
															 import java.util.function.Function; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 @Service 
														 | 
														
														 | 
														
															 @Service 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> implements UserOrderService { 
														 | 
														
														 | 
														
															 public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> implements UserOrderService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private final static Logger log = LoggerFactory.getLogger(UserOrderServiceImpl.class); 
														 | 
														
														 | 
														
															     private final static Logger log = LoggerFactory.getLogger(UserOrderServiceImpl.class); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -94,7 +91,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         orderSuccess.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourseSuccess); 
														 | 
														
														 | 
														
															         orderSuccess.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourseSuccess); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /**********订单取消后******************/ 
														 | 
														
														 | 
														
															         /**********订单取消后******************/ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //orderCancel.put(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        orderCancel.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourseFailed); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -176,7 +173,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //验证成功后,订单入库 
														 | 
														
														 | 
														
															         //验证成功后,订单入库 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        UserOrderVo orderVo = insertOrder(orderNo,orderReq, resList); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        UserOrderVo orderVo = insertOrder(orderNo, orderReq, resList); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<UserOrderDetailVo> orderDetailList = orderVo.getOrderDetailList(); 
														 | 
														
														 | 
														
															         List<UserOrderDetailVo> orderDetailList = orderVo.getOrderDetailList(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for (UserOrderDetailVo orderDetailVo : orderDetailList) { 
														 | 
														
														 | 
														
															         for (UserOrderDetailVo orderDetailVo : orderDetailList) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -213,7 +210,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public HttpResponseResult<OrderPayRes> orderPaytoPaying(OrderPayReq payReq) { 
														 | 
														
														 | 
														
															     public HttpResponseResult<OrderPayRes> orderPaytoPaying(OrderPayReq payReq) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //查询订单 
														 | 
														
														 | 
														
															         //查询订单 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         UserOrderVo detail = detail(payReq.getOrderNo()); 
														 | 
														
														 | 
														
															         UserOrderVo detail = detail(payReq.getOrderNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(OrderStatusEnum.PAYING.equals(detail.getStatus())){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (OrderStatusEnum.PAYING.equals(detail.getStatus())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             //处于付款中状态,需要拉起付款接口返回信息,并且去到汇付 
														 | 
														
														 | 
														
															             //处于付款中状态,需要拉起付款接口返回信息,并且去到汇付 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return orderPayPaying(payReq, detail); 
														 | 
														
														 | 
														
															             return orderPayPaying(payReq, detail); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -246,9 +243,6 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<UserOrderVo> orderList = baseMapper.selectPendingList(); 
														 | 
														
														 | 
														
															         List<UserOrderVo> orderList = baseMapper.selectPendingList(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for (UserOrderVo userOrder : orderList) { 
														 | 
														
														 | 
														
															         for (UserOrderVo userOrder : orderList) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             //待支付订单直接取消 
														 | 
														
														 | 
														
															             //待支付订单直接取消 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (OrderStatusEnum.FAIL.equals(userOrder.getStatus())) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                failPayOrderHandle(userOrder); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (OrderStatusEnum.WAIT_PAY.equals(userOrder.getStatus())) { 
														 | 
														
														 | 
														
															             if (OrderStatusEnum.WAIT_PAY.equals(userOrder.getStatus())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 waitPayOrderHandle(userOrder); 
														 | 
														
														 | 
														
															                 waitPayOrderHandle(userOrder); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -258,17 +252,6 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    /*** 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     * 处理支付失败订单 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     * @author liweifan 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     * @param: userOrder 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     * @updateTime 2022/4/13 16:51 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private void failPayOrderHandle(UserOrderVo userOrder) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        orderCancel(userOrder); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /*** 
														 | 
														
														 | 
														
															     /*** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * 处理待支付订单 
														 | 
														
														 | 
														
															      * 处理待支付订单 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @author liweifan 
														 | 
														
														 | 
														
															      * @author liweifan 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -351,6 +334,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return HttpResponseResult.succeed(orderPayRes); 
														 | 
														
														 | 
														
															             return HttpResponseResult.succeed(orderPayRes); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } else { 
														 | 
														
														 | 
														
															         } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             //入订单付款表,同时修改订单状态 
														 | 
														
														 | 
														
															             //入订单付款表,同时修改订单状态 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            orderCancel(detail); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             insertOrderPayment(responseResult, payReq); 
														 | 
														
														 | 
														
															             insertOrderPayment(responseResult, payReq); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             baseMapper.updateStatusByOrderNo(payReq.getOrderNo(), OrderStatusEnum.FAIL.getCode()); 
														 | 
														
														 | 
														
															             baseMapper.updateStatusByOrderNo(payReq.getOrderNo(), OrderStatusEnum.FAIL.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return HttpResponseResult.failed(responseResult.getMsg()); 
														 | 
														
														 | 
														
															             return HttpResponseResult.failed(responseResult.getMsg()); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -443,6 +427,9 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             orderDetail.setBizContent(res.getBizContent()); 
														 | 
														
														 | 
														
															             orderDetail.setBizContent(res.getBizContent()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             orderDetail.setOriginalPrice(null != res.getOriginalPrice() ? res.getOriginalPrice() : BigDecimal.ZERO); 
														 | 
														
														 | 
														
															             orderDetail.setOriginalPrice(null != res.getOriginalPrice() ? res.getOriginalPrice() : BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             orderDetail.setExpectPrice(null != res.getExpectPrice() ? res.getExpectPrice() : BigDecimal.ZERO); 
														 | 
														
														 | 
														
															             orderDetail.setExpectPrice(null != res.getExpectPrice() ? res.getExpectPrice() : BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            orderDetail.setActualPrice(null != res.getActualPrice() ? res.getActualPrice() : BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            orderDetail.setCouponAmount(null != res.getCouponAmount() ? res.getCouponAmount() : BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             orderDetail.setGoodNum(null != res.getGoodNum() ? res.getGoodNum() : 1); 
														 | 
														
														 | 
														
															             orderDetail.setGoodNum(null != res.getGoodNum() ? res.getGoodNum() : 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             //商品单价计算,使用商品原价计算,退费计算公式(退费金额=实际订单金额-(商品单价 * 已经使用商品数)) 
														 | 
														
														 | 
														
															             //商品单价计算,使用商品原价计算,退费计算公式(退费金额=实际订单金额-(商品单价 * 已经使用商品数)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             //其中,已经使用的商品单价按照原价算 
														 | 
														
														 | 
														
															             //其中,已经使用的商品单价按照原价算 
														 |