修改星巴克下架问题

dev-discount
袁野 2 years ago
parent 4178734953
commit b54c4e2678
  1. 33
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  2. 10
      hai-service/src/main/java/com/hai/common/utils/CommonUtil.java
  3. 10
      hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.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));

@ -0,0 +1,10 @@
package com.hai.common.utils;
/**
* @author sum1dream
*/
public class CommonUtil {
}

@ -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
*/

Loading…
Cancel
Save