Quellcode durchsuchen

fix 增加平台虚拟销量

zoujiajian vor 3 Jahren
Ursprung
Commit
906b6571e7

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDon.java

@@ -84,6 +84,11 @@ public class GoodsDon extends BaseEntity {
      */
     private Integer sortBy;
 
+    /**
+     * 虚拟销量
+     */
+    private Integer virtualSold;
+
     @TableField(exist = false)
     @DbIgnore
     private BigDecimal price;

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpuInsert.java

@@ -84,4 +84,6 @@ public class ReqGoodsSpuInsert {
      * 排序
      */
     private Integer sortBy;
+
+    private Integer virtualSold;
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/GoodsDonViewer.java

@@ -127,6 +127,9 @@ public class GoodsDonViewer {
     @DbField("g.sort_by")
     private Integer sortBy;
 
+    @DbField("g.virtual_sold")
+    private Integer virtualSold;
+
     @DbIgnore
     private List<GoodsDonSku> skus;
 

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonPopularizeView.java

@@ -91,6 +91,12 @@ public class GoodsDonPopularizeView {
 	@DbField("select count(*) from order_don od where od.status not in ('close','noPayment') and od.goods_id = g.id")
 	private Integer sold;
 
+	/**
+	 * 虚拟销量
+	 */
+	@DbField("g.virtual_sold")
+	private Integer virtualSold;
+
 	/**
 	 * 排序
 	 */

+ 1 - 0
netflix-service/src/main/java/com/cyksj/service/distribute/equipment/impl/EquipmentDistributeFrontServiceImpl.java

@@ -59,6 +59,7 @@ public class EquipmentDistributeFrontServiceImpl implements EquipmentDistributeF
 		GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder()
 				.field(GroupsRelationView::getGoodsId, goodsId)
 				.field(GroupsRelationView::getId, relationId)
+				.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
 				.orderBy(GroupsRelationView::getExpiryTime).asc()
 				.field(GroupsRelationView::getUserId, userId)
 				.build());

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/market/impl/MarketFrontServiceImpl.java

@@ -635,7 +635,7 @@ public class MarketFrontServiceImpl implements MarketFrontService {
 				.field(GroupsRelationView::getUserId, userId)
 				.field(GroupsRelationView::getGoodsType, 1)
 				.field(GroupsRelationView::getGoodsSecondType, 2)
-				.field(GroupsRelationView::getStatus, "validity")
+				.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
 				.field(GroupsRelationView::getExpiryTime).op(Operator.NotNull);
 		if (goodsIdList != null && goodsIdList.size() > 0) {
 			builder.field(GroupsRelationView::getGoodsId, goodsIdList).op(Operator.InList);

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/distribute/EquipmentDistributeController.java

@@ -131,7 +131,7 @@ public class EquipmentDistributeController {
 				.field(GroupsRelationView::getUserId, userId)
 				.field(GroupsRelationView::getGoodsType, 1)
 				.field(GroupsRelationView::getGoodsSecondType, 2)
-				.field(GroupsRelationView::getStatus, "validity")
+				.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
 				.field(GroupsRelationView::getExpiryTime).op(Operator.NotNull);
 		if (!goodsIds.isEmpty()) {
 			builder.field(GroupsRelationView::getGoodsId, goodsIds).op(Operator.InList);

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

@@ -60,19 +60,16 @@ public class GoodsDonController {
                 .orderBy(GoodsDon::getId).asc()
                 .build()
         );
-        Integer virtual = 2000;
-        search.getDataList().forEach(goods->{
+        search.getDataList().forEach(goods -> {
             GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getGoodsId, goods.getId())
                     .eq(GoodsDonSku::getStatus, true)
                     .orderByAsc(GoodsDonSku::getPrice)
                     .last("limit 1")
                     .select(GoodsDonSku::getPrice));
             goods.setPrice(goodsDonSku.getPrice());
-            if (goods.getType() != 3 & goods.getId() != 17 && goods.getId() != 23 && goods.getId() != 24) {
-                goods.setSoldNum(virtual + orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-                        .eq(OrderDon::getGoodsId, goods.getId())
-                        .notIn(OrderDon::getStatus, Constant.noOrderStatus)));
-            }
+            goods.setSoldNum(goods.getVirtualSold() + orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
+                    .eq(OrderDon::getGoodsId, goods.getId())
+                    .notIn(OrderDon::getStatus, Constant.noOrderStatus)));
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }
@@ -90,7 +87,6 @@ public class GoodsDonController {
                 .orderBy(GoodsDonPopularizeView::getId).asc()
                 .build());
         DateTime now = DateTime.now();
-        Integer randomNum = 2000;
         search.getDataList().forEach(data -> {
             GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
                     .eq(GoodsDonSku::getGoodsId, data.getId())
@@ -103,9 +99,7 @@ public class GoodsDonController {
             });
             data.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, data.getId()).build()));
             data.setSkuList(beanSearcher.searchAll(GoodsDonSku.class, MapUtils.builder().field(GoodsDonSku::getGoodsId, data.getId()).field(GoodsDonSku::getStatus, true).build()));
-            if (data.getId() != 17 && data.getId() != 23 && data.getId() != 24) {
-                data.setSold(data.getSold() + randomNum);
-            }
+            data.setSold(data.getSold() + data.getVirtualSold());
             SearchResult<OrderComment> orderComments = beanSearcher.search(OrderComment.class,
                     MapUtils.builder().field(OrderComment::getGoodsId, data.getId())
                             .orderBy(OrderComment::getId).desc()
@@ -121,7 +115,7 @@ public class GoodsDonController {
                     .last("limit 1"));
             StringBuilder notifyMsg = new StringBuilder();
             if (orderDon == null) {
-                notifyMsg.append("2分钟");
+                notifyMsg.append("点击购买立即上车");
             } else {
                 Date payTime = orderDon.getPayTime();
                 Date startTime = payTime != null ? payTime : orderDon.getCreatedTime();