|
@@ -71,53 +71,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
private PayOrderMapper payOrderMapper;
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 验证是否有购买资格
|
|
|
- *
|
|
|
- * @param submitDto
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public ResponseJson<Map<String, Object>> verify(SubmitDto submitDto) {
|
|
|
-
|
|
|
- /*Map<String, Object> map = new HashMap<>();
|
|
|
- boolean bol = false;
|
|
|
- // 机构一级分类
|
|
|
- String firstClubType = baseMapper.firstClubTypeById(submitDto.getClubId());
|
|
|
- if (!StringUtils.isNotBlank(firstClubType)) {
|
|
|
- firstClubType = "0";
|
|
|
- }
|
|
|
- try {
|
|
|
- ArrayList<Integer> list = new ArrayList<>();
|
|
|
- JSONArray orderInfo = parseArray(submitDto.getOrderInfo());
|
|
|
- *//*Object productInfo = orderInfo.get("productInfo");
|
|
|
- JSONArray jsonArray = parseArray(productInfo.toString());*//*
|
|
|
- for (Object infoObject : orderInfo) {
|
|
|
- JSONObject productTemp = (JSONObject) infoObject;
|
|
|
- JSONArray productArr = (JSONArray) productTemp.get("productInfo");
|
|
|
- for (Object productObject : productArr) {
|
|
|
- JSONObject product = (JSONObject) productObject;
|
|
|
- list.add((Integer) product.get("skuId"));
|
|
|
- }
|
|
|
- }
|
|
|
- // 获取订单商品械字号类型
|
|
|
- List<String> machineType = baseMapper.machineTypeByID(list);
|
|
|
- for (String str : machineType) {
|
|
|
- if ("3".equals(str)) {
|
|
|
- bol = true;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!"1".equals(firstClubType) && bol) {
|
|
|
- map.put("code", -1);
|
|
|
- } else {
|
|
|
- map.put("code", 1);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return ResponseJson.error("商品验证失败",null);
|
|
|
- }*/
|
|
|
- return ResponseJson.success();
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 生成订单
|
|
@@ -229,27 +182,27 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
String orderShouldPayFee = (String) payInfo.get("orderShouldPayFee");
|
|
|
orderParamBo.setOrderShouldPayFee(Double.parseDouble(orderShouldPayFee));
|
|
|
// 运费标志:0包邮 -1到付 1遵循运费规则
|
|
|
- Integer postageFlag = (Integer) payInfo.get("postageFlag");
|
|
|
+ // Integer postageFlag = (Integer) payInfo.get("postageFlag");
|
|
|
// 运费
|
|
|
- String postage = (String) payInfo.get("postage");
|
|
|
+ /*String postage = (String) payInfo.get("postage");
|
|
|
if (null == postageFlag || null == postage) {
|
|
|
return ResponseJson.error("运费数据异常!", null);
|
|
|
}
|
|
|
orderParamBo.setPostageFlag(postageFlag);
|
|
|
- orderParamBo.setPostage(Double.parseDouble(postage));
|
|
|
+ orderParamBo.setPostage(Double.parseDouble(postage));*/
|
|
|
// 采美豆抵扣运费,1:100,到付默认30元,抵扣3000豆
|
|
|
Integer userBeans = (Integer) payInfo.get("userBeans");
|
|
|
if (null != userBeans && userBeans > 0) {
|
|
|
// 计算需抵扣采美豆数量
|
|
|
- int offsetBeans = MathUtil.mul(postage, 100).intValue();
|
|
|
+ /*int offsetBeans = MathUtil.mul(postage, 100).intValue();
|
|
|
if (-1 == postageFlag) {
|
|
|
// 到付默认30元,抵扣3000豆
|
|
|
offsetBeans = 3000;
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 与前端传入采美豆数量比较
|
|
|
- if (null == orderParamBo.getUserBeans() || !userBeans.equals(offsetBeans)) {
|
|
|
+ /*if (null == orderParamBo.getUserBeans() || !userBeans.equals(offsetBeans)) {
|
|
|
return ResponseJson.error("采美豆数据异常!", null);
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (orderParamBo.getUserBeans() <= 0) {
|
|
|
return ResponseJson.error("用户没有剩余采美豆!", null);
|
|
|
}
|
|
@@ -504,6 +457,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
AtomicDouble payableAmount = new AtomicDouble(0);
|
|
|
// 余额支付金额
|
|
|
AtomicDouble balancePayFee = new AtomicDouble(0);
|
|
|
+ // 总运费
|
|
|
+ AtomicDouble postageFee = new AtomicDouble(0);
|
|
|
// 冷链运输费
|
|
|
AtomicDouble isColdChina = new AtomicDouble(0);
|
|
|
// 统计销量用
|
|
@@ -535,6 +490,9 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
JSONObject shopInfo = (JSONObject) infoObject;
|
|
|
Integer shopId = (Integer) shopInfo.get("shopId");
|
|
|
String shopNote = (String) shopInfo.get("note");
|
|
|
+ String postageString = (String) shopInfo.get("postage");
|
|
|
+ Integer postageFlag = (Integer) shopInfo.get("postageFlag");
|
|
|
+ Integer isColdChinaShop = (Integer) shopInfo.get("isColdChina");
|
|
|
if (null == shopId) {
|
|
|
return ResponseJson.error("供应商数据异常!", null);
|
|
|
}
|
|
@@ -542,6 +500,12 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
if (null == productArr) {
|
|
|
return ResponseJson.error("订单商品数据异常!", null);
|
|
|
}
|
|
|
+ if (1252 == shopId) {
|
|
|
+ secondHandOrderFlag = true;
|
|
|
+ }
|
|
|
+ log.info("postageFlag*****************"+postageFlag);
|
|
|
+ // 运费
|
|
|
+ Double postage = Double.parseDouble(postageString);
|
|
|
// 供应商名称
|
|
|
String shopName = baseMapper.getShopNameById(shopId);
|
|
|
/*
|
|
@@ -551,6 +515,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
shopOrder.setShopId(shopId);
|
|
|
shopOrder.setShopName(shopName);
|
|
|
shopOrder.setNote(shopNote);
|
|
|
+ // 是否勾选冷链运输费
|
|
|
+ shopOrder.setIsColdChina(isColdChinaShop);
|
|
|
// 用户Id
|
|
|
shopOrder.setUserId(orderParamBo.getUserId());
|
|
|
shopOrder.setClubId(orderParamBo.getClubId());
|
|
@@ -570,6 +536,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
AtomicDouble shopAmount = new AtomicDouble(0);
|
|
|
// 付供应商 商品费
|
|
|
AtomicDouble shopProductAmount = new AtomicDouble(0);
|
|
|
+ // 冷链运输费
|
|
|
+ AtomicDouble shopIsColdChina = new AtomicDouble(0);
|
|
|
// 付供应商税费
|
|
|
AtomicDouble shopTaxFee = new AtomicDouble(0);
|
|
|
// 店铺促销活动状态
|
|
@@ -616,18 +584,16 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
return ResponseJson.error("订单商品不存在!", null);
|
|
|
}
|
|
|
// 联合丽格冷链费商品
|
|
|
- if (1 == orderParamBo.getIsColdChain()) {
|
|
|
- if (7881 == product.getProductId()) {
|
|
|
+ if (1 == isColdChinaShop) {
|
|
|
+ if (7536 == product.getProductId()) {
|
|
|
if (productNum >= 100) {
|
|
|
- isColdChina.set(0.00d);
|
|
|
+ shopIsColdChina.set(0.00d);
|
|
|
} else {
|
|
|
- isColdChina.set(700.00d);
|
|
|
- // payableAmount.set(MathUtil.add(payableAmount.get(), isColdChina).doubleValue());
|
|
|
-// orderParamBo.setOrderShouldPayFee(MathUtil.sub(orderParamBo.getOrderShouldPayFee(), isColdChina.get()).doubleValue());
|
|
|
+ shopIsColdChina.set(700.00d);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- isColdChina.set(0.00d);
|
|
|
+ shopIsColdChina.set(0.00d);
|
|
|
}
|
|
|
// 是否二手商品
|
|
|
if (null != product.getProductCategory() && 2 == product.getProductCategory()) {
|
|
@@ -967,6 +933,18 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
productIdList.add(product.getProductId().toString());
|
|
|
skuIdList.add(product.getSkuId().toString());
|
|
|
}
|
|
|
+ // 设置运费
|
|
|
+ if (( 1 == postageFlag && 0 == mainOrder.getUserBeans() ) || ( 0 == postageFlag && isColdChina.get() > 0.00d && 0 != organizeId ) || ( -1 == postageFlag && isColdChina.get() > 0.00d && 0 != organizeId )) {
|
|
|
+ postage = MathUtil.add(shopIsColdChina.get(), postage).doubleValue();
|
|
|
+ shopOrder.setShopPostFee(postage);
|
|
|
+ }
|
|
|
+ log.info("shopIsColdChina.get()=------=-=-===="+shopIsColdChina.get());
|
|
|
+ log.info("postage=-***===="+postage);
|
|
|
+ isColdChina.set(MathUtil.add(isColdChina.get(), shopIsColdChina.get()).doubleValue());
|
|
|
+ log.info("isColdChina.get()=------=-=-===="+isColdChina.get());
|
|
|
+ // 统计总运费
|
|
|
+ postageFee.set(MathUtil.add(postageFee.get(), postage).doubleValue());
|
|
|
+ log.info("统计总运费+--+-+-"+postageFee.get());
|
|
|
Integer count = submitMapper.findSplitResult(productIdList);
|
|
|
if (count > 0) {
|
|
|
//有商品无分帐号,走线下
|
|
@@ -1045,7 +1023,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
// 付供应商 = 商品费 + 运费 + 税费
|
|
|
shopOrder.setShouldPayShopAmount(MathUtil.add(shopProductAmount.get(), shopTaxFee.get()).doubleValue());
|
|
|
// 付给供应商运费
|
|
|
- shopOrder.setShopPostFee(0d);
|
|
|
+ // shopOrder.setShopPostFee(0d);
|
|
|
// 已付供应商金额
|
|
|
shopOrder.setPayedShopAmount(0d);
|
|
|
// (付款供应商)付款状态:1待付款、2部分付款、3已付款
|
|
@@ -1057,6 +1035,9 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
// 普通订单
|
|
|
shopOrder.setOrderType(1);
|
|
|
}
|
|
|
+ // 运费标记
|
|
|
+ shopOrder.setShopPostFlag(postageFlag);
|
|
|
+ log.info("shopOrder.getShopPostFlag()*****************"+shopOrder.getShopPostFlag());
|
|
|
// 添加到子订单列表
|
|
|
shopOrderList.add(shopOrder);
|
|
|
// 统计商品总金额
|
|
@@ -1145,7 +1126,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
/**
|
|
|
* 计算运费
|
|
|
*/
|
|
|
- if (3 != orderParamBo.getCartType()) {
|
|
|
+ /*if (3 != orderParamBo.getCartType()) {
|
|
|
// 机构用户 校验商品运费
|
|
|
if (orderParamBo.getPostageFlag() != -1) {
|
|
|
Integer townId = baseMapper.getTownIdByAddressId(orderParamBo.getAddressId());
|
|
@@ -1157,27 +1138,28 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
return ResponseJson.error("订单邮费不正确!", null);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 设置运费
|
|
|
- mainOrder.setPostage(orderParamBo.getPostage());
|
|
|
+ // mainOrder.setPostage(orderParamBo.getPostage());
|
|
|
// 订单总额 = 商品费 + 运费
|
|
|
- payTotalFee.set(MathUtil.add(productTotalFee.get(), orderParamBo.getPostage()).doubleValue());
|
|
|
+ log.info("总运费"+postageFee.get());
|
|
|
+ payTotalFee.set(MathUtil.add(productTotalFee.get(), postageFee.get()).doubleValue());
|
|
|
// 运费标志:0包邮 -1到付 1遵循运费规则
|
|
|
- mainOrder.setPostageFlag(orderParamBo.getPostageFlag());
|
|
|
- if (1 == orderParamBo.getPostageFlag() && orderParamBo.getOffsetBeans() > 0) {
|
|
|
+ // mainOrder.setPostageFlag(orderParamBo.getPostageFlag());
|
|
|
+ /*if (1 == orderParamBo.getPostageFlag() && orderParamBo.getOffsetBeans() > 0) {
|
|
|
// 订单总额 = 商品费 - 优惠券金额
|
|
|
payTotalFee.set(MathUtil.sub(productTotalFee.get(), couponAmount).doubleValue());
|
|
|
} else {
|
|
|
// 订单总额 -= 优惠券金额
|
|
|
payTotalFee.set(MathUtil.sub(payTotalFee.get(), couponAmount).doubleValue());
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 超级会员优惠
|
|
|
mainOrder.setSvipFullReduction(svipFullReduction.get());
|
|
|
// 商品总额
|
|
|
mainOrder.setProductTotalFee(productTotalFee.get());
|
|
|
mainOrder.setOrderTotalFee(productTotalFee.get());
|
|
|
// 订单总额(商品金额+运费)-- 冷链运输费
|
|
|
- mainOrder.setPayTotalFee(MathUtil.add(payTotalFee.get(), isColdChina.get()).doubleValue());
|
|
|
+ mainOrder.setPayTotalFee(payTotalFee.get());
|
|
|
// 订单状态
|
|
|
if (0 == organizeId) {
|
|
|
if (3 == orderParamBo.getCartType()) {
|
|
@@ -1239,7 +1221,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
// 余额支付金额
|
|
|
mainOrder.setBalancePayFee(balancePayFee.get());
|
|
|
// 实际支付金额(商品金额+运费-余额抵扣) + 冷链费用
|
|
|
- mainOrder.setPayableAmount(MathUtil.add(payableAmount.get(), isColdChina.get()).doubleValue());
|
|
|
+ mainOrder.setPayableAmount(payableAmount.get());
|
|
|
|
|
|
// 是否返佣订单
|
|
|
Integer rebateFlag = (null == orderParamBo.getRebateFlag() ? 0 : orderParamBo.getRebateFlag());
|
|
@@ -1248,8 +1230,9 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
mainOrder.setRebateFee(orderParamBo.getRebateFee());
|
|
|
}
|
|
|
|
|
|
+ log.info("订单总额"+payTotalFee.get());
|
|
|
// 判断前端传入orderShouldPayFee订单应付金额,和后台计算应付金额对比
|
|
|
- orderParamBo.setOrderShouldPayFee(MathUtil.sub(orderParamBo.getOrderShouldPayFee(), isColdChina.get()).doubleValue());
|
|
|
+ // orderParamBo.setOrderShouldPayFee(MathUtil.sub(orderParamBo.getOrderShouldPayFee(), isColdChina.get()).doubleValue());
|
|
|
log.info("【提交订单】>>>>>后台计算payableAmount:" + payableAmount.get() + " ,前端传入orderShouldPayFee:" + orderParamBo.getOrderShouldPayFee());
|
|
|
// compare return[-1:v1<v2, 0:v1=v2, 1:v1>v2]
|
|
|
int compare = MathUtil.compare(orderParamBo.getOrderShouldPayFee(), payableAmount.get());
|
|
@@ -1259,7 +1242,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
return ResponseJson.error("订单付款金额不正确!", null);
|
|
|
}
|
|
|
// 加冷链费
|
|
|
- orderParamBo.setOrderShouldPayFee(MathUtil.add(orderParamBo.getOrderShouldPayFee(), isColdChina.get()).doubleValue());
|
|
|
+ // orderParamBo.setOrderShouldPayFee(MathUtil.add(orderParamBo.getOrderShouldPayFee(), isColdChina.get()).doubleValue());
|
|
|
// 售后条款
|
|
|
Integer clauseId = orderParamBo.getClauseId();
|
|
|
String clauseName = null;
|
|
@@ -1450,17 +1433,12 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
shopOrder.setSplitCode(Constant.BCCMERCHANT);
|
|
|
shopOrder.setRealPay(shopOrder.getNeedPayAmount());
|
|
|
}
|
|
|
- // 冷链运输费
|
|
|
- if (1 == orderParamBo.getIsColdChain()) {
|
|
|
- shopOrder.setIsColdChina(1);
|
|
|
- mainOrder.setPostage(MathUtil.add(mainOrder.getPostage(), isColdChina.get()).doubleValue());
|
|
|
- } else {
|
|
|
- shopOrder.setIsColdChina(0);
|
|
|
- }
|
|
|
// 设置运费
|
|
|
- if (( 1 == mainOrder.getPostageFlag() && 0 == mainOrder.getUserBeans() ) || ( 0 == mainOrder.getPostageFlag() && isColdChina.get() > 0.00d && 0 != organizeId ) || ( -1 == mainOrder.getPostageFlag() && isColdChina.get() > 0.00d && 0 != organizeId )) {
|
|
|
- shopOrder.setShopPostFee(mainOrder.getPostage());
|
|
|
+ boolean shopFlag = ( 1 == shopOrder.getShopPostFlag() && (null != mainOrder.getUserBeans() && 0 == mainOrder.getUserBeans()) ) || ( 0 == shopOrder.getShopPostFlag() && isColdChina.get() > 0.00d && 0 != organizeId ) || ( -1 == shopOrder.getShopPostFlag() && isColdChina.get() > 0.00d && 0 != organizeId );
|
|
|
+ if (!shopFlag) {
|
|
|
+ shopOrder.setShopPostFee(0d);
|
|
|
}
|
|
|
+ log.info("shopOrder.getIsColdChina()******"+shopOrder.getIsColdChina()+"=====shopOrder.getShopPostFee()"+shopOrder.getShopPostFee());
|
|
|
/*
|
|
|
* 保存子订单
|
|
|
*/
|
|
@@ -1539,115 +1517,115 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
* 采美豆抵扣不生成
|
|
|
* 版本不在使用运费子订单
|
|
|
*/
|
|
|
- if (organizeId == 998 && ( 1 == mainOrder.getPostageFlag() && 0 == mainOrder.getUserBeans() ) || ( 0 == mainOrder.getPostageFlag() && isColdChina.get() > 0.00d && 0 != organizeId ) || ( -1 == mainOrder.getPostageFlag() && isColdChina.get() > 0.00d && 0 != organizeId )) {
|
|
|
- // 获取 邮费商品 productId 999 skuId 1
|
|
|
- OrderProductPo postageProduct = submitMapper.getProductDetails(1);
|
|
|
- // 生成子订单编号
|
|
|
- StringBuilder postageOrderNo = new StringBuilder();
|
|
|
- postageOrderNo.append(mainOrder.getOrderNo());
|
|
|
- if (shopOrderIndex.get() < 10) {
|
|
|
- postageOrderNo.append("0");
|
|
|
- }
|
|
|
- postageOrderNo.append(shopOrderIndex.get());
|
|
|
- shopOrderIndex.incrementAndGet();
|
|
|
- /*
|
|
|
- * 初始化邮费订单
|
|
|
- */
|
|
|
- OrderShopPo postageOrder = new OrderShopPo();
|
|
|
- postageOrder.setShopOrderNo(postageOrderNo.toString());
|
|
|
- postageOrder.setOrderNo(mainOrder.getOrderNo());
|
|
|
- postageOrder.setOrderId(mainOrder.getOrderId());
|
|
|
- postageOrder.setUserId(mainOrder.getUserId());
|
|
|
- postageOrder.setOrderSubmitType(mainOrder.getOrderSubmitType());
|
|
|
- postageOrder.setItemCount(1);
|
|
|
- if (0 == organizeId) {
|
|
|
- postageOrder.setSplitCode(Constant.CUSTOMERNUM);
|
|
|
- } else {
|
|
|
- // 联合丽格
|
|
|
- postageOrder.setSplitCode(Constant.BCCMERCHANT);
|
|
|
- }
|
|
|
- // 冷链运输费
|
|
|
- if (1 == orderParamBo.getIsColdChain()) {
|
|
|
- postageOrder.setIsColdChina(1);
|
|
|
- mainOrder.setPostage(MathUtil.add(mainOrder.getPostage(), isColdChina.get()).doubleValue());
|
|
|
- } else {
|
|
|
- postageOrder.setIsColdChina(0);
|
|
|
- }
|
|
|
- postageOrder.setRealPay(mainOrder.getPostage());
|
|
|
- postageOrder.setEachDiscount(0d);
|
|
|
-
|
|
|
- //运费商品供应商Id默认998
|
|
|
- postageOrder.setShopId(postageProduct.getShopId());
|
|
|
- postageOrder.setProductAmount(mainOrder.getPostage());
|
|
|
- postageOrder.setTotalAmount(mainOrder.getPostage());
|
|
|
- postageOrder.setNeedPayAmount(mainOrder.getPostage());
|
|
|
- postageOrder.setOrderTime(mainOrder.getOrderTime());
|
|
|
- postageOrder.setCanRefundAmount(0d);
|
|
|
- postageOrder.setClubId(mainOrder.getClubId());
|
|
|
- // 已付供应商金额
|
|
|
- postageOrder.setPayedShopAmount(0d);
|
|
|
- // (付款供应商)付款状态:1待付款、2部分付款、3已付款
|
|
|
- postageOrder.setPayStatus(3);
|
|
|
- if (3 == orderParamBo.getCartType()) {
|
|
|
- // 协销订单
|
|
|
- postageOrder.setSpId(orderParamBo.getBuyUserId());
|
|
|
- postageOrder.setOrderType(0);
|
|
|
- } else {
|
|
|
- // 普通订单
|
|
|
- postageOrder.setOrderType(1);
|
|
|
- }
|
|
|
- // 订单默认可拆分
|
|
|
- postageOrder.setSplitFlag(1);
|
|
|
- // 设置组织Id
|
|
|
- postageOrder.setOrganizeId(organizeId);
|
|
|
- /*
|
|
|
- * 保存运费子订单
|
|
|
- */
|
|
|
- submitMapper.insertShopOrder(postageOrder);
|
|
|
- log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>新增子订单(运费商品)(insert[cm_shop_order])shopOrderId::" + postageOrder.getShopOrderId() + ",orderId:" + mainOrder.getOrderId());
|
|
|
- // 收集子订单Id字符串
|
|
|
- if (StringUtils.isEmpty(shopOrderIds.get())) {
|
|
|
- shopOrderIds.set(postageOrder.getShopOrderId().toString());
|
|
|
- } else {
|
|
|
- shopOrderIds.set(shopOrderIds.get() + "," + postageOrder.getShopOrderId());
|
|
|
- }
|
|
|
- // 有冷链运输费 且大于 0 修改主订单运费状态
|
|
|
- if (MathUtil.add(mainOrder.getPostage(), isColdChina.get()).doubleValue() > 0) {
|
|
|
- submitMapper.updateOrder(mainOrder.getPostage().doubleValue(), mainOrder.getOrderId());
|
|
|
- }
|
|
|
- /*
|
|
|
- * 设置运费商品
|
|
|
- */
|
|
|
- postageProduct.setOrderNo(mainOrder.getOrderNo());
|
|
|
- postageProduct.setOrderId(mainOrder.getOrderId());
|
|
|
- postageProduct.setShopOrderId(postageOrder.getShopOrderId());
|
|
|
- postageProduct.setShopOrderNo(postageOrder.getShopOrderNo());
|
|
|
- postageProduct.setNum(1);
|
|
|
- postageProduct.setPresentNum(0);
|
|
|
- postageProduct.setPrice(mainOrder.getPostage());
|
|
|
- postageProduct.setNormalPrice(mainOrder.getPostage());
|
|
|
- postageProduct.setTotalAmount(mainOrder.getPostage());
|
|
|
- postageProduct.setTotalFee(mainOrder.getPostage());
|
|
|
- postageProduct.setShouldPayFee(mainOrder.getPostage());
|
|
|
- postageProduct.setDiscount(100d);
|
|
|
- postageProduct.setDiscountPrice(mainOrder.getPostage());
|
|
|
- postageProduct.setTaxRate(100d);
|
|
|
- postageProduct.setAddedValueTax(0d);
|
|
|
- postageProduct.setTotalAddedValueTax(0d);
|
|
|
- postageProduct.setShopFee(0d);
|
|
|
- postageProduct.setOtherFee(0d);
|
|
|
- postageProduct.setCmFee(mainOrder.getPostage());
|
|
|
- postageProduct.setSingleShopFee(0d);
|
|
|
- postageProduct.setSingleOtherFee(0d);
|
|
|
- postageProduct.setSingleCmFee(mainOrder.getPostage());
|
|
|
- postageProduct.setNotOutStore(0);
|
|
|
- postageProduct.setBuyAgainFlag(0);
|
|
|
- /*
|
|
|
- * 保存 订单运费商品
|
|
|
- */
|
|
|
- submitMapper.insertOrderProduct(postageProduct);
|
|
|
- log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>保存订单运费商品(insert[cm_order_product])OrderProductId:" + postageProduct.getOrderProductId() + ",orderId:" + mainOrder.getOrderId());
|
|
|
- }
|
|
|
+// if (organizeId == 998 && ( 1 == mainOrder.getPostageFlag() && 0 == mainOrder.getUserBeans() ) || ( 0 == mainOrder.getPostageFlag() && isColdChina.get() > 0.00d && 0 != organizeId ) || ( -1 == mainOrder.getPostageFlag() && isColdChina.get() > 0.00d && 0 != organizeId )) {
|
|
|
+// // 获取 邮费商品 productId 999 skuId 1
|
|
|
+// OrderProductPo postageProduct = submitMapper.getProductDetails(1);
|
|
|
+// // 生成子订单编号
|
|
|
+// StringBuilder postageOrderNo = new StringBuilder();
|
|
|
+// postageOrderNo.append(mainOrder.getOrderNo());
|
|
|
+// if (shopOrderIndex.get() < 10) {
|
|
|
+// postageOrderNo.append("0");
|
|
|
+// }
|
|
|
+// postageOrderNo.append(shopOrderIndex.get());
|
|
|
+// shopOrderIndex.incrementAndGet();
|
|
|
+// /*
|
|
|
+// * 初始化邮费订单
|
|
|
+// */
|
|
|
+// OrderShopPo postageOrder = new OrderShopPo();
|
|
|
+// postageOrder.setShopOrderNo(postageOrderNo.toString());
|
|
|
+// postageOrder.setOrderNo(mainOrder.getOrderNo());
|
|
|
+// postageOrder.setOrderId(mainOrder.getOrderId());
|
|
|
+// postageOrder.setUserId(mainOrder.getUserId());
|
|
|
+// postageOrder.setOrderSubmitType(mainOrder.getOrderSubmitType());
|
|
|
+// postageOrder.setItemCount(1);
|
|
|
+// if (0 == organizeId) {
|
|
|
+// postageOrder.setSplitCode(Constant.CUSTOMERNUM);
|
|
|
+// } else {
|
|
|
+// // 联合丽格
|
|
|
+// postageOrder.setSplitCode(Constant.BCCMERCHANT);
|
|
|
+// }
|
|
|
+// // 冷链运输费
|
|
|
+// if (isColdChina.get() >= 700) {
|
|
|
+// postageOrder.setIsColdChina(1);
|
|
|
+// mainOrder.setPostage(MathUtil.add(mainOrder.getPostage(), isColdChina.get()).doubleValue());
|
|
|
+// } else {
|
|
|
+// postageOrder.setIsColdChina(0);
|
|
|
+// }
|
|
|
+// postageOrder.setRealPay(mainOrder.getPostage());
|
|
|
+// postageOrder.setEachDiscount(0d);
|
|
|
+//
|
|
|
+// //运费商品供应商Id默认998
|
|
|
+// postageOrder.setShopId(postageProduct.getShopId());
|
|
|
+// postageOrder.setProductAmount(mainOrder.getPostage());
|
|
|
+// postageOrder.setTotalAmount(mainOrder.getPostage());
|
|
|
+// postageOrder.setNeedPayAmount(mainOrder.getPostage());
|
|
|
+// postageOrder.setOrderTime(mainOrder.getOrderTime());
|
|
|
+// postageOrder.setCanRefundAmount(0d);
|
|
|
+// postageOrder.setClubId(mainOrder.getClubId());
|
|
|
+// // 已付供应商金额
|
|
|
+// postageOrder.setPayedShopAmount(0d);
|
|
|
+// // (付款供应商)付款状态:1待付款、2部分付款、3已付款
|
|
|
+// postageOrder.setPayStatus(3);
|
|
|
+// if (3 == orderParamBo.getCartType()) {
|
|
|
+// // 协销订单
|
|
|
+// postageOrder.setSpId(orderParamBo.getBuyUserId());
|
|
|
+// postageOrder.setOrderType(0);
|
|
|
+// } else {
|
|
|
+// // 普通订单
|
|
|
+// postageOrder.setOrderType(1);
|
|
|
+// }
|
|
|
+// // 订单默认可拆分
|
|
|
+// postageOrder.setSplitFlag(1);
|
|
|
+// // 设置组织Id
|
|
|
+// postageOrder.setOrganizeId(organizeId);
|
|
|
+// /*
|
|
|
+// * 保存运费子订单
|
|
|
+// */
|
|
|
+// submitMapper.insertShopOrder(postageOrder);
|
|
|
+// log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>新增子订单(运费商品)(insert[cm_shop_order])shopOrderId::" + postageOrder.getShopOrderId() + ",orderId:" + mainOrder.getOrderId());
|
|
|
+// // 收集子订单Id字符串
|
|
|
+// if (StringUtils.isEmpty(shopOrderIds.get())) {
|
|
|
+// shopOrderIds.set(postageOrder.getShopOrderId().toString());
|
|
|
+// } else {
|
|
|
+// shopOrderIds.set(shopOrderIds.get() + "," + postageOrder.getShopOrderId());
|
|
|
+// }
|
|
|
+// // 有冷链运输费 且大于 0 修改主订单运费状态
|
|
|
+// if (MathUtil.add(mainOrder.getPostage(), isColdChina.get()).doubleValue() > 0) {
|
|
|
+// submitMapper.updateOrder(mainOrder.getPostage().doubleValue(), mainOrder.getOrderId());
|
|
|
+// }
|
|
|
+// /*
|
|
|
+// * 设置运费商品
|
|
|
+// */
|
|
|
+// postageProduct.setOrderNo(mainOrder.getOrderNo());
|
|
|
+// postageProduct.setOrderId(mainOrder.getOrderId());
|
|
|
+// postageProduct.setShopOrderId(postageOrder.getShopOrderId());
|
|
|
+// postageProduct.setShopOrderNo(postageOrder.getShopOrderNo());
|
|
|
+// postageProduct.setNum(1);
|
|
|
+// postageProduct.setPresentNum(0);
|
|
|
+// postageProduct.setPrice(mainOrder.getPostage());
|
|
|
+// postageProduct.setNormalPrice(mainOrder.getPostage());
|
|
|
+// postageProduct.setTotalAmount(mainOrder.getPostage());
|
|
|
+// postageProduct.setTotalFee(mainOrder.getPostage());
|
|
|
+// postageProduct.setShouldPayFee(mainOrder.getPostage());
|
|
|
+// postageProduct.setDiscount(100d);
|
|
|
+// postageProduct.setDiscountPrice(mainOrder.getPostage());
|
|
|
+// postageProduct.setTaxRate(100d);
|
|
|
+// postageProduct.setAddedValueTax(0d);
|
|
|
+// postageProduct.setTotalAddedValueTax(0d);
|
|
|
+// postageProduct.setShopFee(0d);
|
|
|
+// postageProduct.setOtherFee(0d);
|
|
|
+// postageProduct.setCmFee(mainOrder.getPostage());
|
|
|
+// postageProduct.setSingleShopFee(0d);
|
|
|
+// postageProduct.setSingleOtherFee(0d);
|
|
|
+// postageProduct.setSingleCmFee(mainOrder.getPostage());
|
|
|
+// postageProduct.setNotOutStore(0);
|
|
|
+// postageProduct.setBuyAgainFlag(0);
|
|
|
+// /*
|
|
|
+// * 保存 订单运费商品
|
|
|
+// */
|
|
|
+// submitMapper.insertOrderProduct(postageProduct);
|
|
|
+// log.info("【提交订单】>>>>>>>>>>>>>>>>>>>>>>>>>>保存订单运费商品(insert[cm_order_product])OrderProductId:" + postageProduct.getOrderProductId() + ",orderId:" + mainOrder.getOrderId());
|
|
|
+// }
|
|
|
|
|
|
/*
|
|
|
* 更新主订单的子订单Id信息,如:1000,1002
|
|
@@ -1856,7 +1834,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
}
|
|
|
}
|
|
|
if (!"1".equals(firstClubType) && bol) {
|
|
|
-// map.put("code", -1);
|
|
|
// 设置手动回滚事务
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return ResponseJson.error(-6, "订单内存在械字号三类商品,需要拥有医疗执业许可证的医美机构才能购买。建议升级医美机构后再下单,否则会导致订单退款或影响发货。");
|
|
@@ -1907,13 +1884,13 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
orderClubMapper.AddUnionId(orderParamBo.getUnionId(), mainOrder.getOrderId());
|
|
|
openidList.removeIf(Objects::isNull);
|
|
|
String i = orderClubMapper.getOrderIds(mainOrder.getOrderId()).toString();
|
|
|
- if (i.length() < 10) {
|
|
|
+ /*if (i.length() < 10) {
|
|
|
name = StringUtils.strip(i, "[]");
|
|
|
} else {
|
|
|
name = StringUtils.strip(i.substring(0, 11), "[]");
|
|
|
name += "...";
|
|
|
- }
|
|
|
-
|
|
|
+ }*/
|
|
|
+ name = StringUtils.strip(i, "[]");
|
|
|
log.info("订单商品>>>>>" + name + "" + mainOrder.getOrderId());
|
|
|
String associateTitle = "订单已成功提交,等待付款!";
|
|
|
Double money = mainOrder.getPayTotalFee();
|
|
@@ -2064,7 +2041,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
// 付供应商 = 商品费 + 运费 + 税费
|
|
|
shopOrder.setShouldPayShopAmount(MathUtil.add(shopProductAmount.get(), shopTaxFee.get()).doubleValue());
|
|
|
// 付给供应商运费
|
|
|
- shopOrder.setShopPostFee(0d);
|
|
|
+ // shopOrder.setShopPostFee(0d);
|
|
|
// 已付供应商金额
|
|
|
shopOrder.setPayedShopAmount(0d);
|
|
|
// (付款供应商)付款状态:1待付款、2部分付款、3已付款
|