|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.caimei365.order.components.ProductService;
|
|
|
import com.caimei365.order.components.WeChatService;
|
|
|
+import com.caimei365.order.constant.Constant;
|
|
|
import com.caimei365.order.mapper.*;
|
|
|
import com.caimei365.order.model.ResponseJson;
|
|
|
import com.caimei365.order.model.bo.PayParamBo;
|
|
@@ -130,8 +131,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
public ResponseJson<Map<String, Object>> generateOrder(SubmitDto submitDto) {
|
|
|
// 获取机构用户Id
|
|
|
Integer clubUserId = baseMapper.getUserIdByClubId(submitDto.getClubId());
|
|
|
- submitDto.getUnionId();
|
|
|
- unionId=submitDto.getUnionId();
|
|
|
+ unionId = submitDto.getUnionId();
|
|
|
if (null == clubUserId || clubUserId == 0) {
|
|
|
return ResponseJson.error("机构用户信息异常!", null);
|
|
|
}
|
|
@@ -301,7 +301,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
|
|
|
public ResponseJson<Map<String, Object>> saveOrder(OrderParamBo orderParamBo) {
|
|
|
log.info("******************** 提交订单逻辑处理 start *******************");
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 初始化主订单
|
|
|
*/
|
|
|
OrderPo mainOrder = new OrderPo();
|
|
@@ -323,9 +323,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
mainOrder.setUpdateDate(curDateStr);
|
|
|
// 订单状态 0 有效 其它无效
|
|
|
mainOrder.setDelFlag(0);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//协销下单
|
|
|
if (3 == orderParamBo.getCartType()) {
|
|
|
mainOrder.setSpId(orderParamBo.getServiceProviderId());
|
|
@@ -366,7 +363,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
// 是否开发票
|
|
|
mainOrder.setInvoiceFlag(orderParamBo.getInvoiceType());
|
|
|
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 整理订单商品信息
|
|
|
*/
|
|
|
// 商品总数量
|
|
@@ -414,14 +411,10 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
for (Object infoObject : orderInfo) {
|
|
|
JSONObject shopInfo = (JSONObject) infoObject;
|
|
|
Integer shopId = (Integer) shopInfo.get("shopId");
|
|
|
- String splitCode = (String) shopInfo.get("splitCode");
|
|
|
String shopNote = (String) shopInfo.get("note");
|
|
|
if (null == shopId) {
|
|
|
return ResponseJson.error("供应商数据异常!", null);
|
|
|
}
|
|
|
- if (StringUtils.isBlank(splitCode)) {
|
|
|
- onlinePay.set(false);
|
|
|
- }
|
|
|
JSONArray productArr = (JSONArray) shopInfo.get("productInfo");
|
|
|
if (null == productArr) {
|
|
|
return ResponseJson.error("订单商品数据异常!", null);
|
|
@@ -432,7 +425,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
* 初始化子订单
|
|
|
*/
|
|
|
OrderShopPo shopOrder = new OrderShopPo();
|
|
|
- shopOrder.setSplitCode(splitCode);
|
|
|
shopOrder.setShopId(shopId);
|
|
|
shopOrder.setShopName(shopName);
|
|
|
shopOrder.setNote(shopNote);
|
|
@@ -449,6 +441,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
AtomicDouble brokerage = new AtomicDouble(0);
|
|
|
// 需要支付金额
|
|
|
AtomicDouble needPayAmount = new AtomicDouble(0);
|
|
|
+ // 不包含店铺满减的子订单应付
|
|
|
+ AtomicDouble realNeedPay = new AtomicDouble(0);
|
|
|
// 商品总金额
|
|
|
AtomicDouble shopAmount = new AtomicDouble(0);
|
|
|
// 付供应商 商品费
|
|
@@ -488,6 +482,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
OrderProductPo dbProduct = submitMapper.getProductDetails(productId);
|
|
|
OrderProductPo product = new OrderProductPo();
|
|
|
BeanUtils.copyProperties(dbProduct, product);
|
|
|
+ log.info("splitcode-----------------------》"+product.getSplitCode());
|
|
|
if (null == product) {
|
|
|
return ResponseJson.error("订单商品不存在!", null);
|
|
|
}
|
|
@@ -631,6 +626,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
Double productAmount = MathUtil.mul(productTaxPrice, productNum).doubleValue();
|
|
|
// 单个商品的折后金额
|
|
|
Double productFee = MathUtil.mul(discountTaxPrice, productNum).doubleValue();
|
|
|
+ // 不包含单品满减的商品金额
|
|
|
+ Double realProductFee = productFee;
|
|
|
// 单个商品总税费
|
|
|
Double taxFee = MathUtil.mul(discountTax, productNum).doubleValue();
|
|
|
if (hasActProductFlag && null != promotions) {
|
|
@@ -640,7 +637,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
if (promotions.getMode() == 1 || MathUtil.compare(productFee, promotions.getTouchPrice()) >= 0) {
|
|
|
// 满减
|
|
|
if (promotions.getMode() == 2) {
|
|
|
-
|
|
|
if (promotions.getDiscount() != null && promotions.getDiscount() == 1) {
|
|
|
//叠加优惠计算
|
|
|
//叠加倍数
|
|
@@ -701,6 +697,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
// 单个商品的折后金额
|
|
|
product.setTotalFee(productFee);
|
|
|
product.setShouldPayFee(productFee);
|
|
|
+ product.setRealProductFee(realProductFee);
|
|
|
// 税费
|
|
|
product.setAddedValueTax(discountTax);
|
|
|
product.setTotalAddedValueTax(taxFee);
|
|
@@ -776,6 +773,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
brokerage.set(MathUtil.add(brokerage.get(), product.getCmFee()).doubleValue());
|
|
|
// 需要支付金额 shouldPayFee +运费
|
|
|
needPayAmount.set(MathUtil.add(needPayAmount.get(), product.getShouldPayFee()).doubleValue());
|
|
|
+ // 不包含单品满减的子订单需付金额
|
|
|
+ realNeedPay.set(MathUtil.add(realNeedPay.get(),product.getRealProductFee()).doubleValue());
|
|
|
// 统计 总金额 包括税费
|
|
|
shopProductFee.set(MathUtil.add(shopProductFee.get(), product.getTotalFee()).doubleValue());
|
|
|
// 统计子订单内可参与店铺促销的商品总金额
|
|
@@ -794,7 +793,11 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
orderProductList.add(product);
|
|
|
productIdList.add(product.getProductId().toString());
|
|
|
}
|
|
|
-
|
|
|
+ Integer count = submitMapper.findSplitResult(productIdList);
|
|
|
+ if (count > 0) {
|
|
|
+ //有商品无分帐号,走线下
|
|
|
+ onlinePay.set(false);
|
|
|
+ }
|
|
|
if (null != shopPromotions) {
|
|
|
// 是否满足满减满赠
|
|
|
if (MathUtil.compare(shopPromotionFee.get(), shopPromotions.getTouchPrice()) >= 0) {
|
|
@@ -852,6 +855,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
shopOrder.setProductAmount(shopAmount.get());
|
|
|
// 需要支付金额 shouldPayFee +运费
|
|
|
shopOrder.setNeedPayAmount(needPayAmount.get());
|
|
|
+ // 设值
|
|
|
+ shopOrder.setRealNeedPay(realNeedPay.get());
|
|
|
// 付供应商 商品费=成本价*(购买数量 + 赠品数量)
|
|
|
shopOrder.setShopProductAmount(shopProductAmount.get());
|
|
|
// 付给供应商税费
|
|
@@ -935,7 +940,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
mainOrder.setPresentCount(presentCount.get());
|
|
|
//促销赠品数量
|
|
|
mainOrder.setPromotionalGiftsCount(promotionalGiftsCount.get());
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 处理优惠券
|
|
|
*/
|
|
|
Double couponAmount = 0d;
|
|
@@ -950,7 +955,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
couponAmount = coupon.getCouponAmount();
|
|
|
}
|
|
|
mainOrder.setCouponAmount(couponAmount);
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 计算运费
|
|
|
*/
|
|
|
if (3 != orderParamBo.getCartType()) {
|
|
@@ -1072,16 +1077,14 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
mainOrder.setClauseName("无条款");
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 保存主订单数据,返回订单Id
|
|
|
*/
|
|
|
submitMapper.insertMainOrder(mainOrder);
|
|
|
log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>新增主订单(insert[cm_order])orderId:" + mainOrder.getOrderId());
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- /*
|
|
|
+ /**
|
|
|
* 保存订单促销,返回订单促销Id
|
|
|
*/
|
|
|
promotionList.forEach(promotions -> {
|
|
@@ -1092,24 +1095,26 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
/**
|
|
|
* 线上单分摊优惠
|
|
|
*/
|
|
|
+ if (presentCount.get() > 0) {
|
|
|
+ //有赠品不能线上,赠品成本无法分账
|
|
|
+ onlinePay.set(false);
|
|
|
+ }
|
|
|
if (onlinePay.get()) {
|
|
|
+ //在店铺满减算完之后重新根据商品的splitCode排shopOrderList
|
|
|
+ List<OrderShopPo> shops = submitMapper.findShops(productIdList);
|
|
|
+ //子订单分多子订单,满减分摊到原子订单分开的子订单,无满减重算佣金/应付
|
|
|
+ //重组订单
|
|
|
+ shopOrderList= findSplitShopOrder(orderProductList, shopOrderList, shops, orderParamBo);
|
|
|
+ log.info("赋值后的shop------------------》"+shopOrderList.toString());
|
|
|
//线上支付分摊优惠总和到子订单
|
|
|
//经理折扣+优惠券+满减 提交订单的时候无经理折扣
|
|
|
double allDiscount = MathUtil.add(couponAmount, promotionFullReduction.get()).doubleValue();
|
|
|
// 分摊优惠前总佣金
|
|
|
AtomicDouble oldBrokerage = new AtomicDouble(0);
|
|
|
- //超级会员价/复购价/阶梯价/促销活动冲突,只能生效一个,促销活动满减计入优惠分摊,子订单售价=NeedPayAmount+promotionFullReduction
|
|
|
+ //超级会员价/复购价/阶梯价/促销活动冲突,只能生效一个,促销活动满减计入优惠分摊,子订单售价=realNeedPay+promotionFullReduction
|
|
|
shopOrderList.forEach(orderShopPo -> {
|
|
|
- // 单品满减和店铺满减会存入shoporder信息中
|
|
|
- if (null != orderShopPo.getPromotionFullReduction() && orderShopPo.getPromotionFullReduction() > 0) {
|
|
|
- //不含分摊优惠的子订单金额
|
|
|
- orderShopPo.setOldPrice(MathUtil.add(orderShopPo.getNeedPayAmount(), orderShopPo.getPromotionFullReduction()).doubleValue());
|
|
|
- //此处佣金未算优惠券和满减金额,不用加上分摊优惠金额
|
|
|
- orderShopPo.setOldBrokerage(orderShopPo.getBrokerage());
|
|
|
- } else {
|
|
|
- orderShopPo.setOldPrice(orderShopPo.getNeedPayAmount());
|
|
|
- orderShopPo.setOldBrokerage(orderShopPo.getBrokerage());
|
|
|
- }
|
|
|
+ orderShopPo.setOldPrice(orderShopPo.getNeedPayAmount());
|
|
|
+ orderShopPo.setOldBrokerage(orderShopPo.getBrokerage());
|
|
|
oldBrokerage.set(MathUtil.add(oldBrokerage.get(), orderShopPo.getOldBrokerage()).doubleValue());
|
|
|
});
|
|
|
// 按分摊前的佣金排序
|
|
@@ -1146,9 +1151,14 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
} else {
|
|
|
//无优惠金额
|
|
|
shopOrderList.forEach(so -> {
|
|
|
+ //不包含优惠的真实支付金额=子订单应付?
|
|
|
double realPay = so.getNeedPayAmount();
|
|
|
+ so.setRealPay(realPay);
|
|
|
+ so.setEachDiscount(0d);
|
|
|
double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
|
|
|
double bro = so.getBrokerage();
|
|
|
+ so.setRealPay(realPay);
|
|
|
+ so.setEachDiscount(0d);
|
|
|
if (bro < charge) {
|
|
|
onlinePay.set(false);
|
|
|
}
|
|
@@ -1361,8 +1371,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
* 更新主订单线上支付按钮
|
|
|
* onlinePayFlag:0可以 1不可以
|
|
|
*/
|
|
|
- Integer onlinePayFlag=onlinePay.get()?0:1;
|
|
|
- submitMapper.updateOnlinePayFlag(onlinePayFlag,mainOrder.getOrderId());
|
|
|
+ Integer onlinePayFlag = onlinePay.get() ? 0 : 1;
|
|
|
+ submitMapper.updateOnlinePayFlag(onlinePayFlag, mainOrder.getOrderId());
|
|
|
/*
|
|
|
* 保存 订单收货用户信息
|
|
|
*/
|
|
@@ -1544,29 +1554,32 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
|
|
|
log.info("**********************微信模板消息推送*****************************");
|
|
|
List<Integer> productIds = orderClubMapper.getProductOrder(mainOrder.getOrderId());
|
|
|
- if (0==mainOrder.getSecondHandOrderFlag() && 0==mainOrder.getRebateFlag() && (null != productIds && !productIds.contains(6060)) ) {
|
|
|
- log.info("*******获取公众名"+orderClubMapper.getOrderIds(mainOrder.getOrderId()).toString());
|
|
|
- String name="0";
|
|
|
+ if (0 == mainOrder.getSecondHandOrderFlag() && 0 == mainOrder.getRebateFlag() && (null != productIds && !productIds.contains(6060))) {
|
|
|
+ log.info("*******获取公众名" + orderClubMapper.getOrderIds(mainOrder.getOrderId()).toString());
|
|
|
+ String name = "0";
|
|
|
try {
|
|
|
String accessToken = weChatService.getAccessToken();
|
|
|
List<String> openidList = orderClubMapper.getOpenidListByPermission(unionId);
|
|
|
openidList.removeIf(Objects::isNull);
|
|
|
- String i=orderClubMapper.getOrderIds(mainOrder.getOrderId()).toString();
|
|
|
- if(i.length()<10){
|
|
|
- name= StringUtils.strip(i, "[]");
|
|
|
- }else { name= StringUtils.strip(i.substring(0,11), "[]"); name+="...";}
|
|
|
+ String i = orderClubMapper.getOrderIds(mainOrder.getOrderId()).toString();
|
|
|
+ if (i.length() < 10) {
|
|
|
+ name = StringUtils.strip(i, "[]");
|
|
|
+ } else {
|
|
|
+ name = StringUtils.strip(i.substring(0, 11), "[]");
|
|
|
+ name += "...";
|
|
|
+ }
|
|
|
|
|
|
- log.info("订单商品>>>>>"+name+""+mainOrder.getOrderId());
|
|
|
+ log.info("订单商品>>>>>" + name + "" + mainOrder.getOrderId());
|
|
|
String associateTitle = "订单已成功提交,等待付款!";
|
|
|
- Double money=mainOrder.getPayTotalFee();
|
|
|
+ Double money = mainOrder.getPayTotalFee();
|
|
|
String orderno = mainOrder.getOrderNo();
|
|
|
- String remarkText = "下单时间:" + mainOrder.getOrderTime() +"点击详情进行付款";
|
|
|
+ String remarkText = "下单时间:" + mainOrder.getOrderTime() + "点击详情进行付款";
|
|
|
// 跳转到【小程序付款-选择支付方式页面】
|
|
|
- String pagePath = "pages/user/order/order-details?type=share&orderId="+mainOrder.getOrderId();
|
|
|
+ String pagePath = "pages/user/order/order-details?orderId=" + mainOrder.getOrderId();
|
|
|
for (String openid : openidList) {
|
|
|
// sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
- log.error("获取openid>>>>>"+openidList);
|
|
|
- weChatService.sendTemplateMsgs(accessToken, openid, associateTitle, name,orderno, money, remarkText, pagePath);
|
|
|
+ log.error("获取openid>>>>>" + openidList);
|
|
|
+ weChatService.sendTemplateMsgs(accessToken, openid, associateTitle, name, orderno, money, remarkText, pagePath);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("【订单下单通知】获取微信公众号access_token异常!", e);
|
|
@@ -1574,8 +1587,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
log.info("******************** 提交订单逻辑处理 end *******************");
|
|
|
|
|
|
/*
|
|
@@ -1604,6 +1615,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
info.put("orderMark", "#" + mainOrder.getOrderId() + "#");
|
|
|
//应付订单金额
|
|
|
info.put("payTotalFee", mainOrder.getPayTotalFee());
|
|
|
+ //线上线下按钮onlinePayFlag:0线上,1线下
|
|
|
+ info.put("onlinePayFlag", onlinePayFlag);
|
|
|
//真实需要付款金额
|
|
|
info.put("payableAmount", mainOrder.getPayableAmount());
|
|
|
if (isPaySuccessFlag) {
|
|
@@ -1621,6 +1634,108 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
return ResponseJson.success("操作成功!", info);
|
|
|
}
|
|
|
|
|
|
+ private List<OrderShopPo> findSplitShopOrder(List<OrderProductPo> orderProductList, List<OrderShopPo> shopOrderList, List<OrderShopPo> shops, OrderParamBo orderParamBo) {
|
|
|
+ //统计拆分的shop
|
|
|
+ //List<OrderShopPo> collect = shops.stream().filter(s -> shops.stream().filter(so -> so.getShopId().equals(s.getShopId())).count() > 1).collect(Collectors.toList());
|
|
|
+ //对拆分的shop重新计算子订单佣金,应付,不计入店铺满减
|
|
|
+ log.info("原shoporderlist--------------------》"+shopOrderList);
|
|
|
+ log.info("原orderproductlist--------------------》"+orderProductList);
|
|
|
+ ArrayList<OrderShopPo> orderShopPos = new ArrayList<>();
|
|
|
+ for (OrderShopPo shop : shops) {
|
|
|
+ // 供应商名称
|
|
|
+ String shopName = baseMapper.getShopNameById(shop.getShopId());
|
|
|
+ /*
|
|
|
+ * 初始化子订单
|
|
|
+ */
|
|
|
+ List<OrderShopPo> oldShop = shopOrderList.stream().filter(s -> s.getShopId().equals(shop.getShopId())).collect(Collectors.toList());
|
|
|
+ OrderShopPo shopOrder = new OrderShopPo();
|
|
|
+ shopOrder.setSplitCode(shop.getSplitCode());
|
|
|
+ shopOrder.setShopId(shop.getShopId());
|
|
|
+ shopOrder.setShopName(shopName);
|
|
|
+ shopOrder.setNote(oldShop.get(0).getNote());
|
|
|
+ // 用户Id
|
|
|
+ shopOrder.setUserId(oldShop.get(0).getUserId());
|
|
|
+ shopOrder.setClubId(oldShop.get(0).getClubId());
|
|
|
+ if (null != oldShop.get(0).getOrderPromotionsId()) {
|
|
|
+ shopOrder.setOrderPromotionsId(oldShop.get(0).getOrderPromotionsId());
|
|
|
+ }
|
|
|
+ if (3 == orderParamBo.getCartType()) {
|
|
|
+ // 协销订单
|
|
|
+ shopOrder.setSpId(orderParamBo.getBuyUserId());
|
|
|
+ }
|
|
|
+ // 商品总数量
|
|
|
+ AtomicInteger shopProductCount = new AtomicInteger(0);
|
|
|
+ // 佣金 = 应付采美
|
|
|
+ AtomicDouble brokerage = new AtomicDouble(0);
|
|
|
+ // 需要支付金额
|
|
|
+ AtomicDouble needPayAmount = new AtomicDouble(0);
|
|
|
+ // 商品总金额
|
|
|
+ AtomicDouble shopAmount = new AtomicDouble(0);
|
|
|
+ // 付供应商 商品费
|
|
|
+ AtomicDouble shopProductAmount = new AtomicDouble(0);
|
|
|
+ // 付供应商税费
|
|
|
+ AtomicDouble shopTaxFee = new AtomicDouble(0);
|
|
|
+ // 商品费
|
|
|
+ AtomicDouble shopProductFee = new AtomicDouble(0);
|
|
|
+ // 该供应商下该分帐号的商品
|
|
|
+ List<OrderProductPo> shopProducts = orderProductList.stream().filter(po -> po.getSplitCode().equals(shop.getSplitCode()) && po.getShopId().equals(shop.getShopId())).collect(Collectors.toList());
|
|
|
+ // 遍历所有商品
|
|
|
+ for (OrderProductPo product : shopProducts) {
|
|
|
+ /*
|
|
|
+ * 子订单金额计算
|
|
|
+ */
|
|
|
+ // 供应商商品数量
|
|
|
+ shopProductCount.set(shopProductCount.get() + product.getNum());
|
|
|
+ // 佣金 = 应付采美
|
|
|
+ brokerage.set(MathUtil.add(brokerage.get(), product.getCmFee()).doubleValue());
|
|
|
+ // 需要支付金额 shouldPayFee +运费
|
|
|
+ needPayAmount.set(MathUtil.add(needPayAmount.get(), product.getRealProductFee()).doubleValue());
|
|
|
+ // 统计 总金额 包括税费
|
|
|
+ shopProductFee.set(MathUtil.add(shopProductFee.get(), product.getRealProductFee()).doubleValue());
|
|
|
+ // 商品总金额
|
|
|
+ shopAmount.set(MathUtil.add(shopAmount.get(), product.getTotalAmount()).doubleValue());
|
|
|
+ // 付供应商 商品费
|
|
|
+ shopProductAmount.set(MathUtil.add(shopProductAmount.get(), product.getShopProductAmount()).doubleValue());
|
|
|
+ // 付供应商税费
|
|
|
+ shopTaxFee.set(MathUtil.add(shopTaxFee.get(), product.getShouldPayTotalTax()).doubleValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 佣金 采美应收
|
|
|
+ shopOrder.setBrokerage(brokerage.get());
|
|
|
+ // 可退款金额 = 余额抵扣金额
|
|
|
+ shopOrder.setCanRefundAmount(needPayAmount.get());
|
|
|
+ // 购买商品数
|
|
|
+ shopOrder.setItemCount(shopProductCount.get());
|
|
|
+ // 总价(含税) = totalFee
|
|
|
+ shopOrder.setTotalAmount(shopProductFee.get());
|
|
|
+ // 总金额 = 订单商品totalAmount
|
|
|
+ shopOrder.setProductAmount(shopAmount.get());
|
|
|
+ // 需要支付金额 shouldPayFee +运费
|
|
|
+ shopOrder.setNeedPayAmount(needPayAmount.get());
|
|
|
+ // 付供应商 商品费=成本价*(购买数量 + 赠品数量)
|
|
|
+ shopOrder.setShopProductAmount(shopProductAmount.get());
|
|
|
+ // 付给供应商税费
|
|
|
+ shopOrder.setShopTaxFee(shopTaxFee.get());
|
|
|
+ // 付供应商 = 商品费 + 运费 + 税费
|
|
|
+ shopOrder.setShouldPayShopAmount(MathUtil.add(shopProductAmount.get(), shopTaxFee.get()).doubleValue());
|
|
|
+ // 付给供应商运费
|
|
|
+ shopOrder.setShopPostFee(0d);
|
|
|
+ // 已付供应商金额
|
|
|
+ shopOrder.setPayedShopAmount(0d);
|
|
|
+ // (付款供应商)付款状态:1待付款、2部分付款、3已付款
|
|
|
+ shopOrder.setPayStatus(1);
|
|
|
+ if (3 == orderParamBo.getCartType()) {
|
|
|
+ // 协销订单
|
|
|
+ shopOrder.setOrderType(0);
|
|
|
+ } else {
|
|
|
+ // 普通订单
|
|
|
+ shopOrder.setOrderType(1);
|
|
|
+ }
|
|
|
+ orderShopPos.add(shopOrder);
|
|
|
+ }
|
|
|
+ return orderShopPos;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成充值商品订单
|
|
|
*
|