|
@@ -2138,7 +2138,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public synchronized Map offlineRetailSubmit(Map param, SysUserEntity user) {
|
|
|
+ public Map offlineRetailSubmit(Map param, SysUserEntity user) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
// 解析订单数据 List
|
|
|
List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList");
|
|
@@ -2176,6 +2176,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
LOGGER.error("decode machine code failed! error message : ", e);
|
|
|
}
|
|
|
Integer storeId = user.getStoreId();
|
|
|
+ if(Objects.isNull(storeId)){
|
|
|
+ throw new ServiceException(String.format("登录用户错误,请刷新后确认!"));
|
|
|
+ }
|
|
|
// 根据商品条码、sku、门店id查询相对应的商品信息,并组装成对象
|
|
|
List<QueryGoodsVO> queryGoodsVOList = new ArrayList<>();
|
|
|
Map<String, GoodsEntity> goodsEntityMap;
|
|
@@ -2426,6 +2429,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
goodsEntity.setActivity(goodsDto.getActivity());
|
|
|
goodsEntity.setStoreId(storeId);
|
|
|
goodsEntity.setListPicUrl(goodsDto.getListPicUrl());
|
|
|
+ // wcq-注解: goodsEntity1 库存信息 goodsEntity 此次购买的商品信息附加一些库存属性值
|
|
|
GoodsEntity goodsEntity1 = goodsEntityMap.get(sku);
|
|
|
if (Objects.nonNull(goodsEntity1)) {
|
|
|
goodsEntity.setWarehouseSn(goodsEntity1.getWarehouseSn());
|
|
@@ -4946,7 +4950,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
String prodBarcode = goodsDetailsDto.getProdBarcode();
|
|
|
// 此字段 = 零售价 - 其他活动优惠金额
|
|
|
BigDecimal actualPaymentAmount = goodsDetailsDto.getActualPaymentAmount()
|
|
|
- .multiply(BigDecimal.valueOf(goodsDetailsDto.getSellVolume()));
|
|
|
+ .multiply(BigDecimal.valueOf(goodsDetailsDto.getSellVolume()));// 商品金额乘以数量
|
|
|
// 当前商品最大支持抵扣的金额
|
|
|
BigDecimal currentSkuMaxDeductionPrice = actualPaymentAmount.multiply(scoreRatio).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
|
// 其他活动优惠金额
|
|
@@ -4958,6 +4962,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
BigDecimal discountedPrice = BigDecimal.ZERO;
|
|
|
// 计算抵扣,当商品不是最后一个商品
|
|
|
if (i < index) {
|
|
|
+
|
|
|
shareScoreItem = actualPaymentAmount.multiply(scoreIntegerDecimal).divide(skuTotalPrice, 0, BigDecimal.ROUND_FLOOR);
|
|
|
discountedPrice = shareScoreItem.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
@@ -5166,25 +5171,31 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
BigDecimal goodsTotalPrice = BigDecimal.ZERO;
|
|
|
BigDecimal fullCutCouponDec = Constant.ZERO; // 非现金抵扣 = 各种优惠价格 +优惠券的价格 暂时借用这个字段去,为了不改动ccnet系统
|
|
|
+ BigDecimal deductionPrice = Constant.ZERO;// 积分抵扣金额
|
|
|
BigDecimal couponPrice = BigDecimal.ZERO;
|
|
|
BigDecimal freightPrice = Constant.ZERO;
|
|
|
Integer number = 0;
|
|
|
//订单价格计算:订单的总价+运费
|
|
|
for (GoodsEntity goodsEntity : goodsList) {
|
|
|
+ // 商品总价 = 商品单价 * 购买数量 保留两位小数
|
|
|
goodsTotalPrice = goodsTotalPrice
|
|
|
.add(goodsEntity.getRetailPrice().multiply(new BigDecimal(goodsEntity.getSellVolume()))).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // todo: 促销活动费用 这里取的是总优惠金额 不正确 但是后续把这个值传到订单的
|
|
|
fullCutCouponDec = fullCutCouponDec
|
|
|
.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
- couponPrice = couponPrice.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // todo: 优惠券优惠金额 这里取的是总优惠金额 不正确
|
|
|
+ // couponPrice = couponPrice.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // 计算总积分抵扣金额
|
|
|
+ deductionPrice = deductionPrice.add(goodsEntity.getDeductionPrice()).setScale(2, RoundingMode.HALF_UP);
|
|
|
number += goodsEntity.getSellVolume();
|
|
|
}
|
|
|
|
|
|
|
|
|
BigDecimal orderTotalPrice = goodsTotalPrice.add(new BigDecimal(0));
|
|
|
- fullCutCouponDec = fullCutCouponDec.add(couponPrice).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // fullCutCouponDec = fullCutCouponDec.add(couponPrice).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
// 加上税额
|
|
|
- goodsTotalPrice = goodsTotalPrice.subtract(totalTax).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ // goodsTotalPrice = goodsTotalPrice.subtract(totalTax).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
//
|
|
@@ -5235,30 +5246,40 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderInfo.setStore_id(storeId);
|
|
|
orderInfo.setFreight_price(freightPrice.intValue());
|
|
|
|
|
|
- orderInfo.setCoupon_id(Integer.parseInt(String.valueOf(0L)));
|
|
|
- orderInfo.setCoupon_price(couponPrice);
|
|
|
+ orderInfo.setCoupon_id(Integer.parseInt(String.valueOf(0L)));// 优惠券id
|
|
|
+ orderInfo.setCoupon_price(couponPrice);// 优惠券金额
|
|
|
orderInfo.setCoupon_name("无");
|
|
|
orderInfo.setActivity_id(0L);
|
|
|
|
|
|
//使用的促销费用
|
|
|
- orderInfo.setFull_cut_price(fullCutCouponDec);
|
|
|
- orderInfo.setCampMinusId(0);
|
|
|
+ orderInfo.setFull_cut_price(fullCutCouponDec); // 促销活动费用
|
|
|
+ orderInfo.setCampMinusId(0);// 促销活动id
|
|
|
orderInfo.setCampName("");
|
|
|
|
|
|
//留言
|
|
|
orderInfo.setPostscript("无");
|
|
|
orderInfo.setAdd_time(new Date());
|
|
|
+ // 商品总价
|
|
|
orderInfo.setGoods_price(actualPrice.subtract(totalTax));
|
|
|
- orderInfo.setOrder_price(actualPrice);
|
|
|
+ // 订单总价 这里的订单总价取的是 扣减完优惠的商品总价
|
|
|
+ // orderInfo.setOrder_price(actualPrice);
|
|
|
+ // 订单总价 根据前端显示 这里应该取未扣减优惠的商品总价
|
|
|
+ orderInfo.setOrder_price(orderTotalPrice);
|
|
|
orderInfo.setActual_price(actualPrice); // 实际支付金额
|
|
|
+ // 订单类型 1 普通订单 2 团购订单
|
|
|
orderInfo.setOrder_type("1");
|
|
|
+ // 订单状态 0订单创建成功等待付款, 100订单付款中,101订单已取消,
|
|
|
+ // 102订单已删除,201订单已付款,等待发货,300订单已发货,
|
|
|
+ // 301用户确认收货,401 没有发货,退款 402 已收货,退款退货,500订单已关闭;501 支付失败
|
|
|
orderInfo.setOrder_status(0);
|
|
|
orderInfo.setShipping_status(0);
|
|
|
orderInfo.setPay_status(0);
|
|
|
orderInfo.setShipping_id(0L);
|
|
|
+ // 配送费用
|
|
|
orderInfo.setShipping_fee(Constant.ZERO);
|
|
|
orderInfo.setIntegral(0);
|
|
|
- orderInfo.setIntegral_money(Constant.ZERO);
|
|
|
+ // 积分抵扣金额
|
|
|
+ orderInfo.setIntegral_money(deductionPrice);
|
|
|
orderInfo.setCreateTime(new Date());
|
|
|
orderInfo.setModTime(new Date());
|
|
|
orderInfo.setPayMobile(loginUser.getMobile());
|