Merge remote-tracking branch 'origin/master'
# Conflicts: # ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java20230922-ljl-fixBug
commit
40f3effa90
@ -0,0 +1,9 @@
|
||||
package com.ms.api.dto.move;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetRecommendProductListRequestDTO {
|
||||
private Integer pageNo;
|
||||
private Integer pageSize;
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.biz.DsCatService;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.common.Ret;
|
||||
import com.ms.api.common.SPIBaseService;
|
||||
import com.ms.api.dto.move.GetRecommendProductListRequestDTO;
|
||||
import com.ms.api.service.CategoryService;
|
||||
import com.ms.api.tool.DsJsonRequestTemplate;
|
||||
import com.ms.dal.entity.Category;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ExtensionService("getRecommendProductList")
|
||||
@Slf4j
|
||||
public class GetRecommendProductListService extends SPIBaseService implements ExtensionServiceHandler<GetRecommendProductListRequestDTO, Ret> {
|
||||
|
||||
@Autowired
|
||||
private DsJsonRequestTemplate dsJsonRequestTemplate;
|
||||
|
||||
@Autowired
|
||||
private DsCatService dsCatService;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Override
|
||||
public BaseResponse<Ret> handle(BaseRequest<GetRecommendProductListRequestDTO> req) {
|
||||
initHandle(req);
|
||||
getAuthCode();
|
||||
|
||||
GetRecommendProductListRequestDTO requestDTO = req.getData();
|
||||
|
||||
// 1688类目树
|
||||
JSONArray arrayData = dsCatService.getDSProductCatTree();
|
||||
|
||||
// 获取商家抖店类目列表
|
||||
List<Category> categoryList = categoryService.getAllLeafProductCatListFromTos(shopId.intValue(), false);
|
||||
Collections.shuffle(categoryList);
|
||||
|
||||
int productCnt = 0;
|
||||
int categoryIndex = 0;
|
||||
while (productCnt < requestDTO.getPageSize()) {
|
||||
|
||||
|
||||
categoryIndex++;
|
||||
}
|
||||
|
||||
|
||||
// HashMap<String, Object> params = new HashMap<>();
|
||||
//// params.put("keyword",fields.getKeyword());
|
||||
//// params.put("topCid",fields.getTopCid());
|
||||
// params.put("cid",fields.getCid());
|
||||
// params.put("sort", "saleCntDesc");
|
||||
//// params.put("ruleIds", fields.getRuleIds());
|
||||
// params.put("isHideMoved", 1);
|
||||
// params.put("pageNo",requestDTO.getPageNo());
|
||||
// params.put("pageSize",requestDTO.getPageSize());
|
||||
// params.put("authCode",authCode);
|
||||
// log.info(params.toString());
|
||||
// JSONObject resObj = null;
|
||||
// String res = null;
|
||||
// List<Object> products = new LinkedList<>();
|
||||
//
|
||||
// try {
|
||||
// res = dsJsonRequestTemplate.execute("/move/search_choiceness_source_item", params);
|
||||
// resObj = JSON.parseObject(res);
|
||||
// if (resObj.get("result").equals("success")) {
|
||||
// log.info("resObj::"+resObj.toString());
|
||||
// Map result = new HashMap();
|
||||
// List<Object> sourceItems = new ArrayList<>();
|
||||
// JSONArray sourceItemjson = resObj.getJSONArray("sourceItems");
|
||||
// if (!ObjectUtil.isEmpty(sourceItemjson)) {
|
||||
// sourceItems = sourceItemjson;
|
||||
// }
|
||||
// result.put("result", resObj.getString("result"));
|
||||
// result.put("sourceItems", sourceItems);
|
||||
// result.put("total", resObj.getInteger("total"));
|
||||
// res = JSON.toJSONString(result);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// log.error(e.getMessage());
|
||||
// }
|
||||
|
||||
|
||||
return R.ok(Ret.success());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue