Просмотр исходного кода

fix Midjourney、ChatGpt规格座位暗改

zoujiajian 3 лет назад
Родитель
Сommit
9e38282e50

+ 4 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -79,4 +79,8 @@ public interface Constant {
 	List<String> registerAccount = List.of("apple", "spotify", "google");
 	List<String> registerAccount = List.of("apple", "spotify", "google");
 
 
 	String SUCCESS = "success";
 	String SUCCESS = "success";
+
+	List<Long> CHAT_GPT_SKU_IDS = List.of(161l, 168l);
+
+	List<Long> MIDJOURNEY_SKU_IDS = List.of(175l, 185l, 186l);
 }
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/GroupsRelationView.java

@@ -32,6 +32,7 @@ public class GroupsRelationView {
     private Long skuId;
     private Long skuId;
 
 
     @DbField("a.account")
     @DbField("a.account")
+    @JsonIgnore
     private String tripsAccount;
     private String tripsAccount;
 
 
     @DbField("g.id")
     @DbField("g.id")
@@ -65,6 +66,7 @@ public class GroupsRelationView {
     private Date expiryTime;
     private Date expiryTime;
 
 
     @DbField("gr.num")
     @DbField("gr.num")
+    @JsonIgnore
     private Integer num;
     private Integer num;
 
 
     @DbField("u.nickname")
     @DbField("u.nickname")
@@ -86,18 +88,21 @@ public class GroupsRelationView {
      * 创建时间
      * 创建时间
      */
      */
     @DbField("gr.created_time")
     @DbField("gr.created_time")
+    @JsonIgnore
     private Date createdTime;
     private Date createdTime;
 
 
     /**
     /**
      * 创建时间
      * 创建时间
      */
      */
     @DbField("gr.update_time")
     @DbField("gr.update_time")
+    @JsonIgnore
     private Date update_time;
     private Date update_time;
 
 
     /**
     /**
      * 账号
      * 账号
      */
      */
     @DbField("gr.account")
     @DbField("gr.account")
+    @JsonIgnore
     private String account;
     private String account;
 
 
     @DbIgnore
     @DbIgnore

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GroupsView.java

@@ -29,12 +29,14 @@ public class GroupsView {
      * 车位数量
      * 车位数量
      */
      */
     @DbField("g.num")
     @DbField("g.num")
+    @JsonIgnore
     private Integer num;
     private Integer num;
 
 
     /**
     /**
      * 可用车位数
      * 可用车位数
      */
      */
     @DbField("g.available_num")
     @DbField("g.available_num")
+    @JsonIgnore
     private Integer availableNum;
     private Integer availableNum;
 
 
     /**
     /**

+ 6 - 6
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -104,6 +104,9 @@ public class GoodsDonController {
                     data.setMonths(goodsDonSku.getMonths());
                     data.setMonths(goodsDonSku.getMonths());
                 }
                 }
             });
             });
+            if (data.getPrice() != null && data.getPrice().compareTo(BigDecimal.ZERO) > 0) {
+                collect.add(data);
+            }
             if (orderComments != null) {
             if (orderComments != null) {
                 List<OrderComment> comments = orderComments.getDataList();
                 List<OrderComment> comments = orderComments.getDataList();
                 data.setOrderComments(comments);
                 data.setOrderComments(comments);
@@ -142,9 +145,6 @@ public class GoodsDonController {
             }
             }
             notifyMsg.append("前有人购买");
             notifyMsg.append("前有人购买");
             data.setNotifyMsg(notifyMsg.toString());
             data.setNotifyMsg(notifyMsg.toString());
-            if (data.getPrice() != null && data.getPrice().compareTo(BigDecimal.ZERO) > 0) {
-                collect.add(data);
-            }
         });
         });
         search = new SearchResult<>(collect);
         search = new SearchResult<>(collect);
         search.setTotalCount(collect.size());
         search.setTotalCount(collect.size());
@@ -179,6 +179,9 @@ public class GoodsDonController {
                     data.setMonths(donFrontSkuView.getMonths());
                     data.setMonths(donFrontSkuView.getMonths());
                 }
                 }
             });
             });
+            if (data.getPrice() != null && data.getPrice().compareTo(BigDecimal.ZERO) > 0) {
+                collect.add(data);
+            }
             OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
             OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
                     .eq(OrderDon::getGoodsId, data.getId())
                     .eq(OrderDon::getGoodsId, data.getId())
                     .notIn(OrderDon::getStatus, Constant.noOrderStatus).select(OrderDon::getCreatedTime, OrderDon::getPayTime, OrderDon::getId)
                     .notIn(OrderDon::getStatus, Constant.noOrderStatus).select(OrderDon::getCreatedTime, OrderDon::getPayTime, OrderDon::getId)
@@ -213,9 +216,6 @@ public class GoodsDonController {
             }
             }
             notifyMsg.append("前有人购买");
             notifyMsg.append("前有人购买");
             data.setNotifyMsg(notifyMsg.toString());
             data.setNotifyMsg(notifyMsg.toString());
-            if (data.getPrice() != null && data.getPrice().compareTo(BigDecimal.ZERO) > 0) {
-                collect.add(data);
-            }
         });
         });
         search = new SearchResult<>(collect);
         search = new SearchResult<>(collect);
         search.setTotalCount(collect.size());
         search.setTotalCount(collect.size());

+ 43 - 18
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupController.java

@@ -1,10 +1,9 @@
 package com.cyksj.web.controller.group;
 package com.cyksj.web.controller.group;
 
 
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.constant.Constant;
 import com.cyksj.dto.Result;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.GoodsDonSkuMapper;
 import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.model.entity.GoodsDonSku;
 import com.cyksj.model.manage.views.GroupsRelationView;
 import com.cyksj.model.manage.views.GroupsRelationView;
 import com.cyksj.model.views.GroupsView;
 import com.cyksj.model.views.GroupsView;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.BeanSearcher;
@@ -17,10 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.util.Comparator;
 import java.util.List;
 import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 
 /**
 /**
  * @author chan
  * @author chan
@@ -39,26 +35,55 @@ public class GroupController {
     private final GoodsDonSkuMapper goodsDonSkuMapper;
     private final GoodsDonSkuMapper goodsDonSkuMapper;
 
 
     @GetMapping("/get")
     @GetMapping("/get")
-    public Result<SearchResult<GroupsView>> get(Long skuId) {
+    public Result<SearchResult<GroupsView>> get() {
         SearchResult<GroupsView> search = beanSearcher.search(GroupsView.class, MapUtils.flatBuilder(request.getParameterMap())
         SearchResult<GroupsView> search = beanSearcher.search(GroupsView.class, MapUtils.flatBuilder(request.getParameterMap())
                 .orderBy(GroupsView::getOrderBy).asc()
                 .orderBy(GroupsView::getOrderBy).asc()
                 .orderBy(GroupsView::getId).desc().build()
                 .orderBy(GroupsView::getId).desc().build()
         );
         );
-        List<GoodsDonSku> goodsDonSkus = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getGoodsId, 18).select(GoodsDonSku::getId));
-        Set<Long> skuIds = goodsDonSkus.stream().map(GoodsDonSku::getId).collect(Collectors.toSet());
-        if (skuIds.contains(skuId)) {
-            search.getDataList().forEach((groupsView)->{
-                groupsView.setRelations(beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
+        search.getDataList().forEach((groupsView) -> {
+            if (Constant.CHAT_GPT_SKU_IDS.contains(groupsView.getSkuId())) {
+                List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
                         .field(GroupsRelationView::getGroupsId, groupsView.getId())
                         .field(GroupsRelationView::getGroupsId, groupsView.getId())
                         .orderBy(GroupsRelationView::getUpdate_time).desc()
                         .orderBy(GroupsRelationView::getUpdate_time).desc()
-                        .build()));
-            });
-            search.getDataList().sort(Comparator.comparing(GroupsView::getOrderBy));
-        }else {
-            search.getDataList().forEach((groupsView) -> {
+                        .build());
+                List<GroupsRelationView> all = null;
+                //GPT 月付 暗改成20个 展示10个
+                if (groupsView.getSkuId().equals(Constant.CHAT_GPT_SKU_IDS.get(0))) {
+                    all = relationViewList.subList(0, 5);
+                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 5, 20);
+                    all.addAll(after);
+                }
+                //GPT 4人月付暗改成6个 展示4个
+                if (groupsView.getSkuId().equals(Constant.CHAT_GPT_SKU_IDS.get(1))) {
+                    all = relationViewList.subList(0, 2);
+                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 2, 6);
+                    all.addAll(after);
+                }
+                groupsView.setRelations(all);
+            } else if (Constant.MIDJOURNEY_SKU_IDS.contains(groupsView.getSkuId()) && groupsView.getNum() == 15) {
+                List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
+                        .field(GroupsRelationView::getGroupsId, groupsView.getId())
+                        .orderBy(GroupsRelationView::getUpdate_time).desc()
+                        .build());
+                List<GroupsRelationView> all = null;
+                //MIDJOURNEY 月付5个 暗改15个 展示5个
+                if (groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(0))) {
+                    all = relationViewList.subList(0, 5);
+                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 1, 15);
+                    all.addAll(after);
+                }
+                //MIDJOURNEY 标准会员月付10个 暗改15个 展示10个
+                if (groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(1)) || groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(2))) {
+                    all = relationViewList.subList(0, 5);
+                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 5, 15);
+                    all.addAll(after);
+                }
+                groupsView.setRelations(all);
+            } else {
                 groupsView.setRelations(beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getGroupsId, groupsView.getId()).build()));
                 groupsView.setRelations(beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getGroupsId, groupsView.getId()).build()));
-            });
-        }
+            }
+
+        });
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }
     }