zoujiajian 1 年之前
父节点
当前提交
592e07bba0

+ 9 - 4
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2727,12 +2727,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				BigDecimal maxDeductMoney = sku.getPrice().multiply(galaxyCoinPayConfigDto.getMaxRate());
 				if (thisDeductMoney.compareTo(maxDeductMoney) > 0) {
 					thisDeductMoney = maxDeductMoney;
-					//此时需要扣除的银河币
-					subGalxyCoin = thisDeductMoney.divide(deductMoneyEachCoin);
 				}
-				if (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0) {
-					orderDon.setType(OrderDon.Type.GALAXY_COIN);
+				//此次使用的银河币超过订单金额
+				if (thisDeductMoney.compareTo(orderMoney) > 0) {
+					thisDeductMoney = orderMoney;
 				}
+				//此时需要扣除的银河币
+				subGalxyCoin = thisDeductMoney.divide(deductMoneyEachCoin);
 				//银河币抵扣
 				List<UserGalaxyCoinRecord> availableGalaxyCoinList = userGalaxyCoinRecordMapper.selectList(Wrappers.lambdaQuery(UserGalaxyCoinRecord.class)
 						.eq(UserGalaxyCoinRecord::getUserId, orderDon.getUserId())
@@ -2773,6 +2774,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				orderDonGalaxyCoinRecord.setGalaxyCoin(subGalxyCoin);
 				orderDonGalaxyCoinRecord.setDeductMoney(thisDeductMoney);
 				orderDonGalaxyCoinRecordMapper.insert(orderDonGalaxyCoinRecord);
+				orderDon.setMoney(orderMoney.subtract(thisDeductMoney));
+				if (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0) {
+					orderDon.setType(OrderDon.Type.GALAXY_COIN);
+				}
 			}
 		}
 	}

+ 3 - 3
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -1295,12 +1295,12 @@ public class GroupRelationController {
         long userId = StpUserUtil.getLoginIdAsLong();
         List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
         DateTime now = DateTime.now();
-        String conditionSql = String.format("(gr.expiry_time is null or gr.expiry_time > '%s'", now);
-        conditionSql += String.format(" or (sku.is_mirror and gr.expiry_time > '%s')", DateUtil.offsetDay(now, -7));
+        String conditionSql = String.format("(gr.expiry_time is null or gr.expiry_time > '%s' or (sku.is_mirror and gr.expiry_time > '%s'))", now, DateUtil.offsetDay(now, -7));
         SearchResult<GalaxyCoinRenewTicketsView> search = beanSearcher.search(GalaxyCoinRenewTicketsView.class, MapUtils.flatBuilder(request.getParameterMap())
                 .field(GalaxyCoinRenewTicketsView::getUserId, userIdList).op(Operator.InList)
                 .put("condition", conditionSql)
                 .field(GalaxyCoinRenewTicketsView::getIsVip, Boolean.FALSE)
+                .field(GalaxyCoinRenewTicketsView::getStatus, List.of(GroupsRelation.Status.validity.name(), GroupsRelation.Status.outside.name()))
                 .orderBy(GalaxyCoinRenewTicketsView::getExpiryTime).asc()
                 .build());
         User user = userMapper.selectById(userId);
@@ -1318,7 +1318,7 @@ public class GroupRelationController {
         for (GalaxyCoinRenewTicketsView galaxyCoinRenewTicketsView : search.getDataList()) {
             Long skuId = galaxyCoinRenewTicketsView.getSkuId();
             GoodsDonSku maxPriceSku = null;
-            if (galaxyCoinRenewTicketsView.getIsMirror()) {
+            if (galaxyCoinRenewTicketsView.getIsMirror() != null && galaxyCoinRenewTicketsView.getIsMirror()) {
                 List<RenewUpgradePackageFrontView> renewUpgradePackageFrontViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.class, MapUtils.builder().field(RenewUpgradePackageFrontView::getSkuId, skuId).build());
                 List<Long> upgradeSkuIds = new ArrayList<>();
                 renewUpgradePackageFrontViews.forEach(renew -> {