胡锐 2 years ago
commit 39276969d0
  1. 12
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  2. 2
      hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java
  3. 46
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -114,9 +114,9 @@ public class HighThirdPartyController {
for (ApiStarbucksProducts apiStarbucksProducts : list) { for (ApiStarbucksProducts apiStarbucksProducts : list) {
apiStarbucksProducts.setExt1(String.valueOf(i)); apiStarbucksProducts.setExt1(String.valueOf(i));
BigDecimal salesVentiPrice = apiStarbucksProducts.getSalesVentiPrice().add(apiStarbucksProducts.getSalesVentiPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); BigDecimal salesVentiPrice = apiStarbucksProducts.getSalesVentiPrice().add(apiStarbucksProducts.getMarketVentiPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP);
BigDecimal salesTallPrice = apiStarbucksProducts.getSalesTallPrice().add(apiStarbucksProducts.getSalesTallPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); BigDecimal salesTallPrice = apiStarbucksProducts.getSalesTallPrice().add(apiStarbucksProducts.getMarketTallPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP);
BigDecimal salesGrandePrice = apiStarbucksProducts.getSalesGrandePrice().add(apiStarbucksProducts.getSalesGrandePrice().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) { if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) {
salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice();
@ -236,7 +236,7 @@ public class HighThirdPartyController {
JSONObject productsObject = (JSONObject) products; JSONObject productsObject = (JSONObject) products;
BigDecimal productsPrice = productsObject.getBigDecimal("price"); BigDecimal productsPrice = productsObject.getBigDecimal("price");
BigDecimal salePriceF = productsPrice.add(productsPrice.multiply(productDiscount).divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP); BigDecimal salePriceF = productsPrice.add(productsObject.getBigDecimal("originalPrice").multiply(productDiscount).divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP);
if (salePriceF.compareTo(productsObject.getBigDecimal("originalPrice")) > 0) { if (salePriceF.compareTo(productsObject.getBigDecimal("originalPrice")) > 0) {
salePriceF = productsObject.getBigDecimal("originalPrice"); salePriceF = productsObject.getBigDecimal("originalPrice");
} }
@ -246,7 +246,7 @@ public class HighThirdPartyController {
for (Object specGroups : productsObject.getJSONArray("specGroups")) { for (Object specGroups : productsObject.getJSONArray("specGroups")) {
JSONObject specGroupsObject = (JSONObject) specGroups; JSONObject specGroupsObject = (JSONObject) specGroups;
BigDecimal specGroupsPrice = specGroupsObject.getBigDecimal("price"); BigDecimal specGroupsPrice = specGroupsObject.getBigDecimal("price");
BigDecimal salePrice = specGroupsPrice.add(specGroupsPrice.multiply(productDiscount).divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP); BigDecimal salePrice = specGroupsPrice.add(specGroupsObject.getBigDecimal("originalPrice").multiply(productDiscount).divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP);
if (salePrice.compareTo(specGroupsObject.getBigDecimal("originalPrice")) > 0) { if (salePrice.compareTo(specGroupsObject.getBigDecimal("originalPrice")) > 0) {
salePrice = specGroupsObject.getBigDecimal("originalPrice"); salePrice = specGroupsObject.getBigDecimal("originalPrice");
} }
@ -492,7 +492,7 @@ public class HighThirdPartyController {
for (ApiMemberProduct memberProduct : list) { for (ApiMemberProduct memberProduct : list) {
BigDecimal costPrice = memberProduct.getCostPrice().add(memberProduct.getCostPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); BigDecimal costPrice = memberProduct.getCostPrice().add(memberProduct.getPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP);
if (costPrice.compareTo(memberProduct.getPrice()) > 0) { if (costPrice.compareTo(memberProduct.getPrice()) > 0) {
costPrice = memberProduct.getPrice(); costPrice = memberProduct.getPrice();

@ -394,7 +394,7 @@ public class ApiProductServiceImpl implements ApiProductService {
List<ApiKfcStores> apiKfcStores = apiKfcStoresMapper.selectByExample(example); List<ApiKfcStores> apiKfcStores = apiKfcStoresMapper.selectByExample(example);
if (apiKfcStores.size() > 0) { if (apiKfcStores.size() > 0) {
apiKfcStores.get(0); return apiKfcStores.get(0);
} }
return null; return null;
} }

@ -1846,18 +1846,19 @@ public class HighOrderServiceImpl implements HighOrderService {
highOrder.setProductType(object.getInteger("productType")); highOrder.setProductType(object.getInteger("productType"));
// 1 星巴克 2 肯德基 3 会员充值
if (object.getInteger("productType") == 1) {
JSONObject userToken = QianZhuConfig.getTokenV2(user.getId().toString(), user.getName(), user.getPhone()); JSONObject userToken = QianZhuConfig.getTokenV2(user.getId().toString(), user.getName(), user.getPhone());
if (!userToken.getBoolean("success")) { if (!userToken.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message"));
} }
List<String> List = new ArrayList<>(); // 1 星巴克 2 肯德基 3 会员充值
if (object.getInteger("productType") == 1) {
List<String> List = new ArrayList<>();
JSONArray array = object.getJSONArray("orderItems"); JSONArray array = object.getJSONArray("orderItems");
for (Object o : array) { for (Object o : array) {
@ -1939,18 +1940,19 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setGoodsImg(childObject.getString("imgUrl")); childOrder.setGoodsImg(childObject.getString("imgUrl"));
childOrder.setSaleCount(childObject.getInteger("quantity")); childOrder.setSaleCount(childObject.getInteger("quantity"));
childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice")); childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice"));
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice"));
} else {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("unitPrice"));
}
// 计算利润 // 计算利润
BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); BigDecimal profitPrice = childObject.getBigDecimal("marketPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
// 计算子订单支付金额 // 计算子订单支付金额
BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP); BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
if (childPrice.compareTo(childObject.getBigDecimal("marketPrice")) > 0) { if (childPrice.compareTo(childObject.getBigDecimal("marketPrice")) > 0) {
childPrice = childObject.getBigDecimal("marketPrice"); childPrice = childObject.getBigDecimal("marketPrice");
} }
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice"));
} else {
childOrder.setGoodsActualPrice(childPrice);
}
childPrice = childPrice.multiply(childObject.getBigDecimal("quantity")); childPrice = childPrice.multiply(childObject.getBigDecimal("quantity"));
// 计算总订单实际支付金额 // 计算总订单实际支付金额
orderPayPrice = orderPayPrice.add(childPrice); orderPayPrice = orderPayPrice.add(childPrice);
@ -2007,20 +2009,20 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setGoodsImg(childObject.getString("imageUrl")); childOrder.setGoodsImg(childObject.getString("imageUrl"));
childOrder.setSaleCount(childObject.getInteger("quantity")); childOrder.setSaleCount(childObject.getInteger("quantity"));
childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice")); childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice"));
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("originPrice"));
} else {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("price"));
}
// 计算利润 // 计算利润
BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); BigDecimal profitPrice = childObject.getBigDecimal("originPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
// 计算子订单支付金额 // 计算子订单支付金额
BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP); BigDecimal childPrice = childObject.getBigDecimal("price").add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
if (childPrice.compareTo(childObject.getBigDecimal("originPrice")) > 0) { if (childPrice.compareTo(childObject.getBigDecimal("originPrice")) > 0) {
childPrice = childObject.getBigDecimal("originPrice"); childPrice = childObject.getBigDecimal("originPrice");
} }
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("originPrice"));
} else {
childOrder.setGoodsActualPrice(childPrice);
}
childPrice = childPrice.multiply(childObject.getBigDecimal("quantity")); childPrice = childPrice.multiply(childObject.getBigDecimal("quantity"));
// 计算总订单实际支付金额 // 计算总订单实际支付金额
orderPayPrice = orderPayPrice.add(childPrice); orderPayPrice = orderPayPrice.add(childPrice);
@ -2048,7 +2050,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highOrder.setOrderStatus(1); highOrder.setOrderStatus(1);
// 计算实际支付金额 // 计算实际支付金额
orderPayPrice = memberProduct.getCostPrice().add(memberProduct.getCostPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); orderPayPrice = memberProduct.getCostPrice().add(memberProduct.getPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP);
if (orderPayPrice.compareTo(memberProduct.getPrice()) > 0) { if (orderPayPrice.compareTo(memberProduct.getPrice()) > 0) {
orderPayPrice = memberProduct.getPrice(); orderPayPrice = memberProduct.getPrice();
} }
@ -2297,7 +2299,7 @@ public class HighOrderServiceImpl implements HighOrderService {
updateOrder(order); updateOrder(order);
HighGasOrderPush orderPush = new HighGasOrderPush(); HighGasOrderPush orderPush = new HighGasOrderPush();
JSONObject returnObject = new JSONObject(); JSONObject returnObject;
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2); childOrder.setChildOrdeStatus(2);
@ -2343,7 +2345,7 @@ public class HighOrderServiceImpl implements HighOrderService {
// 退还积分 // 退还积分
if (order.getPayGold() > 0) { if (order.getPayGold() != null) {
highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId()); highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId());
if (order.getPayRealPrice().compareTo(new BigDecimal(0)) == 0) { if (order.getPayRealPrice().compareTo(new BigDecimal(0)) == 0) {
order.setOrderStatus(4); order.setOrderStatus(4);

Loading…
Cancel
Save