Compare commits
No commits in common. "68fdd4f4855c97a550dc3310f29dc70d8f7ab686" and "81b74ecc87a691234823abb3c01870a81024142c" have entirely different histories.
68fdd4f485
...
81b74ecc87
|
|
@ -1,41 +0,0 @@
|
|||
package com.bonus.canteen.core.order.business;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
|
||||
import com.bonus.canteen.core.account.service.IAccInfoService;
|
||||
import com.bonus.canteen.core.order.domain.OrderDetail;
|
||||
import com.bonus.canteen.core.order.domain.OrderInfo;
|
||||
import com.bonus.canteen.core.order.domain.param.OrderAddParam;
|
||||
import com.bonus.canteen.core.order.mapper.OrderInfoMapper;
|
||||
import com.bonus.canteen.core.order.service.IOrderDetailService;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class OrderBusiness {
|
||||
@Autowired
|
||||
private IAccInfoService accInfoService;
|
||||
@Autowired
|
||||
private IOrderDetailService orderDetailService;
|
||||
@Autowired
|
||||
private OrderInfoMapper orderInfoMapper;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<OrderInfo> orderPlaceHandler(OrderAddParam orderAddParam) {
|
||||
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
||||
accInfoService.checkAccStatus(accInfoVO);
|
||||
List<OrderInfo> orderInfoList = new OrderInfo().of(orderAddParam);
|
||||
if(CollUtil.isEmpty(orderInfoList) || CollUtil.isEmpty(orderInfoList.get(0).getOrderDetailList())) {
|
||||
throw new ServiceException("订单明细不能为空");
|
||||
}
|
||||
orderInfoMapper.batchInsertOrderInfo(orderInfoList);
|
||||
orderInfoList.forEach(orderInfo -> {
|
||||
List<OrderDetail> orderDetailList = orderInfo.getOrderDetailList();
|
||||
orderDetailService.batchInsertOrderDetail(orderDetailList);
|
||||
});
|
||||
return orderInfoList;
|
||||
}
|
||||
}
|
||||
|
|
@ -176,9 +176,6 @@ public class OrderInfo extends BaseEntity
|
|||
for(OrderInfoAddParam orderInfoAddParam : orderList) {
|
||||
OrderInfo orderInfo = new OrderInfo();
|
||||
orderInfo.setOrderId(Id.next());
|
||||
orderInfo.setDeviceOrderId(orderInfoAddParam.getDeviceOrderId());
|
||||
orderInfo.setDeviceSn(orderInfoAddParam.getDeviceSn());
|
||||
orderInfo.setDeviceNum(orderInfoAddParam.getDeviceNum());
|
||||
orderInfo.setUserId(param.getUserId());
|
||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
||||
orderInfo.setRealAmount(param.getRealAmount());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.canteen.core.order.domain.param;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -26,8 +25,5 @@ public class OrderInfoAddParam {
|
|||
private Date orderDate;
|
||||
@NotNull(message = "订单类型不能为空")
|
||||
private Integer orderType;
|
||||
private String deviceOrderId;
|
||||
private String deviceSn;
|
||||
private String deviceNum;
|
||||
List<OrderDetailInfoAddParam> orderDetailList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import com.bonus.canteen.core.account.service.IAccTradeService;
|
|||
import com.bonus.canteen.core.account.service.IAccWalletInfoService;
|
||||
import com.bonus.canteen.core.common.utils.MqUtil;
|
||||
import com.bonus.canteen.core.common.utils.RedisUtil;
|
||||
import com.bonus.canteen.core.order.business.OrderBusiness;
|
||||
import com.bonus.canteen.core.order.constants.OrderDetailStateEnum;
|
||||
import com.bonus.canteen.core.order.constants.OrderRefundStateEnum;
|
||||
import com.bonus.canteen.core.order.constants.OrderStateEnum;
|
||||
|
|
@ -65,8 +64,6 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
private IAccInfoService accInfoService;
|
||||
@Autowired
|
||||
private IOrderDetailService orderDetailService;
|
||||
@Autowired
|
||||
private OrderBusiness orderBusiness;
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
|
|
@ -106,7 +103,17 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
log.info("[下单]重复提交:{}", paramMd5);
|
||||
throw new ServiceException("请勿重复提交订单");
|
||||
}
|
||||
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(orderAddParam);
|
||||
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
||||
accInfoService.checkAccStatus(accInfoVO);
|
||||
List<OrderInfo> orderInfoList = new OrderInfo().of(orderAddParam);
|
||||
if(CollUtil.isEmpty(orderInfoList) || CollUtil.isEmpty(orderInfoList.get(0).getOrderDetailList())) {
|
||||
throw new ServiceException("订单明细不能为空");
|
||||
}
|
||||
orderInfoMapper.batchInsertOrderInfo(orderInfoList);
|
||||
orderInfoList.forEach(orderInfo -> {
|
||||
List<OrderDetail> orderDetailList = orderInfo.getOrderDetailList();
|
||||
orderDetailService.batchInsertOrderDetail(orderDetailList);
|
||||
});
|
||||
OrderPayDTO orderPayDTO = buildOrderPayDTO(orderInfoList);
|
||||
try {
|
||||
List<AccWalletInfo> walletInfoList = accWalletInfoService.selectAccWalletInfoByUserId(orderPayDTO.getUserId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue