puzhibing
2025-01-13 6461fd7ef5ff8a2b3239b0c9bccd936ab15732ab
修改bug
10个文件已修改
117 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java
@@ -2,6 +2,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.model.Order;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
@@ -29,7 +30,17 @@
            @Override
            public R<Set<Long>> getAppUserByShoppingShop(Integer shopId) {
                return R.fail("获取所有在指定门店消费的用户id失败:" + cause);
                return R.fail("获取所有在指定门店消费的用户id失败:" + cause.getMessage());
            }
            @Override
            public R<Order> getOrderById(Long id) {
                return R.fail("根据id获取订单详情失败:" + cause.getMessage());
            }
            @Override
            public R editOrder(Order order) {
                return R.fail("编辑订单详情失败:" + cause.getMessage());
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java
@@ -4,8 +4,10 @@
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.factory.OrderClientFallbackFactory;
import com.ruoyi.order.model.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -46,4 +48,22 @@
     */
    @PostMapping("/order/getAppUserByShoppingShop")
    R<Set<Long>> getAppUserByShoppingShop(@RequestParam("shopId") Integer shopId);
    /**
     * 根据id获取订单详情
     * @param id
     * @return
     */
    @PostMapping("/order/getOrderById")
    R<Order> getOrderById(@RequestParam("id") Long id);
    /**
     * 编辑订单详情
     * @param order
     * @return
     */
    @PostMapping("/order/editOrder")
    R editOrder(@RequestBody Order order);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java
@@ -32,6 +32,8 @@
    @ApiModelProperty(value = "主键")
    @TableId("id")
    private Long id;
    @TableField(exist = false)
    private String idStr;
    @ApiModelProperty(value = "门店id")
    @TableField("shop_id")
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserCoupon;
@@ -72,11 +73,18 @@
    @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"})
    public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) {
        Long userid = tokenService.getLoginUserApplet().getUserid();
        Page<UserCoupon> page = userCouponService.lambdaQuery()
                .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime)
                .isNotNull(status!=null&&status==2,UserCoupon::getUseTime)
                .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now())
                .eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum-1, pageSize));
        LambdaQueryChainWrapper<UserCoupon> chainWrapper = userCouponService.lambdaQuery()
                .eq(UserCoupon::getAppUserId, userid);
        if(null != status && 1 == status){
            chainWrapper.isNull(UserCoupon::getUseTime).gt(UserCoupon::getEndTime, LocalDateTime.now());
        }
        if(null != status && 2 == status){
            chainWrapper.isNotNull(UserCoupon::getUseTime);
        }
        if(null != status && 3 == status){
            chainWrapper.isNull(UserCoupon::getUseTime).lt(UserCoupon::getEndTime, LocalDateTime.now());
        }
        Page<UserCoupon> page = chainWrapper.page(Page.of(pageNum-1, pageSize));
        for (UserCoupon record : page.getRecords()) {
            record.setIdStr(record.getId().toString());
            CouponInfo data = couponClient.detail(record.getCouponId()).getData();
@@ -102,15 +110,15 @@
            }
            record.setCouponInfoVo(vo);
            if (record.getUseTime()==null){
                record.setStatus(1);
                if (record.getEndTime().isBefore(LocalDateTime.now())){
                    record.setStatus(3);
                }
            }else {
            if(null != record.getUseTime()){
                record.setStatus(2);
            }else{
                if(record.getEndTime().isBefore(LocalDateTime.now())){
                    record.setStatus(3);
                }else{
                    record.setStatus(1);
                }
            }
            AppUser appUser = appUserService.getById(record.getAppUserId());
            record.setUserName(appUser.getName());
            record.setPhone(appUser.getPhone());
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -450,5 +450,29 @@
        }
        return R.ok();
    }
    /**
     * 根据id获取订单详情
     * @param id
     * @return
     */
    @PostMapping("/getOrderById")
    public R<Order> getOrderById(@RequestParam("id") Long id){
        Order order = orderService.getById(id);
        return R.ok(order);
    }
    /**
     * 修改订单
     * @param order
     * @return
     */
    @PostMapping("/editOrder")
    public R editOrder(@RequestBody Order order){
        orderService.updateById(order);
        return R.ok();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -532,7 +532,7 @@
        confirmOrderVo.setDiscountAmount(activityAmount);
        int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum();
        confirmOrderVo.setEarnPoint(earnPoint);
        if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){
        if(null != paymentMoney && BigDecimal.ZERO.compareTo(paymentMoney) > 0){
            paymentMoney = BigDecimal.ZERO;
        }
@@ -1495,7 +1495,7 @@
        }
        //删除购物车数据
        Long userid = tokenService.getLoginUserApplet().getUserid();
        Long userid = order.getAppUserId();
        List<OrderGood> list = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, order.getId()));
        List<Integer> goodsIds = list.stream().map(OrderGood::getGoodsId).collect(Collectors.toList());
        this.remove(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid).in(ShoppingCart::getGoodsId, goodsIds));
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -9,6 +9,8 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.service.GoodsEvaluateService;
@@ -46,6 +48,8 @@
    private GoodsService goodsService;
    @Resource
    private TokenService tokenService;
    @Resource
    private OrderClient orderClient;
@@ -53,7 +57,8 @@
    @GetMapping("/goodsList")
    @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
    public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){
        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0).eq(GoodsEvaluate::getStatus, 2).list();
        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0)
                .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "").orderByDesc(GoodsEvaluate::getCreateTime).list();
        for (GoodsEvaluate goodsEvaluate : list) {
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
            if(null != appUserById){
@@ -101,7 +106,13 @@
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除评论", tags = {"管理后台-商品管理-评价管理"})
    public R<Void> delete(@PathVariable("id") Long id){
        goodsEvaluateService.removeById(id);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
        goodsEvaluate.setDelFlag(1);
        goodsEvaluateService.updateById(goodsEvaluate);
        //修改订单为待评价
        Order data = orderClient.getOrderById(goodsEvaluate.getOrderId()).getData();
        data.setOrderStatus(4);
        orderClient.editOrder(data);
        return R.ok();
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -111,6 +111,7 @@
                        .eq(shopWithdraw.getAuditStatus()!=null,ShopWithdraw::getAuditStatus,shopWithdraw.getAuditStatus())
                        .orderByDesc(ShopWithdraw::getCreateTime)
                );
        page.getRecords().forEach(s->s.setIdStr(s.getId().toString()));
        return R.ok(page);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -258,7 +258,7 @@
        }
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData();
        goodsVO.setSaleNum(integer);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId)
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).ne(GoodsEvaluate::getComment, "")
                .orderByDesc(GoodsEvaluate::getGrade).eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment)
                .eq(GoodsEvaluate::getDelFlag, 0).last(" limit 0, 1").one();
        if (null != goodsEvaluate) {
@@ -387,7 +387,7 @@
                    area.setProvinceCode(goodsArea.getProvinceCode());
                    area.setCityCode(goodsArea.getCityCode());
                    area.setDistrictsCode(goodsArea.getDistrictsCode());
                    if(null != area.getSellingPrice() && null != area.getIntegral()){
                    if(null != area.getSellingPrice() || null != area.getIntegral()){
                        goodsAreaList2.add(area);
                    }
                }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -134,7 +134,7 @@
        seckillActivityDetailVO.setShopList(shops);
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 2).getData();
        seckillActivityDetailVO.setSaleNum(integer);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).isNotNull(GoodsEvaluate::getComment)
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "")
                .orderByDesc(GoodsEvaluate::getGrade).eq(GoodsEvaluate::getStatus, 2).eq(GoodsEvaluate::getDelFlag, 0).last(" limit 0, 1").one();
        if (null != goodsEvaluate) {
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());