fix(工作台): 我的待办缺陷列表状态过滤有误

--bug=1032808 --user=宋昌昌 【工作台】集成local-我的待办-缺陷管理-已关闭状态仍在我的待办列表显示 https://www.tapd.cn/55049933/s/1435662
This commit is contained in:
song-cc-rock 2023-11-13 14:59:22 +08:00 committed by f2c-ci-robot[bot]
parent bcaced6e6e
commit 0039825318
5 changed files with 26 additions and 11 deletions

View File

@ -73,4 +73,8 @@ public class IssuesRequest extends BaseQueryRequest {
* 过滤缺陷ID
*/
private List<String> filterIds;
/**
* Local平台的状态自定义字段ID
*/
private String statusFieldId;
}

View File

@ -216,6 +216,7 @@
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
<property name="statusFieldId" value="request.statusFieldId"/>
</include>
</if>
<if test="request.name != null">
@ -361,13 +362,16 @@
)
or
(
issues.platform = 'Local' and
issues.status
issues.platform = 'Local' and issues.id in
(
select resource_id from custom_field_issues where field_id = #{${statusFieldId}}
and trim(both '"' from value)
<include refid="condition">
<property name="object" value="${condition}.doneStatus"/>
</include>
)
)
)
</if>
<if test="${condition}.followPeople != null">
and issues.id in (

View File

@ -32,13 +32,13 @@ import io.metersphere.service.PlatformPluginService;
import io.metersphere.xpack.track.dto.*;
import io.metersphere.xpack.track.dto.request.IssuesRequest;
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.List;
@ -58,7 +58,7 @@ public class IssuesController {
@PostMapping("/list/{goPage}/{pageSize}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_ISSUE_READ)
public Pager<List<IssuesDao>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody IssuesRequest request) {
issuesService.setFilterIds(request);
issuesService.setFilterParam(request);
if (request.getThisWeekUnClosedTestPlanIssue() && CollectionUtils.isEmpty(request.getFilterIds())) {
Page<List<Issues>> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, Collections.EMPTY_LIST);

View File

@ -11,13 +11,13 @@ import io.metersphere.commons.utils.SubListUtil;
import io.metersphere.constants.SystemCustomField;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.CustomFieldResourceDTO;
import jakarta.annotation.Resource;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -73,7 +73,7 @@ public class CustomFieldIssuesService extends CustomFieldResourceService {
if (customFieldMap == null || customFieldMap.size() == 0) {
return;
}
this.checkInit();
checkInit();
SqlSession sqlSession = ServiceUtils.getBatchSqlSession();
BaseCustomFieldResourceMapper batchMapper = sqlSession.getMapper(BaseCustomFieldResourceMapper.class);
List<CustomFieldResourceDTO> addList = new ArrayList<>();

View File

@ -2067,7 +2067,7 @@ public class IssuesService {
});
}
public void setFilterIds(IssuesRequest request) {
public void setFilterParam(IssuesRequest request) {
List<String> issueIds;
if (request.getThisWeekUnClosedTestPlanIssue()) {
Map<String, Date> weedFirstTimeAndLastTime = io.metersphere.commons.utils.DateUtils.getWeedFirstTimeAndLastTime(new Date());
@ -2105,6 +2105,13 @@ public class IssuesService {
request.setFilterIds(issueIds);
}
}
// 状态过滤时, 设置自定义状态字段ID
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
if (StringUtils.equals(project.getPlatform(), "Local")) {
CustomField statusField = baseCustomFieldService.getCustomFieldByName(request.getProjectId(), SystemCustomField.ISSUE_STATUS);
request.setStatusFieldId(statusField.getId());
}
}
public boolean thirdPartTemplateEnable(String projectId) {