|
@@ -11,6 +11,7 @@ import com.cdf.entity.ProductHk;
|
|
|
import com.cdf.entity.ProductSource;
|
|
|
import com.cdf.exception.BusinessException;
|
|
|
import com.cdf.httpClient.client.CdfClient;
|
|
|
+import com.cdf.httpClient.client.CdfHKClient;
|
|
|
import com.cdf.httpClient.client.FdkkClient;
|
|
|
import com.cdf.httpClient.request.FdkkHotData;
|
|
|
import com.cdf.httpClient.request.FdkkHotRequest;
|
|
@@ -61,7 +62,7 @@ public class FdkkSceneEditService {
|
|
|
@Resource
|
|
|
private FdkkClient fdkkClient;
|
|
|
@Resource
|
|
|
- private CdfClient cdfClient;
|
|
|
+ private CdfHKClient cdfHKClient;
|
|
|
@Autowired
|
|
|
private IHotRelationService hotRelationService;
|
|
|
@Autowired
|
|
@@ -284,8 +285,8 @@ public class FdkkSceneEditService {
|
|
|
for (HotRelation hotRelation : hotRelations) {
|
|
|
hotRelationMap.put(hotRelation.getHotId(),hotRelation);
|
|
|
}
|
|
|
- Set<Integer> productIds = hotRelations.stream().map(HotRelation::getProductSourceId).collect(Collectors.toSet());
|
|
|
- List<ProductSource> productSources = productSourceService.listByIds(productIds);
|
|
|
+ Set<Integer> productSourceIds = hotRelations.stream().map(HotRelation::getProductSourceId).collect(Collectors.toSet());
|
|
|
+ List<ProductSource> productSources = productSourceService.listByIds(productSourceIds);
|
|
|
for (ProductSource productSource : productSources) {
|
|
|
productSourceMap.put(productSource.getId(),productSource);
|
|
|
}
|
|
@@ -324,35 +325,45 @@ public class FdkkSceneEditService {
|
|
|
return tags;
|
|
|
}
|
|
|
|
|
|
- if(pType.equals("AM")){
|
|
|
- CdfProductListByIdsRequest param = new CdfProductListByIdsRequest(requestArray);
|
|
|
- CdfProductListByIdsVo vos = cdfClient.getProductListByIds(param);
|
|
|
- if(vos.getProductCardList()!=null && vos.getProductCardList().size() >0){
|
|
|
- for (CdfProduct cdfProduct : vos.getProductCardList()) {
|
|
|
- productMap.put(cdfProduct.getId(),cdfProduct);
|
|
|
+ for (ProductSource productSource : productSources) {
|
|
|
+ if(productSource.getMchType() == 1){
|
|
|
+ List<ProductHk> list = productHkService.getListByIds(requestArray);
|
|
|
+ List<CdfProduct> convert = productHkService.convert(list, language);
|
|
|
+ for (CdfProduct cdfProduct : convert) {
|
|
|
+ productMap.put(productSource.getId() + "_"+ cdfProduct.getId(),cdfProduct);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if(pType.equals("HK")){
|
|
|
- List<ProductHk> list = productHkService.getListByIds(requestArray);
|
|
|
- List<CdfProduct> convert = productHkService.convert(list, language);
|
|
|
- for (CdfProduct cdfProduct : convert) {
|
|
|
- productMap.put(cdfProduct.getId(),cdfProduct);
|
|
|
+ if(productSource.getMchType() == 0){
|
|
|
+ CdfProductListByIdsRequest param = new CdfProductListByIdsRequest(requestArray);
|
|
|
+ CdfProductListByIdsVo vos = cdfHKClient.getProductListByIds(productSource.getCdfHost(),productSource.getCdfMchId(),param);
|
|
|
+ if(vos.getProductCardList()!=null && vos.getProductCardList().size() >0){
|
|
|
+ for (CdfProduct cdfProduct : vos.getProductCardList()) {
|
|
|
+ productMap.put(productSource.getId() + "_"+ cdfProduct.getId(),cdfProduct);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
for (Object obj : tags) {
|
|
|
JSONObject tag = (JSONObject) obj;
|
|
|
String sid = tag.getString("sid");
|
|
|
+ JSONObject productSource = tag.getJSONObject("productSource");
|
|
|
+ String keyPre = "";
|
|
|
+ if(productSource != null){
|
|
|
+ Integer id = productSource.getInteger("id");
|
|
|
+ keyPre = id +"_";
|
|
|
+ }
|
|
|
+
|
|
|
JSONArray jsonArray = resultMap.get(sid);
|
|
|
if(jsonArray==null || jsonArray.size()<=0){
|
|
|
continue;
|
|
|
}
|
|
|
List<CdfProduct> cdfProductList = new ArrayList<>();
|
|
|
for (Object o : jsonArray) {
|
|
|
- String key = o.toString();
|
|
|
- if(productMap.get(key)!=null){
|
|
|
- cdfProductList.add(productMap.get(key));
|
|
|
+ String key = keyPre + o.toString();
|
|
|
+ if(productMap.get( key)!=null){
|
|
|
+ cdfProductList.add(productMap.get( key));
|
|
|
}
|
|
|
}
|
|
|
if(cdfProductList.size() >0){
|