|  | @@ -36,6 +36,7 @@ import org.apache.commons.collections.CollectionUtils;
 | 
	
		
			
				|  |  |  import org.springframework.context.event.EventListener;
 | 
	
		
			
				|  |  |  import org.springframework.core.annotation.Order;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.time.LocalDateTime;
 | 
	
	
		
			
				|  | @@ -80,6 +81,7 @@ public class SubmitOrderListener {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @EventListener(SubmitOrderEvent.class)
 | 
	
		
			
				|  |  |      @Order(SubmitOrderOrder.DEFAULT)
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public void defaultSubmitOrderListener(SubmitOrderEvent event) {
 | 
	
		
			
				|  |  |          Date now = new Date();
 | 
	
		
			
				|  |  |          String userId = SecurityUtils.getUser().getUserId();
 | 
	
	
		
			
				|  | @@ -146,6 +148,9 @@ public class SubmitOrderListener {
 | 
	
		
			
				|  |  |                      Double mul = Arith.mul(actualTotal, 100);
 | 
	
		
			
				|  |  |                      Double vp = Double.valueOf(point);
 | 
	
		
			
				|  |  |                      if (vp >= mul) {
 | 
	
		
			
				|  |  | +                        order.setIsPayed(1);
 | 
	
		
			
				|  |  | +                        order.setPayTime(new Date());
 | 
	
		
			
				|  |  | +                        order.setStatus(OrderStatus.PADYED.value());
 | 
	
		
			
				|  |  |                          //积分完全足够支付
 | 
	
		
			
				|  |  |                          order.setOffsetPoints(Long.valueOf(String.valueOf(mul).split("\\.")[0]));
 | 
	
		
			
				|  |  |                          actualTotal = 0.0;//剩下需要付的钱
 | 
	
	
		
			
				|  | @@ -156,8 +161,7 @@ public class SubmitOrderListener {
 | 
	
		
			
				|  |  |                          order.setOffsetPoints(Long.valueOf(String.valueOf(sub).split("\\.")[0]));
 | 
	
		
			
				|  |  |                          actualTotal = sub / 100;
 | 
	
		
			
				|  |  |                          mergerOrder.setNextPay(Boolean.TRUE);
 | 
	
		
			
				|  |  | -                        order.setIsPayed(1);
 | 
	
		
			
				|  |  | -                        order.setStatus(OrderStatus.PADYED.value());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      mergerOrder.setNextPay(Boolean.TRUE);
 | 
	
	
		
			
				|  | @@ -415,16 +419,16 @@ public class SubmitOrderListener {
 | 
	
		
			
				|  |  |              } else if (actualTotal > available) {
 | 
	
		
			
				|  |  |                  actualTotal = Arith.sub(actualTotal, available);
 | 
	
		
			
				|  |  |                  //把当前积分已扣完,但是还有钱。钱多积分少
 | 
	
		
			
				|  |  | -                pointsRecord.setVariablePoints(points);
 | 
	
		
			
				|  |  | -                pr.setVariablePoints(points);
 | 
	
		
			
				|  |  | +                pointsRecord.setVariablePoints(BigDecimal.valueOf(actualTotal));
 | 
	
		
			
				|  |  | +                pr.setVariablePoints(BigDecimal.valueOf(actualTotal));
 | 
	
		
			
				|  |  |                  pr.setPointsAudit(3);
 | 
	
		
			
				|  |  |                  pointsRecord.setPointsAudit(3);
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  //恰好等于
 | 
	
		
			
				|  |  |                  pr.setPointsAudit(3);
 | 
	
		
			
				|  |  |                  pointsRecord.setPointsAudit(3);
 | 
	
		
			
				|  |  | -                pointsRecord.setVariablePoints(pointsRecord.getPoints());
 | 
	
		
			
				|  |  | -                pr.setVariablePoints(pointsRecord.getPoints());
 | 
	
		
			
				|  |  | +                pointsRecord.setVariablePoints(BigDecimal.valueOf(actualTotal));
 | 
	
		
			
				|  |  | +                pr.setVariablePoints(BigDecimal.valueOf(actualTotal));
 | 
	
		
			
				|  |  |                  actualTotal = 0.0;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              int update = pointsRecordMapper.updateById(pointsRecord);
 |