refactor(测试跟踪): 缺陷xpack相关改造
This commit is contained in:
parent
89e3fa61aa
commit
e4fede9b8e
|
@ -119,6 +119,10 @@ public class DateUtils {
|
||||||
return dateSum(now, countDays).getTime() / 1000 * 1000;
|
return dateSum(now, countDays).getTime() / 1000 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long getTimestamp(String dateString) throws Exception {
|
||||||
|
return getDate(dateString).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当天的起始时间Date
|
* 获取当天的起始时间Date
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package io.metersphere.xpack.track.controller;
|
||||||
|
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
|
import io.metersphere.xpack.track.service.XpackIssueService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/xpack/issue")
|
||||||
|
public class XpackIssueController {
|
||||||
|
|
||||||
|
@GetMapping("/sync/{projectId}")
|
||||||
|
public boolean getPlatformIssue(@PathVariable String projectId) {
|
||||||
|
XpackIssueService xpackIssueService = CommonBeanFactory.getBean(XpackIssueService.class);
|
||||||
|
return xpackIssueService.syncThirdPartyIssues(projectId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.constants;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author songcc
|
* @author songcc
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.service.issue.domain.azure;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -16,7 +16,7 @@ public class AzureDevopsWorkItemsBatchResponse {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class Value {
|
public static class Value {
|
||||||
private int id;
|
private int id;
|
||||||
private int rev;
|
private int rev;
|
||||||
private Map fields;
|
private Map fields;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.request.testcase;
|
package io.metersphere.xpack.track.dto;
|
||||||
import io.metersphere.base.domain.FileMetadata;
|
import io.metersphere.base.domain.FileMetadata;
|
||||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||||
import io.metersphere.dto.CustomFieldResourceDTO;
|
import io.metersphere.dto.CustomFieldResourceDTO;
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import io.metersphere.base.domain.IssueTemplate;
|
import io.metersphere.base.domain.IssueTemplate;
|
||||||
|
import io.metersphere.dto.CustomFieldDao;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,6 +1,8 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||||
|
import io.metersphere.dto.CustomFieldDao;
|
||||||
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.service.issue.domain.jira;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.service.issue.domain.jira;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.service.issue.domain;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class TapdBaseResponse {
|
||||||
|
private int status;
|
||||||
|
private String info;
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.service.issue.domain.tapd;
|
package io.metersphere.xpack.track.dto;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -8,9 +8,6 @@ import java.util.Map;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class TapdGetIssueResponse {
|
public class TapdGetIssueResponse extends TapdBaseResponse {
|
||||||
|
|
||||||
private int status;
|
|
||||||
private List<Map> data;
|
private List<Map> data;
|
||||||
private String info;
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.request.testcase;
|
package io.metersphere.xpack.track.dto.request;
|
||||||
|
|
||||||
import io.metersphere.request.BaseQueryRequest;
|
import io.metersphere.request.BaseQueryRequest;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
|
@ -1,11 +1,11 @@
|
||||||
package io.metersphere.request.testcase;
|
package io.metersphere.xpack.track.dto.request;
|
||||||
|
|
||||||
import io.metersphere.base.domain.FileMetadata;
|
import io.metersphere.base.domain.FileMetadata;
|
||||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||||
import io.metersphere.dto.CustomFieldItemDTO;
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
import io.metersphere.dto.CustomFieldResourceDTO;
|
import io.metersphere.dto.CustomFieldResourceDTO;
|
||||||
|
|
||||||
import io.metersphere.dto.PlatformStatusDTO;
|
import io.metersphere.xpack.track.dto.PlatformStatusDTO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
package io.metersphere.service.issue;
|
package io.metersphere.xpack.track.issue;
|
||||||
|
|
||||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||||
import io.metersphere.base.domain.Project;
|
import io.metersphere.base.domain.Project;
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
|
||||||
import io.metersphere.dto.IssueTemplateDao;
|
|
||||||
import io.metersphere.dto.IssuesDao;
|
|
||||||
import io.metersphere.dto.UserDTO;
|
import io.metersphere.dto.UserDTO;
|
||||||
import io.metersphere.dto.DemandDTO;
|
import io.metersphere.xpack.track.dto.*;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.request.testcase.EditTestCaseRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -123,4 +118,12 @@ public interface IssuesPlatform {
|
||||||
* @param syncType 同步操作类型: UPLOAD, DELETE
|
* @param syncType 同步操作类型: UPLOAD, DELETE
|
||||||
*/
|
*/
|
||||||
void syncIssuesAttachment(IssuesUpdateRequest issuesRequest, File file, AttachmentSyncType syncType);
|
void syncIssuesAttachment(IssuesUpdateRequest issuesRequest, File file, AttachmentSyncType syncType);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取第三方平台的状态集合
|
||||||
|
* @param issueKey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PlatformStatusDTO> getTransitions(String issueKey);
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package io.metersphere.xpack.track.service;
|
||||||
|
|
||||||
|
public interface XpackIssueService {
|
||||||
|
|
||||||
|
boolean syncThirdPartyIssues(String projectId);
|
||||||
|
}
|
|
@ -33,7 +33,7 @@
|
||||||
from custom_field_template cft
|
from custom_field_template cft
|
||||||
inner join custom_field cf
|
inner join custom_field cf
|
||||||
on cft.field_id = cf.id
|
on cft.field_id = cf.id
|
||||||
<if test="request.templateId != null">
|
<if test="templateId != null">
|
||||||
where cft.template_id = #{templateId}
|
where cft.template_id = #{templateId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -5,7 +5,8 @@ import io.metersphere.dto.*;
|
||||||
|
|
||||||
import io.metersphere.plan.dto.PlanReportIssueDTO;
|
import io.metersphere.plan.dto.PlanReportIssueDTO;
|
||||||
import io.metersphere.request.testcase.IssuesCountRequest;
|
import io.metersphere.request.testcase.IssuesCountRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
and (resource_id = #{resourceId} or ref_id = #{resourceId})
|
and (resource_id = #{resourceId} or ref_id = #{resourceId})
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getIssuesByCaseId" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getIssuesByCaseId" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select issues.*
|
select issues.*
|
||||||
from issues
|
from issues
|
||||||
inner join test_case_issues
|
inner join test_case_issues
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getIssueForMinder" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getIssueForMinder" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select issues.id, issues.title , issues.num , test_case_issues.resource_id, test_case_issues.ref_id, test_case_issues.ref_type
|
select issues.id, issues.title , issues.num , test_case_issues.resource_id, test_case_issues.ref_id, test_case_issues.ref_type
|
||||||
from issues
|
from issues
|
||||||
inner join test_case_issues
|
inner join test_case_issues
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
issues.lastmodify
|
issues.lastmodify
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getIssues" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getIssues" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select
|
select
|
||||||
<include refid="Issue_List_Column"/>
|
<include refid="Issue_List_Column"/>
|
||||||
<if test="request.projectId != null||request.workspaceId != null">
|
<if test="request.projectId != null||request.workspaceId != null">
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPlanIssues" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getPlanIssues" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select
|
select
|
||||||
<include refid="Issue_List_Column"/>
|
<include refid="Issue_List_Column"/>
|
||||||
from issues
|
from issues
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
where i.creator = #{request.creator}
|
where i.creator = #{request.creator}
|
||||||
group by statusValue;
|
group by statusValue;
|
||||||
</select>
|
</select>
|
||||||
<select id="getRelateIssues" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getRelateIssues" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select issues.id, issues.num, issues.title, issues.project_id, issues.create_time, issues.update_time,
|
select issues.id, issues.num, issues.title, issues.project_id, issues.create_time, issues.update_time,
|
||||||
issues.description, issues.status, issues.platform, issues.custom_fields,test_case_issues.resource_id,issues.platform_status,
|
issues.description, issues.status, issues.platform, issues.custom_fields,test_case_issues.resource_id,issues.platform_status,
|
||||||
issues.lastmodify
|
issues.lastmodify
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
group by issues.id
|
group by issues.id
|
||||||
</select>
|
</select>
|
||||||
<select id="getIssueForSync" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getIssueForSync" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select id,platform, platform_id
|
select id,platform, platform_id
|
||||||
from issues
|
from issues
|
||||||
where project_id = #{projectId} and platform = #{platform} and (platform_status != 'delete' or platform_status is null);
|
where project_id = #{projectId} and platform = #{platform} and (platform_status != 'delete' or platform_status is null);
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
where project_id = #{projectId}
|
where project_id = #{projectId}
|
||||||
limit #{offset},#{pageSize}
|
limit #{offset},#{pageSize}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="io.metersphere.dto.IssuesDao">
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select
|
select
|
||||||
<include refid="Issue_List_Column" />
|
<include refid="Issue_List_Column" />
|
||||||
from issues
|
from issues
|
||||||
|
@ -150,13 +150,13 @@
|
||||||
join custom_field cf on cf.id = cfi.field_id
|
join custom_field cf on cf.id = cfi.field_id
|
||||||
where cfi.resource_id = #{issueId}
|
where cfi.resource_id = #{issueId}
|
||||||
</select>
|
</select>
|
||||||
<select id="getPlatformIssueByIds" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getPlatformIssueByIds" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select * from issues where project_id = #{projectId} and platform_id in
|
select * from issues where project_id = #{projectId} and platform_id in
|
||||||
<foreach collection="ids" item="value" separator="," open="(" close=")">
|
<foreach collection="ids" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select id="getIssueCustomFields" resultType="io.metersphere.dto.IssuesDao">
|
<select id="getIssueCustomFields" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||||
select cfi.field_id as fieldId,
|
select cfi.field_id as fieldId,
|
||||||
cf.type fieldType,
|
cf.type fieldType,
|
||||||
cft.custom_data,
|
cft.custom_data,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.Issues;
|
import io.metersphere.base.domain.Issues;
|
||||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||||
import io.metersphere.base.domain.Project;
|
|
||||||
import io.metersphere.commons.constants.NoticeConstants;
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.OperLogModule;
|
import io.metersphere.commons.constants.OperLogModule;
|
||||||
|
@ -14,7 +13,7 @@ import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.log.annotation.MsAuditLog;
|
import io.metersphere.log.annotation.MsAuditLog;
|
||||||
import io.metersphere.notice.annotation.SendNotice;
|
import io.metersphere.notice.annotation.SendNotice;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
import io.metersphere.xpack.track.dto.*;
|
||||||
import io.metersphere.service.issue.domain.jira.JiraIssueType;
|
import io.metersphere.service.issue.domain.jira.JiraIssueType;
|
||||||
import io.metersphere.service.issue.domain.zentao.ZentaoBuild;
|
import io.metersphere.service.issue.domain.zentao.ZentaoBuild;
|
||||||
|
|
||||||
|
@ -22,8 +21,8 @@ import io.metersphere.request.issues.JiraIssueTypeRequest;
|
||||||
import io.metersphere.request.issues.PlatformIssueTypeRequest;
|
import io.metersphere.request.issues.PlatformIssueTypeRequest;
|
||||||
import io.metersphere.request.testcase.AuthUserIssueRequest;
|
import io.metersphere.request.testcase.AuthUserIssueRequest;
|
||||||
import io.metersphere.request.testcase.IssuesCountRequest;
|
import io.metersphere.request.testcase.IssuesCountRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.IssuesService;
|
import io.metersphere.service.IssuesService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -185,9 +184,4 @@ public class IssuesController {
|
||||||
public List<PlatformStatusDTO> getPlatformTransitions(@RequestBody PlatformIssueTypeRequest request) {
|
public List<PlatformStatusDTO> getPlatformTransitions(@RequestBody PlatformIssueTypeRequest request) {
|
||||||
return issuesService.getPlatformTransitions(request);
|
return issuesService.getPlatformTransitions(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/check/third/project")
|
|
||||||
public void checkThirdProjectExist(@RequestBody Project project) {
|
|
||||||
issuesService.checkThirdProjectExist(project);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.metersphere.controller;
|
package io.metersphere.controller;
|
||||||
|
|
||||||
import io.metersphere.dto.IssuesDao;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import io.metersphere.dto.TestPlanCaseDTO;
|
import io.metersphere.dto.TestPlanCaseDTO;
|
||||||
import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
|
import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
|
||||||
import io.metersphere.plan.service.TestPlanReportService;
|
import io.metersphere.plan.service.TestPlanReportService;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import io.metersphere.service.BaseCheckPermissionService;
|
||||||
import io.metersphere.service.FileService;
|
import io.metersphere.service.FileService;
|
||||||
import io.metersphere.service.TestCaseService;
|
import io.metersphere.service.TestCaseService;
|
||||||
import io.metersphere.service.wapper.CheckPermissionService;
|
import io.metersphere.service.wapper.CheckPermissionService;
|
||||||
|
import io.metersphere.xpack.track.dto.EditTestCaseRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.dto;
|
||||||
|
|
||||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.dto;
|
||||||
|
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.dto;
|
||||||
|
|
||||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.plan.dto;
|
||||||
|
|
||||||
import io.metersphere.base.domain.TestPlanReportContent;
|
import io.metersphere.base.domain.TestPlanReportContent;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import io.metersphere.plan.utils.TestPlanRequestUtil;
|
||||||
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
||||||
import io.metersphere.request.report.QueryTestPlanReportRequest;
|
import io.metersphere.request.report.QueryTestPlanReportRequest;
|
||||||
import io.metersphere.service.ServiceUtils;
|
import io.metersphere.service.ServiceUtils;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -72,7 +73,7 @@ public class TestPlanReportService {
|
||||||
private TestPlanPrincipalMapper testPlanPrincipalMapper;
|
private TestPlanPrincipalMapper testPlanPrincipalMapper;
|
||||||
@Resource
|
@Resource
|
||||||
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
|
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
|
||||||
// @Resource
|
// @Resource
|
||||||
// private PerformanceTestService performanceTestService;
|
// private PerformanceTestService performanceTestService;
|
||||||
@Resource
|
@Resource
|
||||||
private PlanApiDefinitionExecResultService planApiDefinitionExecResultService;
|
private PlanApiDefinitionExecResultService planApiDefinitionExecResultService;
|
||||||
|
@ -1022,7 +1023,7 @@ public class TestPlanReportService {
|
||||||
TestPlanEnvInfoDTO testPlanEnvInfo = planTestPlanScenarioCaseService.generateEnvironmentInfo(testPlanReport);
|
TestPlanEnvInfoDTO testPlanEnvInfo = planTestPlanScenarioCaseService.generateEnvironmentInfo(testPlanReport);
|
||||||
BeanUtils.copyBean(testPlanReportDTO, testPlanEnvInfo);
|
BeanUtils.copyBean(testPlanReportDTO, testPlanEnvInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import io.metersphere.plan.utils.TestPlanRequestUtil;
|
||||||
import io.metersphere.request.ScheduleRequest;
|
import io.metersphere.request.ScheduleRequest;
|
||||||
import io.metersphere.service.*;
|
import io.metersphere.service.*;
|
||||||
import io.metersphere.utils.LoggerUtil;
|
import io.metersphere.utils.LoggerUtil;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
|
@ -42,6 +42,7 @@ import io.metersphere.service.ServiceUtils;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.request.testcase.TrackCount;
|
import io.metersphere.request.testcase.TrackCount;
|
||||||
import io.metersphere.request.testreview.SaveCommentRequest;
|
import io.metersphere.request.testreview.SaveCommentRequest;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
|
@ -8,14 +8,14 @@ import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.BeanUtils;
|
||||||
import io.metersphere.commons.utils.FileUtils;
|
import io.metersphere.commons.utils.FileUtils;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
import io.metersphere.xpack.track.dto.AttachmentSyncType;
|
||||||
import io.metersphere.constants.AttachmentType;
|
import io.metersphere.constants.AttachmentType;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.metadata.service.FileMetadataService;
|
import io.metersphere.metadata.service.FileMetadataService;
|
||||||
import io.metersphere.metadata.utils.MetadataUtils;
|
import io.metersphere.metadata.utils.MetadataUtils;
|
||||||
import io.metersphere.request.attachment.AttachmentRequest;
|
import io.metersphere.request.attachment.AttachmentRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.issue.platform.IssueFactory;
|
import io.metersphere.service.issue.platform.IssueFactory;
|
||||||
import io.metersphere.xmind.utils.FileUtil;
|
import io.metersphere.xmind.utils.FileUtil;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
|
|
@ -43,10 +43,6 @@ public class CustomFieldIssuesService extends CustomFieldResourceService {
|
||||||
super.batchEditFields(TABLE_NAME, resourceId, fields);
|
super.batchEditFields(TABLE_NAME, resourceId, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void batchEditFields(HashMap<String, List<CustomFieldResourceDTO>> customFieldMap) {
|
|
||||||
// super.batchEditFields(TABLE_NAME, customFieldMap);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public int updateByPrimaryKeySelective(CustomFieldResourceDTO field) {
|
public int updateByPrimaryKeySelective(CustomFieldResourceDTO field) {
|
||||||
return super.updateByPrimaryKeySelective(TABLE_NAME, field);
|
return super.updateByPrimaryKeySelective(TABLE_NAME, field);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +67,7 @@ public class CustomFieldIssuesService extends CustomFieldResourceService {
|
||||||
return super.getByResourceId(TABLE_NAME, resourceId);
|
return super.getByResourceId(TABLE_NAME, resourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchEditFields(HashMap<String, List<CustomFieldResourceDTO>> customFieldMap) {
|
public void batchEditFields(Map<String, List<CustomFieldResourceDTO>> customFieldMap) {
|
||||||
if (customFieldMap == null || customFieldMap.size() == 0) {
|
if (customFieldMap == null || customFieldMap.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package io.metersphere.service;
|
package io.metersphere.service;
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtIssuesMapper;
|
import io.metersphere.base.mapper.ext.ExtIssuesMapper;
|
||||||
|
@ -9,11 +11,12 @@ import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||||
import io.metersphere.commons.constants.IssuesStatus;
|
import io.metersphere.commons.constants.IssuesStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.*;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
import io.metersphere.plan.service.TestPlanTestCaseService;
|
||||||
|
import io.metersphere.xpack.track.dto.AttachmentSyncType;
|
||||||
import io.metersphere.constants.AttachmentType;
|
import io.metersphere.constants.AttachmentType;
|
||||||
import io.metersphere.constants.SystemCustomField;
|
import io.metersphere.constants.SystemCustomField;
|
||||||
import io.metersphere.dto.CustomFieldDao;
|
import io.metersphere.dto.CustomFieldDao;
|
||||||
import io.metersphere.dto.IssueTemplateDao;
|
import io.metersphere.xpack.track.dto.IssueTemplateDao;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.log.utils.ReflexObjectUtil;
|
import io.metersphere.log.utils.ReflexObjectUtil;
|
||||||
import io.metersphere.log.vo.DetailColumn;
|
import io.metersphere.log.vo.DetailColumn;
|
||||||
|
@ -30,19 +33,21 @@ import io.metersphere.request.issues.JiraIssueTypeRequest;
|
||||||
import io.metersphere.request.issues.PlatformIssueTypeRequest;
|
import io.metersphere.request.issues.PlatformIssueTypeRequest;
|
||||||
import io.metersphere.request.testcase.AuthUserIssueRequest;
|
import io.metersphere.request.testcase.AuthUserIssueRequest;
|
||||||
import io.metersphere.request.testcase.IssuesCountRequest;
|
import io.metersphere.request.testcase.IssuesCountRequest;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
import io.metersphere.xpack.track.dto.PlatformUser;
|
||||||
import io.metersphere.service.issue.domain.jira.JiraIssueType;
|
import io.metersphere.service.issue.domain.jira.JiraIssueType;
|
||||||
import io.metersphere.service.issue.domain.zentao.ZentaoBuild;
|
import io.metersphere.service.issue.domain.zentao.ZentaoBuild;
|
||||||
import io.metersphere.request.attachment.AttachmentRequest;
|
import io.metersphere.request.attachment.AttachmentRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.DemandDTO;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.issue.platform.*;
|
import io.metersphere.service.issue.platform.*;
|
||||||
import io.metersphere.service.remote.project.TrackCustomFieldTemplateService;
|
import io.metersphere.service.remote.project.TrackCustomFieldTemplateService;
|
||||||
import io.metersphere.service.remote.project.TrackIssueTemplateService;
|
import io.metersphere.service.remote.project.TrackIssueTemplateService;
|
||||||
import io.metersphere.service.remote.setting.IntegrationService;
|
|
||||||
import io.metersphere.service.wapper.TrackProjectService;
|
import io.metersphere.service.wapper.TrackProjectService;
|
||||||
|
import io.metersphere.xpack.track.dto.PlatformStatusDTO;
|
||||||
|
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
@ -66,7 +71,7 @@ import java.util.stream.Collectors;
|
||||||
public class IssuesService {
|
public class IssuesService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IntegrationService integrationService;
|
private BaseIntegrationService baseIntegrationService;
|
||||||
@Resource
|
@Resource
|
||||||
private TrackProjectService trackProjectService;
|
private TrackProjectService trackProjectService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -90,12 +95,13 @@ public class IssuesService {
|
||||||
private TrackIssueTemplateService trackIssueTemplateService;
|
private TrackIssueTemplateService trackIssueTemplateService;
|
||||||
@Resource
|
@Resource
|
||||||
private TestCaseIssueService testCaseIssueService;
|
private TestCaseIssueService testCaseIssueService;
|
||||||
// @Resource
|
@Lazy
|
||||||
// private TestPlanTestCaseService testPlanTestCaseService;
|
@Resource
|
||||||
|
private TestPlanTestCaseService testPlanTestCaseService;
|
||||||
@Resource
|
@Resource
|
||||||
private IssueFollowMapper issueFollowMapper;
|
private IssueFollowMapper issueFollowMapper;
|
||||||
// @Resource
|
@Resource
|
||||||
// private TestPlanTestCaseMapper testPlanTestCaseMapper;
|
private TestPlanTestCaseMapper testPlanTestCaseMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private CustomFieldIssuesService customFieldIssuesService;
|
private CustomFieldIssuesService customFieldIssuesService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -118,15 +124,15 @@ public class IssuesService {
|
||||||
public void testAuth(String workspaceId, String platform) {
|
public void testAuth(String workspaceId, String platform) {
|
||||||
IssuesRequest issuesRequest = new IssuesRequest();
|
IssuesRequest issuesRequest = new IssuesRequest();
|
||||||
issuesRequest.setWorkspaceId(workspaceId);
|
issuesRequest.setWorkspaceId(workspaceId);
|
||||||
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, issuesRequest);
|
IssuesPlatform abstractPlatform = IssueFactory.createPlatform(platform, issuesRequest);
|
||||||
abstractPlatform.testAuth();
|
abstractPlatform.testAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IssuesWithBLOBs addIssues(IssuesUpdateRequest issuesRequest, List<MultipartFile> files) {
|
public IssuesWithBLOBs addIssues(IssuesUpdateRequest issuesRequest, List<MultipartFile> files) {
|
||||||
List<AbstractIssuePlatform> platformList = getAddPlatforms(issuesRequest);
|
List<IssuesPlatform> platformList = getAddPlatforms(issuesRequest);
|
||||||
IssuesWithBLOBs issues = null;
|
IssuesWithBLOBs issues = null;
|
||||||
for (AbstractIssuePlatform platform : platformList) {
|
for (IssuesPlatform platform : platformList) {
|
||||||
issues = platform.addIssue(issuesRequest);
|
issues = platform.addIssue(issuesRequest);
|
||||||
}
|
}
|
||||||
if (issuesRequest.getIsPlanEdit()) {
|
if (issuesRequest.getIsPlanEdit()) {
|
||||||
|
@ -203,7 +209,7 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IssuesWithBLOBs updateIssues(IssuesUpdateRequest issuesRequest) {
|
public IssuesWithBLOBs updateIssues(IssuesUpdateRequest issuesRequest) {
|
||||||
List<AbstractIssuePlatform> platformList = getUpdatePlatforms(issuesRequest);
|
List<IssuesPlatform> platformList = getUpdatePlatforms(issuesRequest);
|
||||||
platformList.forEach(platform -> {
|
platformList.forEach(platform -> {
|
||||||
platform.updateIssue(issuesRequest);
|
platform.updateIssue(issuesRequest);
|
||||||
});
|
});
|
||||||
|
@ -227,7 +233,7 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AbstractIssuePlatform> getAddPlatforms(IssuesUpdateRequest updateRequest) {
|
public List<IssuesPlatform> getAddPlatforms(IssuesUpdateRequest updateRequest) {
|
||||||
List<String> platforms = new ArrayList<>();
|
List<String> platforms = new ArrayList<>();
|
||||||
// 缺陷管理关联
|
// 缺陷管理关联
|
||||||
platforms.add(getPlatform(updateRequest.getProjectId()));
|
platforms.add(getPlatform(updateRequest.getProjectId()));
|
||||||
|
@ -240,7 +246,7 @@ public class IssuesService {
|
||||||
return IssueFactory.createPlatforms(platforms, issuesRequest);
|
return IssueFactory.createPlatforms(platforms, issuesRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AbstractIssuePlatform> getUpdatePlatforms(IssuesUpdateRequest updateRequest) {
|
public List<IssuesPlatform> getUpdatePlatforms(IssuesUpdateRequest updateRequest) {
|
||||||
String id = updateRequest.getId();
|
String id = updateRequest.getId();
|
||||||
IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(id);
|
IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(id);
|
||||||
String platform = issuesWithBLOBs.getPlatform();
|
String platform = issuesWithBLOBs.getPlatform();
|
||||||
|
@ -338,7 +344,7 @@ public class IssuesService {
|
||||||
IntegrationRequest request = new IntegrationRequest();
|
IntegrationRequest request = new IntegrationRequest();
|
||||||
request.setPlatform(platform);
|
request.setPlatform(platform);
|
||||||
request.setWorkspaceId(workspaceId);
|
request.setWorkspaceId(workspaceId);
|
||||||
ServiceIntegration integration = integrationService.get(request);
|
ServiceIntegration integration = baseIntegrationService.get(request);
|
||||||
return StringUtils.isNotBlank(integration.getId());
|
return StringUtils.isNotBlank(integration.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,12 +356,12 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlatformUser> getTapdProjectUsers(IssuesRequest request) {
|
public List<PlatformUser> getTapdProjectUsers(IssuesRequest request) {
|
||||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Tapd.name(), request);
|
IssuesPlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Tapd.name(), request);
|
||||||
return platform.getPlatformUser();
|
return platform.getPlatformUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlatformUser> getZentaoUsers(IssuesRequest request) {
|
public List<PlatformUser> getZentaoUsers(IssuesRequest request) {
|
||||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Zentao.name(), request);
|
IssuesPlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Zentao.name(), request);
|
||||||
return platform.getPlatformUser();
|
return platform.getPlatformUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +393,7 @@ public class IssuesService {
|
||||||
updateRequest.setResourceId(request.getCaseResourceId());
|
updateRequest.setResourceId(request.getCaseResourceId());
|
||||||
updateRequest.setProjectId(request.getProjectId());
|
updateRequest.setProjectId(request.getProjectId());
|
||||||
updateRequest.setWorkspaceId(request.getWorkspaceId());
|
updateRequest.setWorkspaceId(request.getWorkspaceId());
|
||||||
List<AbstractIssuePlatform> platformList = getUpdatePlatforms(updateRequest);
|
List<IssuesPlatform> platformList = getUpdatePlatforms(updateRequest);
|
||||||
platformList.forEach(platform -> {
|
platformList.forEach(platform -> {
|
||||||
platform.removeIssueParentLink(updateRequest);
|
platform.removeIssueParentLink(updateRequest);
|
||||||
});
|
});
|
||||||
|
@ -395,10 +401,10 @@ public class IssuesService {
|
||||||
extIssuesMapper.deleteIssues(id, caseResourceId);
|
extIssuesMapper.deleteIssues(id, caseResourceId);
|
||||||
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
|
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
|
||||||
testPlanTestCaseExample.createCriteria().andCaseIdEqualTo(caseResourceId);
|
testPlanTestCaseExample.createCriteria().andCaseIdEqualTo(caseResourceId);
|
||||||
// List<TestPlanTestCase> list = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample);
|
List<TestPlanTestCase> list = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample);
|
||||||
// list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
// testCaseIssueService.updateIssuesCount(item.getId());
|
testCaseIssueService.updateIssuesCount(item.getId());
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +416,7 @@ public class IssuesService {
|
||||||
Project project = baseProjectService.getProjectById(projectId);
|
Project project = baseProjectService.getProjectById(projectId);
|
||||||
IssuesRequest issuesRequest = new IssuesRequest();
|
IssuesRequest issuesRequest = new IssuesRequest();
|
||||||
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
||||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(issuesWithBLOBs.getPlatform(), issuesRequest);
|
IssuesPlatform platform = IssueFactory.createPlatform(issuesWithBLOBs.getPlatform(), issuesRequest);
|
||||||
platform.deleteIssue(id);
|
platform.deleteIssue(id);
|
||||||
// 删除缺陷对应的附件
|
// 删除缺陷对应的附件
|
||||||
AttachmentRequest request = new AttachmentRequest();
|
AttachmentRequest request = new AttachmentRequest();
|
||||||
|
@ -570,7 +576,7 @@ public class IssuesService {
|
||||||
return issueMap;
|
return issueMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, AbstractIssuePlatform> getPlatformMap(IssuesRequest request) {
|
public Map<String, IssuesPlatform> getPlatformMap(IssuesRequest request) {
|
||||||
Project project = baseProjectService.getProjectById(request.getProjectId());
|
Project project = baseProjectService.getProjectById(request.getProjectId());
|
||||||
List<String> platforms = getPlatforms(project);
|
List<String> platforms = getPlatforms(project);
|
||||||
platforms.add(IssuesManagePlatform.Local.toString());
|
platforms.add(IssuesManagePlatform.Local.toString());
|
||||||
|
@ -589,18 +595,18 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void issuesCount() {
|
public void issuesCount() {
|
||||||
// LogUtil.info("测试计划-测试用例同步缺陷信息开始");
|
LogUtil.info("测试计划-测试用例同步缺陷信息开始");
|
||||||
// int pageSize = 100;
|
int pageSize = 100;
|
||||||
// int pages = 1;
|
int pages = 1;
|
||||||
// for (int i = 0; i < pages; i++) {
|
for (int i = 0; i < pages; i++) {
|
||||||
// Page<List<TestPlanTestCase>> page = PageHelper.startPage(i, pageSize, true);
|
Page<List<TestPlanTestCase>> page = PageHelper.startPage(i, pageSize, true);
|
||||||
// List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
|
List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
|
||||||
// pages = page.getPages();// 替换成真实的值
|
pages = page.getPages();// 替换成真实的值
|
||||||
// list.forEach(l -> {
|
list.forEach(l -> {
|
||||||
// testCaseIssueService.updateIssuesCount(l.getCaseId());
|
testCaseIssueService.updateIssuesCount(l.getCaseId());
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// LogUtil.info("测试计划-测试用例同步缺陷信息结束");
|
LogUtil.info("测试计划-测试用例同步缺陷信息结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkSync(String projectId) {
|
public boolean checkSync(String projectId) {
|
||||||
|
@ -649,7 +655,7 @@ public class IssuesService {
|
||||||
String defaultCustomFields = getDefaultCustomFields(projectId);
|
String defaultCustomFields = getDefaultCustomFields(projectId);
|
||||||
issuesRequest.setDefaultCustomFields(defaultCustomFields);
|
issuesRequest.setDefaultCustomFields(defaultCustomFields);
|
||||||
}
|
}
|
||||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(project.getPlatform(), issuesRequest);
|
IssuesPlatform platform = IssueFactory.createPlatform(project.getPlatform(), issuesRequest);
|
||||||
syncThirdPartyIssues(platform::syncIssues, project, issues);
|
syncThirdPartyIssues(platform::syncIssues, project, issues);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -706,7 +712,7 @@ public class IssuesService {
|
||||||
request.setWorkspaceId(orgId);
|
request.setWorkspaceId(orgId);
|
||||||
request.setPlatform(platform);
|
request.setPlatform(platform);
|
||||||
|
|
||||||
ServiceIntegration integration = integrationService.get(request);
|
ServiceIntegration integration = baseIntegrationService.get(request);
|
||||||
return integration.getConfiguration();
|
return integration.getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +743,7 @@ public class IssuesService {
|
||||||
public void userAuth(AuthUserIssueRequest authUserIssueRequest) {
|
public void userAuth(AuthUserIssueRequest authUserIssueRequest) {
|
||||||
IssuesRequest issuesRequest = new IssuesRequest();
|
IssuesRequest issuesRequest = new IssuesRequest();
|
||||||
issuesRequest.setWorkspaceId(authUserIssueRequest.getWorkspaceId());
|
issuesRequest.setWorkspaceId(authUserIssueRequest.getWorkspaceId());
|
||||||
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(authUserIssueRequest.getPlatform(), issuesRequest);
|
IssuesPlatform abstractPlatform = IssueFactory.createPlatform(authUserIssueRequest.getPlatform(), issuesRequest);
|
||||||
abstractPlatform.userAuth(authUserIssueRequest);
|
abstractPlatform.userAuth(authUserIssueRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,6 +883,7 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IssuesWithBLOBs> getIssuesByPlatformIds(List<String> platformIds, String projectId) {
|
public List<IssuesWithBLOBs> getIssuesByPlatformIds(List<String> platformIds, String projectId) {
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(platformIds)) return new ArrayList<>();
|
if (CollectionUtils.isEmpty(platformIds)) return new ArrayList<>();
|
||||||
IssuesExample example = new IssuesExample();
|
IssuesExample example = new IssuesExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
|
@ -885,6 +892,30 @@ public class IssuesService {
|
||||||
return issuesMapper.selectByExampleWithBLOBs(example);
|
return issuesMapper.selectByExampleWithBLOBs(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<IssuesDao> getPlatformIssueByIds(List<String> platformIds, String projectId) {
|
||||||
|
// todo 是否保留
|
||||||
|
List<IssuesDao> issues = extIssuesMapper.getPlatformIssueByIds(platformIds, projectId);
|
||||||
|
if (CollectionUtils.isEmpty(issues)) {
|
||||||
|
return issues;
|
||||||
|
}
|
||||||
|
List<String> issueIds = issues.stream().map(IssuesDao::getId).collect(Collectors.toList());
|
||||||
|
List<IssuesDao> issuesList = extIssuesMapper.getIssueCustomFields(issueIds);
|
||||||
|
Map<String, List<CustomFieldItemDTO>> map = new HashMap<>();
|
||||||
|
issuesList.forEach(f -> {
|
||||||
|
CustomFieldItemDTO dto = new CustomFieldItemDTO();
|
||||||
|
dto.setId(f.getFieldId());
|
||||||
|
dto.setName(f.getFieldName());
|
||||||
|
dto.setType(f.getFieldType());
|
||||||
|
dto.setValue(f.getFieldValue());
|
||||||
|
dto.setCustomData(f.getCustomData());
|
||||||
|
List<CustomFieldItemDTO> list = Optional.ofNullable(map.get(f.getId())).orElse(new ArrayList<>());
|
||||||
|
map.put(f.getId(), list);
|
||||||
|
list.add(dto);
|
||||||
|
});
|
||||||
|
issues.forEach(i -> i.setCustomFieldList(map.getOrDefault(i.getId(), new ArrayList<>())));
|
||||||
|
return issues;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IssueTemplateDao getThirdPartTemplate(String projectId) {
|
public IssueTemplateDao getThirdPartTemplate(String projectId) {
|
||||||
if (StringUtils.isNotBlank(projectId)) {
|
if (StringUtils.isNotBlank(projectId)) {
|
||||||
|
@ -918,7 +949,7 @@ public class IssuesService {
|
||||||
IssuesRequest issueRequest = new IssuesRequest();
|
IssuesRequest issueRequest = new IssuesRequest();
|
||||||
issueRequest.setWorkspaceId(workspaceId);
|
issueRequest.setWorkspaceId(workspaceId);
|
||||||
issueRequest.setProjectId(projectId);
|
issueRequest.setProjectId(projectId);
|
||||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(project.getPlatform(), issueRequest);
|
IssuesPlatform platform = IssueFactory.createPlatform(project.getPlatform(), issueRequest);
|
||||||
return platform.getDemandList(projectId);
|
return platform.getDemandList(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -938,12 +969,12 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
IssuesRequest issuesRequest = getDefaultIssueRequest(request.getProjectId(), request.getWorkspaceId());
|
IssuesRequest issuesRequest = getDefaultIssueRequest(request.getProjectId(), request.getWorkspaceId());
|
||||||
Map<String, AbstractIssuePlatform> platformMap = IssueFactory.createPlatformsForMap(platforms, issuesRequest);
|
Map<String, IssuesPlatform> platformMap = IssueFactory.createPlatformsForMap(platforms, issuesRequest);
|
||||||
try {
|
try {
|
||||||
if (platformMap.size() > 1) {
|
if (platformMap.size() > 1) {
|
||||||
MSException.throwException(Translator.get("project_reference_multiple_plateform"));
|
MSException.throwException(Translator.get("project_reference_multiple_plateform"));
|
||||||
}
|
}
|
||||||
Optional<AbstractIssuePlatform> platformOptional = platformMap.values().stream().findFirst();
|
Optional<IssuesPlatform> platformOptional = platformMap.values().stream().findFirst();
|
||||||
if (platformOptional.isPresent()) {
|
if (platformOptional.isPresent()) {
|
||||||
platformStatusDTOS = platformOptional.get().getTransitions(request.getPlatformKey());
|
platformStatusDTOS = platformOptional.get().getTransitions(request.getPlatformKey());
|
||||||
}
|
}
|
||||||
|
@ -968,32 +999,7 @@ public class IssuesService {
|
||||||
issueFileMapper.deleteByExample(example);
|
issueFileMapper.deleteByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkThirdProjectExist(Project project) {
|
public boolean isThirdPartTemplate(Project project) {
|
||||||
IssuesRequest issuesRequest = new IssuesRequest();
|
return project.getThirdPartTemplate() != null && project.getThirdPartTemplate() && project.getPlatform().equals(IssuesManagePlatform.Jira.name());
|
||||||
if (StringUtils.isBlank(project.getId())) {
|
|
||||||
MSException.throwException("project ID cannot be empty");
|
|
||||||
}
|
|
||||||
issuesRequest.setProjectId(project.getId());
|
|
||||||
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
|
||||||
if (StringUtils.equalsIgnoreCase(project.getPlatform(), IssuesManagePlatform.Tapd.name())) {
|
|
||||||
TapdPlatform tapd = new TapdPlatform(issuesRequest);
|
|
||||||
this.doCheckThirdProjectExist(tapd, project.getTapdId());
|
|
||||||
} else if (StringUtils.equalsIgnoreCase(project.getPlatform(), IssuesManagePlatform.Jira.name())) {
|
|
||||||
JiraPlatform jira = new JiraPlatform(issuesRequest);
|
|
||||||
this.doCheckThirdProjectExist(jira, project.getJiraKey());
|
|
||||||
} else if (StringUtils.equalsIgnoreCase(project.getPlatform(), IssuesManagePlatform.Zentao.name())) {
|
|
||||||
ZentaoPlatform zentao = new ZentaoPlatform(issuesRequest);
|
|
||||||
this.doCheckThirdProjectExist(zentao, project.getZentaoId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doCheckThirdProjectExist(AbstractIssuePlatform platform, String relateId) {
|
|
||||||
if (StringUtils.isBlank(relateId)) {
|
|
||||||
MSException.throwException(Translator.get("issue_project_not_exist"));
|
|
||||||
}
|
|
||||||
Boolean exist = platform.checkProjectExist(relateId);
|
|
||||||
if (BooleanUtils.isFalse(exist)) {
|
|
||||||
MSException.throwException(Translator.get("issue_project_not_exist"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,6 @@ import io.metersphere.request.ResetOrderRequest;
|
||||||
import io.metersphere.request.attachment.AttachmentRequest;
|
import io.metersphere.request.attachment.AttachmentRequest;
|
||||||
import io.metersphere.request.member.QueryMemberRequest;
|
import io.metersphere.request.member.QueryMemberRequest;
|
||||||
import io.metersphere.request.testcase.*;
|
import io.metersphere.request.testcase.*;
|
||||||
import io.metersphere.service.issue.XpackIssueService;
|
|
||||||
import io.metersphere.service.issue.platform.AbstractIssuePlatform;
|
|
||||||
import io.metersphere.service.issue.platform.IssueFactory;
|
import io.metersphere.service.issue.platform.IssueFactory;
|
||||||
import io.metersphere.service.remote.api.RelevanceApiCaseService;
|
import io.metersphere.service.remote.api.RelevanceApiCaseService;
|
||||||
import io.metersphere.service.remote.performance.RelevanceLoadCaseService;
|
import io.metersphere.service.remote.performance.RelevanceLoadCaseService;
|
||||||
|
@ -46,6 +44,10 @@ import io.metersphere.service.wapper.TrackProjectService;
|
||||||
import io.metersphere.xmind.XmindCaseParser;
|
import io.metersphere.xmind.XmindCaseParser;
|
||||||
import io.metersphere.xmind.pojo.TestCaseXmindData;
|
import io.metersphere.xmind.pojo.TestCaseXmindData;
|
||||||
import io.metersphere.xmind.utils.XmindExportUtil;
|
import io.metersphere.xmind.utils.XmindExportUtil;
|
||||||
|
import io.metersphere.xpack.track.dto.EditTestCaseRequest;
|
||||||
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
|
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
@ -56,7 +58,6 @@ import org.apache.ibatis.session.SqlSession;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.mybatis.spring.SqlSessionUtils;
|
import org.mybatis.spring.SqlSessionUtils;
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -259,7 +260,7 @@ public class TestCaseService {
|
||||||
Project project = baseProjectService.getProjectById(request.getProjectId());
|
Project project = baseProjectService.getProjectById(request.getProjectId());
|
||||||
if (StringUtils.equals(project.getPlatform(), IssuesManagePlatform.AzureDevops.name())) {
|
if (StringUtils.equals(project.getPlatform(), IssuesManagePlatform.AzureDevops.name())) {
|
||||||
updateRequest.setWorkspaceId(project.getWorkspaceId());
|
updateRequest.setWorkspaceId(project.getWorkspaceId());
|
||||||
List<AbstractIssuePlatform> platformList = getAddPlatforms(updateRequest);
|
List<IssuesPlatform> platformList = getAddPlatforms(updateRequest);
|
||||||
platformList.forEach(platform -> {
|
platformList.forEach(platform -> {
|
||||||
platform.updateDemandHyperLink(request, project, type);
|
platform.updateDemandHyperLink(request, project, type);
|
||||||
});
|
});
|
||||||
|
@ -293,7 +294,7 @@ public class TestCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AbstractIssuePlatform> getAddPlatforms(IssuesRequest request) {
|
private List<IssuesPlatform> getAddPlatforms(IssuesRequest request) {
|
||||||
List<String> platforms = new ArrayList<>();
|
List<String> platforms = new ArrayList<>();
|
||||||
// 缺陷管理关联
|
// 缺陷管理关联
|
||||||
platforms.add(issuesService.getPlatform(request.getProjectId()));
|
platforms.add(issuesService.getPlatform(request.getProjectId()));
|
||||||
|
@ -417,10 +418,19 @@ public class TestCaseService {
|
||||||
* @param testCase
|
* @param testCase
|
||||||
*/
|
*/
|
||||||
public void updateThirdPartyIssuesLink(EditTestCaseRequest testCase) {
|
public void updateThirdPartyIssuesLink(EditTestCaseRequest testCase) {
|
||||||
XpackIssueService issueService = CommonBeanFactory.getBean(XpackIssueService.class);
|
if (StringUtils.isBlank(testCase.getProjectId())) {
|
||||||
if (issueService != null) {
|
return;
|
||||||
issueService.updateThirdPartyIssuesLink(testCase);
|
|
||||||
}
|
}
|
||||||
|
Project project = baseProjectService.getProjectById(testCase.getProjectId());
|
||||||
|
IssuesRequest issuesRequest = new IssuesRequest();
|
||||||
|
if (!issuesService.isThirdPartTemplate(project)) {
|
||||||
|
issuesRequest.setDefaultCustomFields(issuesService.getDefaultCustomFields(testCase.getProjectId()));
|
||||||
|
}
|
||||||
|
issuesRequest.setProjectId(testCase.getProjectId());
|
||||||
|
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
||||||
|
IssueFactory.createPlatform(issuesService.getPlatform(testCase.getProjectId()), issuesRequest)
|
||||||
|
.updateDemandIssueLink(testCase, project);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package io.metersphere.service.issue;
|
|
||||||
|
|
||||||
import io.metersphere.request.testcase.EditTestCaseRequest;
|
|
||||||
|
|
||||||
public interface XpackIssueService {
|
|
||||||
|
|
||||||
void updateThirdPartyIssuesLink(EditTestCaseRequest testCase);
|
|
||||||
}
|
|
|
@ -5,6 +5,8 @@ import io.metersphere.commons.utils.JSON;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.service.issue.domain.jira.*;
|
import io.metersphere.service.issue.domain.jira.*;
|
||||||
|
import io.metersphere.xpack.track.dto.JiraIssue;
|
||||||
|
import io.metersphere.xpack.track.dto.JiraIssueListResponse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
|
@ -45,7 +47,7 @@ public abstract class JiraAbstractClient extends BaseClient {
|
||||||
MSException.throwException(e.getMessage());
|
MSException.throwException(e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
fields = ((JiraCreateMetadataResponse) getResultForObject(JiraCreateMetadataResponse.class, response))
|
fields = ((JiraCreateMetadataResponse) getResultForObject(JiraCreateMetadataResponse.class, response))
|
||||||
.getProjects().get(0).getIssuetypes().get(0).getFields();
|
.getProjects().get(0).getIssuetypes().get(0).getFields();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MSException.throwException(Translator.get("issue_jira_info_error"));
|
MSException.throwException(Translator.get("issue_jira_info_error"));
|
||||||
|
@ -138,7 +140,7 @@ public abstract class JiraAbstractClient extends BaseClient {
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
HttpEntity<String> requestEntity = new HttpEntity<>(body, headers);
|
HttpEntity<String> requestEntity = new HttpEntity<>(body, headers);
|
||||||
try {
|
try {
|
||||||
restTemplate.exchange(getBaseUrl() + "/issue/" + id, HttpMethod.PUT, requestEntity, String.class);
|
restTemplate.exchange(getBaseUrl() + "/issue/" + id, HttpMethod.PUT, requestEntity, String.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
MSException.throwException(e.getMessage());
|
MSException.throwException(e.getMessage());
|
||||||
|
@ -242,11 +244,11 @@ public abstract class JiraAbstractClient extends BaseClient {
|
||||||
PASSWD = config.getPassword();
|
PASSWD = config.getPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JiraIssueListResponse getProjectIssues(int startAt, int maxResults, String projectKey, String issueType) {
|
public JiraIssueListResponse getProjectIssues(Integer startAt, Integer maxResults, String projectKey, String issueType) {
|
||||||
return getProjectIssues(startAt, maxResults, projectKey, issueType, null);
|
return getProjectIssues(startAt, maxResults, projectKey, issueType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JiraIssueListResponse getProjectIssues(int startAt, int maxResults, String projectKey, String issueType, String fields) {
|
public JiraIssueListResponse getProjectIssues(Integer startAt, Integer maxResults, String projectKey, String issueType, String fields) {
|
||||||
ResponseEntity<String> responseEntity;
|
ResponseEntity<String> responseEntity;
|
||||||
String url = getBaseUrl() + "/search?startAt={1}&maxResults={2}&jql=project={3}+AND+issuetype={4}";
|
String url = getBaseUrl() + "/search?startAt={1}&maxResults={2}&jql=project={3}+AND+issuetype={4}";
|
||||||
if (StringUtils.isNotBlank(fields)) {
|
if (StringUtils.isNotBlank(fields)) {
|
||||||
|
@ -264,7 +266,7 @@ public abstract class JiraAbstractClient extends BaseClient {
|
||||||
return responseEntity.getBody();
|
return responseEntity.getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JiraIssueListResponse getProjectIssuesAttachment(int startAt, int maxResults, String projectKey, String issueType) {
|
public JiraIssueListResponse getProjectIssuesAttachment(Integer startAt, Integer maxResults, String projectKey, String issueType) {
|
||||||
return getProjectIssues(startAt, maxResults, projectKey, issueType, "attachment");
|
return getProjectIssues(startAt, maxResults, projectKey, issueType, "attachment");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.service.issue.domain.tapd.AddTapdIssueResponse;
|
import io.metersphere.service.issue.domain.tapd.AddTapdIssueResponse;
|
||||||
import io.metersphere.service.issue.domain.tapd.TapdBug;
|
import io.metersphere.service.issue.domain.tapd.TapdBug;
|
||||||
import io.metersphere.service.issue.domain.tapd.TapdConfig;
|
import io.metersphere.service.issue.domain.tapd.TapdConfig;
|
||||||
import io.metersphere.service.issue.domain.tapd.TapdGetIssueResponse;
|
import io.metersphere.xpack.track.dto.TapdBaseResponse;
|
||||||
|
import io.metersphere.xpack.track.dto.TapdGetIssueResponse;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
|
@ -29,8 +30,8 @@ public class TapdClient extends BaseClient {
|
||||||
protected String PASSWD;
|
protected String PASSWD;
|
||||||
|
|
||||||
|
|
||||||
public TapdGetIssueResponse getIssueForPage(String projectId, int pageNum, int limit) {
|
public TapdGetIssueResponse getIssueForPage(String projectId, Integer pageNum, Integer limit) {
|
||||||
return getIssueForPageByIds(projectId, pageNum, limit, null);
|
return getIssueForPageByIds(projectId, pageNum, limit, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getStatusMap(String projectId) {
|
public Map<String, String> getStatusMap(String projectId) {
|
||||||
|
@ -42,10 +43,8 @@ public class TapdClient extends BaseClient {
|
||||||
MSException.throwException("请检查配置信息是否填写正确!");
|
MSException.throwException("请检查配置信息是否填写正确!");
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
String resultForObject = (String) getResultForObject(String.class, response);
|
Map resultForObject = (Map) getResultForObject(Map.class, response);
|
||||||
Map<String, Object> jsonObject = JSON.parseMap(resultForObject);
|
return (Map<String, String>) resultForObject.get("data");
|
||||||
String data = jsonObject.get("data").toString();
|
|
||||||
return JSON.parseObject(data, Map.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getPlatformUser(String projectId) {
|
public List getPlatformUser(String projectId) {
|
||||||
|
@ -126,7 +125,7 @@ public class TapdClient extends BaseClient {
|
||||||
public boolean checkProjectExist(String relateId) {
|
public boolean checkProjectExist(String relateId) {
|
||||||
String url = getBaseUrl() + "/roles?workspace_id={1}";
|
String url = getBaseUrl() + "/roles?workspace_id={1}";
|
||||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, relateId);
|
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, relateId);
|
||||||
TapdGetIssueResponse res = (TapdGetIssueResponse) getResultForObject(TapdGetIssueResponse.class, response);
|
TapdBaseResponse res = (TapdBaseResponse) getResultForObject(TapdBaseResponse.class, response);
|
||||||
return res == null || res.getStatus() != 404;
|
return res == null || res.getStatus() != 404;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,12 +152,12 @@ public abstract class ZentaoClient extends BaseClient {
|
||||||
return (Map<String, Object>) JSON.parseMap(response.getBody()).get("data");
|
return (Map<String, Object>) JSON.parseMap(response.getBody()).get("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getBugsByProjectId(String projectId, int pageNum, int pageSize) {
|
public Map getBugsByProjectId(String projectId, Integer pageNum, Integer pageSize) {
|
||||||
String sessionId = login();
|
String sessionId = login();
|
||||||
ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBugList(),
|
ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBugList(),
|
||||||
HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId);
|
HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId);
|
||||||
try {
|
try {
|
||||||
return (Map) JSON.parseMap(response.getBody()).get("data");
|
return JSON.parseMap(JSON.parseMap(response.getBody()).get("data").toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
MSException.throwException("请检查配置信息是否填写正确!");
|
MSException.throwException("请检查配置信息是否填写正确!");
|
||||||
|
@ -222,7 +222,7 @@ public abstract class ZentaoClient extends BaseClient {
|
||||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, authHeader);
|
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, authHeader);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
restTemplate.exchange(requestUrl.getFileUpload(), HttpMethod.POST, requestEntity,
|
restTemplate.exchange(requestUrl.getFileUpload(), HttpMethod.POST, requestEntity,
|
||||||
String.class, objectType, objectId, sessionId);
|
String.class, objectType, objectId, sessionId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.info("upload zentao attachment error");
|
LogUtil.info("upload zentao attachment error");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.service.issue.domain.tapd;
|
package io.metersphere.service.issue.domain.tapd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ public class AddTapdIssueResponse {
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public static class Data {
|
public static class Data {
|
||||||
|
@JsonAlias("Bug")
|
||||||
private TapdBug bug;
|
private TapdBug bug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,21 +11,19 @@ import io.metersphere.commons.constants.IssuesStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.*;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.dto.CustomFieldItemDTO;
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
import io.metersphere.dto.IssueTemplateDao;
|
import io.metersphere.xpack.track.dto.IssueTemplateDao;
|
||||||
import io.metersphere.dto.PlatformStatusDTO;
|
import io.metersphere.xpack.track.dto.PlatformStatusDTO;
|
||||||
import io.metersphere.dto.UserDTO;
|
import io.metersphere.dto.UserDTO;
|
||||||
import io.metersphere.request.IntegrationRequest;
|
import io.metersphere.request.IntegrationRequest;
|
||||||
import io.metersphere.request.testcase.EditTestCaseRequest;
|
import io.metersphere.xpack.track.dto.EditTestCaseRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.*;
|
import io.metersphere.service.*;
|
||||||
import io.metersphere.service.issue.IssuesPlatform;
|
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
||||||
import io.metersphere.service.issue.domain.ProjectIssueConfig;
|
import io.metersphere.service.issue.domain.ProjectIssueConfig;
|
||||||
import io.metersphere.service.remote.setting.IntegrationService;
|
|
||||||
import io.metersphere.service.wapper.TrackProjectService;
|
import io.metersphere.service.wapper.TrackProjectService;
|
||||||
import io.metersphere.service.wapper.UserService;
|
import io.metersphere.service.wapper.UserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.safety.Safelist;
|
import org.jsoup.safety.Safelist;
|
||||||
|
@ -44,7 +42,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
|
|
||||||
protected IntegrationService integrationService;
|
protected BaseIntegrationService baseIntegrationService;
|
||||||
protected TestCaseIssueService testCaseIssueService;
|
protected TestCaseIssueService testCaseIssueService;
|
||||||
protected TestCaseIssuesMapper testCaseIssuesMapper;
|
protected TestCaseIssuesMapper testCaseIssuesMapper;
|
||||||
protected TrackProjectService trackProjectService;
|
protected TrackProjectService trackProjectService;
|
||||||
|
@ -82,7 +80,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractIssuePlatform() {
|
public AbstractIssuePlatform() {
|
||||||
this.integrationService = CommonBeanFactory.getBean(IntegrationService.class);
|
this.baseIntegrationService = CommonBeanFactory.getBean(BaseIntegrationService.class);
|
||||||
this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);
|
this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);
|
||||||
this.trackProjectService = CommonBeanFactory.getBean(TrackProjectService.class);
|
this.trackProjectService = CommonBeanFactory.getBean(TrackProjectService.class);
|
||||||
this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);
|
this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);
|
||||||
|
@ -100,6 +98,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
this.baseProjectService = CommonBeanFactory.getBean(BaseProjectService.class);
|
this.baseProjectService = CommonBeanFactory.getBean(BaseProjectService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xpack 反射调用
|
||||||
|
public String getProjectId() {
|
||||||
|
return projectId;
|
||||||
|
}
|
||||||
|
|
||||||
protected String getPlatformConfig(String platform) {
|
protected String getPlatformConfig(String platform) {
|
||||||
IntegrationRequest request = new IntegrationRequest();
|
IntegrationRequest request = new IntegrationRequest();
|
||||||
if (StringUtils.isBlank(workspaceId)) {
|
if (StringUtils.isBlank(workspaceId)) {
|
||||||
|
@ -108,7 +111,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
request.setWorkspaceId(workspaceId);
|
request.setWorkspaceId(workspaceId);
|
||||||
request.setPlatform(platform);
|
request.setPlatform(platform);
|
||||||
|
|
||||||
ServiceIntegration integration = integrationService.get(request);
|
ServiceIntegration integration = baseIntegrationService.get(request);
|
||||||
return integration.getConfiguration();
|
return integration.getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,26 +398,27 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
|
|
||||||
protected Object getSyncJsonParamValue(Object value) {
|
protected Object getSyncJsonParamValue(Object value) {
|
||||||
Map valObj = ((Map) value);
|
Map valObj = ((Map) value);
|
||||||
String accountId = valObj.get("accountId").toString();
|
String accountId = Optional.ofNullable(valObj.get("accountId")).orElse("").toString();
|
||||||
Map child = (Map) valObj.get("child");
|
Map child = (Map) valObj.get("child");
|
||||||
if (child != null) {// 级联框
|
if (child != null) {// 级联框
|
||||||
List<Object> values = new ArrayList<>();
|
List<Object> values = new ArrayList<>();
|
||||||
if (StringUtils.isNotBlank(valObj.get("id").toString())) {
|
String id = Optional.ofNullable(valObj.get("id")).orElse("").toString();
|
||||||
values.add(valObj.get("id").toString());
|
if (StringUtils.isNotBlank(id)) {
|
||||||
|
values.add(valObj.get("id"));
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(child.get("id").toString())) {
|
if (StringUtils.isNotBlank(id)) {
|
||||||
values.add(child.get("id").toString());
|
values.add(child.get("id"));
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
} else if (StringUtils.isNotBlank(accountId) && isThirdPartTemplate) {
|
} else if (StringUtils.isNotBlank(accountId) && isThirdPartTemplate) {
|
||||||
// 用户选择框
|
// 用户选择框
|
||||||
return accountId;
|
return accountId;
|
||||||
} else {
|
} else {
|
||||||
String id = valObj.get("id").toString();
|
String id = Optional.ofNullable(valObj.get("id")).orElse("").toString();
|
||||||
if (StringUtils.isNotBlank(id)) {
|
if (StringUtils.isNotBlank(id)) {
|
||||||
return valObj.get("id").toString();
|
return valObj.get("id");
|
||||||
} else {
|
} else {
|
||||||
return valObj.get("key").toString();
|
return valObj.get("key");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,7 +438,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
if (value instanceof Map) {
|
if (value instanceof Map) {
|
||||||
item.setValue(getSyncJsonParamValue(value));
|
item.setValue(getSyncJsonParamValue(value));
|
||||||
if (StringUtils.equals(fieldName, "assignee")) {
|
if (StringUtils.equals(fieldName, "assignee")) {
|
||||||
item.setValue(((JSONObject) value).get("displayName"));
|
item.setValue(((Map) value).get("displayName"));
|
||||||
} else {
|
} else {
|
||||||
item.setValue(getSyncJsonParamValue(value));
|
item.setValue(getSyncJsonParamValue(value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package io.metersphere.service.issue.platform;
|
||||||
|
|
||||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
|
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
@ -12,7 +13,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class IssueFactory {
|
public class IssueFactory {
|
||||||
public static AbstractIssuePlatform createPlatform(String platform, IssuesRequest addIssueRequest) {
|
public static IssuesPlatform createPlatform(String platform, IssuesRequest addIssueRequest) {
|
||||||
if (StringUtils.equals(IssuesManagePlatform.Tapd.toString(), platform)) {
|
if (StringUtils.equals(IssuesManagePlatform.Tapd.toString(), platform)) {
|
||||||
return new TapdPlatform(addIssueRequest);
|
return new TapdPlatform(addIssueRequest);
|
||||||
} else if (StringUtils.equals(IssuesManagePlatform.Jira.toString(), platform)) {
|
} else if (StringUtils.equals(IssuesManagePlatform.Jira.toString(), platform)) {
|
||||||
|
@ -22,9 +23,9 @@ public class IssueFactory {
|
||||||
} else if (StringUtils.equals(IssuesManagePlatform.AzureDevops.toString(), platform)) {
|
} else if (StringUtils.equals(IssuesManagePlatform.AzureDevops.toString(), platform)) {
|
||||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||||
try {
|
try {
|
||||||
Class clazz = loader.loadClass("io.metersphere.xpack.issue.azuredevops.AzureDevopsPlatform");
|
Class clazz = loader.loadClass("io.metersphere.xpack.track.issue.platform.AzureDevopsPlatform");
|
||||||
Constructor cons = clazz.getDeclaredConstructor(new Class[] { IssuesRequest.class });
|
Constructor cons = clazz.getDeclaredConstructor(new Class[] { IssuesRequest.class });
|
||||||
AbstractIssuePlatform azureDevopsPlatform = (AbstractIssuePlatform) cons.newInstance(addIssueRequest);
|
IssuesPlatform azureDevopsPlatform = (IssuesPlatform) cons.newInstance(addIssueRequest);
|
||||||
return azureDevopsPlatform;
|
return azureDevopsPlatform;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
|
@ -35,10 +36,10 @@ public class IssueFactory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AbstractIssuePlatform> createPlatforms(List<String> types, IssuesRequest addIssueRequest) {
|
public static List<IssuesPlatform> createPlatforms(List<String> types, IssuesRequest addIssueRequest) {
|
||||||
List<AbstractIssuePlatform> platforms = new ArrayList<>();
|
List<IssuesPlatform> platforms = new ArrayList<>();
|
||||||
types.forEach(type -> {
|
types.forEach(type -> {
|
||||||
AbstractIssuePlatform abstractIssuePlatform = createPlatform(type, addIssueRequest);
|
IssuesPlatform abstractIssuePlatform = createPlatform(type, addIssueRequest);
|
||||||
if (abstractIssuePlatform != null) {
|
if (abstractIssuePlatform != null) {
|
||||||
platforms.add(abstractIssuePlatform);
|
platforms.add(abstractIssuePlatform);
|
||||||
}
|
}
|
||||||
|
@ -46,10 +47,10 @@ public class IssueFactory {
|
||||||
return platforms;
|
return platforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, AbstractIssuePlatform> createPlatformsForMap(List<String> types, IssuesRequest addIssueRequest) {
|
public static Map<String, IssuesPlatform> createPlatformsForMap(List<String> types, IssuesRequest addIssueRequest) {
|
||||||
Map<String, AbstractIssuePlatform> platformMap = new HashMap<>();
|
Map<String, IssuesPlatform> platformMap = new HashMap<>();
|
||||||
types.forEach(type -> {
|
types.forEach(type -> {
|
||||||
AbstractIssuePlatform abstractIssuePlatform = createPlatform(type, addIssueRequest);
|
IssuesPlatform abstractIssuePlatform = createPlatform(type, addIssueRequest);
|
||||||
if (abstractIssuePlatform != null) {
|
if (abstractIssuePlatform != null) {
|
||||||
platformMap.put(type, abstractIssuePlatform);
|
platformMap.put(type, abstractIssuePlatform);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,20 +6,20 @@ import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||||
import io.metersphere.commons.constants.IssuesStatus;
|
import io.metersphere.commons.constants.IssuesStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
import io.metersphere.commons.utils.JSON;
|
import io.metersphere.commons.utils.JSON;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
import io.metersphere.xpack.track.dto.AttachmentSyncType;
|
||||||
import io.metersphere.constants.AttachmentType;
|
import io.metersphere.constants.AttachmentType;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.request.attachment.AttachmentRequest;
|
import io.metersphere.request.attachment.AttachmentRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.*;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.issue.client.JiraClientV2;
|
import io.metersphere.service.issue.client.JiraClientV2;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
|
||||||
import io.metersphere.service.IssuesService;
|
import io.metersphere.service.IssuesService;
|
||||||
import io.metersphere.service.issue.domain.ProjectIssueConfig;
|
import io.metersphere.service.issue.domain.ProjectIssueConfig;
|
||||||
import io.metersphere.service.issue.domain.jira.*;
|
import io.metersphere.service.issue.domain.jira.*;
|
||||||
import net.minidev.json.JSONObject;
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
@ -50,6 +50,11 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
setConfig();
|
setConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xpack 反射调用
|
||||||
|
public JiraClientV2 getJiraClientV2() {
|
||||||
|
return jiraClientV2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||||
issuesRequest.setPlatform(key);
|
issuesRequest.setPlatform(key);
|
||||||
|
@ -62,47 +67,61 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
return issues;
|
return issues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IssuesWithBLOBs getUpdateIssue(JiraIssue jiraIssue) {
|
||||||
|
return getUpdateIssue(null, jiraIssue);
|
||||||
|
}
|
||||||
|
|
||||||
public IssuesWithBLOBs getUpdateIssue(IssuesWithBLOBs issue, JiraIssue jiraIssue) {
|
public IssuesWithBLOBs getUpdateIssue(IssuesWithBLOBs issue, JiraIssue jiraIssue) {
|
||||||
if (issue == null) {
|
try {
|
||||||
issue = new IssuesWithBLOBs();
|
if (issue == null) {
|
||||||
issue.setCustomFields(defaultCustomFields);
|
issue = new IssuesWithBLOBs();
|
||||||
} else {
|
issue.setCustomFields(defaultCustomFields);
|
||||||
mergeCustomField(issue, defaultCustomFields);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map fields = jiraIssue.getFields();
|
|
||||||
String status = getStatus(fields);
|
|
||||||
|
|
||||||
Map<String, String> fileContentMap = getContextMap((List) fields.get("attachment"));
|
|
||||||
|
|
||||||
// 先转换下desc的图片
|
|
||||||
String description = dealWithDescription(fields.get("description").toString(), fileContentMap);
|
|
||||||
fields.put("description", description);
|
|
||||||
CustomFieldItemDTO descItem = null;
|
|
||||||
List<CustomFieldItemDTO> customFieldItems = syncIssueCustomFieldList(issue.getCustomFields(), jiraIssue.getFields());
|
|
||||||
|
|
||||||
// 其他自定义里有富文本框的也转换下图片
|
|
||||||
for (CustomFieldItemDTO item : customFieldItems) {
|
|
||||||
if (StringUtils.equals("description", item.getId())) {
|
|
||||||
// desc转过了,跳过
|
|
||||||
descItem = item;
|
|
||||||
} else {
|
} else {
|
||||||
if (StringUtils.equals(CustomFieldType.RICH_TEXT.getValue(), item.getType())) {
|
mergeCustomField(issue, defaultCustomFields);
|
||||||
item.setValue(dealWithDescription((String) item.getValue(), fileContentMap));
|
}
|
||||||
|
|
||||||
|
Map fields = jiraIssue.getFields();
|
||||||
|
String status = getStatus(fields);
|
||||||
|
|
||||||
|
Map<String, String> fileContentMap = getContextMap((List) fields.get("attachment"));
|
||||||
|
|
||||||
|
// 先转换下desc的图片
|
||||||
|
String description = dealWithDescription(Optional.ofNullable(fields.get("description")).orElse("").toString(), fileContentMap);
|
||||||
|
fields.put("description", description);
|
||||||
|
CustomFieldItemDTO descItem = null;
|
||||||
|
List<CustomFieldItemDTO> customFieldItems = syncIssueCustomFieldList(issue.getCustomFields(), jiraIssue.getFields());
|
||||||
|
|
||||||
|
// 其他自定义里有富文本框的也转换下图片
|
||||||
|
for (CustomFieldItemDTO item : customFieldItems) {
|
||||||
|
if (StringUtils.equals("description", item.getId())) {
|
||||||
|
// desc转过了,跳过
|
||||||
|
descItem = item;
|
||||||
|
} else {
|
||||||
|
if (StringUtils.equals(CustomFieldType.RICH_TEXT.getValue(), item.getType())) {
|
||||||
|
item.setValue(dealWithDescription((String) item.getValue(), fileContentMap));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject assignee = (JSONObject) fields.get("assignee");
|
Map assignee = (Map) fields.get("assignee");
|
||||||
issue.setTitle(fields.get("summary").toString());
|
issue.setTitle(fields.get("summary").toString());
|
||||||
issue.setCreateTime((Long) fields.get("created"));
|
issue.setLastmodify(assignee == null ? "" : assignee.get("displayName").toString());
|
||||||
issue.setUpdateTime((Long) fields.get("updated"));
|
issue.setDescription(description);
|
||||||
issue.setLastmodify(assignee == null ? "" : assignee.get("displayName").toString());
|
issue.setPlatformStatus(status);
|
||||||
issue.setDescription(description);
|
issue.setPlatform(key);
|
||||||
issue.setPlatformStatus(status);
|
issue.setCustomFields(JSON.toJSONString(customFieldItems));
|
||||||
issue.setPlatform(key);
|
try {
|
||||||
issue.setCustomFields(JSON.toJSONString(customFieldItems));
|
issue.setCreateTime(DateUtils.getTimestamp((String) fields.get("created")));
|
||||||
return issue;
|
issue.setUpdateTime(DateUtils.getTimestamp((String) fields.get("updated")));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
return issue;
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
MSException.throwException(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String dealWithDescription(String description, Map<String, String> fileContentMap) {
|
private String dealWithDescription(String description, Map<String, String> fileContentMap) {
|
||||||
|
@ -207,11 +226,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JiraIssueType> getIssueTypes(String jiraKey) {
|
public List<JiraIssueType> getIssueTypes(String jiraKey) {
|
||||||
try {
|
return jiraClientV2.getIssueType(jiraKey);
|
||||||
return jiraClientV2.getIssueType(jiraKey);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -220,8 +235,8 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
setUserConfig();
|
setUserConfig();
|
||||||
Project project = getProject();
|
Project project = getProject();
|
||||||
|
|
||||||
JSONObject addJiraIssueParam = buildUpdateParam(issuesRequest, getIssueType(project.getIssueConfig()), project.getJiraKey());
|
Map addJiraIssueParam = buildUpdateParam(issuesRequest, getIssueType(project.getIssueConfig()), project.getJiraKey());
|
||||||
JiraAddIssueResponse result = jiraClientV2.addIssue(JSONObject.toJSONString(addJiraIssueParam));
|
JiraAddIssueResponse result = jiraClientV2.addIssue(JSON.toJSONString(addJiraIssueParam));
|
||||||
JiraIssue issues = jiraClientV2.getIssues(result.getId());
|
JiraIssue issues = jiraClientV2.getIssues(result.getId());
|
||||||
|
|
||||||
// 上传富文本中的图片作为附件
|
// 上传富文本中的图片作为附件
|
||||||
|
@ -259,7 +274,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return super.getProject(this.projectId, Project::getJiraKey);
|
return super.getProject(this.projectId, Project::getJiraKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<File> getImageFiles(IssuesUpdateRequest issuesRequest) {
|
private List<File> getImageFiles(IssuesUpdateRequest issuesRequest) {
|
||||||
|
@ -284,7 +299,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
* 参数比较特殊,需要特别处理
|
* 参数比较特殊,需要特别处理
|
||||||
* @param fields
|
* @param fields
|
||||||
*/
|
*/
|
||||||
private void setSpecialParam(JSONObject fields) {
|
private void setSpecialParam(Map fields) {
|
||||||
Project project = getProject();
|
Project project = getProject();
|
||||||
try {
|
try {
|
||||||
Map<String, JiraCreateMetadataResponse.Field> createMetadata = jiraClientV2.getCreateMetadata(project.getJiraKey(), getIssueType(project.getIssueConfig()));
|
Map<String, JiraCreateMetadataResponse.Field> createMetadata = jiraClientV2.getCreateMetadata(project.getJiraKey(), getIssueType(project.getIssueConfig()));
|
||||||
|
@ -310,9 +325,9 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
}
|
}
|
||||||
if (isUserKey) {
|
if (isUserKey) {
|
||||||
if (schema.getType() != null && schema.getType().endsWith("user")) {
|
if (schema.getType() != null && schema.getType().endsWith("user")) {
|
||||||
Map field = (Map) fields.get(key);
|
Map field = (Map) fields.get(key);
|
||||||
// 如果不是用户ID,则是用户的key,参数调整为key
|
// 如果不是用户ID,则是用户的key,参数调整为key
|
||||||
JSONObject newField = new JSONObject();
|
Map newField = new LinkedHashMap<>();
|
||||||
newField.put("name", field.get("id").toString());
|
newField.put("name", field.get("id").toString());
|
||||||
fields.put(key, newField);
|
fields.put(key, newField);
|
||||||
}
|
}
|
||||||
|
@ -329,10 +344,10 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject buildUpdateParam(IssuesUpdateRequest issuesRequest, String issuetypeStr, String jiraKey) {
|
private Map<String, Object> buildUpdateParam(IssuesUpdateRequest issuesRequest, String issuetypeStr, String jiraKey) {
|
||||||
issuesRequest.setPlatform(key);
|
issuesRequest.setPlatform(key);
|
||||||
JSONObject fields = new JSONObject();
|
Map fields = new LinkedHashMap<>();
|
||||||
JSONObject project = new JSONObject();
|
Map project = new LinkedHashMap<>();
|
||||||
|
|
||||||
String desc = "";
|
String desc = "";
|
||||||
// 附件描述信息处理
|
// 附件描述信息处理
|
||||||
|
@ -344,11 +359,11 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
fields.put("project", project);
|
fields.put("project", project);
|
||||||
project.put("key", jiraKey);
|
project.put("key", jiraKey);
|
||||||
|
|
||||||
JSONObject issuetype = new JSONObject();
|
Map issuetype = new LinkedHashMap<>();
|
||||||
issuetype.put("id", issuetypeStr);
|
issuetype.put("id", issuetypeStr);
|
||||||
fields.put("issuetype", issuetype);
|
fields.put("issuetype", issuetype);
|
||||||
|
|
||||||
JSONObject addJiraIssueParam = new JSONObject();
|
Map addJiraIssueParam = new LinkedHashMap();
|
||||||
addJiraIssueParam.put("fields", fields);
|
addJiraIssueParam.put("fields", fields);
|
||||||
|
|
||||||
if (issuesRequest.isThirdPartPlatform()) {
|
if (issuesRequest.isThirdPartPlatform()) {
|
||||||
|
@ -411,7 +426,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseCustomFiled(IssuesUpdateRequest issuesRequest, JSONObject fields) {
|
private void parseCustomFiled(IssuesUpdateRequest issuesRequest, Map fields) {
|
||||||
List<CustomFieldItemDTO> customFields = issuesRequest.getRequestFields();
|
List<CustomFieldItemDTO> customFields = issuesRequest.getRequestFields();
|
||||||
|
|
||||||
customFields.forEach(item -> {
|
customFields.forEach(item -> {
|
||||||
|
@ -424,7 +439,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
if (StringUtils.equalsAnyIgnoreCase(name, "PML", "PMLinkTest", "PMLink")) {
|
if (StringUtils.equalsAnyIgnoreCase(name, "PML", "PMLinkTest", "PMLink")) {
|
||||||
fields.put(fieldName, item.getValue());
|
fields.put(fieldName, item.getValue());
|
||||||
} else {
|
} else {
|
||||||
JSONObject param = new JSONObject();
|
Map param = new LinkedHashMap<>();
|
||||||
if (fieldName.equals("assignee") || fieldName.equals("reporter")) {
|
if (fieldName.equals("assignee") || fieldName.equals("reporter")) {
|
||||||
if (issuesRequest.isThirdPartPlatform()) {
|
if (issuesRequest.isThirdPartPlatform()) {
|
||||||
param.put("id", item.getValue());
|
param.put("id", item.getValue());
|
||||||
|
@ -441,7 +456,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
if (item.getValue() != null) {
|
if (item.getValue() != null) {
|
||||||
List values = JSON.parseArray((String) item.getValue());
|
List values = JSON.parseArray((String) item.getValue());
|
||||||
values.forEach(v -> {
|
values.forEach(v -> {
|
||||||
JSONObject param = new JSONObject();
|
Map param = new LinkedHashMap<>();
|
||||||
param.put("id", v);
|
param.put("id", v);
|
||||||
attrs.add(param);
|
attrs.add(param);
|
||||||
});
|
});
|
||||||
|
@ -449,7 +464,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
fields.put(fieldName, attrs);
|
fields.put(fieldName, attrs);
|
||||||
} else if (StringUtils.equalsAny(item.getType(), "cascadingSelect")) {
|
} else if (StringUtils.equalsAny(item.getType(), "cascadingSelect")) {
|
||||||
if (item.getValue() != null) {
|
if (item.getValue() != null) {
|
||||||
JSONObject attr = new JSONObject();
|
Map attr = new LinkedHashMap<>();
|
||||||
if (item.getValue() instanceof List) {
|
if (item.getValue() instanceof List) {
|
||||||
List values = JSON.parseArray((String) item.getValue());
|
List values = JSON.parseArray((String) item.getValue());
|
||||||
if (CollectionUtils.isNotEmpty(values)) {
|
if (CollectionUtils.isNotEmpty(values)) {
|
||||||
|
@ -457,7 +472,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
attr.put("id", values.get(0));
|
attr.put("id", values.get(0));
|
||||||
}
|
}
|
||||||
if (values.size() > 1) {
|
if (values.size() > 1) {
|
||||||
JSONObject param = new JSONObject();
|
Map param = new LinkedHashMap<>();
|
||||||
param.put("id", values.get(1));
|
param.put("id", values.get(1));
|
||||||
attr.put("child", param);
|
attr.put("child", param);
|
||||||
}
|
}
|
||||||
|
@ -486,8 +501,8 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
public void updateIssue(IssuesUpdateRequest request) {
|
public void updateIssue(IssuesUpdateRequest request) {
|
||||||
setUserConfig();
|
setUserConfig();
|
||||||
Project project = getProject();
|
Project project = getProject();
|
||||||
JSONObject param = buildUpdateParam(request, getIssueType(project.getIssueConfig()), project.getJiraKey());
|
Map param = buildUpdateParam(request, getIssueType(project.getIssueConfig()), project.getJiraKey());
|
||||||
jiraClientV2.updateIssue(request.getPlatformId(), JSONObject.toJSONString(param));
|
jiraClientV2.updateIssue(request.getPlatformId(), JSON.toJSONString(param));
|
||||||
|
|
||||||
// 同步Jira富文本有关的附件
|
// 同步Jira富文本有关的附件
|
||||||
syncJiraRichTextAttachment(request);
|
syncJiraRichTextAttachment(request);
|
||||||
|
@ -535,10 +550,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
super.isThirdPartTemplate = isThirdPartTemplate();
|
super.isThirdPartTemplate = isThirdPartTemplate();
|
||||||
HashMap<String, List<CustomFieldResourceDTO>> customFieldMap = new HashMap<>();
|
HashMap<String, List<CustomFieldResourceDTO>> customFieldMap = new HashMap<>();
|
||||||
|
|
||||||
IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);
|
prepareSync(project);
|
||||||
if (project.getThirdPartTemplate()) {
|
|
||||||
super.defaultCustomFields = issuesService.getCustomFieldsValuesString(getThirdPartTemplate().getCustomFields());
|
|
||||||
}
|
|
||||||
|
|
||||||
issues.forEach(item -> {
|
issues.forEach(item -> {
|
||||||
try {
|
try {
|
||||||
|
@ -564,6 +576,13 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
customFieldIssuesService.batchEditFields(customFieldMap);
|
customFieldIssuesService.batchEditFields(customFieldMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void prepareSync(Project project) {
|
||||||
|
IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);
|
||||||
|
if (project.getThirdPartTemplate()) {
|
||||||
|
super.defaultCustomFields = issuesService.getCustomFieldsValuesString(getThirdPartTemplate().getCustomFields());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProjectId(String projectId) {
|
public String getProjectId(String projectId) {
|
||||||
return getProjectId(projectId, Project::getJiraKey);
|
return getProjectId(projectId, Project::getJiraKey);
|
||||||
|
@ -676,7 +695,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
public String getStoryType(String configStr) {
|
public String getStoryType(String configStr) {
|
||||||
ProjectIssueConfig projectConfig = super.getProjectConfig(configStr);
|
ProjectIssueConfig projectConfig = super.getProjectConfig(configStr);
|
||||||
String jiraStoryType = projectConfig.getJiraStoryTypeId();
|
String jiraStoryType = projectConfig.getJiraStoryTypeId();
|
||||||
if (StringUtils.isBlank(jiraStoryType)) {
|
if (StringUtils.isBlank(jiraStoryType)) {
|
||||||
MSException.throwException("请在项目中配置 Jira 需求类型!");
|
MSException.throwException("请在项目中配置 Jira 需求类型!");
|
||||||
}
|
}
|
||||||
return jiraStoryType;
|
return jiraStoryType;
|
||||||
|
@ -761,13 +780,13 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
Object defaultValue = item.getDefaultValue();
|
Object defaultValue = item.getDefaultValue();
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
Object msDefaultValue;
|
Object msDefaultValue;
|
||||||
if (defaultValue instanceof JSONObject) {
|
if (defaultValue instanceof Map) {
|
||||||
msDefaultValue = ((JSONObject) defaultValue).get("id");
|
msDefaultValue = ((Map) defaultValue).get("id");
|
||||||
} else if (defaultValue instanceof List) {
|
} else if (defaultValue instanceof List) {
|
||||||
List defaultList = new ArrayList();
|
List defaultList = new ArrayList();
|
||||||
((List) defaultValue).forEach(i -> {
|
((List) defaultValue).forEach(i -> {
|
||||||
if (i instanceof JSONObject) {
|
if (i instanceof Map) {
|
||||||
JSONObject obj = (JSONObject) i;
|
Map obj = (Map) i;
|
||||||
defaultList.add(obj.get("id"));
|
defaultList.add(obj.get("id"));
|
||||||
} else {
|
} else {
|
||||||
defaultList.add(i);
|
defaultList.add(i);
|
||||||
|
@ -801,7 +820,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
if (allowedValues != null) {
|
if (allowedValues != null) {
|
||||||
List options = new ArrayList<>();
|
List options = new ArrayList<>();
|
||||||
allowedValues.forEach(val -> {
|
allowedValues.forEach(val -> {
|
||||||
JSONObject jsonObject = new JSONObject();
|
Map jsonObject = new LinkedHashMap();
|
||||||
jsonObject.put("value", val.getId());
|
jsonObject.put("value", val.getId());
|
||||||
if (StringUtils.isNotBlank(val.getName())) {
|
if (StringUtils.isNotBlank(val.getName())) {
|
||||||
jsonObject.put("text", val.getName());
|
jsonObject.put("text", val.getName());
|
||||||
|
@ -823,7 +842,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
List<JiraUser> userOptions = jiraClientV2.getAssignableUser(projectKey);
|
List<JiraUser> userOptions = jiraClientV2.getAssignableUser(projectKey);
|
||||||
List options = new ArrayList();
|
List options = new ArrayList();
|
||||||
userOptions.forEach(val -> {
|
userOptions.forEach(val -> {
|
||||||
JSONObject jsonObject = new JSONObject();
|
Map jsonObject = new LinkedHashMap<>();
|
||||||
if (StringUtils.isNotBlank(val.getAccountId())) {
|
if (StringUtils.isNotBlank(val.getAccountId())) {
|
||||||
jsonObject.put("value", val.getAccountId());
|
jsonObject.put("value", val.getAccountId());
|
||||||
} else {
|
} else {
|
||||||
|
@ -877,50 +896,55 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncJiraIssueAttachments(IssuesWithBLOBs issue, JiraIssue jiraIssue) {
|
public void syncJiraIssueAttachments(IssuesWithBLOBs issue, JiraIssue jiraIssue) {
|
||||||
List<String> jiraAttachmentsName = new ArrayList<String>();
|
try {
|
||||||
AttachmentRequest request = new AttachmentRequest();
|
List<String> jiraAttachmentsName = new ArrayList<String>();
|
||||||
request.setBelongType(AttachmentType.ISSUE.type());
|
AttachmentRequest request = new AttachmentRequest();
|
||||||
request.setBelongId(issue.getId());
|
request.setBelongType(AttachmentType.ISSUE.type());
|
||||||
List<FileAttachmentMetadata> allMsAttachments = attachmentService.listMetadata(request);
|
request.setBelongId(issue.getId());
|
||||||
List<String> msAttachmentsName = allMsAttachments.stream().map(FileAttachmentMetadata::getName).collect(Collectors.toList());
|
List<FileAttachmentMetadata> allMsAttachments = attachmentService.listMetadata(request);
|
||||||
List attachments = (List) jiraIssue.getFields().get("attachment");
|
List<String> msAttachmentsName = allMsAttachments.stream().map(FileAttachmentMetadata::getName).collect(Collectors.toList());
|
||||||
// 同步Jira中新的附件
|
List attachments = (List) jiraIssue.getFields().get("attachment");
|
||||||
if (CollectionUtils.isNotEmpty(attachments)) {
|
// 同步Jira中新的附件
|
||||||
for (int i = 0; i < attachments.size(); i++) {
|
if (CollectionUtils.isNotEmpty(attachments)) {
|
||||||
Map attachment = (Map) attachments.get(i);
|
for (int i = 0; i < attachments.size(); i++) {
|
||||||
String filename = attachment.get("filename").toString();
|
Map attachment = (Map) attachments.get(i);
|
||||||
jiraAttachmentsName.add(filename);
|
String filename = attachment.get("filename").toString();
|
||||||
if ((issue.getDescription() == null || !issue.getDescription().contains(filename))
|
jiraAttachmentsName.add(filename);
|
||||||
&& (issue.getCustomFields() == null || !issue.getCustomFields().contains(filename))
|
if ((issue.getDescription() == null || !issue.getDescription().contains(filename))
|
||||||
&& !msAttachmentsName.contains(filename)) {
|
&& (issue.getCustomFields() == null || !issue.getCustomFields().contains(filename))
|
||||||
try {
|
&& !msAttachmentsName.contains(filename)) {
|
||||||
byte[] content = jiraClientV2.getAttachmentContent(attachment.get("content").toString());
|
try {
|
||||||
FileAttachmentMetadata fileAttachmentMetadata = attachmentService.saveAttachmentByBytes(content, AttachmentType.ISSUE.type(), issue.getId(), filename);
|
byte[] content = jiraClientV2.getAttachmentContent(attachment.get("content").toString());
|
||||||
AttachmentModuleRelation attachmentModuleRelation = new AttachmentModuleRelation();
|
FileAttachmentMetadata fileAttachmentMetadata = attachmentService.saveAttachmentByBytes(content, AttachmentType.ISSUE.type(), issue.getId(), filename);
|
||||||
attachmentModuleRelation.setAttachmentId(fileAttachmentMetadata.getId());
|
AttachmentModuleRelation attachmentModuleRelation = new AttachmentModuleRelation();
|
||||||
attachmentModuleRelation.setRelationId(issue.getId());
|
attachmentModuleRelation.setAttachmentId(fileAttachmentMetadata.getId());
|
||||||
attachmentModuleRelation.setRelationType(AttachmentType.ISSUE.type());
|
attachmentModuleRelation.setRelationId(issue.getId());
|
||||||
attachmentModuleRelationMapper.insert(attachmentModuleRelation);
|
attachmentModuleRelation.setRelationType(AttachmentType.ISSUE.type());
|
||||||
} catch (Exception e) {
|
attachmentModuleRelationMapper.insert(attachmentModuleRelation);
|
||||||
LogUtil.error(e);
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 删除Jira中不存在的附件
|
// 删除Jira中不存在的附件
|
||||||
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
|
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
|
||||||
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
|
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
|
||||||
.filter(msAttachment -> !jiraAttachmentsName.contains(msAttachment.getName())).collect(Collectors.toList());
|
.filter(msAttachment -> !jiraAttachmentsName.contains(msAttachment.getName())).collect(Collectors.toList());
|
||||||
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
|
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
|
||||||
List<String> ids = List.of(fileAttachmentMetadata.getId());
|
List<String> ids = List.of(fileAttachmentMetadata.getId());
|
||||||
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
|
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
|
||||||
example.createCriteria().andAttachmentIdIn(ids).andRelationTypeEqualTo(AttachmentType.ISSUE.type());
|
example.createCriteria().andAttachmentIdIn(ids).andRelationTypeEqualTo(AttachmentType.ISSUE.type());
|
||||||
// 删除MS附件及关联数据
|
// 删除MS附件及关联数据
|
||||||
attachmentService.deleteAttachmentByIds(ids);
|
attachmentService.deleteAttachmentByIds(ids);
|
||||||
attachmentService.deleteFileAttachmentByIds(ids);
|
attachmentService.deleteFileAttachmentByIds(ids);
|
||||||
attachmentModuleRelationMapper.deleteByExample(example);
|
attachmentModuleRelationMapper.deleteByExample(example);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
MSException.throwException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package io.metersphere.service.issue.platform;
|
package io.metersphere.service.issue.platform;
|
||||||
|
|
||||||
import io.metersphere.base.domain.Project;
|
import io.metersphere.base.domain.Project;
|
||||||
import io.metersphere.dto.IssuesDao;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import io.metersphere.dto.UserDTO;
|
import io.metersphere.dto.UserDTO;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
import io.metersphere.xpack.track.dto.PlatformUser;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@ import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.BeanUtils;
|
||||||
import io.metersphere.commons.utils.JSON;
|
import io.metersphere.commons.utils.JSON;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
import io.metersphere.xpack.track.dto.AttachmentSyncType;
|
||||||
import io.metersphere.dto.CustomFieldItemDTO;
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
import io.metersphere.dto.DemandDTO;
|
import io.metersphere.xpack.track.dto.DemandDTO;
|
||||||
import io.metersphere.dto.IssuesDao;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.request.testcase.TestCaseBatchRequest;
|
import io.metersphere.request.testcase.TestCaseBatchRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
|
@ -5,21 +5,16 @@ import io.metersphere.base.domain.Project;
|
||||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||||
import io.metersphere.commons.constants.IssuesStatus;
|
import io.metersphere.commons.constants.IssuesStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.xpack.track.dto.*;
|
||||||
import io.metersphere.commons.utils.JSON;
|
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.SystemParameterService;
|
import io.metersphere.service.SystemParameterService;
|
||||||
import io.metersphere.service.issue.client.TapdClient;
|
import io.metersphere.service.issue.client.TapdClient;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
|
||||||
import io.metersphere.service.issue.domain.tapd.TapdBug;
|
import io.metersphere.service.issue.domain.tapd.TapdBug;
|
||||||
import io.metersphere.service.issue.domain.tapd.TapdConfig;
|
import io.metersphere.service.issue.domain.tapd.TapdConfig;
|
||||||
import io.metersphere.service.issue.domain.tapd.TapdGetIssueResponse;
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
@ -40,6 +35,11 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
||||||
setConfig();
|
setConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xpack 反射调用
|
||||||
|
public TapdClient getTapdClient() {
|
||||||
|
return tapdClient;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||||
issuesRequest.setPlatform(key);
|
issuesRequest.setPlatform(key);
|
||||||
|
@ -211,7 +211,7 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
||||||
Map bug = (Map) issue.get("Bug");
|
Map bug = (Map) issue.get("Bug");
|
||||||
String platformId = bug.get("id").toString();
|
String platformId = bug.get("id").toString();
|
||||||
String id = idMap.get(platformId);
|
String id = idMap.get(platformId);
|
||||||
IssuesWithBLOBs updateIssue = getUpdateIssue(issuesMapper.selectByPrimaryKey(id), bug, statusMap);
|
IssuesWithBLOBs updateIssue = getUpdateIssue(issuesMapper.selectByPrimaryKey(id), bug);
|
||||||
updateIssue.setId(id);
|
updateIssue.setId(id);
|
||||||
updateIssue.setCustomFields(syncIssueCustomField(updateIssue.getCustomFields(), bug));
|
updateIssue.setCustomFields(syncIssueCustomField(updateIssue.getCustomFields(), bug));
|
||||||
customFieldMap.put(id, baseCustomFieldService.getCustomFieldResourceDTO(updateIssue.getCustomFields()));
|
customFieldMap.put(id, baseCustomFieldService.getCustomFieldResourceDTO(updateIssue.getCustomFields()));
|
||||||
|
@ -232,7 +232,7 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
||||||
customFieldIssuesService.batchEditFields(customFieldMap);
|
customFieldIssuesService.batchEditFields(customFieldMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IssuesWithBLOBs getUpdateIssue(IssuesWithBLOBs issue, Map bug, Map<String, String> statusMap) {
|
public IssuesWithBLOBs getUpdateIssue(IssuesWithBLOBs issue, Map bug) {
|
||||||
if (issue == null) {
|
if (issue == null) {
|
||||||
issue = new IssuesWithBLOBs();
|
issue = new IssuesWithBLOBs();
|
||||||
issue.setCustomFields(defaultCustomFields);
|
issue.setCustomFields(defaultCustomFields);
|
||||||
|
@ -244,6 +244,10 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
||||||
return issue;
|
return issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IssuesWithBLOBs getUpdateIssue(Map bug) {
|
||||||
|
return getUpdateIssue(null, bug);
|
||||||
|
}
|
||||||
|
|
||||||
private void parseIssue(IssuesWithBLOBs issue, Map bug) {
|
private void parseIssue(IssuesWithBLOBs issue, Map bug) {
|
||||||
TapdBug bugObj = JSON.parseObject(JSON.toJSONString(bug), TapdBug.class);
|
TapdBug bugObj = JSON.parseObject(JSON.toJSONString(bug), TapdBug.class);
|
||||||
BeanUtils.copyBean(issue, bugObj);
|
BeanUtils.copyBean(issue, bugObj);
|
||||||
|
@ -251,11 +255,15 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
||||||
issue.setDescription(htmlDesc2MsDesc(issue.getDescription()));
|
issue.setDescription(htmlDesc2MsDesc(issue.getDescription()));
|
||||||
issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));
|
issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));
|
||||||
issue.setPlatform(key);
|
issue.setPlatform(key);
|
||||||
issue.setCreateTime((Long) bug.get("created"));
|
try {
|
||||||
issue.setUpdateTime((Long) bug.get("modified"));
|
issue.setCreateTime(DateUtils.getTimestamp((String) bug.get("created")));
|
||||||
|
issue.setUpdateTime(DateUtils.getTimestamp((String) bug.get("modified")));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IssuesWithBLOBs getUpdateIssue(IssuesWithBLOBs issue, Map bug, List<CustomFieldItemDTO> customField) {
|
public IssuesWithBLOBs getUpdateIssue(IssuesWithBLOBs issue, Map bug, List<CustomFieldItemDTO> customField) {
|
||||||
if (issue == null) {
|
if (issue == null) {
|
||||||
issue = new IssuesWithBLOBs();
|
issue = new IssuesWithBLOBs();
|
||||||
issue.setCustomFields(defaultCustomFields);
|
issue.setCustomFields(defaultCustomFields);
|
||||||
|
|
|
@ -7,20 +7,23 @@ import io.metersphere.commons.constants.ZentaoIssuePlatformStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.JSON;
|
import io.metersphere.commons.utils.JSON;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.constants.AttachmentSyncType;
|
import io.metersphere.xpack.track.dto.AttachmentSyncType;
|
||||||
import io.metersphere.constants.AttachmentType;
|
import io.metersphere.constants.AttachmentType;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.request.attachment.AttachmentRequest;
|
import io.metersphere.request.attachment.AttachmentRequest;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.DemandDTO;
|
||||||
import io.metersphere.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
|
import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
||||||
import io.metersphere.service.issue.client.ZentaoClient;
|
import io.metersphere.service.issue.client.ZentaoClient;
|
||||||
import io.metersphere.service.issue.client.ZentaoGetClient;
|
import io.metersphere.service.issue.client.ZentaoGetClient;
|
||||||
import io.metersphere.service.issue.domain.PlatformUser;
|
import io.metersphere.xpack.track.dto.PlatformUser;
|
||||||
|
|
||||||
import io.metersphere.service.issue.domain.zentao.AddIssueResponse;
|
import io.metersphere.service.issue.domain.zentao.AddIssueResponse;
|
||||||
import io.metersphere.service.issue.domain.zentao.GetIssueResponse;
|
import io.metersphere.service.issue.domain.zentao.GetIssueResponse;
|
||||||
import io.metersphere.service.issue.domain.zentao.ZentaoBuild;
|
import io.metersphere.service.issue.domain.zentao.ZentaoBuild;
|
||||||
import io.metersphere.service.issue.domain.zentao.ZentaoConfig;
|
import io.metersphere.service.issue.domain.zentao.ZentaoConfig;
|
||||||
|
import io.metersphere.xpack.track.dto.PlatformStatusDTO;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.logging.log4j.util.Strings;
|
import org.apache.logging.log4j.util.Strings;
|
||||||
|
@ -50,6 +53,10 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
"bmp", "jpg", "png", "tif", "gif", "jpeg"
|
"bmp", "jpg", "png", "tif", "gif", "jpeg"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// xpack 反射调用
|
||||||
|
public ZentaoClient getZentaoClient() {
|
||||||
|
return zentaoClient;
|
||||||
|
}
|
||||||
|
|
||||||
public ZentaoPlatform(IssuesRequest issuesRequest) {
|
public ZentaoPlatform(IssuesRequest issuesRequest) {
|
||||||
super(issuesRequest);
|
super(issuesRequest);
|
||||||
|
@ -77,12 +84,12 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
return issues;
|
return issues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IssuesDao getZentaoAssignedAndBuilds(IssuesDao issue){
|
public IssuesDao getZentaoAssignedAndBuilds(IssuesDao issue) {
|
||||||
Map zentaoIssue = (Map) zentaoClient.getBugById(issue.getPlatformId());
|
Map zentaoIssue = (Map) zentaoClient.getBugById(issue.getPlatformId());
|
||||||
String assignedTo = zentaoIssue.get("assignedTo").toString();
|
String assignedTo = zentaoIssue.get("assignedTo").toString();
|
||||||
String openedBuild = zentaoIssue.get("openedBuild").toString();
|
String openedBuild = zentaoIssue.get("openedBuild").toString();
|
||||||
List<String>zentaoBuilds = new ArrayList<>();
|
List<String> zentaoBuilds = new ArrayList<>();
|
||||||
if(Strings.isNotBlank(openedBuild)){
|
if (Strings.isNotBlank(openedBuild)) {
|
||||||
zentaoBuilds = Arrays.asList(openedBuild.split(","));
|
zentaoBuilds = Arrays.asList(openedBuild.split(","));
|
||||||
}
|
}
|
||||||
issue.setZentaoAssigned(assignedTo);
|
issue.setZentaoAssigned(assignedTo);
|
||||||
|
@ -146,13 +153,19 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IssuesWithBLOBs getUpdateIssues(Map bug) {
|
||||||
|
return getUpdateIssues(null, bug);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新缺陷数据
|
* 更新缺陷数据
|
||||||
|
*
|
||||||
* @param issue 待更新缺陷数据
|
* @param issue 待更新缺陷数据
|
||||||
* @param bug 平台缺陷数据
|
* @param bug 平台缺陷数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IssuesWithBLOBs getUpdateIssues(IssuesWithBLOBs issue, Map bug) {
|
public IssuesWithBLOBs getUpdateIssues(IssuesWithBLOBs issue, Map bug) {
|
||||||
|
|
||||||
GetIssueResponse.Issue bugObj = JSON.parseObject(JSON.toJSONString(bug), GetIssueResponse.Issue.class);
|
GetIssueResponse.Issue bugObj = JSON.parseObject(JSON.toJSONString(bug), GetIssueResponse.Issue.class);
|
||||||
String description = bugObj.getSteps();
|
String description = bugObj.getSteps();
|
||||||
String steps = description;
|
String steps = description;
|
||||||
|
@ -168,7 +181,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
mergeCustomField(issue, defaultCustomFields);
|
mergeCustomField(issue, defaultCustomFields);
|
||||||
}
|
}
|
||||||
issue.setPlatformStatus(bugObj.getStatus());
|
issue.setPlatformStatus(bugObj.getStatus());
|
||||||
if (StringUtils.equals(bugObj.getDeleted(),"1")) {
|
if (StringUtils.equals(bugObj.getDeleted(), "1")) {
|
||||||
issue.setPlatformStatus(IssuesStatus.DELETE.toString());
|
issue.setPlatformStatus(IssuesStatus.DELETE.toString());
|
||||||
issuesMapper.updateByPrimaryKeySelective(issue);
|
issuesMapper.updateByPrimaryKeySelective(issue);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +194,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
String lastEditedDate = bug.get("lastEditedDate").toString();
|
String lastEditedDate = bug.get("lastEditedDate").toString();
|
||||||
if (StringUtils.isNotBlank(openedDate) && !openedDate.startsWith("0000-00-00"))
|
if (StringUtils.isNotBlank(openedDate) && !openedDate.startsWith("0000-00-00"))
|
||||||
issue.setCreateTime((Long) bug.get("openedDate"));
|
issue.setCreateTime((Long) bug.get("openedDate"));
|
||||||
if (StringUtils.isNotBlank(lastEditedDate) && !lastEditedDate.startsWith("0000-00-00"))
|
if (StringUtils.isNotBlank(lastEditedDate) && !lastEditedDate.startsWith("0000-00-00"))
|
||||||
issue.setUpdateTime((Long) bug.get("lastEditedDate"));
|
issue.setUpdateTime((Long) bug.get("lastEditedDate"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error("update zentao time" + e.getMessage());
|
LogUtil.error("update zentao time" + e.getMessage());
|
||||||
|
@ -362,9 +375,9 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlatformUser> getPlatformUser() {
|
public List<PlatformUser> getPlatformUser() {
|
||||||
String session = zentaoClient.login();;
|
String session = zentaoClient.login();
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
HttpEntity<MultiValueMap<String,String>> requestEntity = new HttpEntity<>(httpHeaders);
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(httpHeaders);
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
String getUser = zentaoClient.requestUrl.getUserGet();
|
String getUser = zentaoClient.requestUrl.getUserGet();
|
||||||
ResponseEntity<String> responseEntity = restTemplate.exchange(getUser + session,
|
ResponseEntity<String> responseEntity = restTemplate.exchange(getUser + session,
|
||||||
|
@ -374,7 +387,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
|
|
||||||
LogUtil.info("zentao user " + obj);
|
LogUtil.info("zentao user " + obj);
|
||||||
|
|
||||||
List data = (List) obj.get("data");
|
List data = JSON.parseArray(obj.get("data").toString());
|
||||||
|
|
||||||
List<PlatformUser> users = new ArrayList<>();
|
List<PlatformUser> users = new ArrayList<>();
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
@ -483,7 +496,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String zentao2MsDescription(String ztDescription) {
|
private String zentao2MsDescription(String ztDescription) {
|
||||||
String imgRegex ="<img src.*?/>";
|
String imgRegex = "<img src.*?/>";
|
||||||
Pattern pattern = Pattern.compile(imgRegex);
|
Pattern pattern = Pattern.compile(imgRegex);
|
||||||
Matcher matcher = pattern.matcher(ztDescription);
|
Matcher matcher = pattern.matcher(ztDescription);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
|
|
|
@ -11,6 +11,6 @@ public class TrackCustomFieldTemplateService extends TrackProjectSettingService
|
||||||
private static final String BASE_UEL = "/custom/field/template";
|
private static final String BASE_UEL = "/custom/field/template";
|
||||||
|
|
||||||
public List<CustomFieldDao> getCustomFieldByTemplateId(String templateId) {
|
public List<CustomFieldDao> getCustomFieldByTemplateId(String templateId) {
|
||||||
return microService.getForDataArray(serviceName, BASE_UEL + templateId, CustomFieldDao.class);
|
return microService.getForDataArray(serviceName, BASE_UEL + "/list/" + templateId, CustomFieldDao.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.metersphere.service.remote.project;
|
package io.metersphere.service.remote.project;
|
||||||
|
|
||||||
import io.metersphere.dto.IssueTemplateDao;
|
import io.metersphere.xpack.track.dto.IssueTemplateDao;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package io.metersphere.service.remote.setting;
|
|
||||||
|
|
||||||
import io.metersphere.base.domain.ServiceIntegration;
|
|
||||||
import io.metersphere.request.IntegrationRequest;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public class IntegrationService extends SettingService {
|
|
||||||
|
|
||||||
public ServiceIntegration get(IntegrationRequest request) {
|
|
||||||
return microService.postForData(serviceName, "/service/integration/type", request,
|
|
||||||
ServiceIntegration.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@ package io.metersphere.service.wapper;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.request.testcase.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.service.issue.platform.IssueFactory;
|
import io.metersphere.service.issue.platform.IssueFactory;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
|
|
Loading…
Reference in New Issue