| | |
| | | if(shop!=null&&shop.getShopStatus()!=1){ |
| | | throw new ServiceException(AppErrorConstant.SHOP_CLOSED); |
| | | } |
| | | Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); |
| | | // Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); |
| | | // 初始化订单对象 |
| | | AppSureOrderVo appSureOrderVo = new AppSureOrderVo(); |
| | | // 初始化订单商品列表 |
| | |
| | | appShopGoodsGetDto.setGoodsId(goods.getGoodsId()); |
| | | appShopGoodsGetDto.setShopId(appSureOrderDto.getShopId()); |
| | | ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); |
| | | //商户是否定制价格 |
| | | if (shopGoods != null) { |
| | | goodsPrice = shopGoods.getSalesPrice(); |
| | | } else { |
| | | } |
| | | //是否绑定经销商 |
| | | if(shop.getBelongShopId()!=null &&shop.getShopType()==2){ |
| | | //经销商定制价格 |
| | | appShopGoodsGetDto.setGoodsId(goods.getGoodsId()); |
| | | appShopGoodsGetDto.setShopId(belongShop.getShopId()); |
| | | shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); |
| | | AppShopGoodsGetDto shopGoodsGetDto=new AppShopGoodsGetDto(); |
| | | shopGoodsGetDto.setGoodsId(goods.getGoodsId()); |
| | | shopGoodsGetDto.setShopId(shop.getBelongShopId()); |
| | | Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); |
| | | shopGoods = remoteGoodsService.getShopGoods(shopGoodsGetDto).getData(); |
| | | if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { |
| | | goodsPrice = shopGoods.getSalesPrice(); |
| | | goodsPrice=shopGoods.getSalesPrice(); |
| | | } |
| | | } |
| | | appSureOrderGoodsVo.setGoodsPrice(goodsPrice); |
| | |
| | | ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); |
| | | if (shopGoods != null) { |
| | | goodsPrice = shopGoods.getSalesPrice(); |
| | | } else { |
| | | } |
| | | //是否绑定经销商 |
| | | if(shop.getBelongShopId()!=null &&shop.getShopType()==2){ |
| | | //经销商定制价格 |
| | | Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); |
| | | appShopGoodsGetDto = new AppShopGoodsGetDto(); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | @Transactional // todo 放开分布式事务注解 |
| | | // @GlobalTransactional(rollbackFor = Exception.class) |
| | | public AppPlaceOrderVo placeOrder(AppPlaceOrderDto appPlaceOrderDto) { |
| | | // 获取用户ID |
| | | Long userId = appPlaceOrderDto.getUserId(); |
| | |
| | | //使用优惠券 |
| | | StringJoiner memberCouponSJ = new StringJoiner(","); |
| | | List<String> goodsNameList = new ArrayList<>(); |
| | | Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData(); |
| | | if(shop!=null&&shop.getShopStatus()!=1){ |
| | | throw new ServiceException(AppErrorConstant.SHOP_CLOSED); |
| | | } |
| | | // 遍历购买的商品列表 |
| | | for (AppBuyGoodsDto appBuyGoodsDto : appBuyGoodsDtoList) { |
| | | appSureOrderGoodsVo = new AppSureOrderGoodsVo(); |
| | |
| | | if (shopGoods != null) { |
| | | goodsPrice = shopGoods.getSalesPrice(); |
| | | serviceNum = shopGoods.getServiceNum(); |
| | | } else { |
| | | } |
| | | //是否绑定经销商 |
| | | if(shop.getBelongShopId()!=null &&shop.getShopType()==2){ |
| | | //经销商定制价格 |
| | | Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData(); |
| | | Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); |
| | | appShopGoodsGetDto = new AppShopGoodsGetDto(); |
| | | appShopGoodsGetDto.setGoodsId(goods.getGoodsId()); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public AppPlaceOrderVo placeActivityOrder(AppPlaceActivityDto appPlaceActivityDto) { |
| | | Long userId = appPlaceActivityDto.getUserId(); |
| | | Member member = remoteMemberService.getMember(userId).getData(); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public MerVerifyOrderVo sureVerifyOrder(MerVerifyOrderDto merVerifyOrderDto) { |
| | | String orderId = merVerifyOrderDto.getOrderId(); |
| | | BigDecimal relReceiveMoney = merVerifyOrderDto.getRelReceiveMoney(); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public MerVerifyOrderVo sureVerifyOrderDouYin(MerVerifyOrderDto merVerifyOrderDto) { |
| | | String phone = merVerifyOrderDto.getPhone(); |
| | | String orderId = merVerifyOrderDto.getOrderId(); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public MerVerifyCouponVo sureVerifyCoupon(MerVerifyCouponDto merVerifyCouponDto) { |
| | | R<MerVerifyCouponGetVo> verifyCoupon = remoteCouponService.getVerifyCoupon(merVerifyCouponDto.getMemberCouponId()); |
| | | if(verifyCoupon.getCode() != 200){ |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public MerVerifyAwardVo sureVerifyPrize(MerVerifyPrizeDto merVerifyPrizeDto) { |
| | | MerVerifyAwardVo merVerifyAwardVo = new MerVerifyAwardVo(); |
| | | MemberGiftRecord memberGiftRecord = remoteMemberService.getVerifyPrize(merVerifyPrizeDto.getPrizeId()).getData(); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public void createNewOrder(MerNewOrderDto merNewOrderDto) { |
| | | Long userId = merNewOrderDto.getBuyUserId(); |
| | | Date nowTime = new Date(); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public void autoCancelOrder(String orderId) { |
| | | //更新订单信息 |
| | | Order order = this.getById(orderId); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public void payBack(PartnerTransactionsResult transaction, BigDecimal feeAmount) { |
| | | log.info("订单支付回调---"+transaction.toString()); |
| | | // 更新订单状态 outTradeNo |
| | |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | public void refundOrder(String orderId) { |
| | | // 更新订单信息 |
| | | Order order = this.getById(orderId); |
| | |
| | | } |
| | | } |
| | | |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | // @GlobalTransactional(rollbackFor = Exception.class) todo 放开分布式事务注解 |
| | | private void autoTimeCancelOrder(Order order) { |
| | | String orderId = order.getOrderId(); |
| | | order.setOrderStatus(0); |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<MgtThirdOrderPageVo> pageMgtThirdOrder(Page<MgtThirdOrderPageVo> page, MgtThirdOrderPageDto dto) { |
| | | //如果区域代码不为null获取对应的商户id |
| | | if (StringUtils.isNotBlank(dto.getKeyword()) || StringUtils.isNotBlank(dto.getShopProvinceCode()) || StringUtils.isNotBlank(dto.getShopCityCode()) || StringUtils.isNotBlank(dto.getShopAreaCode())) { |
| | | MgtShopIdByCodeDto mgtShopIdByCodeDto = new MgtShopIdByCodeDto(); |
| | | mgtShopIdByCodeDto.setShopProvinceCode(dto.getShopProvinceCode()); |
| | | mgtShopIdByCodeDto.setShopCityCode(dto.getShopCityCode()); |
| | | mgtShopIdByCodeDto.setShopAreaCode(dto.getShopAreaCode()); |
| | | MgtShopIdByCodeVo mgtShopIdByCodeVo = remoteShopService.getShopIdByCode(mgtShopIdByCodeDto).getData(); |
| | | if (StringUtils.isNotBlank(mgtShopIdByCodeVo.getShopIds())) { |
| | | dto.setShopIds(mgtShopIdByCodeVo.getShopIds()); |
| | | } |
| | | } |
| | | //如果关键词不为null获取对应的用户id |
| | | if (StringUtils.isNotBlank(dto.getKeyword())) { |
| | | MgtUserIdByKeywordDto mgtUserIdByKeywordDto = new MgtUserIdByKeywordDto(); |
| | | mgtUserIdByKeywordDto.setKeyword(dto.getKeyword()); |
| | | MgtUserIdByKeywordVo mgtUserIdByKeywordVo = remoteMemberService.getUserIdByKeyword(mgtUserIdByKeywordDto).getData(); |
| | | if (StringUtils.isNotBlank(mgtUserIdByKeywordVo.getUserIds())) { |
| | | dto.setUserIds(mgtUserIdByKeywordVo.getUserIds()); |
| | | } |
| | | } |
| | | //数据权限 |
| | | List<Long> userId = remoteUserService.getScopeOfAuthorityUserId(); |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userId); |
| | | List<Shop> shops = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | if (!shops.isEmpty()) { |
| | | List<Long> collect = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | String join = collect.stream().map(Object::toString).collect(Collectors.joining(",")); |
| | | String shopIds = dto.getShopIds(); |
| | | if(StringUtils.isNotEmpty(shopIds)){ |
| | | shopIds = shopIds + "," + join; |
| | | }else{ |
| | | shopIds = join; |
| | | } |
| | | dto.setShopIds(shopIds); |
| | | } |
| | | |
| | | // 从数据库中获取第三方订单列表 |
| | | List<MgtThirdOrderPageVo> thirdOrderPageVoList = orderMapper.pageMgtThirdOrder(page, dto); |
| | | // 如果列表不为空 |
| | | if (!thirdOrderPageVoList.isEmpty()) { |
| | | // 定义变量 |
| | | HashSet<Long> shopIdSet = new HashSet<>(); |
| | | BigDecimal zeroBig = new BigDecimal("0.00"); |
| | | // 遍历列表,获取店铺 ID 和用户 ID |
| | | for (MgtThirdOrderPageVo mgtActivityOrderPageVo : thirdOrderPageVoList) { |
| | | if(mgtActivityOrderPageVo.getShopId()!=null){ |
| | | shopIdSet.add(mgtActivityOrderPageVo.getShopId()); |
| | | } |
| | | } |
| | | // 将店铺 ID 和用户 ID 转换为逗号分隔的字符串 |
| | | String shopJoinedString = String.join(",", shopIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | // 从远程服务获取店铺和用户信息 |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(shopJoinedString); |
| | | List<MgtSimpleShopVo> simpleShopVoList = remoteShopService.listShopSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | Map<Long, MgtSimpleShopVo> shopMap = simpleShopVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity())); |
| | | mgtBaseBathDto = new MgtBaseBathDto(); |
| | | // 遍历列表,设置店铺名称 |
| | | for (MgtThirdOrderPageVo mgtActivityOrderPageVo : thirdOrderPageVoList) { |
| | | if(mgtActivityOrderPageVo.getShopId()!=null){ |
| | | MgtSimpleShopVo mgtSimpleShopVo = shopMap.get(mgtActivityOrderPageVo.getShopId()); |
| | | mgtActivityOrderPageVo.setShopName(null == mgtSimpleShopVo ? "" : mgtSimpleShopVo.getShopName()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return thirdOrderPageVoList; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public MgtPlTotalThirdOrderStaticsVO getPlTotalThirdOrderStatics(MgtBasePlatformDto mgtBasePlatformDto) { |
| | | MgtPlTotalThirdOrderStaticsVO vo = new MgtPlTotalThirdOrderStaticsVO(); |
| | | //数据权限 |
| | | List<Long> userIdList = mgtBasePlatformDto.getUserIdList(); |
| | | List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId(); |
| | | if(null != userIds){ |
| | | if(null != userIdList){ |
| | | userIdList.addAll(userIds); |
| | | }else{ |
| | | userIdList = userIds; |
| | | } |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData(); |
| | | if (mgtBasePlatformDto.getUserId() != null || StringUtils.isNotBlank(mgtBasePlatformDto.getShopProvinceCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopCityCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopAreaCode())) { |
| | | if(shopIdList==null||shopIdList.isEmpty()){ |
| | | return vo; |
| | | } |
| | | } |
| | | if(mgtBasePlatformDto.getShopId()!=null){ |
| | | shopIdList = new ArrayList<>(); |
| | | shopIdList.add(mgtBasePlatformDto.getShopId()); |
| | | } |
| | | mgtBasePlatformDto.setShopIdList(shopIdList); |
| | | // 从数据库中获取第三方订单统计 |
| | | vo = orderMapper.getPlTotalThirdOrderStatics(mgtBasePlatformDto); |
| | | return vo; |
| | | } |
| | | } |