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 8d013d27..8dc52a35 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -407,7 +407,7 @@ public class HighThirdPartyController { } } else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) { - object = QianZhuConfig.starbucksOrderByOrderNo(order.getOrderNo()); + object = QianZhuConfig.starbucksOrderByOrderNo(order.getHighChildOrderList().get(0).getChannelOrderNo()); if (object.getBoolean("success")) { partyModel.setCode(object.getJSONObject("data").getString("ticket")); partyModel.setStatusDesc(object.getJSONObject("data").getString("statusDesc")); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index e2579408..17cfe120 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -594,10 +594,6 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { // 查询用户 HighUser user = highUserService.findByUserId(object.getLong("userId")); - // 实际支付金额 - BigDecimal orderPayPrice = new BigDecimal(0); - // 市场金额 - BigDecimal marketPrice = new BigDecimal(0); // 查询详单订单的实际 JSONObject productDetail = thirdProductConfig.getThirdPartyByDetail(object.getInteger("platformId"), object.getInteger("productType"), object.getLong("companyId") , object.getLong("productId")); @@ -682,8 +678,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setMemId(user.getId()); childOrder.setMemName(user.getName()); childOrder.setMemPhone(user.getPhone()); - childOrder.setStoreAddress(childObject.getString("storeAddress")); - childOrder.setStoreName(childObject.getString("storeName")); + childOrder.setStoreAddress(orderObject.getJSONObject("data").getString("storeAddress")); + childOrder.setStoreName(orderObject.getJSONObject("data").getString("storeName")); childOrder.setGoodsName(childObject.getString("productName")); childOrder.setGoodsImg(childObject.getString("imgUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); @@ -698,19 +694,14 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { 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); + + // 配置实际支付金额 + childOrder.setGoodsActualPrice(childPrice); + // 计算市场价金额 - marketPrice = marketPrice.add(childObject.getBigDecimal("marketPrice").multiply(childObject.getBigDecimal("quantity"))); - childOrder.setTotalPrice(marketPrice); - childOrder.setTotalActualPrice(orderPayPrice); - childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice)); + childOrder.setTotalPrice(childObject.getBigDecimal("marketPrice").multiply(childObject.getBigDecimal("quantity"))); + childOrder.setTotalActualPrice(childPrice.multiply(childObject.getBigDecimal("quantity"))); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); childOrderList.add(childOrder); } @@ -765,19 +756,13 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { 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); + // 配置实际支付金额 + childOrder.setGoodsActualPrice(childPrice); + // 计算市场价金额 - marketPrice = marketPrice.add(childObject.getBigDecimal("originPrice").multiply(childObject.getBigDecimal("quantity"))); - childOrder.setTotalPrice(marketPrice); - childOrder.setTotalActualPrice(orderPayPrice); - childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice)); + childOrder.setTotalPrice(childObject.getBigDecimal("originPrice").multiply(childObject.getBigDecimal("quantity"))); + childOrder.setTotalActualPrice(childPrice.multiply(childObject.getBigDecimal("quantity"))); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); childOrderList.add(childOrder); } @@ -791,12 +776,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { // 计算实际支付金额 - 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(); + BigDecimal childPrice = memberProduct.getCostPrice().add(memberProduct.getPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); + if (childPrice.compareTo(memberProduct.getPrice()) > 0) { + childPrice = memberProduct.getPrice(); } - // 计算市场价金额 - marketPrice = memberProduct.getPrice(); HighChildOrder childOrder = new HighChildOrder(); @@ -811,16 +794,12 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setMemId(user.getId()); childOrder.setMemName(user.getName()); childOrder.setMemPhone(user.getPhone()); - childOrder.setGoodsPrice(marketPrice); - childOrder.setTotalPrice(marketPrice); - childOrder.setTotalActualPrice(orderPayPrice); + childOrder.setGoodsPrice(memberProduct.getPrice()); + childOrder.setTotalPrice(memberProduct.getPrice()); + childOrder.setTotalActualPrice(childPrice); childOrder.setCreateTime(new Date()); - childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice)); - if (object.getLong("memDiscountId") != null) { - childOrder.setGoodsActualPrice(marketPrice); - } else { - childOrder.setGoodsActualPrice(orderPayPrice); - } + childOrder.setTotalDeductionPrice(memberProduct.getPrice().subtract(childPrice)); + childOrderList.add(childOrder); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 95834d00..d72fd392 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -216,11 +216,11 @@ public class OrderServiceImpl implements OrderService { // 话费充值 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE6.getNumber())) { - order.setProductType(OrderProductType.PRODUCT_TYPE7.getNumber()); + order.setProductType(OrderProductType.PRODUCT_TYPE9.getNumber()); // 优惠券包 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE7.getNumber())) { - order.setProductType(OrderProductType.PRODUCT_TYPE9.getNumber()); + order.setProductType(OrderProductType.PRODUCT_TYPE7.getNumber()); HighChildOrder childOrder = orderCreateHandleService.couponPackage(child); childOrderList.add(childOrder); order.setTitle(childOrder.getGoodsName()); @@ -465,7 +465,7 @@ public class OrderServiceImpl implements OrderService { } // 使用了积分抵扣 - if (order.getPayGold() != null && order.getPayGold().intValue() > 0) { + if (order.getPayGold() != null && order.getPayGold() > 0) { // 积分返回 String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold(); userService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark);