From aa38e02e2b970070b85855a203dc1d157c3f0fc9 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 25 Jul 2022 14:09:29 +0800 Subject: [PATCH 1/5] 1 --- .../main/java/com/hai/service/impl/ApiProductServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java index e9201c6f..2e1a1c8a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java @@ -394,7 +394,7 @@ public class ApiProductServiceImpl implements ApiProductService { List apiKfcStores = apiKfcStoresMapper.selectByExample(example); if (apiKfcStores.size() > 0) { - apiKfcStores.get(0); + return apiKfcStores.get(0); } return null; } From 0d5625397e764582fd87b43058f5b9792d3e3f6d Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 25 Jul 2022 14:33:21 +0800 Subject: [PATCH 2/5] 1 --- .../main/java/com/hai/service/impl/HighOrderServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 18eb196b..009c756f 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -2297,7 +2297,7 @@ public class HighOrderServiceImpl implements HighOrderService { updateOrder(order); HighGasOrderPush orderPush = new HighGasOrderPush(); - JSONObject returnObject = new JSONObject(); + JSONObject returnObject; for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(2); @@ -2343,7 +2343,7 @@ public class HighOrderServiceImpl implements HighOrderService { // 退还积分 - if (order.getPayGold() > 0) { + if (order.getPayGold() != null) { highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId()); if (order.getPayRealPrice().compareTo(new BigDecimal(0)) == 0) { order.setOrderStatus(4); From 7a53afd2598750b9bb35dd7ec59a3cb40b064507 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 27 Jul 2022 13:51:37 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=83=E7=8C=AA=20?= =?UTF-8?q?=E8=82=AF=E5=BE=B7=E5=9F=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hai/service/impl/HighOrderServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 009c756f..6ed61d5e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1846,18 +1846,19 @@ public class HighOrderServiceImpl implements HighOrderService { highOrder.setProductType(object.getInteger("productType")); + JSONObject userToken = QianZhuConfig.getTokenV2(user.getId().toString(), user.getName(), user.getPhone()); + + if (!userToken.getBoolean("success")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); + } + // 1 星巴克 2 肯德基 3 会员充值 if (object.getInteger("productType") == 1) { - JSONObject userToken = QianZhuConfig.getTokenV2(user.getId().toString(), user.getName(), user.getPhone()); - if (!userToken.getBoolean("success")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); - } List List = new ArrayList<>(); - JSONArray array = object.getJSONArray("orderItems"); for (Object o : array) { From a0b9b7ab4bed334e0979ddd87bd001a4819decc6 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 27 Jul 2022 16:39:09 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=83=E7=8C=AA?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighThirdPartyController.java | 12 +++--- .../service/impl/HighOrderServiceImpl.java | 37 ++++++++++--------- 2 files changed, 25 insertions(+), 24 deletions(-) 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 b1fe0206..1113bc76 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -114,9 +114,9 @@ public class HighThirdPartyController { for (ApiStarbucksProducts apiStarbucksProducts : list) { apiStarbucksProducts.setExt1(String.valueOf(i)); - BigDecimal salesVentiPrice = apiStarbucksProducts.getSalesVentiPrice().add(apiStarbucksProducts.getSalesVentiPrice().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 salesGrandePrice = apiStarbucksProducts.getSalesGrandePrice().add(apiStarbucksProducts.getSalesGrandePrice().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.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(); @@ -236,7 +236,7 @@ public class HighThirdPartyController { JSONObject productsObject = (JSONObject) products; 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) { salePriceF = productsObject.getBigDecimal("originalPrice"); } @@ -246,7 +246,7 @@ public class HighThirdPartyController { for (Object specGroups : productsObject.getJSONArray("specGroups")) { JSONObject specGroupsObject = (JSONObject) specGroups; 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) { salePrice = specGroupsObject.getBigDecimal("originalPrice"); } @@ -492,7 +492,7 @@ public class HighThirdPartyController { 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) { costPrice = memberProduct.getPrice(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 6ed61d5e..8fe9a40a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1892,8 +1892,8 @@ public class HighOrderServiceImpl implements HighOrderService { } // 下单 - jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile")); -// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile")); +// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile")); + jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile")); // 判断下单是否成功 if (!Objects.equals(jsonObject.getString("code"), "200")) { @@ -1940,18 +1940,19 @@ public class HighOrderServiceImpl implements HighOrderService { childOrder.setGoodsImg(childObject.getString("imgUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); 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) { childPrice = childObject.getBigDecimal("marketPrice"); } + if (object.getLong("memDiscountId") != null) { + childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice")); + } else { + childOrder.setGoodsActualPrice(childPrice); + } childPrice = childPrice.multiply(childObject.getBigDecimal("quantity")); // 计算总订单实际支付金额 orderPayPrice = orderPayPrice.add(childPrice); @@ -2008,20 +2009,20 @@ public class HighOrderServiceImpl implements HighOrderService { childOrder.setGoodsImg(childObject.getString("imageUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); 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) { childPrice = childObject.getBigDecimal("originPrice"); } + + if (object.getLong("memDiscountId") != null) { + childOrder.setGoodsActualPrice(childObject.getBigDecimal("originPrice")); + } else { + childOrder.setGoodsActualPrice(childPrice); + } childPrice = childPrice.multiply(childObject.getBigDecimal("quantity")); // 计算总订单实际支付金额 orderPayPrice = orderPayPrice.add(childPrice); @@ -2049,7 +2050,7 @@ public class HighOrderServiceImpl implements HighOrderService { 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) { orderPayPrice = memberProduct.getPrice(); } From f0971f3c9fd0c2a78345cdd592cf3a589fdde193 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 27 Jul 2022 16:48:37 +0800 Subject: [PATCH 5/5] 1 --- .../main/java/com/hai/service/impl/HighOrderServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 8fe9a40a..6fd22d55 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1892,8 +1892,8 @@ public class HighOrderServiceImpl implements HighOrderService { } // 下单 -// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile")); - jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile")); + jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile")); +// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile")); // 判断下单是否成功 if (!Objects.equals(jsonObject.getString("code"), "200")) {