...
|
...
|
@@ -63,7 +63,7 @@ public class ProductIndexFeatureVectorUpdateFlow implements RetryBusinessFlow { |
|
|
productVectorFeatureLogicService.updateGenerateDate();
|
|
|
this.versionDate = productVectorFeatureLogicService.getGenerateDate();
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public int getTotalCount() {
|
|
|
if (StringUtils.isEmpty(this.versionDate)) {
|
...
|
...
|
@@ -85,18 +85,25 @@ public class ProductIndexFeatureVectorUpdateFlow implements RetryBusinessFlow { |
|
|
return true;
|
|
|
}
|
|
|
List<Integer> sknList = productList.stream().map(Product::getErpProductId).collect(Collectors.toList());
|
|
|
Map<Integer, Integer> skn2IDMap = productList.stream().collect(Collectors.toMap(Product::getErpProductId, Product::getId));
|
|
|
Map<Integer, String> productVectorFeatureMapBaseSkn = productVectorFeatureLogicService.queryProductVectorFeatureMap(sknList);
|
|
|
logger.info("[{} business][pageNo={}][productVectorFeatureMapBaseSknSize={}]", flowName(), pageNo, productVectorFeatureMapBaseSkn.size());
|
|
|
List<JSONObject> dataList = new ArrayList<JSONObject>();
|
|
|
productVectorFeatureMapBaseSkn.forEach((skn, vector) -> {
|
|
|
if (skn2IDMap.get(skn) != null) {
|
|
|
JSONObject product = new JSONObject();
|
|
|
product.put("id", skn2IDMap.get(skn));
|
|
|
product.put("productFeatureFactor", vector);
|
|
|
dataList.add(product);
|
|
|
|
|
|
for (Product product : productList) {
|
|
|
Integer productId = product.getId();
|
|
|
String vector = productVectorFeatureMapBaseSkn.get(product.getErpProductId());
|
|
|
JSONObject updateData = new JSONObject();
|
|
|
if (StringUtils.isBlank(vector)) {
|
|
|
updateData.put("id", productId);
|
|
|
updateData.put("productFeatureFactor", "");
|
|
|
updateData.put("productFeatureFactorExist", "N");
|
|
|
} else {
|
|
|
updateData.put("id", productId);
|
|
|
updateData.put("productFeatureFactor", vector);
|
|
|
updateData.put("productFeatureFactorExist", "Y");
|
|
|
}
|
|
|
});
|
|
|
dataList.add(updateData);
|
|
|
}
|
|
|
if (CollectionUtils.isEmpty(dataList)) {
|
|
|
return true;
|
|
|
}
|
...
|
...
|
|