| | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.QATestItemStatusEnum; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TQaTestItemDTO; |
| | | import com.ruoyi.system.dto.UpAndDownDTO; |
| | | import com.ruoyi.system.dto.TQaTestItemEvaluateDTO; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import com.ruoyi.system.model.TProjectTeam; |
| | | import com.ruoyi.system.model.TProjectTeamStaff; |
| | | import com.ruoyi.system.model.TQaTestItem; |
| | | import com.ruoyi.system.model.TQaTestItemReport; |
| | | import com.ruoyi.system.query.TQaTestItemQuery; |
| | | import com.ruoyi.system.service.TProjectTeamService; |
| | | import com.ruoyi.system.service.TProjectTeamStaffService; |
| | | import com.ruoyi.system.service.TQaTestItemReportService; |
| | | import com.ruoyi.system.service.TQaTestItemService; |
| | | import com.ruoyi.system.vo.TProjectTeamVO; |
| | | import com.ruoyi.system.vo.TQaTestItemReportVO; |
| | | import com.ruoyi.system.vo.TQaTestItemVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Api(tags = "QA检测项管理") |
| | | @RestController |
| | | @RequestMapping("/t-qa-test-item") |
| | | @RequestMapping("") |
| | | public class TQaTestItemController { |
| | | |
| | | private final TQaTestItemService qaTestItemService; |
| | | private final TQaTestItemReportService qaTestItemReportService; |
| | | private final TokenService tokenService; |
| | | private final TProjectTeamService projectTeamService; |
| | | private final TProjectTeamStaffService projectTeamStaffService; |
| | | private final SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | public TQaTestItemController(TQaTestItemService qaTestItemService, TQaTestItemReportService qaTestItemReportService) { |
| | | public TQaTestItemController(TQaTestItemService qaTestItemService, TQaTestItemReportService qaTestItemReportService, TokenService tokenService, TProjectTeamService projectTeamService, TProjectTeamStaffService projectTeamStaffService, SysUserMapper sysUserMapper) { |
| | | this.qaTestItemService = qaTestItemService; |
| | | this.qaTestItemReportService = qaTestItemReportService; |
| | | this.tokenService = tokenService; |
| | | this.projectTeamService = projectTeamService; |
| | | this.projectTeamStaffService = projectTeamStaffService; |
| | | this.sysUserMapper = sysUserMapper; |
| | | } |
| | | |
| | | /** |
| | | * 获取QA检测项管理管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:list')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:list')") |
| | | @ApiOperation(value = "获取QA检测项管理分页列表", response = TQaTestItemQuery.class) |
| | | @PostMapping(value = "/api/t-qa-test-item/pageList") |
| | | public R<PageInfo<TQaTestItemVO>> pageList(@RequestBody String param) { |
| | | TQaTestItemQuery query = JSON.parseObject(param, TQaTestItemQuery.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType != 1){ |
| | | // 查询用户所在项目组 |
| | | List<TProjectTeamStaff> projectTeamStaffs = projectTeamStaffService.list(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId)); |
| | | if(projectTeamStaffs.size() > 0){ |
| | | // 查询项目组id |
| | | List<String> teamIds = projectTeamStaffs.stream().map(TProjectTeamStaff::getTeamId).distinct().collect(Collectors.toList()); |
| | | query.setTeamIds(teamIds); |
| | | } |
| | | } |
| | | return R.ok(qaTestItemService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取QA检测项管理评定列表 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:evaluateList')") |
| | | @ApiOperation(value = "获取QA检测项管理评定列表", response = TQaTestItemQuery.class) |
| | | @PostMapping(value = "/api/t-qa-test-item/evaluateList") |
| | | public R<PageInfo<TQaTestItemVO>> evaluateList(@RequestBody String param) { |
| | | TQaTestItemQuery query = JSON.parseObject(param, TQaTestItemQuery.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType != 1){ |
| | | // 查询用户所在项目组 |
| | | List<TProjectTeamStaff> projectTeamStaffs = projectTeamStaffService.list(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId)); |
| | | if(projectTeamStaffs.size() > 0){ |
| | | // 查询项目组id |
| | | List<String> teamIds = projectTeamStaffs.stream().map(TProjectTeamStaff::getTeamId).distinct().collect(Collectors.toList()); |
| | | query.setTeamIds(teamIds); |
| | | } |
| | | } |
| | | return R.ok(qaTestItemService.evaluateList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加QA检测项管理管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:add')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:add')") |
| | | @Log(title = "QA检测项管理信息-新增QA检测项管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加QA检测项管理",response = TQaTestItemDTO.class) |
| | | @PostMapping(value = "/api/t-qa-test-item/add") |
| | |
| | | /** |
| | | * 修改QA检测项管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:edit')") |
| | | @Log(title = "QA检测项管理信息-修改QA检测项管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改QA检测项管理") |
| | | @PostMapping(value = "/api/t-qa-test-item/update") |
| | |
| | | /** |
| | | * 查看QA检测项管理详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:detail')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:detail')") |
| | | @ApiOperation(value = "查看QA检测项管理详情") |
| | | @GetMapping(value = "/open/t-qa-test-item/getDetailById") |
| | | public R<TQaTestItemVO> getDetailById(@RequestParam String id) { |
| | |
| | | // 查询QA检测项检测报告 |
| | | List<TQaTestItemReportVO> qaTestItemReportVOS= qaTestItemReportService.getList(id); |
| | | testItemVO.setQaTestItemReportList(qaTestItemReportVOS); |
| | | // 查询项目组名称 |
| | | TProjectTeam projectTeam = projectTeamService.getById(testItemVO.getTeamId()); |
| | | TProjectTeamVO projectTeamVO = new TProjectTeamVO(); |
| | | BeanUtils.copyProperties(projectTeam, projectTeamVO); |
| | | // 查询项目组成员 |
| | | List<TProjectTeamStaff> list = projectTeamStaffService.list(Wrappers.lambdaQuery(TProjectTeamStaff.class).eq(TProjectTeamStaff::getTeamId, testItemVO.getTeamId())); |
| | | if (!CollectionUtils.isEmpty(list)){ |
| | | List<Long> userIds = list.stream().map(TProjectTeamStaff::getUserId).distinct().collect(Collectors.toList()); |
| | | // 查询所有人员 |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(userIds); |
| | | for (TProjectTeamStaff tProjectTeamStaff : list) { |
| | | sysUsers.stream().filter(sysUser -> sysUser.getUserId().equals(tProjectTeamStaff.getUserId())).forEach(sysUser -> { |
| | | tProjectTeamStaff.setNickName(sysUser.getNickName()); |
| | | tProjectTeamStaff.setAvatar(sysUser.getAvatar()); |
| | | }); |
| | | } |
| | | projectTeamVO.setStaffs(list); |
| | | } |
| | | testItemVO.setProjectTeamVO(projectTeamVO); |
| | | return R.ok(testItemVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除QA检测项管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") |
| | | @Log(title = "QA检测项管理信息-删除QA检测项管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除QA检测项管理") |
| | | @DeleteMapping(value = "/open/t-qa-test-item/deleteById") |
| | |
| | | /** |
| | | * 批量删除QA检测项管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") |
| | | @Log(title = "QA检测项管理信息-删除QA检测项管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除QA检测项管理") |
| | | @DeleteMapping(value = "/open/t-qa-test-item/deleteByIds") |
| | |
| | | /** |
| | | * 修改QA检测项管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:qaTestItem:commitEvaluate')") |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:commitEvaluate')") |
| | | @Log(title = "QA检测项管理信息-提交评价QA检测项管理状态", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改QA检测项管理状态") |
| | | @PutMapping(value = "/open/t-qa-test-item/commitEvaluate") |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 评定QA检测项管理 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:qaTestItem:evaluate')") |
| | | @Log(title = "QA检测项管理信息-评定QA检测项管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "评定QA检测项管理",response = TQaTestItemEvaluateDTO.class) |
| | | @PostMapping(value = "/api/t-qa-test-item/evaluate") |
| | | public R<Boolean> evaluate(@RequestBody String param) { |
| | | TQaTestItemEvaluateDTO dto = JSON.parseObject(param,TQaTestItemEvaluateDTO.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | TQaTestItem testItem = qaTestItemService.getById(dto); |
| | | testItem.setStatus(QATestItemStatusEnum.EVALUATED.getCode()); |
| | | testItem.setEvaluatePersonId(userId); |
| | | testItem.setEvaluateTime(LocalDateTime.now()); |
| | | testItem.setEvaluateScore(dto.getEvaluateScore()); |
| | | qaTestItemService.updateById(testItem); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |