fix:定时插入缺陷修改
This commit is contained in:
parent
2c9214d70b
commit
81f7162036
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.job.sechedule;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
@ -34,7 +35,7 @@ public class IssuesJob {
|
|||
try {
|
||||
List<IssuesDao> issues = issuesService.getIssues(l.getCaseId());
|
||||
int issuesCount = issues.size();
|
||||
testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString());
|
||||
testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), JSON.toJSONString(issues));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("定时任务处理bug数量报错planId: " + l.getPlanId(), e);
|
||||
}
|
||||
|
|
|
@ -3,14 +3,14 @@ package io.metersphere.track.issue;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.IssuesMapper;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.base.mapper.TestCaseIssuesMapper;
|
||||
import io.metersphere.base.mapper.WorkspaceMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtIssuesMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.IntegrationRequest;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
|
@ -51,10 +51,14 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
protected ResourceService resourceService;
|
||||
protected RestTemplate restTemplateIgnoreSSL;
|
||||
protected UserService userService;
|
||||
|
||||
protected WorkspaceMapper workspaceMapper;
|
||||
protected ProjectMapper projectMapper;
|
||||
protected String testCaseId;
|
||||
protected String projectId;
|
||||
protected String key;
|
||||
protected String orgId;
|
||||
protected String userId;
|
||||
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
|
@ -90,16 +94,12 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
this.resourceService = CommonBeanFactory.getBean(ResourceService.class);
|
||||
this.testCaseId = issuesRequest.getTestCaseId();
|
||||
this.projectId = issuesRequest.getProjectId();
|
||||
|
||||
this.orgId = issuesRequest.getOrganizationId();
|
||||
this.userId = issuesRequest.getUserId();
|
||||
this.restTemplateIgnoreSSL = restTemplate;
|
||||
}
|
||||
|
||||
protected String getPlatformConfig(String platform) {
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
String orgId = user.getLastOrganizationId();
|
||||
/*
|
||||
String orgId = "88aceecf-5764-4094-96a9-f82bd52e77ad";
|
||||
*/
|
||||
IntegrationRequest request = new IntegrationRequest();
|
||||
if (StringUtils.isBlank(orgId)) {
|
||||
MSException.throwException("organization id is null");
|
||||
|
|
|
@ -52,7 +52,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
||||
if (StringUtils.isNotBlank(config)) {
|
||||
jiraConfig = JSONObject.parseObject(config, JiraConfig.class);
|
||||
UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(orgId, SessionUtils.getUserId());
|
||||
UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(orgId, userId);
|
||||
if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getJiraAccount())
|
||||
&& StringUtils.isNotBlank(userPlatInfo.getJiraPassword())) {
|
||||
jiraConfig.setAccount(userPlatInfo.getJiraAccount());
|
||||
|
|
|
@ -14,6 +14,7 @@ public class IssuesRequest extends BaseQueryRequest {
|
|||
private String projectId;
|
||||
private String testCaseId;
|
||||
private List<String> tapdUsers;
|
||||
private String userId;
|
||||
/**
|
||||
* zentao bug 处理人
|
||||
*/
|
||||
|
|
|
@ -2,10 +2,7 @@ package io.metersphere.track.service;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.IssueTemplateMapper;
|
||||
import io.metersphere.base.mapper.IssuesMapper;
|
||||
import io.metersphere.base.mapper.TestCaseIssuesMapper;
|
||||
import io.metersphere.base.mapper.WorkspaceMapper;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtIssuesMapper;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
|
@ -71,6 +68,8 @@ public class IssuesService {
|
|||
private WorkspaceMapper workspaceMapper;
|
||||
@Resource
|
||||
private IssueTemplateService issueTemplateService;
|
||||
@Resource
|
||||
private TestCaseMapper testCaseMapper;
|
||||
|
||||
public void testAuth(String platform) {
|
||||
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
|
||||
|
@ -139,6 +138,13 @@ public class IssuesService {
|
|||
issueRequest.setTestCaseId(caseId);
|
||||
ServiceUtils.getDefaultOrder(issueRequest.getOrders());
|
||||
Project project = getProjectByCaseId(caseId);
|
||||
String workspaceId = project.getWorkspaceId();
|
||||
Workspace workspace = workspaceMapper.selectByPrimaryKey(workspaceId);
|
||||
TestCase testCase = testCaseMapper.selectByPrimaryKey(caseId);
|
||||
String orgId = workspace.getOrganizationId();
|
||||
String userId = testCase.getMaintainer();
|
||||
issueRequest.setOrganizationId(orgId);
|
||||
issueRequest.setUserId(userId);
|
||||
return getIssuesByProject(issueRequest, project);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue