zoujiajian 2 lat temu
rodzic
commit
f535fca633

+ 4 - 4
netflix-dao/src/main/java/com/cyksj/mapper/UserMapper.java

@@ -36,8 +36,8 @@ public interface UserMapper extends BaseMapper<User> {
     @Update("update user set points = points - #{deductPoints} where id = #{id} and points = #{originalPoints}")
     Integer subPointsNegative(@Param("id") Long userId, @Param("originalPoints") BigDecimal originalPoints, @Param("deductPoints") BigDecimal deductPoints);
 
-    @Update("update user set balance = balance - #{deduct} where id = #{userId} and balance = #{userBalance} and balance >= #{deduct}")
-    Integer deductBalance(@Param("userId") Long userId, @Param("deduct") BigDecimal deduct, @Param("userBalance") BigDecimal userBalance);
+    @Update("update user set balance = balance - #{deduct} where id = #{userId} and balance >= #{deduct}")
+    Integer deductBalance(@Param("userId") Long userId, @Param("deduct") BigDecimal deduct);
 
     @Update("update user set balance = balance + #{returnBalance} where id = #{userId} and balance = #{userBalance}")
     Integer returnBalance(@Param("userId") Long userId, @Param("returnBalance") BigDecimal returnBalance, @Param("userBalance") BigDecimal userBalance);
@@ -63,8 +63,8 @@ public interface UserMapper extends BaseMapper<User> {
     @Update("update user set yhs_money = yhs_money - #{subMoney} where id = #{shopUserId} and yhs_money >= #{subMoney} and yhs_money > 0")
     Integer subYhsMoney(@Param("shopUserId") Long shopUserId, @Param("subMoney") BigDecimal subMoney);
 
-    @Update("update user set galaxycoin = galaxycoin - (${subGalaxycoin}) where id = #{id} and galaxycoin = #{userGalaxycoin}")
-    Integer deductGalaxycoin(@Param("id") Long id, @Param("subGalaxycoin") BigDecimal subGalaxycoin, @Param("userGalaxycoin") BigDecimal userGalaxycoin);
+    @Update("update user set galaxycoin = galaxycoin - (${subGalaxycoin}) where id = #{id} and galaxycoin >= #{subGalaxycoin}")
+    Integer deductGalaxycoin(@Param("id") Long id, @Param("subGalaxycoin") BigDecimal subGalaxycoin);
 
     @Update("update user set galaxycoin = galaxycoin + (${addGalaxycoin}) where id = #{id} and galaxycoin = #{originalGalaxycoin}")
     Integer updateGalaxycoin(@Param("id") Long id, @Param("originalGalaxycoin") BigDecimal originalGalaxycoin, @Param("addGalaxycoin") BigDecimal addGalaxycoin);

+ 3 - 2
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2325,7 +2325,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 	/**
 	 * 使用优惠营销 订单金额抵扣
 	 */
-	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, Integer goodsType, BigDecimal gcCash, List<Long> gcpIds, BigDecimal galaxycoin) {
+	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, User user, BigDecimal skuMoney, Integer goodsType, BigDecimal gcCash, List<Long> gcpIds, UnifiedOrderPayReq unifiedOrderPayReq) {
 		if (gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0 && couponUser != null) {
 			throw BusinessRuntimeException.getInstance("现金卡不能与其他优惠叠加使用");
 		}
@@ -2417,7 +2417,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				}
 			}
 		}
-
+		BigDecimal galaxycoin = unifiedOrderPayReq.getGalaxycoin();
+		BigDecimal balance = unifiedOrderPayReq.getBalance();
 		//银河币 coin
 		if (galaxycoin != null && galaxycoin.compareTo(BigDecimal.ZERO) > 0 && orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
 			BigDecimal money = orderDon.getMoney();