From ec213a71112c17cb268ae2c5336348f496e7b3ae Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 26 五月 2025 17:31:24 +0800
Subject: [PATCH] 修改接口

---
 ruoyi-system/src/main/resources/mapper/system/TQaTestItemReportMapper.xml               |    6 ++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java  |   22 +++++++++++++++++-----
 ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaProduceReportVO.java                  |    4 ++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaTestItemReportController.java |   13 +++++++++++++
 ruoyi-system/src/main/java/com/ruoyi/system/query/TQaTestItemReportQuery.java           |    5 +++++
 5 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java
index bdf9a2d..839d2a4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java
@@ -6,6 +6,7 @@
 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.*;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.dto.AuditStatusDTO;
@@ -16,10 +17,7 @@
 import com.ruoyi.system.model.TQaProduceReport;
 import com.ruoyi.system.model.TQaReportFile;
 import com.ruoyi.system.query.TQaProduceReportQuery;
-import com.ruoyi.system.service.TProjectTeamService;
-import com.ruoyi.system.service.TProjectTeamStaffService;
-import com.ruoyi.system.service.TQaProduceReportService;
-import com.ruoyi.system.service.TQaReportFileService;
+import com.ruoyi.system.service.*;
 import com.ruoyi.system.vo.TQaProduceReportVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -50,13 +48,15 @@
     private final TokenService tokenService;
     private final TProjectTeamService projectTeamService;
     private final TProjectTeamStaffService projectTeamStaffService;
+    private final ISysUserService sysUserService;
     @Autowired
-    public TQaProduceReportController(TQaProduceReportService qaProduceReportService, TQaReportFileService qaReportFileService, TokenService tokenService, TProjectTeamService projectTeamService, TProjectTeamStaffService projectTeamStaffService) {
+    public TQaProduceReportController(TQaProduceReportService qaProduceReportService, TQaReportFileService qaReportFileService, TokenService tokenService, TProjectTeamService projectTeamService, TProjectTeamStaffService projectTeamStaffService, ISysUserService sysUserService) {
         this.qaProduceReportService = qaProduceReportService;
         this.qaReportFileService = qaReportFileService;
         this.tokenService = tokenService;
         this.projectTeamService = projectTeamService;
         this.projectTeamStaffService = projectTeamStaffService;
+        this.sysUserService = sysUserService;
     }
 
     /**
@@ -225,6 +225,18 @@
                 .eq(TQaReportFile::getReportId, id)
                 .ne(TQaReportFile::getReportType, QaReportFileEnum.TEST_REPORT.getCode()));
         qaProduceReportVO.setQaReportFileList(qaReportFiles);
+        // 获取项目组名称
+        qaProduceReportVO.setTeamName(projectTeamService.getById(qaProduceReport.getTeamId()).getTeamName());
+        // 获取审批人名称
+        SysUser sysUser = sysUserService.selectUserById(qaProduceReport.getAuditPersonId());
+        if (Objects.nonNull(sysUser)) {
+            qaProduceReportVO.setAuditPersonName(sysUser.getNickName());
+        }
+        // 获取评定人名称
+        SysUser sysUser1 = sysUserService.selectUserById(qaProduceReport.getEvaluatePersonId());
+        if (Objects.nonNull(sysUser1)) {
+            qaProduceReportVO.setEvaluatePersonName(sysUser1.getNickName());
+        }
         return R.ok(qaProduceReportVO);
     }
 
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaTestItemReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaTestItemReportController.java
index 986e677..6259dfe 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaTestItemReportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaTestItemReportController.java
@@ -32,6 +32,7 @@
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -68,6 +69,18 @@
     @PostMapping(value = "/api/t-qa-test-item-report/pageList")
     public R<PageInfo<TQaTestItemReportVO>> pageList(@RequestBody String param) {
         TQaTestItemReportQuery query = JSON.parseObject(param, TQaTestItemReportQuery.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(qaTestItemReportService.pageList(query));
     }
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/TQaTestItemReportQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/TQaTestItemReportQuery.java
index e71ffbb..ab17af9 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/query/TQaTestItemReportQuery.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/TQaTestItemReportQuery.java
@@ -5,6 +5,8 @@
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 @ApiModel(value = "QA检测项检测报告分页query")
 public class TQaTestItemReportQuery extends BasePage {
@@ -24,4 +26,7 @@
     @ApiModelProperty(value = "状态  -1=草稿箱 1=待审核 2=已通过 3=已驳回 4=已撤销")
     private Integer status;
 
+    @ApiModelProperty(value = "项目组id集合 前端忽略")
+    private List<String> teamIds;
+
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaProduceReportVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaProduceReportVO.java
index 66f5ec9..5f99625 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaProduceReportVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaProduceReportVO.java
@@ -14,6 +14,10 @@
 
     @ApiModelProperty(value = "项目组名称")
     private String teamName;
+    @ApiModelProperty(value = "审批人名称")
+    private String auditPersonName;
+    @ApiModelProperty(value = "评定人名称")
+    private String evaluatePersonName;
 
     @ApiModelProperty(value = "检测报告文件")
     private List<TQaReportFile> qaReportFileList;
diff --git a/ruoyi-system/src/main/resources/mapper/system/TQaTestItemReportMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TQaTestItemReportMapper.xml
index 9b92717..ba88585 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TQaTestItemReportMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TQaTestItemReportMapper.xml
@@ -54,6 +54,12 @@
             <if test="query.reportContent != null and query.reportContent != ''">
                 and tqtir.report_content = #{query.reportContent}
             </if>
+            <if test="query.teamIds != null and query.teamIds.size() > 0">
+                and tqti.team_id in
+                <foreach item="teamId" collection="query.teamIds" separator="," close=")" open="(" index="">
+                    #{teamId}
+                </foreach>
+            </if>
             <if test="query.status != null">
                 and tqtir.status = #{query.status}
             </if>

--
Gitblit v1.7.1