diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 7b4d55bc..7ae4361e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -35,6 +35,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.math.RoundingMode; +import java.sql.Array; import java.util.*; import java.util.stream.Collectors; @@ -118,20 +119,44 @@ public class HighThirdPartyController { BigDecimal salesTallPrice = apiStarbucksProducts.getSalesTallPrice().add(apiStarbucksProducts.getMarketTallPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); BigDecimal salesGrandePrice = apiStarbucksProducts.getSalesGrandePrice().add(apiStarbucksProducts.getMarketGrandePrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); - if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) { - salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); - } + + + // 判断当前价格是否大雨原价 如果大于显示原价 if (salesTallPrice.compareTo(apiStarbucksProducts.getMarketTallPrice()) > 0) { salesTallPrice = apiStarbucksProducts.getMarketTallPrice(); } if (salesGrandePrice.compareTo(apiStarbucksProducts.getMarketGrandePrice()) > 0) { salesGrandePrice = apiStarbucksProducts.getMarketGrandePrice(); } + if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) { + salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); + } + + String[] strings = apiStarbucksProducts.getCupSize().split(","); + + for (String string : strings) { + if ("中杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesTallPrice); + break; + } + if ("大杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesGrandePrice); + break; + } + if ("超大杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesVentiPrice); + break; + } + } + apiStarbucksProducts.setSalesVentiPrice(salesVentiPrice); apiStarbucksProducts.setSalesTallPrice(salesTallPrice); apiStarbucksProducts.setCount(0); apiStarbucksProducts.setSalesGrandePrice(salesGrandePrice); - starbucksProductsList.add(apiStarbucksProducts); + if (apiStarbucksProducts.getShowPrice() != null) { + starbucksProductsList.add(apiStarbucksProducts); + } + } starbucksProducts.setName(s); starbucksProducts.setExt2(SysConst.getSysConfig().getImgUrl() + ProductImgEnum.getNameByImgUrl(s)); diff --git a/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java b/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java new file mode 100644 index 00000000..96c0c6c3 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java @@ -0,0 +1,10 @@ +package com.hai.common.utils; + +/** + * @author sum1dream + */ +public class CommonUtil { + + + +} diff --git a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java index ea2e6d26..8cb38ec3 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java +++ b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java @@ -131,6 +131,16 @@ public class ApiStarbucksProducts implements Serializable { private Integer count; + private BigDecimal showPrice; + + public BigDecimal getShowPrice() { + return showPrice; + } + + public void setShowPrice(BigDecimal showPrice) { + this.showPrice = showPrice; + } + /** * ext_1 */