From bc7d58f9e4700e4ea35c7290a989d67648b6246b Mon Sep 17 00:00:00 2001 From: jiangqs <343695869@qq.com> Date: 星期日, 06 八月 2023 12:41:13 +0800 Subject: [PATCH] bug --- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java | 38 ++++++++++++++++++++++++++++++-------- 1 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java index 9d319da..6e52346 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java @@ -243,7 +243,7 @@ } else if (couponType == 2 && appMemberCouponVo.getDiscountPercent() != null) { discountPercent = appMemberCouponVo.getDiscountPercent(); goodsRealPrice = goodsTotalPrice.multiply(discountPercent).divide(BigDecimal.TEN,2,BigDecimal.ROUND_HALF_UP); - discountMoney = goodsRealPrice.subtract(goodsTotalPrice); + discountMoney = goodsTotalPrice.subtract(goodsRealPrice); useCoupon = 1; userCouponIdSet.add(memberCouponId); appSureOrderGoodsVo.setMemberCouponId(memberCouponId); @@ -597,7 +597,7 @@ } else if (couponType == 2 && appMemberCouponVo.getDiscountPercent() != null) { discountPercent = appMemberCouponVo.getDiscountPercent(); goodsRealPrice = goodsTotalPrice.multiply(discountPercent).divide(BigDecimal.TEN,2, BigDecimal.ROUND_HALF_UP); - discountMoney = goodsRealPrice.subtract(goodsTotalPrice); + discountMoney = goodsTotalPrice.subtract(goodsRealPrice); useCoupon = 1; } else if (couponType == 3 && appMemberCouponVo.getDiscountMoney() != null) { discountMoney = appMemberCouponVo.getDiscountMoney(); @@ -1226,6 +1226,7 @@ merVerifyOrderVo.setAppUserOrderGoodsPageVoList(appUserOrderGoodsPageVoList); // 根据订单用户ID获取用户信息 Member member = remoteMemberService.getMember(order.getUserId()).getData(); + merVerifyOrderVo.setUserId(order.getUserId()); merVerifyOrderVo.setUserName(member.getRealName()); merVerifyOrderVo.setUserMobile(member.getMobile()); merVerifyOrderVo.setCloseFlag(order.getCloseFlag()); @@ -1354,6 +1355,7 @@ merVerifyOrderVo.setPayTime(order.getPayTime()); merVerifyOrderVo.setUseTime(order.getUseTime()); Member member = remoteMemberService.getMember(order.getUserId()).getData(); + merVerifyOrderVo.setUserId(order.getUserId()); merVerifyOrderVo.setUserName(member.getRealName()); merVerifyOrderVo.setUserMobile(member.getMobile()); merVerifyOrderVo.setCloseFlag(order.getCloseFlag()); @@ -1921,6 +1923,18 @@ */ @Override public List<MerOrderPageVo> pageMerOrder(Page page, MerOrderPageDto merOrderPageDto) { + if(StringUtils.isNotBlank(merOrderPageDto.getKeyword())){ + MgtUserIdByKeywordDto userIdByKeywordDto = new MgtUserIdByKeywordDto(); + userIdByKeywordDto.setKeyword(merOrderPageDto.getKeyword()); + MgtUserIdByKeywordVo userIdByKeywordVo = remoteMemberService.getUserIdByKeyword(userIdByKeywordDto).getData(); + if(StringUtils.isNotBlank(userIdByKeywordVo.getUserIds())){ + List<Long> userIdList = Arrays.stream(userIdByKeywordVo.getUserIds().split(",")) + .map(Long::parseLong) + .collect(Collectors.toList()); + merOrderPageDto.setMemberUserIdList(userIdList); + merOrderPageDto.setMemberUserId(null); + } + } List<MerOrderPageVo> merOrderPageVoList = orderMapper.pageMerOrder(page, merOrderPageDto); if (merOrderPageVoList != null && !merOrderPageVoList.isEmpty()) { Long userId; @@ -1954,9 +1968,13 @@ Map<Long, MgtSimpleMemberVo> userMap = simpleMemberVoList.stream() .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); for (MerOrderPageVo merOrderPageVo : merOrderPageVoList) { - merOrderPageVo.setUserName(userMap.get(merOrderPageVo.getUserId()).getRealName()); - merOrderPageVo.setNickName(userMap.get(merOrderPageVo.getUserId()).getNickName()); - merOrderPageVo.setUserMobile(userMap.get(merOrderPageVo.getUserId()).getUserMobile()); + if(merOrderPageVo.getUserId()!=null&&userMap.get(merOrderPageVo.getUserId())!=null){ + merOrderPageVo.setUserName(userMap.get(merOrderPageVo.getUserId()).getRealName()); + merOrderPageVo.setNickName(userMap.get(merOrderPageVo.getUserId()).getNickName()); + merOrderPageVo.setUserMobile(userMap.get(merOrderPageVo.getUserId()).getUserMobile()); + }else{ + log.debug("订单merOrderPageVo"+merOrderPageVo.getOrderId()+"缺少用户"); + } } } return merOrderPageVoList; @@ -2322,7 +2340,11 @@ mgtOrderDetailVo.setCancelTime(order.getCancelTime()); mgtOrderDetailVo.setOrderRemark(order.getOrderRemark()); mgtOrderDetailVo.setShopId(order.getShopId()); - mgtOrderDetailVo.setShopName(shop.getShopName()); + if(shop!=null){ + mgtOrderDetailVo.setShopName(shop.getShopName()); + }else{ + mgtOrderDetailVo.setShopName("商户已被删除"); + } mgtOrderDetailVo.setVerifyTime(order.getUseTime()); //获取支付记录 List<MgtOrderPayListVo> orderPayListVoList = payRecordService.listMgtOrderPayVo(orderId); @@ -3921,14 +3943,14 @@ delayTime = redisService.getCacheObject(SecurityConstant.AUTO_CANCEL_ORDER_TIME); } delayTime = delayTime + 5; - Date checkTime = DateUtils.addMinutes(new Date(),delayTime); + Date checkTime = DateUtils.addMinutes(new Date(),-delayTime); LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Order::getDelFlag,0); queryWrapper.lt(Order::getCreateTime,checkTime); queryWrapper.eq(Order::getOrderStatus,1); List<Order> orderList = this.list(queryWrapper); if(orderList!=null&&!orderList.isEmpty()){ - for(Order order: orderList){ + for(Order order: orderList){ autoTimeCancelOrder(order); } } -- Gitblit v1.7.1