Forráskód Böngészése

平台是否参与店铺分销;开店审核商务展示

zoujiajian 2 éve
szülő
commit
81dcb149f5

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

@@ -184,6 +184,11 @@ public class GoodsDon extends BaseEntity {
      */
     private Boolean isSp;
 
+    /**
+     * 是否参与分销 默认参与
+     */
+    private Boolean isDistribute;
+
     @AllArgsConstructor
     @Getter
     public enum SpecialType {

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/YhShopApplyRecord.java

@@ -36,6 +36,8 @@ public class YhShopApplyRecord extends BaseEntity {
 	 */
 	private Status verifyStatus;
 
+	private Long businessId;
+
 	/**
 	 * 审核失败原因
 	 */

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

@@ -122,4 +122,6 @@ public class ReqGoodsSpuInsert {
      * 推荐平台
      */
     private List<Long> recommendGoodsList;
+
+    private Boolean isDistribute;
 }

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

@@ -165,6 +165,12 @@ public class GoodsDonViewer {
     @DbField("g.recommend_goods")
     private String recommendGoods;
 
+    /**
+     * 是否参与分销 默认参与
+     */
+    @DbField("g.is_distribute")
+    private Boolean isDistribute;
+
     @DbIgnore
     private List<Long> recommendGoodsList;
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/YhShopAvailableGoodsView.java

@@ -14,7 +14,7 @@ import lombok.Setter;
 @Getter
 @Setter
 @SearchBean(tables = "yh_shop_goods_rate yr left join goods_don g on g.id = yr.goods_id",
-		where = "g.type = 1 and g.deleted is true and g.status is true :condition:"
+		where = "g.type = 1 and g.deleted is true and g.status is true and g.is_distribute is true :condition:"
 		, groupBy = "g.id,g.title")
 public class YhShopAvailableGoodsView {
 	@DbField("g.id")

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/YhShopGoodsFrontView.java

@@ -21,7 +21,7 @@ import java.util.List;
 @Setter
 @SearchBean(tables = "(select ys.goods_id,min(ys.price) as price from yh_shop_goods_sku ys left join goods_don_sku sku on sku.id = ys.sku_id where sku.status is true and ys.status is true and ys.deleted is true :condition: group by ys.goods_id) yg" +
 		" inner join goods_don g on g.id = yg.goods_id",
-		where = "g.deleted is true and g.status is true",
+		where = "g.deleted is true and g.status is true and g.is_distribute is true",
 		orderBy = "g.sort_by asc, g.id")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class YhShopGoodsFrontView {

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/YhShopGoodsRateView.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 @Data
 @SearchBean(tables = "goods_don g left join goods_don_category gc on gc.id = g.category",
-        where = "g.type = 1 and g.status = true and g.deleted = true")
+        where = "g.type = 1 and g.status = true and g.deleted = true and g.is_distribute is true")
 public class YhShopGoodsRateView {
     @DbField("g.id")
     private Long goodsId;

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/YhShopGoodsView.java

@@ -16,7 +16,7 @@ import java.util.List;
 @Data
 @SearchBean(tables = "yh_shop_goods_sku ysgs left join goods_don g on g.id = ysgs.goods_id" +
         " left join goods_don_sku sku on sku.id = ysgs.sku_id",
-        where = "ysgs.deleted is true and g.status = true and g.deleted = true and sku.status is true"
+        where = "ysgs.deleted is true and g.status is true and g.deleted is true and sku.status is true and g.is_distribute is true"
         , groupBy = "g.id,g.title,g.category,ysgs.status,ysgs.user_id,ysgs.created_time,ysgs.update_time")
 public class YhShopGoodsView {
     @DbField("g.id")

+ 8 - 1
netflix-dao/src/main/java/com/cyksj/model/views/YhShopView.java

@@ -16,7 +16,8 @@ import java.util.Date;
  */
 @Getter
 @Setter
-@SearchBean(tables = "yh_shop_apply_record ys left join user u on u.id = ys.user_id")
+@SearchBean(tables = "yh_shop_apply_record ys left join user u on u.id = ys.user_id" +
+		" left join cms_user cu on cu.id = ys.business_id")
 public class YhShopView {
 	@DbField("ys.id")
 	private Long id;
@@ -40,6 +41,12 @@ public class YhShopView {
 	@DbField("ys.custom_id")
 	private String customId;
 
+	@DbField("ys.business_id")
+	private Long businessId;
+
+	@DbField("cu.nickname")
+	private String businessName;
+
 	/**
 	 * 是否审核通过
 	 */

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

@@ -9,14 +9,11 @@ import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alipay.api.AlipayApiException;
 import com.alipay.api.AlipayClient;
-import com.alipay.api.AlipayRequest;
 import com.alipay.api.domain.AlipayFundTransCommonQueryModel;
-import com.alipay.api.domain.AlipayTradePagePayModel;
 import com.alipay.api.domain.AlipayTradeRefundModel;
 import com.alipay.api.domain.AlipayTradeWapPayModel;
 import com.alipay.api.internal.util.AlipaySignature;
 import com.alipay.api.request.AlipayFundTransCommonQueryRequest;
-import com.alipay.api.request.AlipayFundTransUniTransferRequest;
 import com.alipay.api.request.AlipayTradeFastpayRefundQueryRequest;
 import com.alipay.api.request.AlipayTradeQueryRequest;
 import com.alipay.api.response.AlipayFundTransCommonQueryResponse;
@@ -58,7 +55,10 @@ import com.cyksj.model.entity.*;
 import com.cyksj.model.manage.dto.GiftCardDto;
 import com.cyksj.model.manage.views.GroupsRelationView;
 import com.cyksj.model.manage.views.OrderDonView;
-import com.cyksj.model.request.*;
+import com.cyksj.model.request.GiftCardPayReq;
+import com.cyksj.model.request.OrderAttach;
+import com.cyksj.model.request.OrderPayRequest;
+import com.cyksj.model.request.TelegramBotMsgReq;
 import com.cyksj.model.views.CouponNewUserView;
 import com.cyksj.model.views.CouponUserView;
 import com.cyksj.model.views.GiftCardGoodsSkuFrontView;
@@ -273,6 +273,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		if (goodsDon == null || !goodsDon.getStatus()) {
 			throw new BusinessRuntimeException("商品已下架");
 		}
+		//是否参与店铺分销
+		if (yhsId > 0 && !goodsDon.getIsDistribute()) {
+			throw new BusinessRuntimeException("系统异常,请刷新页面重试");
+		}
 		if (isGiftCardPay.get() && (goodsDon.getSpecialType() == null || goodsDon.getSpecialType() != GoodsDon.SpecialType.giftCard)) {
 			throw BusinessRuntimeException.getInstance("非礼品卡类型商品");
 		}

+ 11 - 0
netflix-service/src/main/java/com/cyksj/service/shop/impl/YhShopServiceImpl.java

@@ -12,6 +12,7 @@ import com.cyksj.mapper.shop.YhShopApplyRecordMapper;
 import com.cyksj.mapper.shop.YhShopMapper;
 import com.cyksj.model.dto.YhShopInfo;
 import com.cyksj.model.entity.SysConfig;
+import com.cyksj.model.entity.UserDistribute;
 import com.cyksj.model.entity.YhShop;
 import com.cyksj.model.entity.YhShopApplyRecord;
 import com.cyksj.service.shop.YhShopFrontService;
@@ -72,12 +73,21 @@ public class YhShopServiceImpl implements YhShopFrontService {
 		if (user_ds_order < ds_order_limit) {
 			throw BusinessRuntimeException.getInstance("您推广单数不符合开店资格");
 		}
+		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
+				.eq(UserDistribute::getUserId, userId)
+				.eq(UserDistribute::getDeleted, true)
+				.last("limit 1"));
+		Long businessId = 0l;
+		if (userDistribute != null) {
+			businessId = userDistribute.getBusinessId();
+		}
 		try {
 			YhShop save = new YhShop();
 			save.setName(name);
 			save.setUserId(userId);
 			save.setCustomId(customId);
 			save.setVerifyStatus(YhShop.Status.verify);
+			save.setBusinessId(businessId);
 			yhShopMapper.insert(save);
 
 			YhShopApplyRecord yhShopApplyRecord = new YhShopApplyRecord();
@@ -85,6 +95,7 @@ public class YhShopServiceImpl implements YhShopFrontService {
 			yhShopApplyRecord.setUserId(userId);
 			yhShopApplyRecord.setCustomId(customId);
 			yhShopApplyRecord.setVerifyStatus(YhShopApplyRecord.Status.verify);
+			yhShopApplyRecord.setBusinessId(businessId);
 			yhShopApplyRecordMapper.insert(yhShopApplyRecord);
 		} catch (Exception e) {
 			throw BusinessRuntimeException.getInstance("系统繁忙,请重试..");

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

@@ -572,7 +572,6 @@ public class GoodsDonController {
         DateTime now = DateTime.now();
         list.forEach(data->{
             Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getYhsId, yhsId)
                     .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
             data.setSold(sold + data.getVs());
             data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));

+ 1 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopUserController.java

@@ -119,6 +119,7 @@ public class YhShopUserController {
 		yhShopApplyRecord.setVerifyStatus(YhShopApplyRecord.Status.verify);
 		yhShopApplyRecord.setName(name);
 		yhShopApplyRecord.setUserId(userId);
+		yhShopApplyRecord.setBusinessId(yhShop.getBusinessId());
 		yhShopApplyRecordMapper.insert(yhShopApplyRecord);
 
 		if (StrUtil.isNotBlank(yhShop.getReason())) {