| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.dto.PersonDto; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.PowerMapper; |
| | | import com.yuanchu.mom.mapper.UserMapper; |
| | | import com.yuanchu.mom.pojo.Company; |
| | | import com.yuanchu.mom.pojo.Person; |
| | | import com.yuanchu.mom.pojo.Power; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.util.HeaderToken; |
| | | import com.yuanchu.mom.vo.Result; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | |
| | | |
| | | private UserService userService; |
| | | |
| | | UserMapper userMapper; |
| | | |
| | | PowerMapper powerMapper; |
| | | |
| | | private GetLook getLook; |
| | | |
| | | @ValueClassify("用户管理") |
| | | @PostMapping("/getSampleUser") |
| | | @ApiOperation(value = "直接获取与自己相同单位的人员列表") |
| | | public Result<?> getSampleUser(){ |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify("用户管理") |
| | | @ApiOperation(value = "获取人事系统组织架构") |
| | | @GetMapping(value = "/selectCompaniesList") |
| | | public Result<List<Company>> selectCompaniesList() { |
| | | return Result.success(headerToken.companyUrl()); |
| | | //判断是否有直接获取第三方部门的权限 |
| | | Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | User user = userMapper.selectById(userId); |
| | | Integer roleId = user.getRoleId(); |
| | | Power power = powerMapper.selectOne(Wrappers.<Power>lambdaQuery().eq(Power::getRoleId, roleId).eq(Power::getMenuMethod, "getSampleUser")); |
| | | if (ObjectUtils.isNotEmpty(power)){ |
| | | List<Company> companies = new ArrayList<>(); |
| | | Company company = new Company(); |
| | | if (ObjectUtils.isEmpty(user.getCompanyId())){ |
| | | throw new ErrorException("该用户没有所属单位!"); |
| | | } |
| | | company.setCompanyId(user.getCompanyId()); |
| | | companies.add(company); |
| | | return Result.success(companies); |
| | | }else { |
| | | return Result.success(headerToken.companyUrl()); |
| | | } |
| | | } |
| | | |
| | | @ValueAuth |