商品会员价

This commit is contained in:
GYJ
2024-11-01 10:12:13 +08:00
parent 6792450f6b
commit 9c82661351

View File

@@ -374,6 +374,7 @@ public class ProductService {
// HashSet<String> specSet = new HashSet<>();
AtomicDouble sum = new AtomicDouble(0.0);
BigDecimal lowerPrice = null;
BigDecimal lowMemberPrice = null;
for (TbProductSku item : tbProductSkus) {
if (item.getRealSalesNumber() != null) {
sum.addAndGet(item.getRealSalesNumber());
@@ -381,45 +382,24 @@ public class ProductService {
if (lowerPrice == null || lowerPrice.compareTo(item.getSalePrice()) > 0) {
lowerPrice = item.getSalePrice();
}
String specSnap = item.getSpecSnap();
// if (specSnap != null) {
// specSet.addAll(Arrays.asList(specSnap.split(",")));
// }
if (lowMemberPrice == null || lowMemberPrice.compareTo(item.getMemberPrice()) > 0) {
lowMemberPrice = item.getMemberPrice();
}
}
//销量
// 销量
it.setStockNumber(sum.intValue());
// 售价
if (lowerPrice == null) {
lowerPrice = BigDecimal.ZERO;
}
//售价
it.setLowPrice(lowerPrice);
// String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
// if (tagSnap != null) {
// JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
// JSONObject snapJSON;
// JSONArray finalSnap = new JSONArray();
// for (Object snap : tagSnaps) {
// snapJSON = (JSONObject) snap;
// String values = snapJSON.getString("value");
// String finalValues = "";
// if (StrUtil.isNotBlank(values)) {
// String[] valueList = values.split(",");
// for (String value : valueList) {
// if (specSet.contains(value)) {
// finalValues = finalValues + (value) + ",";
// }
// }
// if (StrUtil.isNotBlank(finalValues)) {
// finalValues = StrUtil.removeSuffix(finalValues, ",");
// snapJSON.put("value", finalValues);
// finalSnap.add(snapJSON);
// }
// }
// }
// //sku Result
// skuResult.setTagSnap(finalSnap.toJSONString());
// }
// 会员价
if (lowMemberPrice == null) {
lowMemberPrice = BigDecimal.ZERO;
}
it.setLowMemberPrice(lowMemberPrice);
it.setProductSkuResult(skuResult);
});
return products;