luodangjia
2024-12-10 18e68871f0423910f748a727ceab297a8e4765d1
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
1 文件已重命名
52个文件已修改
1043 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java 6 ●●●●● 补丁 | 查看 | 原始文档 | 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/BaseSetting.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDept.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysRole.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RoleInfoVo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysDeptMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java 274 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/AgreementController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/PhoneController.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -35,6 +35,11 @@
            public R<Void> updateOrderStatus(Order order) {
                return R.fail("更新订单状态失败");
            }
            @Override
            public R<Void> subscribe(Long id, Integer technicianId) {
                return R.fail("预约失败");
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -40,4 +40,10 @@
     */
    @PostMapping("/order/updateOrderStatus")
    public R<Void> updateOrderStatus(@RequestBody Order order);
    /**
     * 预约技师
     */
    @PostMapping("/order/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id" , required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
@@ -80,4 +80,7 @@
    @ApiModelProperty(value = "门店id")
    private Integer shopId;
    @ApiModelProperty(value = "技师名称")
    private String technicianName;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/BaseSetting.java
@@ -26,7 +26,7 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "1:合伙人积分设置一    2:合伙人积分设置二    3:会员说明设置    4:活动管理-活动设置 1开0关  5:售后设置")
    @ApiModelProperty(value = "1:合伙人积分设置一    2:合伙人积分设置二    3:会员说明设置    4:活动管理-活动设置 1开0关  5:售后设置 6:充值设置")
    @TableId("id")
    private Integer id;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
@@ -79,5 +79,19 @@
    @TableField(exist = false)
    private String userName;
    @ApiModelProperty(value = "商品名字")
    @TableField(exist = false)
    private String goodsName;
    @ApiModelProperty(value = "商品图片")
    @TableField(exist = false)
    private String goodsImg;
    @TableField(exist = false)
    private String idStr;
    public void setId(Long id) {
        this.id = id;
        this.idStr = String.valueOf(id);
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -32,7 +32,7 @@
    @ApiModelProperty(value = "主键")
    @TableId("id")
    private Long id;
    private Integer id;
    @ApiModelProperty(value = "用户id")
    @TableField("app_user_id")
@@ -40,7 +40,7 @@
    @ApiModelProperty(value = "技师id")
    @TableField("technician_id")
    private Long technicianId;
    private Integer technicianId;
    @ApiModelProperty(value = "预约时间")
    @TableField("subscribe_time")
@@ -70,5 +70,15 @@
    private LocalDateTime createTime;
    @ApiModelProperty(value = "订单id")
    private Long orderId;
    @TableField(exist = false)
    private String idStr;
    public void setId(Integer id) {
        this.id = id;
        this.idStr = String.valueOf(id);
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java
@@ -131,5 +131,9 @@
    @TableField("keep_shop_point")
    private Integer keepShopPoint;
    @ApiModelProperty(value = "会员等级是否必须达到代理: 0-否 1-是")
    @TableField("vip_level_up_proxy_role")
    private Integer vipLevelUpProxyRole;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -6,6 +6,8 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
@Slf4j
public class ShopClientFallbackFactory implements FallbackFactory<ShopClient> {
    @Override
@@ -20,6 +22,11 @@
            public R<Shop> getShopByPhone(String phone) {
                return R.fail("根据店铺管理员电话获取门店数据失败:" + cause.getMessage());
            }
            @Override
            public R<List<Shop>> getShopByUserIds(List<Long> userIds) {
                return R.fail("根据用户id集合获取门店数据失败");
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java
@@ -2,6 +2,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Technician;
import com.ruoyi.other.api.domain.TechnicianSubscribe;
import com.ruoyi.other.api.feignClient.TechnicianClient;
import org.springframework.cloud.openfeign.FallbackFactory;
@@ -15,9 +16,14 @@
            }
            @Override
            public R<Void> updateStatus(Integer status, Integer subscribeId) {
            public R<Void> updateStatus(Integer status, Long subscribeId) {
                return R.fail("跟新技师预约状态失败:" + cause.getMessage());
            }
            @Override
            public R<TechnicianSubscribe> getSubscribeByOrderId(Long orderId) {
                return R.fail("根据订单id获取预约信息失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java
@@ -17,6 +17,4 @@
public interface OrderClient {
    @PostMapping(value = "/management/give/vip")
    public R<List<Long>> getOrderIdsByTechId(@RequestParam("id") Integer id);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -1,12 +1,16 @@
package com.ruoyi.other.api.feignClient;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.factory.ShopClientFallbackFactory;
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;
/**
 * @author zhibing.pu
@@ -32,4 +36,7 @@
     */
    @PostMapping("/shop/getShopByPhone")
    R<Shop> getShopByPhone(@RequestParam("phone") String phone);
    @PostMapping("/getShopByUserIds")
    public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
@@ -3,18 +3,22 @@
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Technician;
import com.ruoyi.other.api.domain.TechnicianSubscribe;
import com.ruoyi.other.api.factory.TechnicianClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class)
public interface TechnicianClient {
    @PostMapping("/technician/shop/detail")
    R<Technician> shopdetail(@RequestParam("techId") Integer techId);
    @GetMapping("/technician/getById")
    R<Technician> shopdetail(@RequestParam("id") Integer techId);
    @PutMapping("/technician-subscribe/updateStatus")
    R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Integer subscribeId);
    R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Long subscribeId);
    @GetMapping("/technician-subscribe/getSubscribeByOrderId")
    R<TechnicianSubscribe> getSubscribeByOrderId(@RequestParam("orderId") Long orderId);
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDept.java
@@ -47,6 +47,10 @@
    /** 删除标志(0代表存在 2代表删除) */
    private String delFlag;
    /**
     * 门店id
     */
    private Integer shopId;
    /** 父部门名称 */
    private String parentName;
@@ -177,7 +181,15 @@
    {
        this.children = children;
    }
    public Integer getShopId() {
        return shopId;
    }
    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysRole.java
@@ -46,6 +46,11 @@
    /** 角色状态(0正常 1停用) */
    @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
    private String status;
    /**
     * 门店id
     */
    @TableField("shop_id")
    private Integer shopId;
    /** 删除标志(0代表存在 2代表删除) */
    @TableField("del_flag")
@@ -214,6 +219,14 @@
        this.number = number;
    }
    
    public Integer getShopId() {
        return shopId;
    }
    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
@@ -9,6 +9,7 @@
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.service.ISysDeptService;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -32,8 +33,8 @@
     * 获取部门列表
     */
    @GetMapping("/list")
    public AjaxResult list(SysDept dept)
    {
    @ApiOperation(value = "获取部门列表", tags = {"管理后台-部门管理", "门店后台-部门管理"})
    public AjaxResult list(SysDept dept) {
        List<SysDept> depts = deptService.selectDeptList(dept);
        return success(depts);
    }
@@ -53,8 +54,7 @@
     * 根据部门编号获取详细信息
     */
    @GetMapping(value = "/{deptId}")
    public AjaxResult getInfo(@PathVariable Long deptId)
    {
    public AjaxResult getInfo(@PathVariable Long deptId) {
        deptService.checkDeptDataScope(deptId);
        return success(deptService.selectDeptById(deptId));
    }
@@ -63,11 +63,10 @@
     * 新增部门
     */
    @Log(title = "部门管理", businessType = BusinessType.INSERT)
    @ApiOperation(value = "添加部门", tags = {"管理后台-部门管理", "门店后台-部门管理"})
    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysDept dept)
    {
        if (!deptService.checkDeptNameUnique(dept))
        {
    public AjaxResult add(@Validated @RequestBody SysDept dept) {
        if (!deptService.checkDeptNameUnique(dept)) {
            return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
        }
        dept.setCreateBy(SecurityUtils.getUsername());
@@ -78,13 +77,12 @@
     * 修改部门
     */
    @Log(title = "部门管理", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "编辑部门", tags = {"管理后台-部门管理", "门店后台-部门管理"})
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody SysDept dept)
    {
    public AjaxResult edit(@Validated @RequestBody SysDept dept) {
        Long deptId = dept.getDeptId();
        deptService.checkDeptDataScope(deptId);
        if (!deptService.checkDeptNameUnique(dept))
        {
        if (!deptService.checkDeptNameUnique(dept)) {
            return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
        }
        else if (dept.getParentId().equals(deptId))
@@ -103,6 +101,7 @@
     * 删除部门
     */
    @Log(title = "部门管理", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除部门", tags = {"管理后台-部门管理", "门店后台-部门管理"})
    @DeleteMapping("/{deptId}")
    public AjaxResult remove(@PathVariable Long deptId)
    {
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java
@@ -11,6 +11,7 @@
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysRole;
@@ -68,25 +69,41 @@
    @Resource
    private SysMenuMapper menuMapper;
    
    @Resource
    private TokenService tokenService;
    
    @ApiOperation(value = "获取角色列表", tags = {"管理后台-系统用户管理"})
    @Resource
    private ISysUserService sysUserService;
    @ApiOperation(value = "获取角色列表", tags = {"管理后台-账号管理", "门店后台-账号管理"})
    @GetMapping("/list")
    public AjaxResult list() {
        List<SysRole> list = roleService.list(new LambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, 0).eq(SysRole::getStatus, 0));
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserService.getById(userid);
        LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, 0).eq(SysRole::getStatus, 0);
        if(sysUser.getRoleType() == 2){
            wrapper.eq(SysRole::getShopId, sysUser.getObjectId());
        }
        List<SysRole> list = roleService.list(wrapper);
        return AjaxResult.success(list);
    }
    
    
    @ResponseBody
    @GetMapping("/listPage")
    @ApiOperation(value = "获取角色列表", tags = {"管理后台-角色管理"})
    @ApiOperation(value = "获取角色列表", tags = {"管理后台-权限管理", "门店后台-权限管理"})
    public AjaxResult listPage(String name, BasePage basePage) {
        PageInfo<SysRole> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize());
        LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getStatus, 0).eq(SysRole::getDelFlag, 0);
        if (StringUtils.isNotEmpty(name)) {
            wrapper.like(SysRole::getRoleName, name);
        }
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserService.getById(userid);
        if(sysUser.getRoleType() == 2){
            wrapper.eq(SysRole::getShopId, sysUser.getObjectId());
        }
        PageInfo<SysRole> page = roleService.page(pageInfo, wrapper.orderByDesc(SysRole::getCreateTime));
        for (SysRole record : page.getRecords()) {
            long count = sysUserRoleService.count(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, record.getRoleId()));
@@ -98,13 +115,19 @@
    
    @ResponseBody
    @PostMapping("/roleAdd")
    @ApiOperation(value = "添加角色", tags = {"管理后台-角色管理"})
    @GlobalTransactional(rollbackFor = Exception.class)//分布式事务
    @ApiOperation(value = "添加角色", tags = {"管理后台-权限管理", "门店后台-权限管理"})
    public AjaxResult roleAdd(@Validated @RequestBody RoleAddDto dto) {
        SysRole role = new SysRole();
        role.setRoleName(dto.getRoleName());
        long count = roleService.count(Wrappers.lambdaQuery(SysRole.class)
                .eq(SysRole::getRoleName, dto.getRoleName()));
        LambdaQueryWrapper<SysRole> wrapper = Wrappers.lambdaQuery(SysRole.class)
                .eq(SysRole::getRoleName, dto.getRoleName());
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserService.getById(userid);
        if(sysUser.getRoleType() == 2){
            wrapper.eq(SysRole::getShopId, sysUser.getObjectId());
        }
        long count = roleService.count(wrapper);
        if (count > 0) {
            return AjaxResult.error("角色已存在,请重新输入");
        }
@@ -117,13 +140,17 @@
        role.setRemark(dto.getRemark());
        role.setCreateBy(SecurityUtils.getUsername());
        role.setCreateTime(new Date());
        if(sysUser.getRoleType() == 2){
            role.setShopId(sysUser.getObjectId());
        }
        roleService.insertRole(role);
        return AjaxResult.success();
    }
    
    
    @GetMapping("/roleInfo")
    @ApiOperation(value = "角色详情", tags = {"管理后台-角色管理"})
    @ApiOperation(value = "角色详情", tags = {"管理后台-权限管理"})
    public AjaxResult roleInfo(@RequestParam Long id) {
        SysRole role = roleService.selectRoleById(id);
        RoleInfoVo roleInfoVo = new RoleInfoVo();
@@ -159,8 +186,7 @@
    
    
    @PostMapping("/roleUpdate")
    @ApiOperation(value = "编辑角色", tags = {"管理后台-角色管理"})
    @GlobalTransactional(rollbackFor = Exception.class)//分布式事务
    @ApiOperation(value = "编辑角色", tags = {"管理后台-权限管理"})
    public AjaxResult roleUpdate(@Validated @RequestBody RoleUpdateDto dto) {
        SysRole role = new SysRole();
        role.setRoleName(dto.getRoleName());
@@ -206,7 +232,7 @@
     */
    @Log(title = "角色管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{roleIds}")
    @ApiOperation(value = "删除角色", tags = {"管理后台-角色管理"})
    @ApiOperation(value = "删除角色", tags = {"管理后台-权限管理"})
    public AjaxResult remove(@PathVariable Long[] roleIds) {
        return toAjax(roleService.deleteRoleByIds(roleIds));
    }
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
@@ -77,7 +77,7 @@
     * 获取用户列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-系统用户管理", "管理后台-角色管理"})
    @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-账号管理"})
    public AjaxResult list(GetSysUserList getSysUserList) {
        PageInfo<SysUser> pageInfo = new PageInfo<>(getSysUserList.getPageCurr(), getSysUserList.getPageSize());
        PageInfo<SysUser> page = userService.getList(pageInfo, getSysUserList);
@@ -98,8 +98,7 @@
     */
    @Log(title = "用户管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation(value = "添加系统用户", tags = {"管理后台-系统用户管理"})
    @GlobalTransactional(rollbackFor = Exception.class)//分布式事务
    @ApiOperation(value = "添加系统用户", tags = {"管理后台-账号管理"})
    public AjaxResult add(@RequestBody SysUser user) {
        user.setUserName(user.getPhonenumber());
        if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){
@@ -112,7 +111,7 @@
            return error("登录账号重复");
        }
        user.setCreateBy(SecurityUtils.getUsername());
        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
        user.setPassword(SecurityUtils.encryptPassword("a123456"));
        user.setRoleType(1);
        userService.insertUser(user);
        SysUserRole sysUserRole = new SysUserRole();
@@ -124,7 +123,7 @@
    
    
    @GetMapping("/verifyUserNameRepeat/{username}")
    @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-系统用户管理"})
    @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-账号管理"})
    public AjaxResult verifyUserNameRepeat(@PathVariable String username){
        SysUser user = new SysUser();
        user.setUserName(username);
@@ -142,7 +141,7 @@
    /**
     * 根据用户编号获取详细信息
     */
    @ApiOperation(value = "获取用户详情", tags = {"管理后台-系统用户管理"})
    @ApiOperation(value = "获取用户详情", tags = {"管理后台-账号管理"})
    @GetMapping("/getInfo/{userId}")
    public AjaxResult getInfo(@PathVariable Long userId) {
        userService.checkUserDataScope(userId);
@@ -165,8 +164,7 @@
     */
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    @ApiOperation(value = "编辑系统用户", tags = {"管理后台-系统用户管理"})
    @GlobalTransactional(rollbackFor = Exception.class)//分布式事务
    @ApiOperation(value = "编辑系统用户", tags = {"管理后台-账号管理"})
    public AjaxResult edit(@Validated @RequestBody SysUser user) {
        user.setUserName(user.getPhonenumber());
        if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){
@@ -216,7 +214,7 @@
     */
    @Log(title = "用户管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{userIds}")
    @ApiOperation(value = "删除系统用户", tags = {"管理后台-系统用户管理"})
    @ApiOperation(value = "删除系统用户", tags = {"管理后台-账号管理"})
    public AjaxResult remove(@PathVariable Long[] userIds) {
        if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) {
            return error("当前用户不能删除");
@@ -228,7 +226,7 @@
    @PostMapping("/shopUserStart")
    @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-系统用户管理"})
    @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-账号管理"})
    public AjaxResult shopUserStart(@RequestBody ShopUserStart shopUserStart) {
        if (shopUserStart.getUserId() == null) {
            return AjaxResult.error("userId不能为空");
@@ -354,11 +352,11 @@
     */
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @PutMapping("/resetPwd")
    @ApiOperation(value = "重置密码", tags = {"管理后台-系统用户管理"})
    @ApiOperation(value = "重置密码", tags = {"管理后台-账号管理"})
    public AjaxResult resetPwd(@RequestBody SysUser user) {
        userService.checkUserAllowed(user);
        userService.checkUserDataScope(user.getUserId());
        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
        user.setPassword(SecurityUtils.encryptPassword("a123456"));
        user.setUpdateBy(SecurityUtils.getUsername());
        return toAjax(userService.resetPwd(user));
    }
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RoleInfoVo.java
@@ -16,8 +16,4 @@
    
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty("站点id")
    private List<Integer> siteIds;
    @ApiModelProperty(value = "站点名称")
    private List<String> siteNames;
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
@@ -6,6 +6,7 @@
import com.ruoyi.common.core.utils.SpringUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysRole;
@@ -14,9 +15,11 @@
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -35,6 +38,15 @@
    @Autowired
    private SysRoleMapper roleMapper;
    @Resource
    private TokenService tokenService;
    @Resource
    private ISysUserService sysUserService;
    /**
     * 查询部门管理数据
@@ -44,8 +56,12 @@
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<SysDept> selectDeptList(SysDept dept)
    {
    public List<SysDept> selectDeptList(SysDept dept) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserService.getById(userid);
        if(sysUser.getRoleType() == 2){
            dept.setShopId(sysUser.getObjectId());
        }
        return deptMapper.selectDeptList(dept);
    }
@@ -219,6 +235,12 @@
            throw new ServiceException("部门停用,不允许新增");
        }
        dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
        //判断店铺数据
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserService.getById(userid);
        if(sysUser.getRoleType() == 2){
            dept.setShopId(sysUser.getObjectId());
        }
        return deptMapper.insertDept(dept);
    }
@@ -233,13 +255,18 @@
    {
        SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
        SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
        if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
        {
        if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
            String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
            String oldAncestors = oldDept.getAncestors();
            dept.setAncestors(newAncestors);
            updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
        }
        //判断店铺数据
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserService.getById(userid);
        if(sysUser.getRoleType() == 2){
            dept.setShopId(sysUser.getObjectId());
        }
        int result = deptMapper.updateDept(dept);
        if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
                && !StringUtils.equals("0", dept.getAncestors()))
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysDeptMapper.xml
@@ -20,10 +20,11 @@
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
        <result property="shopId" column="shop_id" />
    </resultMap>
    
    <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.shop_id
        from sys_dept d
    </sql>
    
@@ -41,6 +42,9 @@
        </if>
        <if test="status != null and status != ''">
            AND status = #{status}
        </if>
        <if test="shopId != null">
            AND shop_id = #{shopId}
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
@@ -96,6 +100,7 @@
             <if test="phone != null and phone != ''">phone,</if>
             <if test="email != null and email != ''">email,</if>
             <if test="status != null">status,</if>
            <if test="shopId != null">shop_id,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             create_time
         )values(
@@ -108,6 +113,7 @@
             <if test="phone != null and phone != ''">#{phone},</if>
             <if test="email != null and email != ''">#{email},</if>
             <if test="status != null">#{status},</if>
            <if test="shopId != null">#{shopId},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             sysdate()
         )
@@ -124,6 +130,7 @@
             <if test="phone != null">phone = #{phone},</if>
             <if test="email != null">email = #{email},</if>
             <if test="status != null and status != ''">status = #{status},</if>
            <if test="shopId != null">shop_id = #{shopId},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             update_time = sysdate()
         </set>
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java
@@ -1,7 +1,6 @@
package com.ruoyi.account.controller;
import com.alibaba.fastjson2.JSONObject;
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;
@@ -13,8 +12,6 @@
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.other.api.feignClient.GoodsVipClient;
import com.ruoyi.other.api.feignClient.RemoteVipSettingClient;
import com.ruoyi.other.api.feignClient.VipGoodClient;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -46,10 +43,6 @@
    private VipSettingService vipSettingService;
    @Resource
    private TokenService tokenService;
    @Resource
    private VipGoodClient vipGoodClient;
    @Resource
    private AppUserService appUserService;
    @Resource
    private VipCenterService vipCenterService;
@@ -130,22 +123,8 @@
    @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("参数错误");
        }
        return R.ok(vipCenterService.check(type));
    }
    private boolean checkSuccess(R<?> r) {
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
@@ -39,5 +39,6 @@
        return AjaxResult.success();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java
@@ -21,4 +21,7 @@
     * 校验合伙人的申请条件
     */
    Boolean checkReadyToBePartner(Long userId);
    Boolean check(Integer type);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
@@ -8,16 +8,23 @@
import com.ruoyi.account.service.VipCenterService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.security.service.TokenService;
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.Shop;
import com.ruoyi.other.api.domain.VipGood;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.VipGoodClient;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@@ -30,24 +37,291 @@
    private VipGoodClient vipGoodClient;
    @Resource
    private VipSettingService vipSettingService;
    @Resource
    private ShopClient shopClient;
    @Resource
    private TokenService tokenService;
    @Override
    public Boolean checkReadyToBeProxy(Long userId,Integer vipId) {
        AppUser appUser = appUserService.getById(userId);
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 准代理会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(4);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (vipLevelUpNumRole == 1){
            // 直推钻石用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 获取用户直推钻石用户数量
            long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 3));
            // 判断是否满足直推钻石用户数量
            if (userDiamondsCount >= vipDirectNum){
                return true;
            }
        }
        // 获取指定购买商品
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(4);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    String goodJson = vipGood.getGoodJson();
                    Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
    @Override
    public Boolean checkReadyToBeAgent(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 代理会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(5);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (vipLevelUpNumRole == 1){
            // 直推钻石用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 获取用户直推钻石用户数量
            long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 3));
            // 判断是否满足直推钻石用户数量
            if (userDiamondsCount >= vipDirectNum){
                return true;
            }
        }
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    String goodJson = vipGood.getGoodJson();
                    Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
    @Override
    public Boolean checkReadyToBeTotalAgent(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        // 获取总代会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(6);
        // 获取会员等级是否必须达到代理
        Integer vipLevelUpProxyRole = vipSetting.getVipLevelUpProxyRole();
        if (vipLevelUpProxyRole == 1 && appUser.getVipId() == 5){
            return true;
        }
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (vipLevelUpNumRole == 1){
            // 直推代理用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 准代理用户数阈值
            Integer vipDirectVipNum = vipSetting.getVipDirectVipNum();
            // 获取用户直推代理用户数量
            List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 5));
            // 代理下的准代理数量
            List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList());
            long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                    .in(AppUser::getInviteUserId, userQuasiAgent)
                    .eq(AppUser::getVipId, 4));
            // 判断是否满足直推代理用户数量和准代理数量
            if (userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum){
                return true;
            }
        }
        // 获取指定购买商品
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    String goodJson = vipGood.getGoodJson();
                    Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
    @Override
    public Boolean checkReadyToBePartner(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        // 消费积分
        Integer shopPoint = appUser.getShopPoint();
        // 返佣积分
        Integer sharePoint = appUser.getSharePoint();
        // 合伙人会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(7);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
                return true;
            }
            Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
            if (vipLevelUpNumRole == 1){
                // 直推代理用户数阈值
                Integer vipDirectNum = vipSetting.getVipDirectNum();
                // 准代理用户数阈值
                Integer vipDirectVipNum = vipSetting.getVipDirectVipNum();
                // 总代用户数阈值
                Integer vipTeamVipNum = vipSetting.getVipTeamVipNum();
                // 获取开店数量阈值
                Integer vipOpenShopNum = vipSetting.getVipOpenShopNum();
                // 获取直推用户有超过指定门店数量的用户
                List<Long> userShopList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                        .eq(AppUser::getInviteUserId, userId))
                        .stream().map(AppUser::getId).collect(Collectors.toList());
                if (CollectionUtil.isNotEmpty(userShopList)){
                    R<List<Shop>> r = shopClient.getShopByUserIds(userShopList);
                    List<Shop> shopList = r.getData();
                    if (CollectionUtil.isNotEmpty(shopList)){
                        Map<Long, List<Shop>> shopUserMap = shopList.stream().collect(Collectors.groupingBy(Shop::getAppUserId));
                        // 查找 list 长度大于 3 的 key
                        Set<Long> shopUserIdSet = shopUserMap.entrySet().stream()
                                .filter(entry -> entry.getValue().size() >= vipOpenShopNum)
                                .map(Map.Entry::getKey)
                                .collect(Collectors.toSet());
                        // 获取用户直推总代理数量
                        List<AppUser> userTotalAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                                .in(AppUser::getInviteUserId, shopUserIdSet)
                                .eq(AppUser::getVipId, 6));
                        // 获取用户直推代理用户数量
                        List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                                .in(AppUser::getInviteUserId, shopUserIdSet)
                                .eq(AppUser::getVipId, 5));
                        // 代理下的准代理数量
                        List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList());
                        long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                                .in(AppUser::getInviteUserId, userQuasiAgent)
                                .eq(AppUser::getVipId, 4));
                        // 判断是否满足直推代理用户数量和准代理数量
                        return userTotalAgentList.size() >= vipTeamVipNum && userAgentList.size() >= vipDirectNum &&
                                userQuasiAgentCount >= vipDirectVipNum;
                    }
                }
            }
        }
        return false;
    }
    @Override
    public Boolean check(Integer type) {
        LoginUser loginUser = tokenService.getLoginUser();
        Long userid = loginUser.getUserid();
        if (type == 4){
            return checkReadyToBeProxy(userid, type);
        }else if (type == 5){
            return checkReadyToBeAgent(userid);
        }else if (type == 6){
            return checkReadyToBeTotalAgent(userid);
        }else if (type == 7){
            return checkReadyToBePartner(userid);
        }else {
            throw new ServiceException("参数错误");
        }
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -10,15 +10,21 @@
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.order.enums.OrderStatus;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.vo.OrderDetailVO;
import com.ruoyi.order.vo.OrderVO;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -39,6 +45,10 @@
    private TokenService tokenService;
    @Resource
    private UserAddressClient addressClient;
    @Resource
    private CommissionService commissionService;
    @Resource
    private BaseSettingClient baseSettingClient;
    /**
@@ -112,7 +122,9 @@
    })
    @GetMapping("/cancel/{orderId}")
    public R<Void> cancel(@PathVariable("orderId") Long orderId){
        // TODO 待完善
        orderService.update(new LambdaUpdateWrapper<Order>()
                .eq(Order::getId, orderId)
                .set(Order::getOrderStatus, OrderStatus.CANCELLED.getCode()));
        return R.ok();
    }
@@ -125,7 +137,25 @@
    })
    @GetMapping("/confirm/{orderId}")
    public R<Void> confirm(@PathVariable("orderId") Long orderId){
        // TODO 待完善
        boolean update = orderService.update(new LambdaUpdateWrapper<Order>()
                .eq(Order::getId, orderId)
                .eq(Order::getOrderStatus, OrderStatus.PENDING_RECEIPT.getCode())
                .set(Order::getOrderStatus, OrderStatus.COMPLETED.getCode()));
        if(!update){
            return R.fail("订单状态异常");
        }
        R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5);
        if (R.isError(baseSettingR)) {
            return R.fail("售后设置获取失败");
        }
        BaseSetting baseSetting = baseSettingR.getData();
        if (baseSetting == null) {
            return R.fail("售后设置获取失败");
        }
        String content = baseSetting.getContent();
        JSONObject jsonObject = JSONObject.parseObject(content);
        Long days = jsonObject.getLong("days");
        commissionService.addToCommissionDelayQueue(orderId, LocalDateTime.now().plusDays(days));
        return R.ok();
    }
@@ -166,6 +196,18 @@
    }
    /**
     * 预约技师
     */
    @PostMapping("/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId){
        Order order = orderService.getById(id);
        order.setTechnicianId(technicianId);
        orderService.updateById(order);
        return R.ok();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -86,7 +86,7 @@
            return R.fail("售后取消失败");
        }
        refundPass.setDelFlag(1);
        refundPassService.updateById(refundPass);
        refundPassService.removeById(id);
        order.setOrderStatus(4);
        orderService.updateById(order);
        return R.ok();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
@@ -1,11 +1,19 @@
package com.ruoyi.order.controller;
import cn.hutool.core.collection.CollectionUtil;
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.order.service.ShoppingCartService;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.GoodsShop;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.feignClient.GoodsShopClient;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -14,6 +22,9 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/shopping-cart")
@@ -25,6 +36,11 @@
    
    @Resource
    private TokenService tokenService;
    @Resource
    private GoodsShopClient goodsShopClient;
    @Resource
    private ShopClient shopClient;
    
    
    
@@ -88,9 +104,38 @@
    @ResponseBody
    @PostMapping("/shoppingCartPayment")
    @ApiOperation(value = "购物车订单支付", tags = {"商城-购物车-小程序"})
    public R<Void> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){
    public R<String> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){
        return shoppingCartService.shoppingCartPayment(shoppingCartPayment);
    }
    @ResponseBody
    @GetMapping("/getVerifiableShop")
    @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
    public R<List<VerifiableShopVo>> getVerifiableShop(){
        LoginUser loginUser = tokenService.getLoginUserApplet();
        List<ShoppingCart> shoppingCarts = shoppingCartService.list(new LambdaQueryWrapper<ShoppingCart>()
                .eq(ShoppingCart::getAppUserId, loginUser.getUserid()));
        List<Integer> goodsIds = shoppingCarts.stream().map(ShoppingCart::getGoodsId).collect(Collectors.toList());
        GetGoodsShopByGoodsIds goodsShopByGoodsIds = new GetGoodsShopByGoodsIds();
        goodsShopByGoodsIds.setGoodsIds(goodsIds);
        R<List<GoodsShop>> r = goodsShopClient.getGoodsShopByGoodsIds(goodsShopByGoodsIds);
        List<GoodsShop> goodsShops = r.getData();
        List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>();
        if (CollectionUtil.isNotEmpty(goodsShops)){
            for (GoodsShop goodsShop : goodsShops) {
                R<Shop> shopR = shopClient.getShopById(goodsShop.getShopId());
                if (R.isSuccess(shopR)){
                    VerifiableShopVo verifiableShopVo = new VerifiableShopVo();
                    verifiableShopVo.setId(shopR.getData().getId());
                    verifiableShopVo.setName(shopR.getData().getName());
                    verifiableShopVoList.add(verifiableShopVo);
                }
            }
        }
        return R.ok(verifiableShopVoList);
    }
    
    
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -24,5 +24,4 @@
    void writeOff(String code,Integer shopId);
    void commission(Long orderId);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java
@@ -22,7 +22,7 @@
     * 添加商品
     * @param shoppingCart
     */
    void addGoods(ShoppingCart shoppingCart);
    Long addGoods(ShoppingCart shoppingCart);
    
    
    /**
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -17,12 +17,13 @@
import com.ruoyi.order.mapper.OrderMapper;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.vo.OrderDetailVO;
import com.ruoyi.order.vo.OrderGoodsVO;
import com.ruoyi.order.vo.OrderVO;
import com.ruoyi.other.api.domain.*;
import com.ruoyi.other.api.feignClient.GoodsClient;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.TechnicianClient;
import com.ruoyi.system.api.model.LoginUser;
@@ -30,6 +31,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -56,6 +58,10 @@
    private TechnicianClient technicianClient;
    @Resource
    private ShopClient shopClient;
    @Resource
    private CommissionService commissionService;
    @Resource
    private BaseSettingClient baseSettingClient;
    @Override
@@ -128,9 +134,15 @@
            orderDetailVO.setDistributionMode(goods.getDistributionMode());
        }
        Technician technician = new Technician();
        if (order.getTechnicianId() != null){
            R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
            if (shopdetail.getCode() != R.SUCCESS){
                throw new ServiceException("获取技师信息失败");
            }
            technician = shopdetail.getData();
        }
        Shop shop = shopR.getData();
        orderDetailVO.setId(order.getId());
        orderDetailVO.setOrderStatus(order.getOrderStatus());
        orderDetailVO.setPoint(order.getPoint());
@@ -153,6 +165,7 @@
        orderDetailVO.setLongitude(shop.getLongitude());
        orderDetailVO.setLatitude(shop.getLatitude());
        orderDetailVO.setShopId(shop.getId());
        orderDetailVO.setTechnicianName(technician.getName());
        return orderDetailVO;
    }
@@ -197,22 +210,30 @@
        orderMapper.updateById(order);
        Integer orderType = order.getOrderType();
        if (orderType.equals(OrderType.SERVICE.getCode())){
            R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
            if (shopdetail.getCode() != R.SUCCESS){
                throw new ServiceException("获取技师信息失败");
            R<TechnicianSubscribe> subscribeR = technicianClient.getSubscribeByOrderId(order.getId());
            if (R.isError(subscribeR)){
                throw new ServiceException("获取预约信息失败");
            }
            Technician technician = shopdetail.getData();
            R<Void> r = technicianClient.updateStatus(2, technician.getId());
            if (r.getCode() != R.SUCCESS){
                throw new ServiceException("修改技师状态失败");
            TechnicianSubscribe subscribe = subscribeR.getData();
            subscribe.setStatus(2);
            R<Void> r = technicianClient.updateStatus(subscribe.getStatus(), subscribe.getId());
            if (R.isError(r)){
                throw new ServiceException("更新预约状态失败");
            }
        }
    }
    @Override
    public void commission(Long orderId) {
        // 售后设置
        R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5);
        if (R.isError(baseSettingR)) {
            throw new ServiceException("售后设置获取失败");
        }
        BaseSetting baseSetting = baseSettingR.getData();
        if (baseSetting == null) {
            throw new ServiceException("售后设置获取失败");
        }
        String content = baseSetting.getContent();
        JSONObject jsonObject = JSONObject.parseObject(content);
        Long days = jsonObject.getLong("days");
        commissionService.addToCommissionDelayQueue(order.getId(), LocalDateTime.now().plusDays(days));
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -327,10 +327,11 @@
    
    @Override
    public void addGoods(ShoppingCart shoppingCart) {
    public Long addGoods(ShoppingCart shoppingCart) {
        Long userid = tokenService.getLoginUserApplet().getUserid();
        shoppingCart.setAppUserId(userid);
        this.save(shoppingCart);
        return shoppingCart.getId();
    }
    
    
@@ -367,7 +368,22 @@
     */
    @Override
    public ConfirmOrderVo confirmOrder(ConfirmOrder confirmOrder) {
        Integer position = confirmOrder.getPosition();
        Long userid = tokenService.getLoginUserApplet().getUserid();
        //直接购买商品
        if(2 == position){
            //先加入购物车
            String goodsJson = confirmOrder.getGoodsJson();
            JSONArray objects = JSON.parseArray(goodsJson);
            Long id = objects.getJSONObject(0).getLong("id");
            Integer num1 = objects.getJSONObject(0).getInteger("num");
            ShoppingCart shoppingCart = new ShoppingCart();
            shoppingCart.setAppUserId(userid);
            shoppingCart.setGoodsId(id.intValue());
            shoppingCart.setNumber(num1);
            Long shoppingCarId = addGoods(shoppingCart);
            confirmOrder.setGoodsJson("[{\"id\": " + shoppingCarId + ", \"num\": " + num1 + "}]");
        }
        AppUser appUser = appUserClient.getAppUserById(userid);
        Integer shopId = confirmOrder.getShopId();
        Shop shop = shopClient.getShopById(shopId).getData();
@@ -412,6 +428,7 @@
        confirmOrderVo.setResidualPoint(appUser.getLavePoint().intValue());
        //获取默认收货地址
        UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData();
        userAddress.setIdStr(userAddress.getId().toString());
        confirmOrderVo.setUserAddress(userAddress);
        confirmOrderVo.setPaymentType(confirmOrder.getPaymentType());
        //获取用户优惠券,用户全部优惠券,不能使用的需要标识出来置灰展示
@@ -795,7 +812,7 @@
        order.setGoodName(goodName.substring(0, goodName.length() - 1));
        Goods goods = goodsClient.getGoodsById(goodsList.get(0).getGoodsId()).getData();
        order.setOrderType(goods.getType());
        order.setOrderStatus(1);
        order.setOrderStatus(goods.getType() == 1 ? 3 : 1);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        order.setOrderNumber("QJS" + getNumber(3) + sdf.format(new Date()));
        order.setTotalAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN));
@@ -1039,7 +1056,7 @@
                this.removeBatchByIds(ids);
            }
        }
        return R.ok();
        return R.ok(order.getId().toString());
    }
    
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java
@@ -11,6 +11,8 @@
@Data
@ApiModel
public class ConfirmOrder {
    @ApiModelProperty(value = "购买方式(1=购物车,2=商品详情)", required = true)
    private Integer position;
    @ApiModelProperty(value = "购物车数据id,数量 JSON[{id:1212,num:2}]", required = true)
    private String goodsJson;
    @ApiModelProperty(value = "支付方式(1=现金,2=积分)", required = true)
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
File was renamed from ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/VerifiableShopVo.java
@@ -1,4 +1,4 @@
package com.ruoyi.other.vo;
package com.ruoyi.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/AgreementController.java
@@ -10,6 +10,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
@@ -38,4 +39,31 @@
        Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type));
        return R.ok(null == one ? "" : one.getContent());
    }
    @ResponseBody
    @GetMapping("/getAgreementByType/{type}")
    @ApiOperation(value = "获取协议详情", tags = {"管理后台-协议管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=技师上门免责声明,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"),
    })
    public R<Agreement> getAgreementByType(@PathVariable("type") Integer type){
        Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type));
        return R.ok(one);
    }
    @ResponseBody
    @PostMapping("/saveAgreement")
    @ApiOperation(value = "保存协议", tags = {"管理后台-协议管理"})
    public R saveAgreement(@RequestBody Agreement agreement){
        if(null != agreement.getId()){
            agreementService.updateById(agreement);
        }else{
            agreement.setCreateTime(LocalDateTime.now());
            agreementService.save(agreement);
        }
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
@@ -1,14 +1,17 @@
package com.ruoyi.other.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.other.api.domain.GoodsCategory;
import com.ruoyi.other.service.GoodsCategoryService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@@ -23,10 +26,51 @@
 */
@RestController
@RequestMapping("/goods-category")
@Api(tags = "商品分类")
public class GoodsCategoryController {
@Api("商品分类")
public class GoodsCategoryController extends BaseController {
    @Resource
    private GoodsCategoryService goodsCategoryService;
    @PostMapping("/addGoodsCategory")
    @ApiOperation(value = "添加商品分类", tags = {"管理后台-商品分类"})
    public R<Void> addGoodsCategory(GoodsCategory goodsCategory){
        goodsCategoryService.save(goodsCategory);
        return R.ok();
    }
    @PutMapping("/updateGoodsCategory")
    @ApiOperation(value = "修改商品分类", tags = {"管理后台-商品分类"})
    public R<Void> updateGoodsCategory(GoodsCategory goodsCategory){
        goodsCategoryService.updateById(goodsCategory);
        return R.ok();
    }
    @GetMapping("/getGoodsCategoryById")
    @ApiOperation(value = "商品分类详情", tags = {"管理后台-商品分类"})
    public R<GoodsCategory> getGoodsCategoryById(@RequestParam("id") Integer id){
        return R.ok(goodsCategoryService.getById(id));
    }
    @GetMapping("/getList")
    @ApiOperation(value = "商品分类列表", tags = {"管理后台-商品分类"})
    public R<Page<GoodsCategory>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize, GoodsCategory goodsCategory){
        Page<GoodsCategory> page = goodsCategoryService.lambdaQuery()
                .like(StringUtils.isNotEmpty(goodsCategory.getName()),GoodsCategory::getName, goodsCategory.getName())
                .page(Page.of(PageNum, pageSize));
        return R.ok(page);
    }
    @DeleteMapping("/delete")
    @ApiOperation(value = "删除商品分类", tags = {"管理后台-商品分类"})
    public R<Void> delete(@RequestParam("id") Integer id){
        goodsCategoryService.removeById(id);
        return R.ok();
    }
    @GetMapping("/index/list")
    @ApiOperation(value = "商品分类", tags = {"小程序-首页"})
@@ -34,8 +78,7 @@
        List<GoodsCategory> indexlist = goodsCategoryService.lambdaQuery()
                .orderByDesc(GoodsCategory::getCreateTime)
                .last("limit 8")
                .list()
                ;
                .list();
        return R.ok(indexlist);
    }
    @GetMapping("/list")
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -32,6 +32,17 @@
    private GoodsService goodsService;
    /**
     * 添加商品
     */
    @PostMapping("/addGoods")
    @ApiOperation(value = "添加商品", tags = {"管理后台-发布商品"})
    public R<Void> addGoods(@RequestBody Goods goods) {
        return R.ok();
    }
    /**
     * 商品列表
     */
    @GetMapping("/goodsList")
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -5,9 +5,13 @@
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.security.service.TokenService;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.vo.GoodsEvaluateVO;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -15,6 +19,7 @@
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -32,6 +37,10 @@
    private GoodsEvaluateService goodsEvaluateService;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private GoodsService goodsService;
    @Resource
    private TokenService tokenService;
    @GetMapping("/goodsList")
    @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
@@ -41,6 +50,7 @@
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
            goodsEvaluate.setUserName(appUserById.getName());
            goodsEvaluate.setAvatar(appUserById.getAvatar());
            goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
        }
        return R.ok(list);
    }
@@ -61,9 +71,16 @@
    @GetMapping("/detail/{orderId}")
    @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"})
    public R<List<GoodsEvaluate>> detail(@PathVariable("orderId") Long orderId){
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getStatus, 2)
                .eq(GoodsEvaluate::getAppUserId,loginUserApplet.getUserid())
                .eq(GoodsEvaluate::getOrderId, orderId));
        for (GoodsEvaluate goodsEvaluate : list) {
            Goods goods = goodsService.getById(goodsEvaluate.getGoodsId());
            goodsEvaluate.setGoodsName(goods.getName());
            goodsEvaluate.setGoodsImg(goods.getHomePagePicture());
        }
        return R.ok(list);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java
@@ -49,7 +49,9 @@
    @ResponseBody
    @PostMapping("/getGoodsShopByGoodsIds")
    public R<List<GoodsShop>> getGoodsShopByGoodsIds(@RequestBody GetGoodsShopByGoodsIds goodsIds) {
        List<GoodsShop> list = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getShopId, goodsIds.getShopId()).in(GoodsShop::getGoodsId, goodsIds.getGoodsIds()));
        List<GoodsShop> list = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>()
                .eq(goodsIds.getShopId() != null,GoodsShop::getShopId, goodsIds.getShopId())
                .in(goodsIds.getGoodsIds() !=null ,GoodsShop::getGoodsId, goodsIds.getGoodsIds()));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/PhoneController.java
@@ -4,16 +4,16 @@
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.security.service.TokenService;
import com.ruoyi.other.api.domain.Phone;
import com.ruoyi.other.enums.PhoneType;
import com.ruoyi.other.service.PhoneService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
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;
import java.util.List;
@@ -32,6 +32,15 @@
public class PhoneController extends BaseController {
    @Resource
    private PhoneService phoneService;
    @Resource
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    /**
     * 查询指定门店手机号
@@ -43,5 +52,57 @@
                .eq(Phone::getType, PhoneType.SHOP.getCode())
                .eq(Phone::getShopId, shopId)));
    }
    @GetMapping("/getSysPhone")
    @ApiOperation(value = "获取客服电话", tags = {"管理后台-客服电话", "门店后台-客服电话"})
    public R<Phone> getSysPhone(){
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        LambdaQueryWrapper<Phone> wrapper = new LambdaQueryWrapper<>();
        if(sysUser.getRoleType() == 1){
            wrapper.eq(Phone::getType, 1);
        }else{
            wrapper.eq(Phone::getType, 2).eq(Phone::getShopId, sysUser.getObjectId());
        }
        Phone one = phoneService.getOne(wrapper);
        return R.ok(one);
    }
    @PostMapping("/savePhone")
    @ApiOperation(value = "保存客服电话", tags = {"管理后台-客服电话", "门店后台-客服电话"})
    public R savePhone(@RequestBody Phone phone){
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        //平台配置
        if(sysUser.getRoleType() == 1){
            Phone one = phoneService.getOne(new LambdaQueryWrapper<Phone>().eq(Phone::getType, 1));
            if(null != one){
                one.setPhoneOne(phone.getPhoneOne());
                one.setPhoneTwo(phone.getPhoneTwo());
                phoneService.updateById(one);
            }else{
                phone.setType(1);
                phoneService.save(phone);
            }
        }else{
            //门店配置
            Phone one = phoneService.getOne(new LambdaQueryWrapper<Phone>().eq(Phone::getType, 2).eq(Phone::getShopId, sysUser.getObjectId()));
            if(null != one){
                one.setPhoneOne(phone.getPhoneOne());
                one.setPhoneTwo(phone.getPhoneTwo());
                phoneService.updateById(one);
            }else{
                phone.setType(2);
                phone.setShopId(sysUser.getObjectId());
                phoneService.save(phone);
            }
        }
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -6,10 +6,12 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.other.api.domain.Share;
import com.ruoyi.other.enums.ShareAddType;
import com.ruoyi.other.enums.ShareAuditStatus;
import com.ruoyi.other.service.ShareService;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -113,7 +115,8 @@
    @ApiOperation(value = "添加", tags = {"后台-分享管理"})
    @PostMapping("/manage/add")
    public R<Void> manage(@RequestBody Share share){
        Long userid = tokenService.getLoginUser().getUserid();
        LoginUser loginUser = SecurityUtils.getLoginUser();
        Long userid = loginUser.getSysUser().getUserId();
        share.setAddType(1);
            share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode());
            share.setObjectId(userid.toString());
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -6,19 +6,16 @@
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.api.domain.Technician;
import com.ruoyi.other.enums.ShopStatus;
import com.ruoyi.other.service.ShopScoreService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.service.TechnicianService;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.ShopDetailVO;
import com.ruoyi.other.vo.VerifiableShopVo;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -52,6 +49,7 @@
    private ShopScoreService shopScoreService;
    @Resource
    private TokenService tokenService;
    @PostMapping("/getDetailById")
@@ -119,15 +117,6 @@
    @ResponseBody
    @GetMapping("/getVerifiableShop")
    @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
    public R<List<VerifiableShopVo>> getVerifiableShop(){
        // todo 待完善 pu
        return R.ok();
    }
    /**
     * 根据id获取门店信息
     * @param id
@@ -152,5 +141,12 @@
        Shop one = shopService.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getPhone, phone).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        return R.ok(one);
    }
    @PostMapping("/getShopByUserIds")
    public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds){
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getAppUserId, userIds));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -6,6 +6,7 @@
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.domain.Technician;
import com.ruoyi.other.api.domain.TechnicianScore;
import com.ruoyi.other.service.TechnicianScoreService;
import com.ruoyi.other.service.TechnicianService;
@@ -99,9 +100,16 @@
     */
    @GetMapping("/technicianListByShopId")
    @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"})
    public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) {
    public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name) {
        startPage();
        return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId)));
        return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId,name)));
    }
    @GetMapping("/getById")
    @ApiOperation(value = "技师详情", tags = {"技师详情-小程序"})
    public R<Technician> getById(@RequestParam("id") Integer id){
        Technician byId = technicianService.getById(id);
        return R.ok(byId);
    }
    /**
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -52,7 +52,7 @@
    @PostMapping("/subscribe")
    @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表-预约技师"})
    public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) {
        technicianSubscribeService.subscribe(technicianSubscribe, technicianSubscribe.getTechnicianId());
        technicianSubscribeService.subscribe(technicianSubscribe);
        return R.ok();
    }
@@ -104,6 +104,13 @@
        return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status));
    }
    @GetMapping("/getSubscribeByOrderId")
    @ApiOperation(value = "根据订单id获取预约信息", notes = "根据订单id获取预约信息", tags = {"后台-技师预约管理-根据订单id获取预约信息"})
    public R<TechnicianSubscribe> getSubscribeByOrderId(@ApiParam(value = "订单id") @RequestParam Long orderId) {
        return R.ok(technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>()
                .eq(TechnicianSubscribe::getOrderId, orderId)));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
@@ -4,6 +4,7 @@
import com.ruoyi.other.api.domain.Technician;
import com.ruoyi.other.vo.TechnicianDetailVO;
import com.ruoyi.other.vo.TechnicianVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -17,7 +18,7 @@
 */
public interface TechnicianMapper extends BaseMapper<Technician> {
    List<TechnicianVO> selectTechnicianListByShopId(Long shopId);
    List<TechnicianVO> selectTechnicianListByShopId(@Param("shopId") Long shopId,@Param("name") String name);
    TechnicianDetailVO selectTechnicianDetail(Long technicianId);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java
@@ -21,4 +21,5 @@
    List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude);
    ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java
@@ -16,7 +16,7 @@
 * @since 2024-11-20
 */
public interface TechnicianService extends IService<Technician> {
    List<TechnicianVO> getTechnicianListByShopId(Long shopId);
    List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name);
    TechnicianDetailVO technicianDetail(Long technicianId);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java
@@ -25,5 +25,5 @@
    IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status);
    void subscribe(TechnicianSubscribe technicianSubscribe, Long technicianId);
    void subscribe(TechnicianSubscribe technicianSubscribe);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -3,12 +3,15 @@
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.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 com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -27,15 +30,24 @@
public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService {
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @Resource
    private TokenService tokenService;
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) {
        List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates();
        for (GoodsEvaluate goodsEvaluate : evaluates) {
            goodsEvaluate.setStatus(2);
            if (StringUtils.isNotEmpty(goodsEvaluate.getIdStr())){
                goodsEvaluate.setId(Long.valueOf(goodsEvaluate.getIdStr()));
                updateById(goodsEvaluate);
            }else {
                LoginUser loginUserApplet = tokenService.getLoginUserApplet();
                goodsEvaluate.setAppUserId(loginUserApplet.getUserid());
                save(goodsEvaluate);
            }
        }
        this.saveBatch(evaluates);
        if (CollectionUtil.isNotEmpty(evaluates)){
            Order order = new Order();
            order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId());
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
@@ -39,8 +39,8 @@
    private TechnicianScoreService technicianScoreService;
    @Override
    public List<TechnicianVO> getTechnicianListByShopId(Long shopId) {
        return technicianMapper.selectTechnicianListByShopId(shopId);
    public List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name) {
        return technicianMapper.selectTechnicianListByShopId(shopId,name);
    }
    @Override
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
@@ -3,10 +3,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.other.api.domain.TechnicianSubscribe;
import com.ruoyi.other.enums.TechnicianStatus;
import com.ruoyi.other.mapper.TechnicianMapper;
import com.ruoyi.other.mapper.TechnicianSubscribeMapper;
import com.ruoyi.other.service.TechnicianSubscribeService;
import com.ruoyi.other.vo.TechnicianSubscribeVO;
@@ -29,7 +30,7 @@
    @Resource
    private TechnicianSubscribeMapper technicianSubscribeMapper;
    @Resource
    private TechnicianMapper technicianMapper;
    private RemoteOrderGoodsClient orderGoodsClient;
    @Override
    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) {
@@ -41,22 +42,21 @@
    }
    @Override
//    @DistributedLock(lockNamePre = "#technician_subscribe_lock", lockNamePost = "#technicianId")
    public void subscribe(TechnicianSubscribe subscribe, Long technicianId) {
//        Long count = technicianSubscribeMapper.selectCount(new LambdaQueryWrapper<TechnicianSubscribe>()
//                .eq(TechnicianSubscribe::getTechnicianId, technicianId)
//                .eq(TechnicianSubscribe::getSubscribeTime, subscribe.getSubscribeTime())
//                .eq(TechnicianSubscribe::getStatus, TechnicianStatus.UNSUBSCRIBE.getCode()));
//        if (count > 0) {
//            throw new ServiceException("当前时间段已被预约", TechnicianErrorCode.TECHNICIAN_ALREADY_SUBSCRIBED.getCode());
//        }
        // 创建技师预约单
        Long userId = SecurityUtils.getUserId();
        subscribe.setAppUserId(userId);
        subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode());
        subscribe.setDelFlag(0);
        subscribe.setCreateTime(LocalDateTime.now());
        technicianSubscribeMapper.insert(subscribe);
    public void subscribe(TechnicianSubscribe subscribe) {
        if (StringUtils.isNotEmpty(subscribe.getIdStr())){
            subscribe.setId(Long.parseLong(subscribe.getIdStr()));
            technicianSubscribeMapper.updateById(subscribe);
        }else {
            Long userId = SecurityUtils.getUserId();
            subscribe.setAppUserId(userId);
            subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode());
            subscribe.setDelFlag(0);
            subscribe.setCreateTime(LocalDateTime.now());
            technicianSubscribeMapper.insert(subscribe);
        }
        if (subscribe.getTechnicianId() != null){
            orderGoodsClient.subscribe(subscribe.getOrderId(), subscribe.getTechnicianId());
        }
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java
@@ -60,4 +60,6 @@
    @ApiModelProperty(value = "纬度")
    private String latitude;
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
@@ -17,6 +17,9 @@
          tt.`status` = 2
          AND tt.del_flag = 0
          AND tt.shop_id = #{shopId}
        <if test="name != null and name != ''">
            AND tt.`name` LIKE concat('%', #{name}, '%')
        </if>
        GROUP BY
            tt.id,
            tt.`name`,
@@ -30,13 +33,12 @@
            tt.`name`,
            tt.introduction,
            tt.home_picture,
            COUNT(tts.id) AS serviceCount,
            COUNT(DISTINCT tts.id) AS serviceCount,
            AVG(ttsc.score) AS score,
            tt.info_picture
        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
          tt.`status` = 2
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml
@@ -26,7 +26,7 @@
    <select id="getTechnicianSubscribeByUser" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO">
        SELECT  * from (
        SELECT
            tts.id,
            CAST(tts.id AS CHAR) id,
            tts.user_address,
            ts.`name` shopName,
            ts.address shopAddress,