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