From d0c0d02f9721ad6971621d264e27a45a2cc9bbc6 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 6 Nov 2024 13:58:56 +0800 Subject: [PATCH] 1 --- .../controller/app/ApiAppLoginController.java | 16 ++++ .../staff/mapper/CompanyStaffMapper.java | 10 +++ .../staff/service/CompanyStaffService.java | 8 ++ .../service/impl/CompanyStaffServiceImpl.java | 81 ++++++++++++++++++- .../module/staff/vo/CompanyStaffRespVO.java | 4 + .../mapper/staff/CompanyStaffMapper.xml | 11 +++ 6 files changed, 127 insertions(+), 3 deletions(-) diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/app/ApiAppLoginController.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/app/ApiAppLoginController.java index 4ded4b19..b8f63318 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/app/ApiAppLoginController.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/app/ApiAppLoginController.java @@ -1,9 +1,12 @@ package cn.iocoder.yudao.module.staff.controller.app; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.module.staff.service.ApiAppLoginService; +import cn.iocoder.yudao.module.staff.service.CompanyStaffService; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -19,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController; public class ApiAppLoginController { @Autowired private ApiAppLoginService apiAppLoginService; + @Autowired + private CompanyStaffService companyStaffService; /** * 登录获取验证码 @@ -33,5 +38,16 @@ public class ApiAppLoginController { return apiAppLoginService.loginSmsCode(phone,sysCode); } + /** + * 客户查我的邀请人 + * @author vinjor-M + * @date 10:40 2024/11/6 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @GetMapping("/getMyAdviser") + @TenantIgnore + public CommonResult getMyAdviser(Long tenantId,String sysCode) { + return CommonResult.success(companyStaffService.getMyAdviser(tenantId,sysCode)); + } } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/mapper/CompanyStaffMapper.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/mapper/CompanyStaffMapper.java index e411164f..5f8c22c2 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/mapper/CompanyStaffMapper.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/mapper/CompanyStaffMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.staff.mapper; import cn.iocoder.yudao.module.staff.entity.CompanyStaff; import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO; +import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -17,4 +18,13 @@ import org.apache.ibatis.annotations.Param; public interface CompanyStaffMapper extends BaseMapper { IPage selectListPage(@Param("map") CompanyStaffReqVO companyStaffReqVO, Page page); + /** + * 客户查我的邀请人 + * @author vinjor-M + * @date 11:05 2024/11/6 + * @param tenantId 租户ID + * @param userId userId + * @return cn.iocoder.yudao.module.staff.entity.CompanyStaff + **/ + CompanyStaffRespVO selectMyAdviser(@Param("tenantId") Long tenantId, @Param("userId") Long userId); } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/CompanyStaffService.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/CompanyStaffService.java index 96e7ec0f..1fce4aa7 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/CompanyStaffService.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/CompanyStaffService.java @@ -131,4 +131,12 @@ public interface CompanyStaffService extends IService { * @date 17:23 2024/10/15 **/ void setStaffUnicode(); + + /** + * 客户查我的邀请人 + * @author vinjor-M + * @date 10:49 2024/11/6 + * @return cn.iocoder.yudao.module.staff.entity.CompanyStaff + **/ + CompanyStaffRespVO getMyAdviser(Long tenantId,String sysCode); } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java index b5b1cd61..977fed6b 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java @@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.staff.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; -import cn.iocoder.yudao.common.BaseConstants; -import cn.iocoder.yudao.common.CommonErrorCodeConstants; -import cn.iocoder.yudao.common.InviterTypeEnum; +import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; @@ -40,6 +38,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -610,4 +609,80 @@ public class CompanyStaffServiceImpl extends ServiceImpl byUserId = permissionApi.getRoleIdsByUserId(userId); + // 所有的角色信息 + List roleList = roleApi.getRoleList(); + // 过滤出登录用户有的角色信息 + List collect = roleList.stream().filter(item -> byUserId.contains(item.getId())).collect(Collectors.toList()); + // 取出角色名称 + List codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList()); + // 维修业务管理员--可以看所有数据,但不能做操作 + if (codes.contains(RepairRoleEnum.ADMIN.getCode())) { + return RepairRoleEnum.ADMIN.getName(); + } + // 总检 + if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) { + return RepairRoleEnum.INSPECTION.getName(); + } + // 服务顾问 + if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) { + return RepairRoleEnum.ADVISOR.getName(); + } + // 维修工(或班组长) + if (codes.contains(RepairRoleEnum.REPAIR_STAFF.getCode())) { + return RepairRoleEnum.REPAIR_STAFF.getName(); + } + // 维修仓库管理员 + if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) { + return RepairRoleEnum.WAREHOUSE.getName(); + } + // 维修财务 + if (codes.contains(RepairRoleEnum.WXCW.getCode())) { + return RepairRoleEnum.WXCW.getName(); + } + // 啥也不是 + return ""; + } } diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffRespVO.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffRespVO.java index 8c7e3e7d..2bc2ec76 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffRespVO.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffRespVO.java @@ -27,4 +27,8 @@ public class CompanyStaffRespVO extends CompanyStaff { * 员工标签 **/ List labelsArray; + /** + * 角色名称 + **/ + private String roleName; } diff --git a/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml b/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml index b4794795..4c129cb6 100644 --- a/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml +++ b/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml @@ -104,4 +104,15 @@ order by cs.create_time desc + \ No newline at end of file