|
@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.*;
|
|
@@ -38,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.UserOrderDao;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
@@ -52,7 +54,8 @@ import java.util.function.Function;
|
|
|
@Service
|
|
|
public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> implements UserOrderService {
|
|
|
private final static Logger log = LoggerFactory.getLogger(UserOrderServiceImpl.class);
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private UserOrderService self;
|
|
|
@Autowired
|
|
|
private MemberPriceSettingsService memberPriceSettingsService;
|
|
|
@Autowired
|
|
@@ -107,7 +110,6 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
|
|
|
/**********订单生成后******************/
|
|
|
|
|
|
-
|
|
|
//曲目购买
|
|
|
orderAfter.put(GoodTypeEnum.MUSIC, musicSheetService::orderAfterSheet);
|
|
|
|
|
@@ -308,7 +310,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
|
|
|
//判断订单是否是无需支付的订单,若是,则直接完成订单
|
|
|
if (BigDecimal.ZERO.compareTo(orderVo.getActualPrice()) == 0) {
|
|
|
- orderSuccess(orderVo);
|
|
|
+ orderSuccess(orderVo,null);
|
|
|
}
|
|
|
return HttpResponseResult.succeed(orderVo);
|
|
|
}
|
|
@@ -376,7 +378,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
closeOrSuccessOrder(orderNo);
|
|
|
}
|
|
|
|
|
|
- private void closeOrSuccessOrder(String orderNo) {
|
|
|
+ public void closeOrSuccessOrder(String orderNo) {
|
|
|
UserOrderVo detail = detail(orderNo, null);
|
|
|
if (null == detail) {
|
|
|
return;
|
|
@@ -444,7 +446,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
* @param orderNo
|
|
|
* @return 可以继续支付 true
|
|
|
*/
|
|
|
- private Boolean checkAndSuccessOrder(String orderNo) {
|
|
|
+ public Boolean checkAndSuccessOrder(String orderNo) {
|
|
|
UserOrderVo detail = detail(orderNo, null);
|
|
|
if (null == detail) {
|
|
|
return true;
|
|
@@ -491,7 +493,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private HttpResponseResult<OrderPayRes> doOrderPay(OrderPayReq payReq, UserOrderVo detail) throws Exception {
|
|
|
+ public HttpResponseResult<OrderPayRes> doOrderPay(OrderPayReq payReq, UserOrderVo detail) throws Exception {
|
|
|
Boolean aBoolean = checkAndSuccessOrder(payReq.getOrderNo());
|
|
|
if (aBoolean) {
|
|
|
return orderPaymentService.createOrderPayment(payReq, detail);
|
|
@@ -508,7 +510,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
* @updateTime 2022/3/31 16:15
|
|
|
* @return: com.yonge.cooleshow.biz.dal.entity.Order
|
|
|
*/
|
|
|
- private UserOrderVo insertOrder(OrderReq orderReq) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public UserOrderVo insertOrder(OrderReq orderReq) {
|
|
|
UserOrder userOrder = new UserOrder();
|
|
|
|
|
|
userOrder.setOrderNo(orderReq.getOrderNo());
|
|
@@ -610,7 +613,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
* @updateTime 2022/3/31 16:49
|
|
|
* @return: java.math.BigDecimal
|
|
|
*/
|
|
|
- private BigDecimal getServiceFeeRate(GoodTypeEnum goodTypeEnum) {
|
|
|
+ public BigDecimal getServiceFeeRate(GoodTypeEnum goodTypeEnum) {
|
|
|
String configValue = "0";
|
|
|
if (GoodTypeEnum.VIDEO.equals(goodTypeEnum)) {
|
|
|
configValue = sysConfigService.findConfigValue(SysConfigConstant.VIDEO_LESSON_SERVICE_FEE);
|
|
@@ -631,7 +634,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
* @updateTime 2022/3/31 16:49
|
|
|
* @return: java.math.BigDecimal
|
|
|
*/
|
|
|
- private String getGoodUrlByType(GoodTypeEnum goodTypeEnum) {
|
|
|
+ public String getGoodUrlByType(GoodTypeEnum goodTypeEnum) {
|
|
|
String configValue = "";
|
|
|
if (GoodTypeEnum.VIP.equals(goodTypeEnum)) {
|
|
|
configValue = sysConfigService.findConfigValue(SysConfigConstant.GOOD_LOGO_VIP);
|
|
@@ -649,7 +652,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
return configValue;
|
|
|
}
|
|
|
|
|
|
- private Boolean checkPositiveOrZero(BigDecimal amount) {
|
|
|
+ public Boolean checkPositiveOrZero(BigDecimal amount) {
|
|
|
if (null == amount) {
|
|
|
return false;
|
|
|
}
|
|
@@ -677,7 +680,6 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
&& !OrderStatusEnum.FAIL.equals(orderStatus)) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
List<UserOrderDetailVo> orderDetailList = orderDetailService.getOrderDetilListByOrderNo(userOrder.getOrderNo());
|
|
|
for (UserOrderDetailVo orderDetailVo : orderDetailList) {
|
|
|
orderDetailVo.setUserId(userOrder.getUserId());
|
|
@@ -694,7 +696,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
baseMapper.updateById(userOrder);
|
|
|
}
|
|
|
|
|
|
- private void orderSuccess(UserOrderVo detail) {
|
|
|
+ public void orderSuccess(UserOrderVo detail) {
|
|
|
orderSuccess(detail, null);
|
|
|
}
|
|
|
|
|
@@ -749,8 +751,14 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
log.error("订单完成-更新付款单失败, UserOrderVo is {},PaymentCallBack is {}", JSONObject.toJSONString(detail), JSONObject.toJSONString(data));
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- //调用业务
|
|
|
+
|
|
|
+ /*List<UserOrderDetailVo> orderDetailList = detail.getOrderDetailList();
|
|
|
+ if(CollectionUtils.isEmpty(orderDetailList)){
|
|
|
+ orderDetailList = orderDetailService.getOrderDetilListByOrderNo(detail.getOrderNo());
|
|
|
+ }*/
|
|
|
List<UserOrderDetailVo> orderDetailList = orderDetailService.getOrderDetilListByOrderNo(detail.getOrderNo());
|
|
|
+
|
|
|
+ //调用业务
|
|
|
for (UserOrderDetailVo orderDetailVo : orderDetailList) {
|
|
|
orderDetailVo.setUserId(detail.getUserId());
|
|
|
orderDetailVo.setOrderId(detail.getId());
|
|
@@ -773,7 +781,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void testOrderSuccess(UserOrderVo detail) {
|
|
|
+ public void testOrderSuccess(UserOrderVo detail) {
|
|
|
if (null == detail || StringUtil.isEmpty(detail.getOrderNo())) {
|
|
|
return;
|
|
|
}
|