Ver Fonte

fix HBO GO车队满员下架车队

zoujiajian há 1 ano atrás
pai
commit
dd4625c0a4

+ 20 - 0
netflix-service/src/main/java/com/cyksj/service/mange/group/CmsGroupServiceImpl.java

@@ -315,6 +315,9 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
                     .eq(GroupsRelationAlert::getSkuId, sku.getId())
                     .eq(GroupsRelationAlert::getIsReset, false));
         }
+
+        //HBO GO 满员,车队下架
+        setDownIfFull(goodsDon, groupsTrips);
     }
 
     @Override
@@ -508,4 +511,21 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
         }
         return available;
     }
+
+    private void setDownIfFull(GoodsDon goodsDon, GroupsTrips groupsTrips) {
+        //HBO GO 满员,车队下架
+        if (goodsDon.getId() == 8l) {
+            if (groupsTrips.getStatus() == GroupsTrips.Status.validity) {
+                Integer count2 = relationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class)
+                        .eq(GroupsRelation::getGroupsId, groupsTrips.getId())
+                        .in(GroupsRelation::getStatus, List.of(GroupsRelation.Status.none, GroupsRelation.Status.locking)));
+                if (count2 == 0) {
+                    log.info("HBO GO车队:{}已满员,自动下架", groupsTrips.getId());
+                    groupsMapper.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
+                            .set(GroupsTrips::getStatus, GroupsTrips.Status.down)
+                            .eq(GroupsTrips::getId, groupsTrips.getId()));
+                }
+            }
+        }
+    }
 }

+ 23 - 0
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2663,6 +2663,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				sendSubDistributeRewards(orderDon);
 				//删除用户意向标签
 				clearEpIntentionTag(goodsDon, orderDon.getUserId());
+
+				//HBO GO车队满员 车队自动下架
+				setTripDownIfFull(orderDon);
 			} catch (Exception e) {
 				log.error("回调修改订单信息错误,orderId:{},error:{}", orderDon.getId(), StringUtil.getErrorText(e));
 			}
@@ -2717,6 +2720,26 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			}
 		}
 	}
+
+	private void setTripDownIfFull(OrderDon orderDon) {
+		if (orderDon.getGoodsId() == 8l) {
+			Long relationId = orderDon.getRelationId();
+			GroupsRelation relation = groupsRelationMapper.selectById(relationId);
+			GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
+			if (groupsTrips.getStatus() == GroupsTrips.Status.validity) {
+				Integer count = groupsRelationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class)
+						.eq(GroupsRelation::getGroupsId, relation.getGroupsId())
+						.in(GroupsRelation::getStatus, List.of(GroupsRelation.Status.none, GroupsRelation.Status.locking)));
+				if (count == 0) {
+					log.info("HBO GO车队:{}已满员,自动下架", relation.getGroupsId());
+					groupsMapper.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
+							.set(GroupsTrips::getStatus, GroupsTrips.Status.down)
+							.eq(GroupsTrips::getId, relation.getGroupsId()));
+				}
+			}
+		}
+	}
+
 	private void mjRenewOrder(OrderDon orderDon){
 		if (orderDon.getOrderType() == 2 && orderDon.getGoodsId() == 26) {
 			GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectById(orderDon.getSkuId());