| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.server.Sys; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.ChoiceDTO; |
| | | import com.ruoyi.system.dto.SysUserDTO; |
| | | import com.ruoyi.system.dto.TProjectTeamDTO; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TProjectTeamStaffService projectTeamStaffService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | /** |
| | | * 获取项目组管理列表 |
| | | */ |
| | |
| | | public R<PageInfo<TProjectTeamVO>> pageList(@RequestBody String param) { |
| | | TProjectTeamQuery query = JSON.parseObject(param, TProjectTeamQuery.class); |
| | | return R.ok(projectTeamService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取当前用户的所属项目组") |
| | | @PostMapping(value = "/api/t_project_myteam/pageList") |
| | | public R<List<TProjectTeam>> myTeamPageList() { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | List<TProjectTeam> list; |
| | | |
| | | // 判断是否为管理员(超级管理员) |
| | | if (tokenService.getLoginUser().getUser().isAdmin()) { |
| | | // 管理员查询全部 |
| | | list = projectTeamService.lambdaQuery() |
| | | .eq(TProjectTeam::getStatus, 1) |
| | | .list(); |
| | | } else { |
| | | // 普通用户查询自己的项目组 |
| | | List<String> projetIds = projectTeamStaffService.lambdaQuery() |
| | | .eq(TProjectTeamStaff::getUserId, userId) |
| | | .list() |
| | | .stream() |
| | | .map(TProjectTeamStaff::getTeamId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (projetIds.isEmpty()) { |
| | | list = new ArrayList<>(); |
| | | } else { |
| | | list = projectTeamService.lambdaQuery() |
| | | .eq(TProjectTeam::getStatus, 1) |
| | | .in(TProjectTeam::getId, projetIds) |
| | | .list(); |
| | | } |
| | | } |
| | | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增报告-获取项目组分页列表") |
| | | @PostMapping(value = "/api/t_project_team/pageList1") |
| | | public R<PageInfo<TProjectTeamVO>> pageList1(@RequestBody String param) { |
| | | TProjectTeamQuery query = JSON.parseObject(param, TProjectTeamQuery.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | if (!sysUser.getRoleType().equals("1")){ |
| | | List<String> projetIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, userId).list() |
| | | .stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (projetIds.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | query.setProjectIds(projetIds); |
| | | } |
| | | return R.ok(projectTeamService.pageList1(query)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public R<Boolean> upAndDown(@RequestBody String param) { |
| | | UpAndDownDTO dto = JSON.parseObject(param,UpAndDownDTO.class); |
| | | TProjectTeam projectTeam = projectTeamService.getById(dto.getId()); |
| | | projectTeam.setStatus(dto.getStatus()); |
| | | if (projectTeam.getStatus()==1){ |
| | | projectTeam.setStatus(2); |
| | | }else{ |
| | | projectTeam.setStatus(1); |
| | | } |
| | | projectTeamService.updateById(projectTeam); |
| | | return R.ok(); |
| | | } |