|  | @@ -134,6 +134,9 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private FsStoreProductAttrValueMapper fsStoreProductAttrValueMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private LiveUserLotteryRecordMapper liveUserLotteryRecordMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      ICompanyUserService companyUserService;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -948,6 +951,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |          order.setStatus(-2);
 | 
	
		
			
				|  |  |          order.setRefundMoney(order.getPayMoney());
 | 
	
		
			
				|  |  |          order.setRefundStatus(String.valueOf(OrderInfoEnum.REFUND_STATUS_2.getValue()));
 | 
	
		
			
				|  |  | +        liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), -2);
 | 
	
		
			
				|  |  |          baseMapper.updateLiveOrder(order);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //退库存
 | 
	
	
		
			
				|  | @@ -1007,6 +1011,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |          order.setStatus(-2);
 | 
	
		
			
				|  |  |          order.setRefundMoney(order.getPayMoney());
 | 
	
		
			
				|  |  |          order.setRefundStatus(String.valueOf(OrderInfoEnum.REFUND_STATUS_2.getValue()));
 | 
	
		
			
				|  |  | +        liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), -2);
 | 
	
		
			
				|  |  |          baseMapper.updateLiveOrder(order);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //退库存
 | 
	
	
		
			
				|  | @@ -1484,7 +1489,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |              order.setDeliveryName(deliverName);
 | 
	
		
			
				|  |  |              order.setDeliverySn(deliveryId);
 | 
	
		
			
				|  |  |              order.setDeliveryCode(express.getCode());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +            liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), 3);
 | 
	
		
			
				|  |  |              baseMapper.updateLiveOrder(order);
 | 
	
		
			
				|  |  |              if(ObjectUtil.isNotNull(express)) {
 | 
	
		
			
				|  |  |                  FsStoreDelivers fsStoreDeliver = new FsStoreDelivers();
 | 
	
	
		
			
				|  | @@ -1667,6 +1672,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |                              map.setStatus(OrderInfoEnum.STATUS_2.getValue());
 | 
	
		
			
				|  |  |                              map.setOrderId(order.getOrderId());
 | 
	
		
			
				|  |  |                              map.setDeliverySn(response.getOrders().get(0).getDeliverys().get(0).getMail_no());
 | 
	
		
			
				|  |  | +                            liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), 2);
 | 
	
		
			
				|  |  |                              liveOrderMapper.updateLiveOrder(map);
 | 
	
		
			
				|  |  |                              liveOrderLogsService.create(order.getOrderId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
 | 
	
		
			
				|  |  |                                      OrderLogEnum.DELIVERY_GOODS.getDesc());
 | 
	
	
		
			
				|  | @@ -1899,6 +1905,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |          if(order.getStatus()==OrderInfoEnum.STATUS_3.getValue()){
 | 
	
		
			
				|  |  |              order.setFinishTime(new Date());
 | 
	
		
			
				|  |  |              order.setStatus(4);
 | 
	
		
			
				|  |  | +            liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), 4);
 | 
	
		
			
				|  |  |              baseMapper.updateLiveOrder(order);
 | 
	
		
			
				|  |  |              liveOrderLogsService.create(order.getOrderId(), OrderLogEnum.FINISH_ORDER.getValue(),
 | 
	
		
			
				|  |  |                      OrderLogEnum.FINISH_ORDER.getDesc());
 | 
	
	
		
			
				|  | @@ -1959,6 +1966,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |      public int updateLiveOrder(LiveOrder liveOrder)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          liveOrder.setUpdateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  | +        liveUserLotteryRecordMapper.updateOrderStatusByOrderId(liveOrder.getOrderId(), liveOrder.getStatus());
 | 
	
		
			
				|  |  |          return baseMapper.updateLiveOrder(liveOrder);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2116,6 +2124,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |  //                OrderLogEnum.FINISH_ORDER.getDesc());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          int i = baseMapper.updateLiveOrder(updateEntity);
 | 
	
		
			
				|  |  | +        liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), OrderInfoEnum.STATUS_3.getValue());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return i;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -2189,6 +2198,8 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |          if (StringUtils.isEmpty(orderKey)) {
 | 
	
		
			
				|  |  |              return R.error("订单已过期");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        LiveUserLotteryRecord liveUserLotteryRecord = liveUserLotteryRecordMapper.selectLiveUserLotteryRecordById(liveOrder.getRecordId());
 | 
	
		
			
				|  |  | +        if(liveUserLotteryRecord == null) return R.error("未查询到中奖记录,请联系管理员处理!");
 | 
	
		
			
				|  |  |          if(liveOrder.getLiveId() == null) return R.error("直播ID不能为空");
 | 
	
		
			
				|  |  |          if(liveOrder.getProductId() == null) return R.error("购物商品ID不能为空");
 | 
	
		
			
				|  |  |          if(liveOrder.getUserName() == null) return R.error("用户名不能为空");
 | 
	
	
		
			
				|  | @@ -2253,6 +2264,9 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |          liveOrder.setPayMoney(BigDecimal.ZERO);
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              if (baseMapper.insertLiveOrder(liveOrder) > 0) {
 | 
	
		
			
				|  |  | +                liveUserLotteryRecord.setOrderId(liveOrder.getOrderId());
 | 
	
		
			
				|  |  | +                liveUserLotteryRecord.setOrderStatus(liveOrder.getStatus());
 | 
	
		
			
				|  |  | +                liveUserLotteryRecordMapper.updateLiveUserLotteryRecord(liveUserLotteryRecord);
 | 
	
		
			
				|  |  |                  LiveOrderItemDTO dto=new LiveOrderItemDTO();
 | 
	
		
			
				|  |  |                  dto.setImage(fsStoreProduct.getImage());
 | 
	
		
			
				|  |  |                  dto.setSku(String.valueOf(fsStoreProduct.getStock()));
 | 
	
	
		
			
				|  | @@ -2347,6 +2361,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              liveOrder.setStatus(2);
 | 
	
		
			
				|  |  |              liveOrder.setPayTime(LocalDateTime.now());
 | 
	
		
			
				|  |  | +            liveUserLotteryRecordMapper.updateOrderStatusByOrderId(liveOrder.getOrderId(), 2);
 | 
	
		
			
				|  |  |              baseMapper.updateLiveOrder(liveOrder);
 | 
	
		
			
				|  |  |              return R.ok("支付成功");
 | 
	
		
			
				|  |  |          }catch (Exception e){
 | 
	
	
		
			
				|  | @@ -2461,15 +2476,13 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |                  LiveOrderItemDTO dto=new LiveOrderItemDTO();
 | 
	
		
			
				|  |  |                  dto.setImage(fsStoreProduct.getImage());
 | 
	
		
			
				|  |  |                  dto.setSku(String.valueOf(fsStoreProduct.getStock()));
 | 
	
		
			
				|  |  | -                if (StringUtils.isEmpty(fsStoreProduct.getBarCode())) {
 | 
	
		
			
				|  |  | -                    FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId()).stream().filter(attrValue -> StringUtils.isNotEmpty(attrValue.getBarCode())).findFirst().orElse(null);
 | 
	
		
			
				|  |  | -                    if (fsStoreProductAttrValue != null) {
 | 
	
		
			
				|  |  | -                        dto.setBarCode(fsStoreProductAttrValue.getBarCode());
 | 
	
		
			
				|  |  | -                        dto.setGroupBarCode(fsStoreProductAttrValue.getGroupBarCode());
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    dto.setBarCode(fsStoreProduct.getBarCode());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProduct.getProductId()).stream().filter(attrValue -> StringUtils.isNotEmpty(attrValue.getBarCode())).findFirst().orElse(null);
 | 
	
		
			
				|  |  | +                if (fsStoreProductAttrValue != null) {
 | 
	
		
			
				|  |  | +                    dto.setBarCode(fsStoreProductAttrValue.getBarCode());
 | 
	
		
			
				|  |  | +                    dto.setGroupBarCode(fsStoreProductAttrValue.getGroupBarCode());
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  dto.setPrice(fsStoreProduct.getPrice());
 | 
	
		
			
				|  |  |                  dto.setProductName(fsStoreProduct.getProductName());
 | 
	
		
			
				|  |  |                  dto.setNum(Long.valueOf(liveOrder.getTotalNum()));
 | 
	
	
		
			
				|  | @@ -2594,6 +2607,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 | 
	
		
			
				|  |  |          if(order.getStatus() == 1){
 | 
	
		
			
				|  |  |              LiveOrder liveOrder = baseMapper.selectLiveOrderByOrderId(String.valueOf(order.getOrderId()));
 | 
	
		
			
				|  |  |              if(liveOrder == null) return R.error("订单不存在");
 | 
	
		
			
				|  |  | +            liveUserLotteryRecordMapper.updateOrderStatusByOrderId(order.getOrderId(), -3);
 | 
	
		
			
				|  |  |              baseMapper.cancelOrder(order.getOrderId());
 | 
	
		
			
				|  |  |              liveOrderLogsService.create(order.getOrderId(), OrderLogEnum.CANCEL_ORDER.getValue(),
 | 
	
		
			
				|  |  |                      OrderLogEnum.CANCEL_ORDER.getDesc());
 |