Commit fb762e15 by 刘宇峰

查询商品详情-新增从云中鹤查商品详情接口,方便跟踪信息

1 parent 36ae66b9
...@@ -11,6 +11,8 @@ import io.swagger.v3.oas.annotations.Operation; ...@@ -11,6 +11,8 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -41,10 +43,16 @@ public class GoodsApiController implements ShopmallGoodsApiService { ...@@ -41,10 +43,16 @@ public class GoodsApiController implements ShopmallGoodsApiService {
return goodsService.queryGoodsListByCondition(req); return goodsService.queryGoodsListByCondition(req);
} }
@Operation(summary = "获取商品详情信息接口", description = "查询获取云中鹤平台商城商品详情信息") @Operation(summary = "获取商品详情信息接口(本地库)", description = "查询获取云中鹤平台商城商品详情信息(本地库同步数据)")
@Override @Override
public List<QueryGoodsDetailResponse> queryGoodsDetail(@NotEmpty @RequestParam("goodsSkuCodes") List<String> goodsSkuCodes) { public List<QueryGoodsDetailResponse> queryGoodsDetail(@NotEmpty @RequestParam("goodsSkuCodes") List<String> goodsSkuCodes) {
return goodsService.queryGoodsDetail(goodsSkuCodes); return goodsService.queryGoodsDetail(goodsSkuCodes, false);
}
@Operation(summary = "获取商品详情信息接口(云中鹤)", description = "查询获取云中鹤平台商城商品详情信息(云中鹤接口数据)")
@GetMapping(value = "goods/queryCraneGoodsDetail", produces = MediaType.APPLICATION_JSON_VALUE)
public List<QueryGoodsDetailResponse> queryCraneGoodsDetail(@NotEmpty @RequestParam("goodsSkuCodes") List<String> goodsSkuCodes) {
return goodsService.queryGoodsDetail(goodsSkuCodes, true);
} }
@Operation(summary = "获取商品图片列表接口", description = "查询获取云中鹤平台商城商品图片信息列表") @Operation(summary = "获取商品图片列表接口", description = "查询获取云中鹤平台商城商品图片信息列表")
......
...@@ -109,9 +109,11 @@ public class GoodsService implements InitializingBean { ...@@ -109,9 +109,11 @@ public class GoodsService implements InitializingBean {
* @author huangch * @author huangch
* @date 2023/4/11 10:12 * @date 2023/4/11 10:12
*/ */
public List<QueryGoodsDetailResponse> queryGoodsDetail(List<String> goodsSkuCodes) { public List<QueryGoodsDetailResponse> queryGoodsDetail(List<String> goodsSkuCodes, boolean isFromCrane) {
Assert.notEmpty(goodsSkuCodes, "goodsSkuCodes cannot be empty."); Assert.notEmpty(goodsSkuCodes, "goodsSkuCodes cannot be empty.");
// cloudCraneService.queryGoodsDetail(goodsSkuCodes); if (isFromCrane) {
return cloudCraneService.queryGoodsDetail(goodsSkuCodes);
}
List<Goods> goodsList = goodsMapper.queryGoodsDetail(goodsSkuCodes); List<Goods> goodsList = goodsMapper.queryGoodsDetail(goodsSkuCodes);
List<QueryGoodsDetailResponse> goodsDetailList = goodsList.parallelStream().map(GoodsConverter.INSTANCE::toGoodsDetailResponse).collect(Collectors.toList()); List<QueryGoodsDetailResponse> goodsDetailList = goodsList.parallelStream().map(GoodsConverter.INSTANCE::toGoodsDetailResponse).collect(Collectors.toList());
......
...@@ -41,7 +41,7 @@ public class GoodsServiceTest { ...@@ -41,7 +41,7 @@ public class GoodsServiceTest {
@Test @Test
public void testQueryGoodsInfo() { public void testQueryGoodsInfo() {
List<String> goodsSkuCodes = Lists.newArrayList("2888888889106479"); List<String> goodsSkuCodes = Lists.newArrayList("2888888889106479");
List<QueryGoodsDetailResponse> goodsDetailList = goodsService.queryGoodsDetail(goodsSkuCodes); List<QueryGoodsDetailResponse> goodsDetailList = goodsService.queryGoodsDetail(goodsSkuCodes, false);
System.out.println(goodsDetailList); System.out.println(goodsDetailList);
// System.out.println(goodsService.queryGoodsImageList(goodsSkuCodes)); // System.out.println(goodsService.queryGoodsImageList(goodsSkuCodes));
// System.out.println(goodsService.queryGoodsShelvesList(goodsSkuCodes)); // System.out.println(goodsService.queryGoodsShelvesList(goodsSkuCodes));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!