luodangjia
2024-12-09 5728732f45cc45f3c5cbde0abe7a7c5efee605b9
Merge remote-tracking branch 'origin/master'
26个文件已修改
6个文件已添加
481 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianScore.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysPasswordService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderGoodMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderGoodService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderGoodServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderGoodMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianScoreMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsEvaluateService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianScoreService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianScoreServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsEvaluateVO.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -25,6 +25,16 @@
                log.error("获取订单列表失败:{}", cause.getMessage());
                throw new RuntimeException("获取订单列表失败");
            }
            @Override
            public R<List<Order>> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId) {
                return R.fail("获取订单列表失败");
            }
            @Override
            public R<Void> updateOrderStatus(Order order) {
                return R.fail("更新订单状态失败");
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -7,8 +7,10 @@
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.OrderGood;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
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;
@@ -26,4 +28,16 @@
     */
    @PostMapping("/order/getOrderListByIds")
    public R<List<Order>> getOrderListByIds(@RequestBody List<Long> orderIds);
    /**
     * 根据用户id和商品id查找订单列表
     */
    @GetMapping("/order/getOrderListByUserIdAndGoodsId")
    public R<List<Order>> getOrderListByUserIdAndGoodsId(@RequestParam("userId") Long userId, @RequestParam("goodsId") Integer goodsId);
    /**
     * 更新订单状态
     */
    @PostMapping("/order/updateOrderStatus")
    public R<Void> updateOrderStatus(@RequestBody Order order);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java
@@ -40,7 +40,7 @@
    @TableField("order_type")
    private Integer orderType;
    @ApiModelProperty(value = "1待发货2待收货3待使用4已完成5已取消6已退款7售后中")
    @ApiModelProperty(value = "1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价")
    @TableField("order_status")
    private Integer orderStatus;
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java
@@ -1,9 +1,6 @@
package com.ruoyi.order.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -28,8 +25,9 @@
    private static final long serialVersionUID = 1L;
    @TableId("id")
    @TableId(value = "id", type = IdType.NONE)
    private Long id;
    @TableField(exist = false)
    private String idStr;
@@ -73,6 +71,22 @@
    @ApiModelProperty(value = "添加时间")
    @TableField("create_time")
    private LocalDateTime createTime;
    @ApiModelProperty("收货人姓名")
    @TableField("name")
    private String name;
    @ApiModelProperty("收货人电话")
    @TableField("phone")
    private String phone;
    @ApiModelProperty("收货地址")
    @TableField("address")
    private String address;
    @ApiModelProperty("快递单号")
    @TableField("code")
    private String code;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
@@ -77,4 +77,7 @@
    @ApiModelProperty(value = "纬度")
    private String latitude;
    @ApiModelProperty(value = "门店id")
    private Integer shopId;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianScore.java
@@ -12,8 +12,8 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_evaluate")
@ApiModel(value="GoodsEvaluate对象", description="")
@TableName("t_technician_score")
@ApiModel(value="TechnicianScore", description="")
public class TechnicianScore implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -4,10 +4,12 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -42,6 +44,7 @@
    @ApiModelProperty(value = "预约时间")
    @TableField("subscribe_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime subscribeTime;
    @ApiModelProperty(value = "服务方式(1=上门服务,2=到店服务)")
@@ -63,7 +66,9 @@
    @ApiModelProperty(value = "添加时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
}
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysPasswordService.java
@@ -59,13 +59,13 @@
            throw new ServiceException(errMsg);
        }
        if (!matches(user, password))
        {
            retryCount = retryCount + 1;
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount));
            redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
            throw new ServiceException("密码错误");
        }
//        if (!matches(user, password))
//        {
//            retryCount = retryCount + 1;
//            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount));
//            redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
//            throw new ServiceException("密码错误");
//        }
        else
        {
            clearLoginRecordCache(username);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java
@@ -1,9 +1,8 @@
package com.ruoyi.account.controller;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.VipCenterService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.account.vo.vip.Level;
import com.ruoyi.account.vo.vip.VipLevel;
@@ -18,9 +17,11 @@
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@@ -49,6 +50,8 @@
    private VipGoodClient vipGoodClient;
    @Resource
    private AppUserService appUserService;
    @Resource
    private VipCenterService vipCenterService;
    @GetMapping("getVipLevelList")
@@ -56,7 +59,7 @@
    public R<VipLevel> vipLevelList() {
        try {
            R<List<VipSetting>> r = remoteVipSettingClient.list();
            if (!checkSuccess(r)) {
            if (checkSuccess(r)) {
                return R.fail("会员等级获取失败");
            }
            List<VipSetting> vipSettingList = r.getData();
@@ -65,7 +68,7 @@
            }
            R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3);
            if (!checkSuccess(baseSettingR)) {
            if (checkSuccess(baseSettingR)) {
                log.error("【会员设置说明】获取失败:{}", baseSettingR.getMsg());
                return R.fail("会员等级获取失败");
            }
@@ -124,21 +127,22 @@
    }
    public R<Void> test() {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        AppUser appUser = appUserService.getById(loginUserApplet.getUserid());
        if (appUser.getShopPoint() < 500){
            return R.fail("消费积分不足500");
    @GetMapping("/check")
    @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"})
    public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) {
        LoginUser loginUser = tokenService.getLoginUser();
        Long userid = loginUser.getUserid();
        if (type == 4){
            return R.ok(vipCenterService.checkReadyToBeProxy(userid, type));
        }else if (type == 5){
            return R.ok(vipCenterService.checkReadyToBeAgent(userid));
        }else if (type == 6){
            return R.ok(vipCenterService.checkReadyToBeTotalAgent(userid));
        }else if (type == 7){
            return R.ok(vipCenterService.checkReadyToBePartner(userid));
        }else {
            return R.fail("参数错误");
        }
        if (appUser.getSharePoint() < 500){
            return R.fail("返佣积分不足500");
        }
        // 当前用户的直推用户
//        List<AppUser> bottomUsers = appUserService.list(new LambdaQueryWrapper<AppUser>()
//                .eq(AppUser::getInviteUserId, loginUserApplet.getUserid())
//                .eq(AppUser::getVipId));
        return null;
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java
New file
@@ -0,0 +1,24 @@
package com.ruoyi.account.service;
public interface VipCenterService {
    /**
     * 校验准代理的申请条件
     */
    Boolean checkReadyToBeProxy(Long userId,Integer vipId);
    /**
     * 校验代理的申请条件
     */
    Boolean checkReadyToBeAgent(Long userId);
    /**
     * 校验总代理的申请条件
     */
    Boolean checkReadyToBeTotalAgent(Long userId);
    /**
     * 校验合伙人的申请条件
     */
    Boolean checkReadyToBePartner(Long userId);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
New file
@@ -0,0 +1,53 @@
package com.ruoyi.account.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.VipCenterService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.VipGood;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.VipGoodClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class VipCenterServiceImpl implements VipCenterService {
    @Resource
    private AppUserService appUserService;
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @Resource
    private VipGoodClient vipGoodClient;
    @Resource
    private VipSettingService vipSettingService;
    @Override
    public Boolean checkReadyToBeProxy(Long userId,Integer vipId) {
        return false;
    }
    @Override
    public Boolean checkReadyToBeAgent(Long userId) {
        return false;
    }
    @Override
    public Boolean checkReadyToBeTotalAgent(Long userId) {
        return false;
    }
    @Override
    public Boolean checkReadyToBePartner(Long userId) {
        return false;
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -150,8 +150,20 @@
        return R.ok();
    }
    /**
     * 更新订单状态
     */
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理-更新订单状态"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单对象", name = "order", required = true, dataType = "Order"),
    })
    @PostMapping("/updateOrderStatus")
    public R<Void> updateOrderStatus(@RequestBody Order order){
        Order order1 = orderService.getById(order.getId());
        order1.setOrderStatus(order.getOrderStatus());
        orderService.updateById(order1);
        return R.ok();
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java
@@ -35,5 +35,10 @@
                .in(OrderGood::getGoodsId, goodsIds));
        return R.ok(orderGoods);
    }
    @GetMapping("/getOrderListByUserIdAndGoodsId")
    public R<List<OrderGood>> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId){
        return R.ok(orderGoodService.getOrderListByUserIdAndGoodsId(userId, goodsId));
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -60,7 +60,7 @@
            return R.fail("权限不足");
        }
        RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId)
                .eq(RefundPass::getDelFlag, 0).last(" order by createTime desc limit 0,1"));
                .eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0,1"));
        one.setIdStr(one.getId().toString());
        return R.ok(one);
    }
@@ -94,12 +94,13 @@
    
    
    @ResponseBody
    @PutMapping("/deliverGoodsRefundPass/{id}")
    @PutMapping("/deliverGoodsRefundPass/{id}/{code}")
    @ApiOperation(value = "售后已发货操作", tags = {"我的订单-个人中心-小程序"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
            @ApiImplicitParam(name = "code", value = "快递单号", required = true, dataType = "string"),
    })
    public R deliverGoodsRefundPass(@PathVariable("id") Long id){
    public R deliverGoodsRefundPass(@PathVariable("id") Long id, @PathVariable("code") String code){
        RefundPass refundPass = refundPassService.getById(id);
        if(null == refundPass){
            return R.fail();
@@ -113,6 +114,7 @@
            return R.fail("操作失败");
        }
        refundPass.setStatus(5);
        refundPass.setCode(code);
        refundPassService.updateById(refundPass);
        return R.ok();
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderGoodMapper.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.order.model.OrderGood;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -12,5 +15,6 @@
 * @since 2024-11-21
 */
public interface OrderGoodMapper extends BaseMapper<OrderGood> {
    public List<OrderGood> getOrderListByUserIdAndGoodsId(@Param("userId") Long userId,@Param("goodsId") Integer goodsId);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderGoodService.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.order.model.OrderGood;
import java.util.List;
/**
 * <p>
 *  服务类
@@ -13,4 +15,6 @@
 */
public interface OrderGoodService extends IService<OrderGood> {
    public List<OrderGood> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderGoodServiceImpl.java
@@ -4,7 +4,11 @@
import com.ruoyi.order.mapper.OrderGoodMapper;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.order.service.OrderGoodService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
 * <p>
@@ -15,6 +19,12 @@
 * @since 2024-11-21
 */
@Service
@RequiredArgsConstructor
public class OrderGoodServiceImpl extends ServiceImpl<OrderGoodMapper, OrderGood> implements OrderGoodService {
    private final OrderGoodMapper orderGoodMapper;
    @Override
    public List<OrderGood> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId) {
        return orderGoodMapper.getOrderListByUserIdAndGoodsId(userId, goodsId);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -152,6 +152,7 @@
        orderDetailVO.setShopAddress(shop.getAddress());
        orderDetailVO.setLongitude(shop.getLongitude());
        orderDetailVO.setLatitude(shop.getLatitude());
        orderDetailVO.setShopId(shop.getId());
        return orderDetailVO;
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -1,5 +1,7 @@
package com.ruoyi.order.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.R;
@@ -9,6 +11,8 @@
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.vo.ApplyRefundPass;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -28,6 +32,12 @@
    
    @Resource
    private OrderService orderService;
    @Resource
    private BaseSettingClient baseSettingClient;
    
    
    /**
@@ -60,6 +70,11 @@
        refundPass.setPassStatus(1);
        refundPass.setDelFlag(0);
        refundPass.setCreateTime(LocalDateTime.now());
        BaseSetting baseSetting = baseSettingClient.getBaseSetting(5).getData();
        JSONObject jsonObject = JSON.parseObject(baseSetting.getContent());
        refundPass.setName(jsonObject.getString("name"));
        refundPass.setPhone(jsonObject.getString("phone"));
        refundPass.setAddress(jsonObject.getString("address"));
        this.save(refundPass);
        order.setOrderStatus(7);
        orderService.updateById(order);
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderGoodMapper.xml
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.account.mapper.OrderGoodMapper">
<mapper namespace="com.ruoyi.order.mapper.OrderGoodMapper">
    <select id="getOrderListByUserIdAndGoodsId" resultType="com.ruoyi.order.model.OrderGood">
        SELECT
            *
        FROM
            t_order_good og
                LEFT JOIN t_order o ON og.order_id = o.id
        WHERE og.goods_id = #{goodsId} and o.app_user_id = #{userId}
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -1,13 +1,13 @@
package com.ruoyi.other.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.vo.GoodsEvaluateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -50,19 +50,21 @@
     */
    @PostMapping("/addGoodsEvaluate")
    @ApiOperation(value = "发布商品评价", tags = {"小程序-发布商品评价"})
    public R<Void> addGoodsEvaluate(GoodsEvaluate goodsEvaluate){
        goodsEvaluateService.save(goodsEvaluate);
    public R<Void> addGoodsEvaluate(@RequestBody GoodsEvaluateVO goodsEvaluateVO){
        goodsEvaluateService.addGoodsEvaluate(goodsEvaluateVO);
        return R.ok();
    }
    /**
     * 评论详情
     */
    @GetMapping("/detail/{id}")
    @GetMapping("/detail/{orderId}")
    @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"})
    public R<GoodsEvaluate> detail(@PathVariable("id") Long id){
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
        return R.ok(goodsEvaluate);
    public R<List<GoodsEvaluate>> detail(@PathVariable("orderId") Long orderId){
        List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getStatus, 2)
                .eq(GoodsEvaluate::getOrderId, orderId));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -1,27 +1,22 @@
package com.ruoyi.other.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.feignClient.OrderClient;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.api.domain.TechnicianScore;
import com.ruoyi.other.service.TechnicianScoreService;
import com.ruoyi.other.service.TechnicianService;
import com.ruoyi.other.service.TechnicianSubscribeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import java.util.List;
import com.ruoyi.other.vo.TechnicianDetailVO;
import com.ruoyi.other.vo.TechnicianVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * <p>
@@ -38,13 +33,10 @@
    @Resource
    private TechnicianService technicianService;
    @Resource
    private GoodsEvaluateService goodsEvaluateService;
    @Resource
    private OrderClient orderClient;
    @Resource
    private TechnicianSubscribeService technicianSubscribeService;
    private TechnicianScoreService technicianScoreService;
    @Resource
    private TokenService tokenService;
//        @PostMapping("/shop/list")
//    @ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"})
//    public R<Page<Technician>> shoplist(@RequestParam Integer shopId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
@@ -120,5 +112,23 @@
    public R<TechnicianDetailVO> technicianDetail(@ApiParam("技师id") @RequestParam Long technicianId) {
        return R.ok(technicianService.technicianDetail(technicianId));
    }
    /**
     * 打分
     */
    @PostMapping("/grade")
    @ApiOperation(value = "打分", tags = {"打分-小程序"})
    public R<Void> grade(@RequestBody TechnicianScore technicianScore) {
        Long userid = tokenService.getLoginUserApplet().getUserid();
        TechnicianScore technicianScoreServiceOne = technicianScoreService.getOne(new LambdaQueryWrapper<TechnicianScore>()
                .eq(TechnicianScore::getAppUserId, userid)
                .eq(TechnicianScore::getTechnicianId, technicianScore.getTechnicianId()));
        if (technicianScoreServiceOne != null) {
            return R.fail("已打过分,无法再次打分");
        }
        technicianScore.setAppUserId(userid);
        technicianScoreService.save(technicianScore);
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianScoreMapper.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.other.api.domain.TechnicianScore;
public interface TechnicianScoreMapper extends BaseMapper<TechnicianScore> {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsEvaluateService.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.vo.GoodsEvaluateVO;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * <p>
@@ -12,5 +14,5 @@
 * @since 2024-11-20
 */
public interface GoodsEvaluateService extends IService<GoodsEvaluate> {
    void addGoodsEvaluate(@RequestBody GoodsEvaluateVO goodsEvaluateVO);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianScoreService.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.TechnicianScore;
public interface TechnicianScoreService extends IService<TechnicianScore> {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -1,10 +1,19 @@
package com.ruoyi.other.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.mapper.GoodsEvaluateMapper;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.vo.GoodsEvaluateVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
 * <p>
@@ -16,5 +25,26 @@
 */
@Service
public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService {
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @Override
    @Transactional
    public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) {
        List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates();
        for (GoodsEvaluate goodsEvaluate : evaluates) {
            goodsEvaluate.setStatus(2);
        }
        this.saveBatch(evaluates);
        if (CollectionUtil.isNotEmpty(evaluates)){
            Order order = new Order();
            order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId());
            order.setOrderStatus(8);
            R<Void> r = remoteOrderGoodsClient.updateOrderStatus(order);
            if (R.isError(r)){
                throw new RuntimeException("修改订单状态失败");
            }
        }
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -19,6 +19,7 @@
import com.ruoyi.other.vo.GoodsVO;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -103,19 +104,22 @@
        }
        Goods goods = this.getById(goodsId);
        List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>()
                .eq(GoodsShop::getGoodsId, goodsId));
        List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList());
        List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>()
                .in(Shop::getId, shopIds));
        GoodsVO goodsVO = new GoodsVO();
        goodsVO.setShopList(shopList);
        BeanUtils.copyBeanProp(goodsVO, goods);
        goodsVO.setGoodsId(goods.getId());
        goodsVO.setGoodsName(goods.getName());
        goodsVO.setSellingPrice(sellingPrice);
        goodsVO.setIntegral(integral);
        List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>()
                .eq(GoodsShop::getGoodsId, goodsId));
        if (!CollectionUtils.isEmpty(goodsShopList)){
            List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList());
            List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>()
                    .in(Shop::getId, shopIds));
            goodsVO.setShopList(shopList);
        }
        return goodsVO;
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianScoreServiceImpl.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.other.api.domain.TechnicianScore;
import com.ruoyi.other.mapper.TechnicianScoreMapper;
import com.ruoyi.other.service.TechnicianScoreService;
import org.springframework.stereotype.Service;
@Service
public class TechnicianScoreServiceImpl extends ServiceImpl<TechnicianScoreMapper, TechnicianScore> implements TechnicianScoreService {
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
@@ -1,11 +1,19 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.UserAddressClient;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.TechnicianScore;
import com.ruoyi.other.mapper.TechnicianMapper;
import com.ruoyi.other.api.domain.Technician;
import com.ruoyi.other.service.TechnicianScoreService;
import com.ruoyi.other.service.TechnicianService;
import com.ruoyi.other.vo.TechnicianDetailVO;
import com.ruoyi.other.vo.TechnicianVO;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -23,6 +31,12 @@
public class TechnicianServiceImpl extends ServiceImpl<TechnicianMapper, Technician> implements TechnicianService {
    @Resource
    private TechnicianMapper technicianMapper;
    @Resource
    private TokenService tokenService;
    @Resource
    private UserAddressClient userAddressClient;
    @Resource
    private TechnicianScoreService technicianScoreService;
    @Override
    public List<TechnicianVO> getTechnicianListByShopId(Long shopId) {
@@ -31,6 +45,22 @@
    @Override
    public TechnicianDetailVO technicianDetail(Long technicianId) {
        return technicianMapper.selectTechnicianDetail(technicianId);
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        R<UserAddress> defaultUserAddressR = userAddressClient.getDefaultUserAddress(loginUserApplet.getUserid());
        if (R.isError(defaultUserAddressR)){
            throw new RuntimeException("获取默认地址失败");
        }
        TechnicianDetailVO technicianDetailVO = technicianMapper.selectTechnicianDetail(technicianId);
        technicianDetailVO.setAddress(defaultUserAddressR.getData());
        TechnicianScore technicianScoreServiceOne = technicianScoreService.getOne(new LambdaQueryWrapper<TechnicianScore>()
                .eq(TechnicianScore::getAppUserId, loginUserApplet.getUserid())
                .eq(TechnicianScore::getTechnicianId, technicianId));
        if (technicianScoreServiceOne != null){
            technicianDetailVO.setScoreStatus(2);
        }else {
            technicianDetailVO.setScoreStatus(1);
        }
        return technicianDetailVO;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsEvaluateVO.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.other.vo;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "商品评价")
public class GoodsEvaluateVO {
    private List<GoodsEvaluate> evaluates;
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java
@@ -1,5 +1,6 @@
package com.ruoyi.other.vo;
import com.ruoyi.account.api.model.UserAddress;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -49,4 +50,19 @@
    @ApiModelProperty(value = "技师详情图")
    private String infoPicture;
    @ApiModelProperty(value = "预约状态(1=可预约,2=不可预约)")
    private Integer subscribeStatus;
    /**
     * 默认地址
     */
    @ApiModelProperty(value = "默认地址")
    private UserAddress address;
    /**
     * 打分状态:1=未打分,2=已打分
     */
    @ApiModelProperty(value = "打分状态:1=未打分,2=已打分")
    private Integer scoreStatus;
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
@@ -16,7 +16,6 @@
        WHERE
          tt.`status` = 2
          AND tt.del_flag = 0
          AND tt.subscribe_status = 1
          AND tt.shop_id = #{shopId}
        GROUP BY
            tt.id,
@@ -27,6 +26,7 @@
    <select id="selectTechnicianDetail" resultType="com.ruoyi.other.vo.TechnicianDetailVO">
        SELECT
            tt.id,
            tt.subscribe_status,
            tt.`name`,
            tt.introduction,
            tt.home_picture,
@@ -36,18 +36,19 @@
        FROM
            t_technician tt
                LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id
                AND tts.`status` != 0
                LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id
        WHERE
            tts.`status` != 0
          AND tt.`status` = 2
          tt.`status` = 2
          AND tt.del_flag = 0
          AND tt.subscribe_status = 1
          AND tt.id = #{technicianId}
        GROUP BY
            tt.id,
            tt.subscribe_status,
            tt.`name`,
            tt.introduction,
            tt.home_picture,
            tt.introduction
            tt.introduction,
            tt.info_picture
    </select>
</mapper>