dev-discount
胡锐 2 years ago
commit 3180a8bcad
  1. 7
      hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java
  2. 35
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  3. 3
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -1,5 +1,6 @@
package com.hai.order.model; package com.hai.order.model;
import com.alibaba.fastjson.JSONObject;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -83,6 +84,12 @@ public class CreateOrderChildModel {
private Integer productType; private Integer productType;
// 平台id 1:小程序 2:H5 3:银联 // 平台id 1:小程序 2:H5 3:银联
private Integer platformId; private Integer platformId;
// 就餐方式 1:店内就餐 2:打包
private Integer eatType;
// 门店编号
private String storeCode;
// 请求参数
private Object orderItems;
/** ======================= 肯德基,星巴克,会员充值所需参数 ======================== **/ /** ======================= 肯德基,星巴克,会员充值所需参数 ======================== **/
/** ======================= 话费充值所需参数 ======================== **/ /** ======================= 话费充值所需参数 ======================== **/

@ -508,10 +508,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Override @Override
public List<HighChildOrder> thirdPartyOrder(JSONObject object) throws Exception { public List<HighChildOrder> thirdPartyOrder(JSONObject object) throws Exception {
JSONObject jsonObject = null; JSONObject jsonObject;
List<HighChildOrder> childOrderList = new ArrayList<>(); List<HighChildOrder> childOrderList = new ArrayList<>();
// 查询用户 // 查询用户
HighUser user = highUserService.findByUserId(object.getLong("userId")); HighUser user = highUserService.findByUserId(object.getLong("userId"));
@ -596,15 +595,21 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
HighChildOrder childOrder = new HighChildOrder(); HighChildOrder childOrder = new HighChildOrder();
childOrder.setChildOrderStatus(1); childOrder.setChildOrderStatus(1);
childOrder.setGoodsType(9); childOrder.setGoodsType(9);
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setStoreId(object.getLong("storeCode")); childOrder.setStoreId(object.getLong("storeCode"));
childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo"));
childOrder.setGoodsId(object.getLong("productId")); childOrder.setGoodsId(object.getLong("productId"));
childOrder.setMemId(user.getId());
childOrder.setMemName(user.getName());
childOrder.setMemPhone(user.getPhone());
childOrder.setStoreAddress(childObject.getString("storeAddress")); childOrder.setStoreAddress(childObject.getString("storeAddress"));
childOrder.setStoreName(childObject.getString("storeName")); childOrder.setStoreName(childObject.getString("storeName"));
childOrder.setGoodsName(childObject.getString("productName")); childOrder.setGoodsName(childObject.getString("productName"));
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"));
childOrder.setGiveawayType(false);
childOrder.setCreateTime(new Date());
// 计算利润 // 计算利润
BigDecimal profitPrice = childObject.getBigDecimal("marketPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); 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); orderPayPrice = orderPayPrice.add(childPrice);
// 计算市场价金额 // 计算市场价金额
marketPrice = marketPrice.add(childObject.getBigDecimal("marketPrice").multiply(childObject.getBigDecimal("quantity"))); 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); childOrderList.add(childOrder);
} }
@ -656,6 +663,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
HighChildOrder childOrder = new HighChildOrder(); HighChildOrder childOrder = new HighChildOrder();
childOrder.setChildOrderStatus(1); childOrder.setChildOrderStatus(1);
childOrder.setGoodsType(4); 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.setGoodsId(object.getLong("productId"));
childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo"));
childOrder.setStoreAddress(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeAddress")); childOrder.setStoreAddress(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeAddress"));
@ -664,7 +675,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
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"));
childOrder.setGiveawayType(false);
childOrder.setCreateTime(new Date());
// 计算利润 // 计算利润
BigDecimal profitPrice = childObject.getBigDecimal("originPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); 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); orderPayPrice = orderPayPrice.add(childPrice);
// 计算市场价金额 // 计算市场价金额
marketPrice = marketPrice.add(childObject.getBigDecimal("originPrice").multiply(childObject.getBigDecimal("quantity"))); 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); childOrderList.add(childOrder);
} }
@ -708,17 +722,24 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
HighChildOrder childOrder = new HighChildOrder(); HighChildOrder childOrder = new HighChildOrder();
childOrder.setChildOrderStatus(1); childOrder.setChildOrderStatus(1);
childOrder.setGoodsType(10); childOrder.setGoodsType(10);
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setStoreId(object.getLong("storeCode")); childOrder.setStoreId(object.getLong("storeCode"));
childOrder.setGoodsId(memberProduct.getId()); childOrder.setGoodsId(memberProduct.getId());
childOrder.setGoodsName(memberProduct.getName()); childOrder.setGoodsName(memberProduct.getName());
childOrder.setGiveawayType(false);
childOrder.setSaleCount(1); childOrder.setSaleCount(1);
childOrder.setMemId(user.getId());
childOrder.setMemName(user.getName());
childOrder.setMemPhone(user.getPhone());
childOrder.setGoodsPrice(marketPrice); childOrder.setGoodsPrice(marketPrice);
childOrder.setTotalPrice(marketPrice);
childOrder.setTotalActualPrice(orderPayPrice);
childOrder.setCreateTime(new Date());
childOrder.setTotalDeductionPrice(marketPrice.subtract(orderPayPrice));
if (object.getLong("memDiscountId") != null) { if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(marketPrice); childOrder.setGoodsActualPrice(marketPrice);
childOrder.setTotalPrice(marketPrice);
} else { } else {
childOrder.setGoodsActualPrice(orderPayPrice); childOrder.setGoodsActualPrice(orderPayPrice);
childOrder.setTotalPrice(orderPayPrice);
} }
childOrderList.add(childOrder); childOrderList.add(childOrder);

@ -162,8 +162,11 @@ public class OrderServiceImpl implements OrderService {
object.put("customerMobile" , child.getCustomerMobile()); object.put("customerMobile" , child.getCustomerMobile());
object.put("productType" , child.getProductType()); object.put("productType" , child.getProductType());
object.put("platformId" , child.getPlatformId()); object.put("platformId" , child.getPlatformId());
object.put("eatType" , child.getEatType());
object.put("storeCode" , child.getStoreCode());
object.put("companyId" , order.getCompanyId()); object.put("companyId" , order.getCompanyId());
object.put("userId" , child.getMemId()); object.put("userId" , child.getMemId());
object.put("orderItems" , child.getOrderItems());
// 购买卡券 // 购买卡券
if (child.getGoodsType().equals(OrderChildGoodsType.TYPE1.getNumber())) { if (child.getGoodsType().equals(OrderChildGoodsType.TYPE1.getNumber())) {

Loading…
Cancel
Save