| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.common.init.UserCacheManager; |
| | | import com.matrix.component.tools.WxUtils; |
| | | import com.matrix.component.wechat.externalInterface.protocol.paramProtocol.BrandWCPayRequestData; |
| | | import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil; |
| | |
| | | @Autowired |
| | | private WxShopOrderUtil wxShopOrderUtil; |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | private UserCacheManager userCacheManager; |
| | | @Autowired |
| | | private WeixinServiceUtil weixinServiceUtil; |
| | | @Autowired |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public ShopOrder createShopOrder(ShopOrderDto shopOrderDto) throws Exception { |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | |
| | | |
| | | |
| | |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); |
| | | |
| | | List<ShopOrderDetails> details = new ArrayList<>(); |
| | | // 是否包含实物商品 |
| | | boolean hasRealGoods = false; |
| | | |
| | | Integer orderCount = 0; |
| | | for (OrderItemDto orderItemDto : shopOrderDto.getOrderItemList()) { |
| | | ShopOrderDetails shopOrderDetails = new ShopOrderDetails(); |
| | | shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER); |
| | | shopOrderDetails.setUpdateBy(AppConstance.SYSTEM_USER); |
| | | shopOrderDetails.setpId(orderItemDto.getProductId()); |
| | | |
| | | if (!hasRealGoods) { |
| | | ShopProduct shopProduct = shopProductDao.selectById(orderItemDto.getProductId()); |
| | | if (shopProduct.getIsUnrealProduct() == 2) { |
| | | hasRealGoods = true; |
| | | } |
| | | } |
| | | |
| | | shopOrderDetails.setsId(orderItemDto.getSkuId()); |
| | | shopOrderDetails.setCount(orderItemDto.getCount()); |
| | | if(ShopOrderDetails.PAYTYPE_MICRO==orderItemDto.getPayType()){ |
| | |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); |
| | | //购买方式 |
| | | shopOrder.setShippingMethod(shopOrderDto.getDeliverySelect()); |
| | | // 客户选择的物流配送,且没有实物产品(全是虚拟产品), 则直接门店自提,无需填写配送单 |
| | | if (ShopOrder.SHIPPING_METHOD_WL == shopOrderDto.getDeliverySelect() && !hasRealGoods) { |
| | | shopOrder.setShippingMethod(ShopOrder.SHIPPING_METHOD_MDZT); |
| | | } |
| | | //生成订单号 |
| | | shopOrder.setOrderNo(WxUtils.getOrderNum()); |
| | | //设置支付状态 |
| | |
| | | //支付总积分 |
| | | Integer scoreCount=0; |
| | | |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | |
| | | //计算购物车中物品的优惠信息 |
| | | List<OrderItemDto> orderItemDtos = shopOrderDto.getOrderItemList() |
| | |
| | | List<CouponReceiveInfoVO> usefulCoupon = new ArrayList<>(); |
| | | CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO(); |
| | | //满足店铺活动的订单不能使用优惠券 |
| | | if (conditionsGroupCount > 0) { |
| | | if (conditionsGroupCount <= 0) { |
| | | //计算可用优惠券 |
| | | usefulCoupon = wxShopCouponService.getCartVoCouponList(sysVipInfo.getCompanyId(), orderItemDtos); |
| | | //获取用户使用的优惠券 |
| | |
| | | |
| | | |
| | | //计算运费 |
| | | discountExplain.setPostage(calculationPostage(billPrice, HostInterceptor.getCompanyId())); |
| | | |
| | | |
| | | if(ShopOrder.SHIPPING_METHOD_WL==shopOrderDto.getDeliverySelect()){ |
| | | discountExplain.setPostage(calculationPostage(billPrice, HostInterceptor.getCompanyId())); |
| | | }else{ |
| | | discountExplain.setPostage(BigDecimal.ZERO); |
| | | } |
| | | |
| | | //账单总金额 |
| | | discountExplain.setBillPrice(billPrice.add(discountExplain.getPostage())); |
| | |
| | | */ |
| | | @Override |
| | | public AjaxResult getMyOrderInfo(OrderInfoQueryPOJO orderInfoQueryPOJO) { |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | orderInfoQueryPOJO.setSort("update_time"); |
| | | if (orderInfoQueryPOJO.getOffset() >= 1) { |
| | | orderInfoQueryPOJO.setOffset((orderInfoQueryPOJO.getOffset() - 1) * orderInfoQueryPOJO.getLimit()); |
| | |
| | | */ |
| | | @Override |
| | | public AjaxResult getOrderInfoById(Integer orderId) { |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | ShopOrder shopOrder = shopOrderDao.selectOrderInfoById(sysVipInfo.getId(), orderId); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(shopOrder)); |
| | | } |
| | |
| | | } |
| | | if (shopOrder.getDiscountAmount() != null && shopOrder.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) { |
| | | ShopCouponRecord shopCouponRecord = new ShopCouponRecord(); |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | shopCouponRecord.setUserId(sysVipInfo.getId()); |
| | | shopCouponRecord.setOrderId(orderId); |
| | | List<ShopCouponRecord> recordList = shopCouponRecordDao.selectByModel(shopCouponRecord); |
| | |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @Autowired |
| | | RabiitMqTemplate rabiitMqTemplate; |
| | | |
| | | @Override |
| | | public AjaxResult findOrderPayStatus(Integer orderId) { |