|
@@ -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();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|