zoujiajian 1 年間 前
コミット
3632b78444

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/coin/UserGalaxyCoinService.java

@@ -23,4 +23,6 @@ public interface UserGalaxyCoinService {
 	void handleUserGalaxyCoinOrderNotify(Long orderId, Long userId, String orderNo, OrderDonGalaxyCoinRecord.Source source);
 
 	void sendOrderCashback(Long orderId, Long userId, Integer galaxyCoin, String remark, OrderDonGalaxyCoinRecord.Source source);
+
+	void sendOrderGalaxyCloseOrder(Long orderId, Long userId, BigDecimal galaxyCoin, OrderDonGalaxyCoinRecord.Source source);
 }

+ 4 - 0
netflix-service/src/main/java/com/cyksj/service/coin/impl/UserGalaxyCoinServiceImpl.java

@@ -177,4 +177,8 @@ public class UserGalaxyCoinServiceImpl implements UserGalaxyCoinService {
 	public void sendOrderCashback(Long orderId, Long userId, Integer galaxyCoin, String remark, OrderDonGalaxyCoinRecord.Source source) {
 		sendGalaxyCoinHandle(userId, orderId, galaxyCoin, remark, true, true, source);
 	}
+
+	public void sendOrderGalaxyCloseOrder(Long orderId, Long userId, BigDecimal galaxyCoin, OrderDonGalaxyCoinRecord.Source source) {
+		sendGalaxyCoinHandle(userId, orderId, galaxyCoin.intValue(), PointsRecordConst.ORDER_CLOSE, true, true, source);
+	}
 }

+ 10 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1083,9 +1083,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				//返回银河币
 				UserGalaxyCoinRecord userGalaxyCoinRecord = userGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(UserGalaxyCoinRecord.class)
 						.eq(UserGalaxyCoinRecord::getOrderId, orderDon.getId())
+						.eq(UserGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.ordinary.ordinal())
 						.last("limit 1"));
 				if (userGalaxyCoinRecord != null) {
-					userGalaxyCoinService.sendGalaxyCoinRecord(orderDon.getUserId(), userGalaxyCoinRecord.getGalaxyCoin().intValue(), PointsRecordConst.ORDER_CLOSE, false);
+					userGalaxyCoinService.sendOrderGalaxyCloseOrder(orderDon.getId(), orderDon.getUserId(), userGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.ordinary);
 				}
 
 				//是否是礼品卡 现金支付订单
@@ -4283,6 +4284,14 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
 					userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), null, null, null, null, false);
 				}
+				//返回银河币
+				UserGalaxyCoinRecord userGalaxyCoinRecord = userGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(UserGalaxyCoinRecord.class)
+						.eq(UserGalaxyCoinRecord::getOrderId, orderDon.getId())
+						.eq(UserGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.upgrade.ordinal())
+						.last("limit 1"));
+				if (userGalaxyCoinRecord != null) {
+					userGalaxyCoinService.sendOrderGalaxyCloseOrder(orderDon.getId(), orderDon.getUserId(), userGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.upgrade);
+				}
 			}
 		}
 	}

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/VipOrderDonServiceImpl.java

@@ -334,9 +334,10 @@ public class VipOrderDonServiceImpl extends ServiceImpl<VipOrderDonMapper, VipOr
 			//返回银河币
 			UserGalaxyCoinRecord userGalaxyCoinRecord = userGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(UserGalaxyCoinRecord.class)
 					.eq(UserGalaxyCoinRecord::getOrderId, orderDon.getId())
+					.eq(UserGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.vip.ordinal())
 					.last("limit 1"));
 			if (userGalaxyCoinRecord != null) {
-				userGalaxyCoinService.sendGalaxyCoinRecord(orderDon.getUserId(), userGalaxyCoinRecord.getGalaxyCoin().intValue(), PointsRecordConst.ORDER_CLOSE, false);
+				userGalaxyCoinService.sendOrderGalaxyCloseOrder(orderDon.getId(), orderDon.getUserId(), userGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.vip);
 			}
 		}
 	}