yumeng 2 éve
szülő
commit
8150342772

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedanceController.java

@@ -50,7 +50,7 @@ public class BytedanceController extends BaseController {
     @ApiOperation(value = "新增活动商品")
     @GetMapping("/addBytedanceColonelActivityProduct")
     public void addBytedanceColonelActivityProduct(@ApiParam("activityId") @RequestParam(value = "活动ID", required = true) Long activityId,
-                                                   @ApiParam("productInfo") @RequestParam(value = "商品信息", required = true) String productInfo
+                                                   @ApiParam("productInfo") @RequestParam(value = "商品信息", required = true) Long productInfo
     ) {
         bytedanceService.addBytedanceColonelActivityProduct(activityId, productInfo);
     }

+ 3 - 1
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/IBytedanceService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.bytedance.service;
 
 
+import com.alibaba.fastjson.JSONObject;
+
 /**
  * 调用媒体服务
  *
@@ -22,7 +24,7 @@ public interface IBytedanceService {
     /**
      * job 新增活动商品
      */
-    void addBytedanceColonelActivityProduct(Long activityId, String productInfo);
+    JSONObject addBytedanceColonelActivityProduct(Long activityId, Long productInfo);
 
     void addBytedanceInstituteOrderColonel(String startTime, String endTime, String cursor);
 }

+ 82 - 6
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedanceServiceImpl.java

@@ -58,7 +58,7 @@ public class BytedanceServiceImpl implements IBytedanceService {
     /**
      * 新增团长活动 信息
      *
-     * @param bytedanceColonelActivity 团长活动 信息
+     * @param  团长活动 信息
      */
     @Override
     public void addBytedanceColonelActivityList(Long page) {
@@ -152,13 +152,16 @@ public class BytedanceServiceImpl implements IBytedanceService {
     }
 
     @Override
-    public void addBytedanceColonelActivityProduct(Long activityId, String productInfo) {
+    public JSONObject addBytedanceColonelActivityProduct(Long activityId, Long productInfo) {
+
+
+        JSONObject returnJson = new JSONObject();
         AccessToken accessToken = tokenService.getAccessToken(1L);
 
         AllianceColonelActivityProductRequest request = new AllianceColonelActivityProductRequest();
         AllianceColonelActivityProductParam param = request.getParam();
         param.setActivityId(activityId);
-        param.setProductInfo(productInfo);//商品ID/名称(支持根据商品id或者商品名称搜索,商品ID精准匹配,商品名称模糊匹配)
+        param.setProductInfo(String.valueOf(productInfo));//商品ID/名称(支持根据商品id或者商品名称搜索,商品ID精准匹配,商品名称模糊匹配)
         param.setPage(1L);//页码,从1开始。分页模式下生效,超过10000条会被限制,推荐使用游标模式 retrieve_mode=1
         param.setCount(20L);//每页数量(每页最多20)
 //        param.setSearchType(4L);//0:报名时间;1:活动价格排序;2:活动佣金比例排序;4:更新时间排序
@@ -169,11 +172,84 @@ public class BytedanceServiceImpl implements IBytedanceService {
 //        param.setRetrieveMode(1);//获取模式。0: 分页模式(默认),最多返回10000条数据;1: 游标模式(推荐),返回条数无限制
 
         AllianceColonelActivityProductResponse response = request.execute(accessToken);
+
         System.out.println(response);
-        if (Check.isNull(response) || !"10000".equals(response.getCode())) {
-            log.error("\n【请求接口】: {}\n【请求参数】:{}\n【响应数据】:{}", "/buyin/colonelActivityDetail;(获取团长活动详情)", param, response);
-            return;
+
+
+        JSONObject jsonObject = JSONObject.parseObject(response.toString());
+        Integer code = jsonObject.getInteger("code");
+        String msg = jsonObject.getString("msg");
+        if (code == 10000) {
+            returnJson.put("code", 0);
+            returnJson.put("message", "请求成功");
+            returnJson.put("judgeStatus", "1");
+            JSONObject dataJson = jsonObject.getJSONObject("data");
+            JSONObject data = dataJson.getJSONArray("data").getJSONObject(0);
+            if (!Check.isNull(data)) {
+                JSONObject itemJson = new JSONObject();
+                Long product_id = data.getLong("product_id");//商品ID
+                String title = data.getString("title");//商品名称
+                Long price = data.getLong("price");//商品售价
+                Double cos_ratio = data.getDouble("cos_ratio");//	佣金比例
+                Long cos_fee = data.getLong("cos_fee");//	佣金金额,单位分
+                Long first_cid = data.getLong("first_cid");//	商品一级类目
+                Long second_cid = data.getLong("second_cid");//	商品二级类目
+                Long third_cid = data.getLong("third_cid");//	商品商品三级类目
+                Long sales = data.getLong("sales");//	销量
+                String cover = data.getString("cover");//	商品主图
+                String detail_url = data.getString("detail_url");//	商品团长活动链接
+                Long shop_id = data.getLong("shop_id");//	店铺ID
+                String shop_name = data.getString("shop_name");//	店铺名称
+                Integer status = data.getInteger("status");//	审核状态
+                String reason = data.getString("reason");//	reason
+                Long category_id = data.getLong("category_id");//	行业类目ID
+                String category_name = data.getString("category_name");//	行业类目名称
+                String product_stock = data.getString("product_stock");//	商品库存
+                String shop_score = data.getString("shop_score");//	店铺分
+
+                itemJson.put("itemId", product_id);
+                itemJson.put("itemTitle", title);
+                itemJson.put("itemPrice", price);
+                itemJson.put("itemDesc", "-");
+                itemJson.put("zkFinalPrice", price);
+                itemJson.put("itemImgUrl", cover);
+                itemJson.put("shopStar", "-");
+                itemJson.put("mallLogisticsScore", shop_name);
+                if (status == 0) {
+                    itemJson.put("activityItemStatus", 1);
+                } else if (status == 1) {
+                    itemJson.put("activityItemStatus", 2);
+                } else if (status == 2) {
+                    itemJson.put("activityItemStatus", 3);
+                } else {
+                    itemJson.put("activityItemStatus", 5);
+                }
+                itemJson.put("categoryId", category_id);
+                itemJson.put("categoryName", category_name);
+                itemJson.put("itemGalleryUrls", null); // 轮播图
+                itemJson.put("itemDescUrls", null); // 详情图
+                itemJson.put("activityId", activityId);
+                itemJson.put("shopTitle", shop_name);
+                itemJson.put("commissionRate", cos_ratio);
+                itemJson.put("mallServiceScore", shop_score);
+                itemJson.put("mallQualityScore", ""); // 店铺质量分
+                itemJson.put("skuList", ""); // sku信息
+                itemJson.put("postArea", ""); // 发货地址
+                itemJson.put("detailUrl", detail_url);
+                itemJson.put("regimentalPromotionRate", null);
+                returnJson.put("itemJson", itemJson);
+
+            }
+
+        } else {
+            returnJson.put("code", -1);
+            returnJson.put("message", msg);
+
         }
+
+
+        return returnJson;
+
     }
 
     @Override

+ 27 - 11
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemListController.java

@@ -1,10 +1,13 @@
 package com.ruixuan.isc.controller;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.kuaishou.merchant.open.api.KsMerchantApiException;
+import com.ruixuan.bytedance.service.IBytedanceService;
 import com.ruixuan.common.annotation.Log;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.AjaxResult;
@@ -41,6 +44,8 @@ public class KuaishouItemListController extends BaseController {
     private ISysDeptService sysDeptService;
     @Autowired
     private IAccessTokenService accessTokenService;
+    @Autowired
+    private IBytedanceService bytedanceService;
 
 
     @GetMapping("/bytedanceToken")
@@ -100,7 +105,8 @@ public class KuaishouItemListController extends BaseController {
     public JSONObject getItemPreview(
             @ApiParam("活动ID") @RequestParam(value = "activityId", required = false) Long activityId,
             @ApiParam("商品ID") @RequestParam(value = "itemId", required = false) Long itemId,
-            @ApiParam("团长ID") @RequestParam(value = "regId", required = false) Long regId
+            @ApiParam("团长ID") @RequestParam(value = "regId", required = false) Long regId,
+            @ApiParam("媒体ID") @RequestParam(value = "mediaId", required = false) Long mediaId
 
     ) {
         JSONObject returnJson = new JSONObject();
@@ -108,18 +114,25 @@ public class KuaishouItemListController extends BaseController {
             if (Check.isNull(itemId)) {
                 throw new Exception("请传入商品ID");
             }
-            if (Check.isNull(regId)) {
+          /*  if (Check.isNull(regId)) {
                 throw new Exception("请选择所属团");
-            }
+            }*/
             if (Check.isNull(activityId)) {
                 throw new Exception("请输入活动ID");
             }
-            KuaishouAccessToken accessToken = accessTokenService.getAccessToken(regId);
-
-            if (Check.isNull(accessToken)) {
-                throw new Exception("获取token授权信息为空");
+            if (Check.isNull(mediaId)) {
+                throw new Exception("请选择媒体");
+            }
+            if (mediaId == 2) {
+                KuaishouAccessToken accessToken = accessTokenService.getAccessToken(regId);
+                if (Check.isNull(accessToken)) {
+                    throw new Exception("获取token授权信息为空");
+                }
+                returnJson = kuaishouItemListService.getItemDetail(regId, activityId, itemId, accessToken);
+            } else if (mediaId == 1) {
+                returnJson = bytedanceService.addBytedanceColonelActivityProduct(activityId, itemId);
             }
-            returnJson = kuaishouItemListService.getItemDetail(regId, activityId, itemId, accessToken);
+
         } catch (Exception e) {
             e.printStackTrace();
             returnJson.put("code", 500);
@@ -136,7 +149,9 @@ public class KuaishouItemListController extends BaseController {
             @ApiParam("审核状态") @RequestParam(value = "examineStatus", required = false) Long examineStatus,
             @ApiParam("商品ID") @RequestParam(value = "itemId", required = false) Long itemId,
             @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) String itemTitle,
-            @ApiParam("品类ID") @RequestParam(value = "categoryId", required = false) Long categoryId) {
+            @ApiParam("品类ID") @RequestParam(value = "categoryId", required = false) Long categoryId,
+            @ApiParam("品类ID") @RequestParam(value = "mediaId", required = false) Integer mediaId
+    ) {
         TableDataInfo dataInfo = new TableDataInfo();
         try {
             Map<String, Object> requestMap = new HashMap<>();
@@ -165,6 +180,9 @@ public class KuaishouItemListController extends BaseController {
             if (!Check.isNull(categoryId)) {
                 requestMap.put("categoryId", categoryId);
             }
+            if (!Check.isNull(mediaId)) {
+                requestMap.put("mediaId", mediaId);
+            }
 
             startPage();
             List<KuaishouItemList> list = kuaishouItemListService.getItemList(requestMap);
@@ -379,7 +397,6 @@ public class KuaishouItemListController extends BaseController {
     }
 
 
-
     @GetMapping("/removeRelateByItemId")
     public JSONObject removeRelateByItemId(Long itemId) {
         JSONObject returnJson = new JSONObject();
@@ -429,7 +446,6 @@ public class KuaishouItemListController extends BaseController {
     }
 
 
-
     @GetMapping("/getListByRelateId")
     public JSONObject getListByRelateId(Long relateId) {
         JSONObject returnJson = new JSONObject();

+ 22 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouItemList.java

@@ -12,6 +12,7 @@ public class KuaishouItemList extends BaseEntity {
      * 商品ID
      */
     private Long itemId;
+    private Long  mediaId;
 
     /**
      * 商品标题
@@ -225,12 +226,15 @@ public class KuaishouItemList extends BaseEntity {
     private Long validAmount;
     @Transient
     private String ruleName;
+    @Transient
+    private String mediaName;
     private Integer samplesReceived;
     private Integer samplesPeoples;
 
     private Long relateId;
     private Long ruleId;
 
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -243,6 +247,14 @@ public class KuaishouItemList extends BaseEntity {
         this.itemId = itemId;
     }
 
+    public Long getMediaId() {
+        return mediaId;
+    }
+
+    public void setMediaId(Long mediaId) {
+        this.mediaId = mediaId;
+    }
+
     public String getItemTitle() {
         return itemTitle;
     }
@@ -547,6 +559,14 @@ public class KuaishouItemList extends BaseEntity {
         this.ruleName = ruleName;
     }
 
+    public String getMediaName() {
+        return mediaName;
+    }
+
+    public void setMediaName(String mediaName) {
+        this.mediaName = mediaName;
+    }
+
     public Integer getSamplesReceived() {
         return samplesReceived;
     }
@@ -583,6 +603,7 @@ public class KuaishouItemList extends BaseEntity {
     public String toString() {
         return "KuaishouItemList{" +
                 "itemId=" + itemId +
+                ", mediaId=" + mediaId +
                 ", itemTitle='" + itemTitle + '\'' +
                 ", itemPrice=" + itemPrice +
                 ", itemDesc='" + itemDesc + '\'' +
@@ -621,6 +642,7 @@ public class KuaishouItemList extends BaseEntity {
                 ", validOrderNum=" + validOrderNum +
                 ", validAmount=" + validAmount +
                 ", ruleName='" + ruleName + '\'' +
+                ", mediaName='" + mediaName + '\'' +
                 ", samplesReceived=" + samplesReceived +
                 ", samplesPeoples=" + samplesPeoples +
                 ", relateId=" + relateId +

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 21 - 6
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemListMapper.xml