|
@@ -8,26 +8,22 @@ import cn.hobbystocks.auc.domain.Order;
|
|
|
import cn.hobbystocks.auc.dto.OrderApiResponse;
|
|
import cn.hobbystocks.auc.dto.OrderApiResponse;
|
|
|
import cn.hobbystocks.auc.dto.SkuOrderDTO;
|
|
import cn.hobbystocks.auc.dto.SkuOrderDTO;
|
|
|
import cn.hobbystocks.auc.forest.OrderApi;
|
|
import cn.hobbystocks.auc.forest.OrderApi;
|
|
|
-import cn.hobbystocks.auc.mapper.OrderMapper;
|
|
|
|
|
import cn.hobbystocks.auc.service.IAuctionService;
|
|
import cn.hobbystocks.auc.service.IAuctionService;
|
|
|
import cn.hobbystocks.auc.service.ILotService;
|
|
import cn.hobbystocks.auc.service.ILotService;
|
|
|
import cn.hobbystocks.auc.service.IOrderService;
|
|
import cn.hobbystocks.auc.service.IOrderService;
|
|
|
import cn.hobbystocks.auc.vo.OrderVO;
|
|
import cn.hobbystocks.auc.vo.OrderVO;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
-public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {
|
|
|
|
|
|
|
+public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
ILotService lotService;
|
|
ILotService lotService;
|
|
@@ -39,7 +35,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
private String orderUrl;
|
|
private String orderUrl;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- @Transactional
|
|
|
|
|
public OrderVO createSkuOrder(Order order) {
|
|
public OrderVO createSkuOrder(Order order) {
|
|
|
Lot lot = lotService.selectLotById(order.getLotId());
|
|
Lot lot = lotService.selectLotById(order.getLotId());
|
|
|
Auction auction = auctionService.selectAuctionById(lot.getAuctionId());
|
|
Auction auction = auctionService.selectAuctionById(lot.getAuctionId());
|
|
@@ -61,15 +56,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
order.setServiceExpense(serviceExpense);
|
|
order.setServiceExpense(serviceExpense);
|
|
|
Date expireTime = DateUtils.addHours(new Date(), payTimeLimit);
|
|
Date expireTime = DateUtils.addHours(new Date(), payTimeLimit);
|
|
|
order.setExpireTime(expireTime);
|
|
order.setExpireTime(expireTime);
|
|
|
- save(order);
|
|
|
|
|
|
|
|
|
|
OrderApiResponse response = orderApi.createSkuOrder(orderUrl, buildSkuOrderDTO(order, lot, auction));
|
|
OrderApiResponse response = orderApi.createSkuOrder(orderUrl, buildSkuOrderDTO(order, lot, auction));
|
|
|
- OrderVO orderVO = response.toOrderVO();
|
|
|
|
|
- order.setOrderId(orderVO.getOrderId());
|
|
|
|
|
- order.setOrderNo(orderVO.getOrderNo());
|
|
|
|
|
- order.setStatus(orderVO.getStatus());
|
|
|
|
|
- updateById(order);
|
|
|
|
|
- return orderVO;
|
|
|
|
|
|
|
+ return response.toOrderVO();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SkuOrderDTO buildSkuOrderDTO(Order order, Lot lot, Auction auction) {
|
|
SkuOrderDTO buildSkuOrderDTO(Order order, Lot lot, Auction auction) {
|
|
@@ -89,13 +78,4 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return skuOrderDTO;
|
|
return skuOrderDTO;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public int modifyOrder(Order order) {
|
|
|
|
|
- return getBaseMapper().updateOrderStatus(order);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public List<Order> getOrderListByUserAndAuction(Long auctionId, Integer userId) {
|
|
|
|
|
- return getBaseMapper().selectOrderByAuctionId(auctionId, userId);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|