diff --git a/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java b/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java index 39f4e68f..35aeff5b 100644 --- a/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java +++ b/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java @@ -1,5 +1,6 @@ package com.hai.order.model; +import com.alibaba.fastjson.JSONObject; import io.swagger.models.auth.In; import lombok.Data; import java.math.BigDecimal; @@ -83,6 +84,12 @@ public class CreateOrderChildModel { private Integer productType; // 平台id 1:小程序 2:H5 3:银联 private Integer platformId; + // 就餐方式 1:店内就餐 2:打包 + private Integer eatType; + // 门店编号 + private String storeCode; + // 请求参数 + private Object orderItems; /** ======================= 肯德基,星巴克,会员充值所需参数 ======================== **/ /** ======================= 话费充值所需参数 ======================== **/ 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 ce0eee89..d0e069c4 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 @@ -508,10 +508,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Override public List thirdPartyOrder(JSONObject object) throws Exception { - JSONObject jsonObject = null; + JSONObject jsonObject; List childOrderList = new ArrayList<>(); - // 查询用户 HighUser user = highUserService.findByUserId(object.getLong("userId")); @@ -596,15 +595,21 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { HighChildOrder childOrder = new HighChildOrder(); childOrder.setChildOrderStatus(1); childOrder.setGoodsType(9); + childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); childOrder.setStoreId(object.getLong("storeCode")); childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); childOrder.setGoodsId(object.getLong("productId")); + childOrder.setMemId(user.getId()); + childOrder.setMemName(user.getName()); + childOrder.setMemPhone(user.getPhone()); childOrder.setStoreAddress(childObject.getString("storeAddress")); childOrder.setStoreName(childObject.getString("storeName")); childOrder.setGoodsName(childObject.getString("productName")); childOrder.setGoodsImg(childObject.getString("imgUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice")); + childOrder.setGiveawayType(false); + childOrder.setCreateTime(new Date()); // 计算利润 BigDecimal profitPrice = childObject.getBigDecimal("marketPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); @@ -623,7 +628,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { orderPayPrice = orderPayPrice.add(childPrice); // 计算市场价金额 marketPrice = marketPrice.add(childObject.getBigDecimal("marketPrice").multiply(childObject.getBigDecimal("quantity"))); - childOrder.setTotalPrice(childPrice); + childOrder.setTotalPrice(marketPrice); + childOrder.setTotalActualPrice(orderPayPrice); + childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice)); childOrderList.add(childOrder); } @@ -656,6 +663,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { HighChildOrder childOrder = new HighChildOrder(); childOrder.setChildOrderStatus(1); childOrder.setGoodsType(4); + childOrder.setMemId(user.getId()); + childOrder.setMemName(user.getName()); + childOrder.setMemPhone(user.getPhone()); + childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); childOrder.setGoodsId(object.getLong("productId")); childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); childOrder.setStoreAddress(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeAddress")); @@ -664,7 +675,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setGoodsImg(childObject.getString("imageUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice")); - + childOrder.setGiveawayType(false); + childOrder.setCreateTime(new Date()); // 计算利润 BigDecimal profitPrice = childObject.getBigDecimal("originPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); // 计算子订单支付金额 @@ -683,7 +695,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { orderPayPrice = orderPayPrice.add(childPrice); // 计算市场价金额 marketPrice = marketPrice.add(childObject.getBigDecimal("originPrice").multiply(childObject.getBigDecimal("quantity"))); - childOrder.setTotalPrice(childPrice); + childOrder.setTotalPrice(marketPrice); + childOrder.setTotalActualPrice(orderPayPrice); + childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice)); childOrderList.add(childOrder); } @@ -708,17 +722,24 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { HighChildOrder childOrder = new HighChildOrder(); childOrder.setChildOrderStatus(1); childOrder.setGoodsType(10); + childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); childOrder.setStoreId(object.getLong("storeCode")); childOrder.setGoodsId(memberProduct.getId()); childOrder.setGoodsName(memberProduct.getName()); + childOrder.setGiveawayType(false); childOrder.setSaleCount(1); + childOrder.setMemId(user.getId()); + childOrder.setMemName(user.getName()); + childOrder.setMemPhone(user.getPhone()); childOrder.setGoodsPrice(marketPrice); + childOrder.setTotalPrice(marketPrice); + childOrder.setTotalActualPrice(orderPayPrice); + childOrder.setCreateTime(new Date()); + childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice)); if (object.getLong("memDiscountId") != null) { childOrder.setGoodsActualPrice(marketPrice); - childOrder.setTotalPrice(marketPrice); } else { childOrder.setGoodsActualPrice(orderPayPrice); - childOrder.setTotalPrice(orderPayPrice); } 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 26489f52..656eebfd 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 @@ -162,8 +162,11 @@ public class OrderServiceImpl implements OrderService { object.put("customerMobile" , child.getCustomerMobile()); object.put("productType" , child.getProductType()); object.put("platformId" , child.getPlatformId()); + object.put("eatType" , child.getEatType()); + object.put("storeCode" , child.getStoreCode()); object.put("companyId" , order.getCompanyId()); object.put("userId" , child.getMemId()); + object.put("orderItems" , child.getOrderItems()); // 购买卡券 if (child.getGoodsType().equals(OrderChildGoodsType.TYPE1.getNumber())) {