| | |
| | | import com.matrix.system.common.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | | import com.matrix.system.score.dao.ScoreVipDetailDao; |
| | | import com.matrix.system.shopXcx.api.action.PayThreadPool; |
| | | import com.matrix.system.shopXcx.api.pojo.OrderCouponGroup; |
| | | import com.matrix.system.shopXcx.api.pojo.OrderInfoQueryPOJO; |
| | |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | private ScoreVipDetailDao scoreVipDetailDao; |
| | | |
| | | @Override |
| | | public BigDecimal calculationPostage(BigDecimal payPrice, Long companyId) { |
| | | BigDecimal postage = BigDecimal.ZERO; |
| | |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "请选择正确的收获地址"); |
| | | } |
| | | |
| | | AjaxResult caculateResult= buildDiscountExplain(shopOrderDto); |
| | | |
| | | |
| | | //计算订单优惠信息 |
| | | AjaxResult caculateResult= buildDiscountExplain(shopOrderDto); |
| | | DiscountExplain discountExplain= (DiscountExplain) caculateResult.getMapInfo().get("discountExplain"); |
| | | |
| | | |
| | | |
| | | //取出购物车中选中的产品 |
| | | List<ShopShoppingCart> buyCart = new ArrayList<>(); |
| | | //取出购物车中没有参加店铺活动的产品,和参加了店铺活动但是活动没有达到标准的产品,用来计算是否可以使用优惠券 |
| | | List<ShopShoppingCart> notCouponuyCart = new ArrayList<>(); |
| | | |
| | | if(discountExplain.getScorePay()!=null){ |
| | | //校验用户积分是否够用 |
| | | int score=scoreVipDetailDao.selectUserTotalScore(bizUser.getOpenId(),null); |
| | | if(score<discountExplain.getScorePay()){ |
| | | return AjaxResult.buildFailInstance("积分不足"); |
| | | } |
| | | } |
| | | |
| | | ShopOrder shopOrder = new ShopOrder(); |
| | | shopOrder.setCompanyId(bizUser.getCompanyId()); |
| | |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); |
| | | |
| | | List<ShopOrderDetails> details = new ArrayList<>(); |
| | | Integer cartCount = 0; |
| | | Integer orderCount = 0; |
| | | for (OrderItemDto orderItemDto : shopOrderDto.getOrderItemList()) { |
| | | ShopOrderDetails shopOrderDetails = new ShopOrderDetails(); |
| | | shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER); |
| | |
| | | shopOrderDetails.setDiscountAmount(BigDecimal.ZERO); |
| | | |
| | | details.add(shopOrderDetails); |
| | | cartCount += shopOrderDetails.getCount(); |
| | | orderCount += shopOrderDetails.getCount(); |
| | | if(orderItemDto.getCartId()!=null){ |
| | | //删除用户购物车选中的产品 |
| | | shoppingCartDao.deleteById(orderItemDto.getCartId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | //校验商品是否限购 |
| | |
| | | shopOrder.setCreateBy("微信小程序生成"); |
| | | shopOrder.setUpdateBy("微信小程序生成"); |
| | | shopOrder.setCommodityPrice(discountExplain.getBillPrice()); |
| | | shopOrder.setPurchaseQuantity(cartCount); |
| | | shopOrder.setPurchaseQuantity(orderCount); |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); |
| | | //购买方式 |
| | | shopOrder.setShippingMethod(shopOrderDto.getDeliverySelect()); |
| | |
| | | //获取邮费 |
| | | shopOrder.setPostage(discountExplain.getPostage()); |
| | | shopOrder.setOrderMoney(discountExplain.getPayPrice()); |
| | | shopOrder.setScorePay(discountExplain.getScorePay()); |
| | | Gson g = new GsonBuilder().create(); |
| | | shopOrder.setDiscountExplain(g.toJson(discountExplain)); |
| | | shopOrder.setDiscountAmount(discountExplain.getActivityPrice().add(discountExplain.getCouponPrice())); |
| | |
| | | shopCouponRecordDao.updateByModel(record); |
| | | } |
| | | |
| | | //删除用户购物车选中的产品 |
| | | shoppingCartDao.deleteUserSelectCart(bizUser.getOpenId()); |
| | | |
| | | |
| | | BrandWCPayRequestData payData = startPayment(shopOrder); |
| | |
| | | if (!shopOrder.getPayResult().equals(ShopOrder.ORDER_PAY_STATUS_WAIT)) { |
| | | throw new GlobleException("该订单不是待支付状态!"); |
| | | } |
| | | |
| | | if(shopOrder.getScorePay()!=null){ |
| | | //校验用户积分是否够用 |
| | | int score=scoreVipDetailDao.selectUserTotalScore(shopOrder.getUserId(),null); |
| | | if(score<shopOrder.getScorePay()){ |
| | | return AjaxResult.buildFailInstance("积分不足"); |
| | | } |
| | | } |
| | | |
| | | BrandWCPayRequestData payData = startPayment(shopOrder); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(payData)); |
| | | result.putInMap("orderId", shopOrder.getId()); |