Commit 6061b635 by 胡园园

Merge branch 'hotfix-20230106-product' into 'master'

分支hotfix-20230106-product已上线,自动合并到master

See merge request !9
parents 038e4fce f519ca8a
Pipeline #44716 canceled with stages
...@@ -47,6 +47,12 @@ public class SupplierItemServiceImpl implements ISupplierItemService { ...@@ -47,6 +47,12 @@ public class SupplierItemServiceImpl implements ISupplierItemService {
} }
fullItemIds.removeAll(itemIds); fullItemIds.removeAll(itemIds);
} }
List<Long> itemIds = new ArrayList<>(fullItemIds);
AjaxResult<List<SpuTO>> listAjaxResult = itemRpcService.batchQuerySpuInfo(BatchQuerySpuInfoParam.builder().ids(itemIds).build());
List<SpuTO> pageSpuTo = listAjaxResult.getData();
if (!CollectionUtils.isEmpty(pageSpuTo)) {
spuTOList.addAll(pageSpuTo);
}
} }
if (StringUtils.isNotBlank(itemId)) { if (StringUtils.isNotBlank(itemId)) {
spuTOList = spuTOList.stream().filter(i -> Long.valueOf(itemId).equals(i.getId())).collect(Collectors.toList()); spuTOList = spuTOList.stream().filter(i -> Long.valueOf(itemId).equals(i.getId())).collect(Collectors.toList());
......
/**
* @(#)ItemcenterRpcService.java, 2023/1/6.
* <p/>
* Copyright 2023 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.biz.service.rpc;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory;
import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
import com.netease.mail.yanxuan.change.common.bean.ResponseCodeEnum;
import com.netease.mail.yanxuan.change.integration.flow.goods.ItemManagerTO;
import com.netease.mail.yanxuan.change.integration.flow.goods.ItemcenterApiRpcService;
import com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse;
import lombok.extern.slf4j.Slf4j;
/**
* @Author zcwang
* @Date 2023/1/6
*/
@Component
@Slf4j
public class ItemcenterRpcService {
@Autowired
private ItemcenterApiRpcService itemcenterApiRpcService;
public List<ItemManagerTO> getProduct(List<Long> itemIds) {
List<ItemManagerTO> itemManagerTOS = new ArrayList<>();
List<List<Long>> partition = Lists.partition(itemIds, 200);
for (List<Long> list : partition) {
String collect = StringUtils.join(list, ",");
AjaxResponse<List<ItemManagerTO>> response = itemcenterApiRpcService.getProduct("qc", collect);
if (ResponseCodeEnum.SUCCESS.getCode() == response.getCode()) {
log.info("[getProduct] response={}", JSON.toJSONString(response));
if (CollectionUtils.isNotEmpty(response.getData())) {
itemManagerTOS.addAll(response.getData());
}
} else {
log.error("[getProduct] get Product detail failed, query={}, errMsg={}", JSON.toJSONString(itemIds),
JSON.toJSONString(response));
throw ExceptionFactory.createBiz(ResponseCode.DETAIL_FLOW_ERROR, "查询工单详情错误");
}
}
return itemManagerTOS;
}
}
\ No newline at end of file
/**
* @(#)ItemManagerTO.java, 2023/1/6.
* <p/>
* Copyright 2023 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.integration.flow.goods;
import lombok.Data;
/**
* @Author zcwang
* @Date 2023/1/6
*/
@Data
public class ItemManagerTO {
/**
* 邮箱账号
*/
private String uid;
/**
* 用户名
*/
private String name;
/**
* 商品id
*/
private Long itemId;
}
\ No newline at end of file
package com.netease.mail.yanxuan.change.integration.flow.goods; package com.netease.mail.yanxuan.change.integration.flow.goods;
import com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse;
import com.netease.yanxuan.flowx.sdk.meta.dto.base.FlowDataDTO;
import com.netease.yanxuan.missa.client.annotation.MissaClient; import com.netease.yanxuan.missa.client.annotation.MissaClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
/** /**
...@@ -24,6 +29,9 @@ public interface ItemcenterApiRpcService { ...@@ -24,6 +29,9 @@ public interface ItemcenterApiRpcService {
@PostMapping(value = "/yxicadmin/api/xhr/item/group/itemIds.json") @PostMapping(value = "/yxicadmin/api/xhr/item/group/itemIds.json")
String getDetail(@RequestBody List<Long> goodsId); String getDetail(@RequestBody List<Long> goodsId);
@GetMapping(value = "/yxicadmin/api/xhr/item/queryManagers")
AjaxResponse<List<ItemManagerTO>> getProduct(@RequestParam(value = "product") String product, @RequestParam(value = "itemIds") String itemIds);
/* /*
* 调用案例 * 调用案例
SupplierSendEmailReq req = new SupplierSendEmailReq(); SupplierSendEmailReq req = new SupplierSendEmailReq();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment