|
@@ -51,6 +51,8 @@ public class ApiOrderService {
|
|
|
private ApiGoodsGroupOpenDetailMapper apiGoodsGroupOpenDetailMapper;
|
|
|
@Autowired
|
|
|
private FormIdsService formIdsService;
|
|
|
+ @Autowired
|
|
|
+ private ApiGoodsMapper apiGoodsMapper;
|
|
|
|
|
|
public OrderVo queryObject(Long id) {
|
|
|
return apiOrderMapper.queryObject(id);
|
|
@@ -99,6 +101,7 @@ public class ApiOrderService {
|
|
|
}
|
|
|
|
|
|
public void update(OrderVo order) {
|
|
|
+ order.setIsScan("0");
|
|
|
apiOrderMapper.update(order);
|
|
|
}
|
|
|
|
|
@@ -231,7 +234,11 @@ public class ApiOrderService {
|
|
|
//统计商品总价
|
|
|
List<OrderGoodsVo> orderGoodsData = new ArrayList();
|
|
|
if (orderInfo.getOrderBizType().equalsIgnoreCase(goodsItem.getGoodsBizType())) {
|
|
|
- OrderGoodsVo orderGoodsVo = setOrderGoodsVo(orderInfo, goodsItem);
|
|
|
+ GoodsVo goodsVo = apiGoodsMapper.queryObject(goodsItem.getGoods_id());
|
|
|
+ if(goodsVo==null){
|
|
|
+ throw new RRException("订单提交失败:商品不存在");
|
|
|
+ }
|
|
|
+ OrderGoodsVo orderGoodsVo = setOrderGoodsVo(orderInfo, goodsItem,goodsVo);
|
|
|
apiOrderGoodsMapper.save(orderGoodsVo);
|
|
|
}
|
|
|
}
|
|
@@ -281,7 +288,8 @@ public class ApiOrderService {
|
|
|
Integer userCouponId = jsonParam.getInteger("userCouponId");
|
|
|
String postscript = jsonParam.getString("postscript");
|
|
|
Long fullCutCouponId = jsonParam.getLong("fullCutCouponId");
|
|
|
- BigDecimal freightPrice = new BigDecimal(10.00);
|
|
|
+// BigDecimal freightPrice = new BigDecimal(10.00);
|
|
|
+ BigDecimal freightPrice = new BigDecimal(0.00);
|
|
|
AddressVo addressVo = jsonParam.getObject("checkedAddress", AddressVo.class);
|
|
|
Date delivery_date = jsonParam.getDate("delivery_date");
|
|
|
if (null == delivery_date) {
|
|
@@ -311,19 +319,19 @@ public class ApiOrderService {
|
|
|
}
|
|
|
}
|
|
|
// 获取优惠信息提示
|
|
|
- Map couponParam = new HashMap();
|
|
|
- couponParam.put("enabled", true);
|
|
|
- Integer[] send_types = new Integer[]{7};
|
|
|
- couponParam.put("send_types", send_types);
|
|
|
- List<CouponVo> couponVos = apiCouponMapper.queryList(couponParam);
|
|
|
- if (null != couponVos && couponVos.size() > 0) {
|
|
|
- for (CouponVo couponVo : couponVos) {
|
|
|
- // 是否免运费
|
|
|
- if (couponVo.getSend_type() == 7 && couponVo.getMin_goods_amount().compareTo(goodsTotalPrice) <= 0) {
|
|
|
- freightPrice = couponVo.getType_money();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// Map couponParam = new HashMap();
|
|
|
+// couponParam.put("enabled", true);
|
|
|
+// Integer[] send_types = new Integer[]{7};
|
|
|
+// couponParam.put("send_types", send_types);
|
|
|
+// List<CouponVo> couponVos = apiCouponMapper.queryList(couponParam);
|
|
|
+// if (null != couponVos && couponVos.size() > 0) {
|
|
|
+// for (CouponVo couponVo : couponVos) {
|
|
|
+// // 是否免运费
|
|
|
+// if (couponVo.getSend_type() == 7 && couponVo.getMin_goods_amount().compareTo(goodsTotalPrice) <= 0) {
|
|
|
+// freightPrice = couponVo.getType_money();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
// 获取优惠信息 满减
|
|
|
BigDecimal fullCutCouponDec = new BigDecimal(0);
|
|
|
CouponVo fullCutCoupon = apiCouponMapper.queryObject(fullCutCouponId);
|
|
@@ -332,7 +340,7 @@ public class ApiOrderService {
|
|
|
}
|
|
|
|
|
|
//订单价格计算
|
|
|
- BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice); //订单的总价
|
|
|
+ BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice); //订单的总价+运费
|
|
|
|
|
|
BigDecimal actualPrice = orderTotalPrice.subtract(fullCutCouponDec).subtract(couponPrice); //减去其它支付的金额后,要实际支付的金额
|
|
|
|
|
@@ -377,11 +385,12 @@ public class ApiOrderService {
|
|
|
orderInfo.setModTime(new Date());
|
|
|
orderInfo.setPayMobile(loginUser.getMobile());
|
|
|
orderInfo.setPayTransactionId("");
|
|
|
+ orderInfo.setIsScan("0");//默认未扫描
|
|
|
return orderInfo;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public OrderGoodsVo setOrderGoodsVo(OrderVo orderInfo,CartVo goodsItem){
|
|
|
+ public OrderGoodsVo setOrderGoodsVo(OrderVo orderInfo,CartVo goodsItem,GoodsVo goodsVo){
|
|
|
OrderGoodsVo orderGoodsVo = new OrderGoodsVo();
|
|
|
orderGoodsVo.setOrder_id(orderInfo.getId());
|
|
|
orderGoodsVo.setGoods_id(goodsItem.getGoods_id());
|
|
@@ -397,6 +406,9 @@ public class ApiOrderService {
|
|
|
orderGoodsVo.setOrderBizType(goodsItem.getGoodsBizType());
|
|
|
orderGoodsVo.setCreateTime(new Date());
|
|
|
orderGoodsVo.setModTime(new Date());
|
|
|
+
|
|
|
+ orderGoodsVo.setGoodsRate(goodsVo.getGoodsRate());
|
|
|
+ orderGoodsVo.setSettlePrice(new BigDecimal("0"));//商品结算平摊价格=(零售价格*数量)/订单结算总金额
|
|
|
return orderGoodsVo;
|
|
|
}
|
|
|
/**
|