| 
					
				 | 
			
			
				@@ -656,4 +656,29 @@ public class OrderInfoServiceImpl implements OrderInfoService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         goodsPayOrder.setPayNo(orderNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         goodsPayOrderMapper.insertSelective(goodsPayOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void payOrder(String orderId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        GoodsOrderInfo goodsOrderInfo = goodsOrderInfoMapper.selectByPrimaryKey(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer orderStatus = goodsOrderInfo.getOrderStatus(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(orderStatus.intValue() !=1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new RuntimeException("该订单已支付!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer state = goodsOrderInfo.getState(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(state.intValue() == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new RuntimeException("该订单为无效订单!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        goodsOrderInfo.setOrderStatus(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        goodsOrderInfo.setModifiedTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int i = goodsOrderInfoMapper.updateByPrimaryKeySelective(goodsOrderInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (i > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //更新农户收入信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            updateFarmerSaleInfo(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //生成证书信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            applicationContext.publishEvent(new CredentialInfoEvent(this, orderId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //生成购买碳汇数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            applicationContext.publishEvent(new CustomerCarbonValEvent(this, orderId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new RuntimeException(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |