feat: Jira缺陷类型配置改到项目下

This commit is contained in:
chenjianxing 2022-01-20 21:09:13 +08:00 committed by zhangdahai112
parent c8102b9941
commit 4b2e924355
22 changed files with 564 additions and 256 deletions

View File

@ -45,14 +45,14 @@ public class Project implements Serializable {
private String azureFilterId; private String azureFilterId;
private String apiQuick;
private Boolean casePublic;
private String platform; private String platform;
private Boolean thirdPartTemplate; private Boolean thirdPartTemplate;
private Boolean casePublic;
private String apiQuick;
private Boolean versionEnable; private Boolean versionEnable;
private Boolean cleanTrackReport; private Boolean cleanTrackReport;
@ -67,5 +67,7 @@ public class Project implements Serializable {
private String cleanLoadReportExpr; private String cleanLoadReportExpr;
private String issueConfig;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -1434,136 +1434,6 @@ public class ProjectExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
return (Criteria) this;
}
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
return (Criteria) this;
}
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andPlatformIsNull() { public Criteria andPlatformIsNull() {
addCriterion("platform is null"); addCriterion("platform is null");
return (Criteria) this; return (Criteria) this;
@ -1694,6 +1564,136 @@ public class ProjectExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
return (Criteria) this;
}
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
return (Criteria) this;
}
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andVersionEnableIsNull() { public Criteria andVersionEnableIsNull() {
addCriterion("version_enable is null"); addCriterion("version_enable is null");
return (Criteria) this; return (Criteria) this;

View File

@ -16,15 +16,21 @@ public interface ProjectMapper {
int insertSelective(Project record); int insertSelective(Project record);
List<Project> selectByExampleWithBLOBs(ProjectExample example);
List<Project> selectByExample(ProjectExample example); List<Project> selectByExample(ProjectExample example);
Project selectByPrimaryKey(String id); Project selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") Project record, @Param("example") ProjectExample example); int updateByExampleSelective(@Param("record") Project record, @Param("example") ProjectExample example);
int updateByExampleWithBLOBs(@Param("record") Project record, @Param("example") ProjectExample example);
int updateByExample(@Param("record") Project record, @Param("example") ProjectExample example); int updateByExample(@Param("record") Project record, @Param("example") ProjectExample example);
int updateByPrimaryKeySelective(Project record); int updateByPrimaryKeySelective(Project record);
int updateByPrimaryKeyWithBLOBs(Project record);
int updateByPrimaryKey(Project record); int updateByPrimaryKey(Project record);
} }

View File

@ -22,10 +22,10 @@
<result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort" /> <result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort" />
<result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen" /> <result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen" />
<result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId" /> <result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId" />
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick" />
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="platform" jdbcType="VARCHAR" property="platform" /> <result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="third_part_template" jdbcType="BIT" property="thirdPartTemplate" /> <result column="third_part_template" jdbcType="BIT" property="thirdPartTemplate" />
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick" />
<result column="version_enable" jdbcType="BIT" property="versionEnable" /> <result column="version_enable" jdbcType="BIT" property="versionEnable" />
<result column="clean_track_report" jdbcType="BIT" property="cleanTrackReport" /> <result column="clean_track_report" jdbcType="BIT" property="cleanTrackReport" />
<result column="clean_track_report_expr" jdbcType="VARCHAR" property="cleanTrackReportExpr" /> <result column="clean_track_report_expr" jdbcType="VARCHAR" property="cleanTrackReportExpr" />
@ -34,6 +34,9 @@
<result column="clean_load_report" jdbcType="BIT" property="cleanLoadReport" /> <result column="clean_load_report" jdbcType="BIT" property="cleanLoadReport" />
<result column="clean_load_report_expr" jdbcType="VARCHAR" property="cleanLoadReportExpr" /> <result column="clean_load_report_expr" jdbcType="VARCHAR" property="cleanLoadReportExpr" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.Project">
<result column="issue_config" jdbcType="LONGVARCHAR" property="issueConfig" />
</resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
@ -96,10 +99,29 @@
id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key, id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key,
zentao_id, azure_devops_id, `repeatable`, case_template_id, issue_template_id, custom_num, zentao_id, azure_devops_id, `repeatable`, case_template_id, issue_template_id, custom_num,
scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open, azure_filter_id, scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open, azure_filter_id,
api_quick, case_public, platform, third_part_template, version_enable, clean_track_report, platform, third_part_template, case_public, api_quick, version_enable, clean_track_report,
clean_track_report_expr, clean_api_report, clean_api_report_expr, clean_load_report, clean_track_report_expr, clean_api_report, clean_api_report_expr, clean_load_report,
clean_load_report_expr clean_load_report_expr
</sql> </sql>
<sql id="Blob_Column_List">
issue_config
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from project
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
@ -114,9 +136,11 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from project from project
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
@ -137,22 +161,22 @@
azure_devops_id, `repeatable`, case_template_id, azure_devops_id, `repeatable`, case_template_id,
issue_template_id, custom_num, scenario_custom_num, issue_template_id, custom_num, scenario_custom_num,
create_user, system_id, mock_tcp_port, create_user, system_id, mock_tcp_port,
is_mock_tcp_open, azure_filter_id, api_quick, is_mock_tcp_open, azure_filter_id, platform,
case_public, platform, third_part_template, third_part_template, case_public, api_quick,
version_enable, clean_track_report, clean_track_report_expr, version_enable, clean_track_report, clean_track_report_expr,
clean_api_report, clean_api_report_expr, clean_load_report, clean_api_report, clean_api_report_expr, clean_load_report,
clean_load_report_expr) clean_load_report_expr, issue_config)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR}, #{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR},
#{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR}, #{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR},
#{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT}, #{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER},
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{apiQuick,jdbcType=VARCHAR}, #{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR},
#{casePublic,jdbcType=BIT}, #{platform,jdbcType=VARCHAR}, #{thirdPartTemplate,jdbcType=BIT}, #{thirdPartTemplate,jdbcType=BIT}, #{casePublic,jdbcType=BIT}, #{apiQuick,jdbcType=VARCHAR},
#{versionEnable,jdbcType=BIT}, #{cleanTrackReport,jdbcType=BIT}, #{cleanTrackReportExpr,jdbcType=VARCHAR}, #{versionEnable,jdbcType=BIT}, #{cleanTrackReport,jdbcType=BIT}, #{cleanTrackReportExpr,jdbcType=VARCHAR},
#{cleanApiReport,jdbcType=BIT}, #{cleanApiReportExpr,jdbcType=VARCHAR}, #{cleanLoadReport,jdbcType=BIT}, #{cleanApiReport,jdbcType=BIT}, #{cleanApiReportExpr,jdbcType=VARCHAR}, #{cleanLoadReport,jdbcType=BIT},
#{cleanLoadReportExpr,jdbcType=VARCHAR}) #{cleanLoadReportExpr,jdbcType=VARCHAR}, #{issueConfig,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Project"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.Project">
insert into project insert into project
@ -217,18 +241,18 @@
<if test="azureFilterId != null"> <if test="azureFilterId != null">
azure_filter_id, azure_filter_id,
</if> </if>
<if test="apiQuick != null">
api_quick,
</if>
<if test="casePublic != null">
case_public,
</if>
<if test="platform != null"> <if test="platform != null">
platform, platform,
</if> </if>
<if test="thirdPartTemplate != null"> <if test="thirdPartTemplate != null">
third_part_template, third_part_template,
</if> </if>
<if test="casePublic != null">
case_public,
</if>
<if test="apiQuick != null">
api_quick,
</if>
<if test="versionEnable != null"> <if test="versionEnable != null">
version_enable, version_enable,
</if> </if>
@ -250,6 +274,9 @@
<if test="cleanLoadReportExpr != null"> <if test="cleanLoadReportExpr != null">
clean_load_report_expr, clean_load_report_expr,
</if> </if>
<if test="issueConfig != null">
issue_config,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -312,18 +339,18 @@
<if test="azureFilterId != null"> <if test="azureFilterId != null">
#{azureFilterId,jdbcType=VARCHAR}, #{azureFilterId,jdbcType=VARCHAR},
</if> </if>
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="platform != null"> <if test="platform != null">
#{platform,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR},
</if> </if>
<if test="thirdPartTemplate != null"> <if test="thirdPartTemplate != null">
#{thirdPartTemplate,jdbcType=BIT}, #{thirdPartTemplate,jdbcType=BIT},
</if> </if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
</if>
<if test="versionEnable != null"> <if test="versionEnable != null">
#{versionEnable,jdbcType=BIT}, #{versionEnable,jdbcType=BIT},
</if> </if>
@ -345,6 +372,9 @@
<if test="cleanLoadReportExpr != null"> <if test="cleanLoadReportExpr != null">
#{cleanLoadReportExpr,jdbcType=VARCHAR}, #{cleanLoadReportExpr,jdbcType=VARCHAR},
</if> </if>
<if test="issueConfig != null">
#{issueConfig,jdbcType=LONGVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultType="java.lang.Long">
@ -416,18 +446,18 @@
<if test="record.azureFilterId != null"> <if test="record.azureFilterId != null">
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR}, azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
</if> </if>
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.platform != null"> <if test="record.platform != null">
platform = #{record.platform,jdbcType=VARCHAR}, platform = #{record.platform,jdbcType=VARCHAR},
</if> </if>
<if test="record.thirdPartTemplate != null"> <if test="record.thirdPartTemplate != null">
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT}, third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
</if> </if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
</if>
<if test="record.versionEnable != null"> <if test="record.versionEnable != null">
version_enable = #{record.versionEnable,jdbcType=BIT}, version_enable = #{record.versionEnable,jdbcType=BIT},
</if> </if>
@ -449,11 +479,52 @@
<if test="record.cleanLoadReportExpr != null"> <if test="record.cleanLoadReportExpr != null">
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR}, clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR},
</if> </if>
<if test="record.issueConfig != null">
issue_config = #{record.issueConfig,jdbcType=LONGVARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update project
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
tapd_id = #{record.tapdId,jdbcType=VARCHAR},
jira_key = #{record.jiraKey,jdbcType=VARCHAR},
zentao_id = #{record.zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{record.azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{record.repeatable,jdbcType=BIT},
case_template_id = #{record.caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{record.issueTemplateId,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=BIT},
scenario_custom_num = #{record.scenarioCustomNum,jdbcType=BIT},
create_user = #{record.createUser,jdbcType=VARCHAR},
system_id = #{record.systemId,jdbcType=VARCHAR},
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
case_public = #{record.casePublic,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
version_enable = #{record.versionEnable,jdbcType=BIT},
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{record.cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{record.cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{record.cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{record.cleanLoadReportExpr,jdbcType=VARCHAR},
issue_config = #{record.issueConfig,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update project update project
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
@ -476,10 +547,10 @@
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER}, mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT}, is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR}, azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
case_public = #{record.casePublic,jdbcType=BIT},
platform = #{record.platform,jdbcType=VARCHAR}, platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT}, third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
case_public = #{record.casePublic,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
version_enable = #{record.versionEnable,jdbcType=BIT}, version_enable = #{record.versionEnable,jdbcType=BIT},
clean_track_report = #{record.cleanTrackReport,jdbcType=BIT}, clean_track_report = #{record.cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR}, clean_track_report_expr = #{record.cleanTrackReportExpr,jdbcType=VARCHAR},
@ -551,18 +622,18 @@
<if test="azureFilterId != null"> <if test="azureFilterId != null">
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR}, azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
</if> </if>
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="platform != null"> <if test="platform != null">
platform = #{platform,jdbcType=VARCHAR}, platform = #{platform,jdbcType=VARCHAR},
</if> </if>
<if test="thirdPartTemplate != null"> <if test="thirdPartTemplate != null">
third_part_template = #{thirdPartTemplate,jdbcType=BIT}, third_part_template = #{thirdPartTemplate,jdbcType=BIT},
</if> </if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
</if>
<if test="versionEnable != null"> <if test="versionEnable != null">
version_enable = #{versionEnable,jdbcType=BIT}, version_enable = #{versionEnable,jdbcType=BIT},
</if> </if>
@ -584,9 +655,47 @@
<if test="cleanLoadReportExpr != null"> <if test="cleanLoadReportExpr != null">
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR}, clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR},
</if> </if>
<if test="issueConfig != null">
issue_config = #{issueConfig,jdbcType=LONGVARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.Project">
update project
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
tapd_id = #{tapdId,jdbcType=VARCHAR},
jira_key = #{jiraKey,jdbcType=VARCHAR},
zentao_id = #{zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{repeatable,jdbcType=BIT},
case_template_id = #{caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{issueTemplateId,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=BIT},
scenario_custom_num = #{scenarioCustomNum,jdbcType=BIT},
create_user = #{createUser,jdbcType=VARCHAR},
system_id = #{systemId,jdbcType=VARCHAR},
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
case_public = #{casePublic,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR},
version_enable = #{versionEnable,jdbcType=BIT},
clean_track_report = #{cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},
clean_api_report = #{cleanApiReport,jdbcType=BIT},
clean_api_report_expr = #{cleanApiReportExpr,jdbcType=VARCHAR},
clean_load_report = #{cleanLoadReport,jdbcType=BIT},
clean_load_report_expr = #{cleanLoadReportExpr,jdbcType=VARCHAR},
issue_config = #{issueConfig,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Project"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Project">
update project update project
set workspace_id = #{workspaceId,jdbcType=VARCHAR}, set workspace_id = #{workspaceId,jdbcType=VARCHAR},
@ -608,10 +717,10 @@
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER}, mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT}, is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR}, azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
api_quick = #{apiQuick,jdbcType=VARCHAR},
case_public = #{casePublic,jdbcType=BIT},
platform = #{platform,jdbcType=VARCHAR}, platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT}, third_part_template = #{thirdPartTemplate,jdbcType=BIT},
case_public = #{casePublic,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR},
version_enable = #{versionEnable,jdbcType=BIT}, version_enable = #{versionEnable,jdbcType=BIT},
clean_track_report = #{cleanTrackReport,jdbcType=BIT}, clean_track_report = #{cleanTrackReport,jdbcType=BIT},
clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR}, clean_track_report_expr = #{cleanTrackReportExpr,jdbcType=VARCHAR},

View File

@ -53,7 +53,8 @@
p.mock_tcp_port AS mockTcpPort, p.mock_tcp_port AS mockTcpPort,
p.is_mock_tcp_open AS isMockTcpOpen, p.is_mock_tcp_open AS isMockTcpOpen,
p.scenario_custom_num, p.scenario_custom_num,
p.platform, p.third_part_template p.platform, p.third_part_template,
p.issue_config
FROM project p FROM project p
JOIN workspace w ON p.workspace_id = w.id JOIN workspace w ON p.workspace_id = w.id
LEFT JOIN user ON user.id = p.create_user LEFT JOIN user ON user.id = p.create_user

View File

@ -14,7 +14,9 @@ import io.metersphere.dto.IssueTemplateDao;
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.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.PlatformUser;
import io.metersphere.track.issue.domain.jira.JiraIssueType;
import io.metersphere.track.issue.domain.zentao.ZentaoBuild; import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
import io.metersphere.track.request.issues.JiraIssueTypeRequest;
import io.metersphere.track.request.testcase.AuthUserIssueRequest; import io.metersphere.track.request.testcase.AuthUserIssueRequest;
import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesRequest;
import io.metersphere.track.request.testcase.IssuesUpdateRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest;
@ -161,4 +163,8 @@ public class IssuesController {
return issuesService.getThirdPartTemplate(projectId); return issuesService.getThirdPartTemplate(projectId);
} }
@PostMapping("/jira/issuetype")
public List<JiraIssueType> getJiraIssueType(@RequestBody JiraIssueTypeRequest request) {
return issuesService.getIssueTypes(request);
}
} }

View File

@ -16,6 +16,7 @@ import io.metersphere.dto.CustomFieldItemDTO;
import io.metersphere.dto.IssueTemplateDao; import io.metersphere.dto.IssueTemplateDao;
import io.metersphere.dto.UserDTO; import io.metersphere.dto.UserDTO;
import io.metersphere.service.*; import io.metersphere.service.*;
import io.metersphere.track.issue.domain.ProjectIssueConfig;
import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesRequest;
import io.metersphere.track.request.testcase.IssuesUpdateRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest;
import io.metersphere.track.service.IssuesService; import io.metersphere.track.service.IssuesService;
@ -141,6 +142,10 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
public abstract String getProjectId(String projectId); public abstract String getProjectId(String projectId);
public String getProjectId(String projectId, Function<Project, String> getProjectKeyFuc) { public String getProjectId(String projectId, Function<Project, String> getProjectKeyFuc) {
return getProjectKeyFuc.apply(getProject(projectId, getProjectKeyFuc));
}
public Project getProject(String projectId, Function<Project, String> getProjectKeyFuc) {
Project project; Project project;
if (StringUtils.isNotBlank(projectId)) { if (StringUtils.isNotBlank(projectId)) {
project = projectService.getProjectById(projectId); project = projectService.getProjectById(projectId);
@ -149,8 +154,20 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
project = projectService.getProjectById(testCase.getProjectId()); project = projectService.getProjectById(testCase.getProjectId());
} }
String projectKey = getProjectKeyFuc.apply(project); String projectKey = getProjectKeyFuc.apply(project);
if (StringUtils.isBlank(projectKey)) MSException.throwException("请在项目设置配置 " + key + "项目ID"); if (StringUtils.isBlank(projectKey)) {
return projectKey; MSException.throwException("请在项目设置配置 " + key + "项目ID");
}
return project;
}
public ProjectIssueConfig getProjectConfig(String configStr) {
ProjectIssueConfig issueConfig;
if (StringUtils.isNotBlank(configStr)) {
issueConfig = JSONObject.parseObject(configStr, ProjectIssueConfig.class);
} else {
issueConfig = new ProjectIssueConfig();
}
return issueConfig;
} }
protected boolean isIntegratedPlatform(String workspaceId, String platform) { protected boolean isIntegratedPlatform(String workspaceId, String platform) {
@ -491,7 +508,9 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
public <T> T getConfig(String platform, Class<T> clazz) { public <T> T getConfig(String platform, Class<T> clazz) {
String config = getPlatformConfig(platform); String config = getPlatformConfig(platform);
if (StringUtils.isBlank(config)) MSException.throwException("配置为空"); if (StringUtils.isBlank(config)) {
MSException.throwException("配置为空");
}
return JSONObject.parseObject(config, clazz); return JSONObject.parseObject(config, clazz);
} }

View File

@ -19,6 +19,7 @@ import io.metersphere.service.CustomFieldService;
import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.dto.DemandDTO;
import io.metersphere.track.issue.client.JiraClientV2; import io.metersphere.track.issue.client.JiraClientV2;
import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.PlatformUser;
import io.metersphere.track.issue.domain.ProjectIssueConfig;
import io.metersphere.track.issue.domain.jira.*; import io.metersphere.track.issue.domain.jira.*;
import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesRequest;
import io.metersphere.track.request.testcase.IssuesUpdateRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest;
@ -103,12 +104,11 @@ public class JiraPlatform extends AbstractIssuePlatform {
@Override @Override
public List<DemandDTO> getDemandList(String projectId) { public List<DemandDTO> getDemandList(String projectId) {
List<DemandDTO> list = new ArrayList<>(); List<DemandDTO> list = new ArrayList<>();
JiraConfig config = getConfig(); Project project = getProject();
int maxResults = 50, startAt = 0; int maxResults = 50, startAt = 0;
JSONArray demands; JSONArray demands;
String key = validateJiraKey(projectId);
do { do {
demands = jiraClientV2.getDemands(key, config.getStorytype(), startAt, maxResults); demands = jiraClientV2.getDemands(project.getJiraKey(), getStoryType(project.getIssueConfig()), startAt, maxResults);
for (int i = 0; i < demands.size(); i++) { for (int i = 0; i < demands.size(); i++) {
JSONObject o = demands.getJSONObject(i); JSONObject o = demands.getJSONObject(i);
String issueKey = o.getString("key"); String issueKey = o.getString("key");
@ -130,24 +130,18 @@ public class JiraPlatform extends AbstractIssuePlatform {
if (config == null) { if (config == null) {
MSException.throwException("jira config is null"); MSException.throwException("jira config is null");
} }
if (StringUtils.isBlank(config.getIssuetype())) {
MSException.throwException("Jira 问题类型为空");
}
} }
private String validateJiraKey(String projectId) { public List<JiraIssueType> getIssueTypes(String jiraKey) {
String jiraKey = getProjectId(projectId); return jiraClientV2.getIssueType(jiraKey);
if (StringUtils.isBlank(jiraKey)) {
MSException.throwException("未关联Jira 项目Key");
}
return jiraKey;
} }
@Override @Override
public IssuesWithBLOBs addIssue(IssuesUpdateRequest issuesRequest) { public IssuesWithBLOBs addIssue(IssuesUpdateRequest issuesRequest) {
JiraConfig jiraConfig = setUserConfig(); setUserConfig();
JSONObject addJiraIssueParam = buildUpdateParam(issuesRequest, jiraConfig.getIssuetype()); Project project = getProject();
JSONObject addJiraIssueParam = buildUpdateParam(issuesRequest, getIssueType(project.getIssueConfig()), project.getJiraKey());
JiraAddIssueResponse result = jiraClientV2.addIssue(JSONObject.toJSONString(addJiraIssueParam)); JiraAddIssueResponse result = jiraClientV2.addIssue(JSONObject.toJSONString(addJiraIssueParam));
JiraIssue issues = jiraClientV2.getIssues(result.getId()); JiraIssue issues = jiraClientV2.getIssues(result.getId());
@ -170,53 +164,57 @@ public class JiraPlatform extends AbstractIssuePlatform {
return res; return res;
} }
public Project getProject() {
return super.getProject(this.projectId, Project::getJiraKey);
}
/** /**
* 参数比较特殊需要特别处理 * 参数比较特殊需要特别处理
* @param fields * @param fields
*/ */
private void setSpecialParam(JSONObject fields) { private void setSpecialParam(JSONObject fields) {
String projectKey = getProjectId(this.projectId); Project project = getProject();
JiraConfig config = getConfig();
Map<String, JiraCreateMetadataResponse.Field> createMetadata = new HashMap<>();
try { try {
createMetadata = jiraClientV2.getCreateMetadata(projectKey, config.getIssuetype()); Map<String, JiraCreateMetadataResponse.Field> createMetadata = jiraClientV2.getCreateMetadata(project.getJiraKey(), getIssueType(project.getIssueConfig()));
} catch (Exception e) {} List<JiraUser> userOptions = jiraClientV2.getAssignableUser(project.getJiraKey());
Boolean isUserKey = false;
if (CollectionUtils.isNotEmpty(userOptions) && StringUtils.isBlank(userOptions.get(0).getAccountId())) {
isUserKey = true;
}
for (String name : createMetadata.keySet()) { for (String name : createMetadata.keySet()) {
JiraCreateMetadataResponse.Field item = createMetadata.get(name); JiraCreateMetadataResponse.Field item = createMetadata.get(name);
JiraCreateMetadataResponse.Schema schema = item.getSchema(); JiraCreateMetadataResponse.Schema schema = item.getSchema();
String key = item.getKey(); String key = item.getKey();
if (StringUtils.isBlank(key)) { if (StringUtils.isBlank(key) || schema == null) {
continue; continue;
} }
if (schema != null && schema.getCustom() != null && schema.getCustom().endsWith("sprint")) { if (schema.getCustom() != null && schema.getCustom().endsWith("sprint")) {
try { try {
JSONObject field = fields.getJSONObject(key); JSONObject field = fields.getJSONObject(key);
// sprint 传参数比较特殊需要要传数值 // sprint 传参数比较特殊需要要传数值
fields.put(key, field.getInteger("id")); fields.put(key, field.getInteger("id"));
} catch (Exception e) {} } catch (Exception e) {}
} }
if (key.equals("reporter")) { if (schema.getType() != null && schema.getType().endsWith("user")) {
JSONObject field = fields.getJSONObject(key); JSONObject field = fields.getJSONObject(key);
try { if (isUserKey) {
UUID.fromString(field.getString("id")); // 如果不是用户ID则是用户的key参数调整为key
} catch (Exception e) {
// 如果不是uuid则是用户的key参数调整为key
JSONObject newField = new JSONObject(); JSONObject newField = new JSONObject();
newField.put("key", field.getString("id")); newField.put("name", field.getString("id"));
fields.put(key, newField); fields.put(key, newField);
} }
} }
}
} catch (Exception e) {
LogUtil.error(e);
} }
} }
private JSONObject buildUpdateParam(IssuesUpdateRequest issuesRequest, String issuetypeStr) { private JSONObject buildUpdateParam(IssuesUpdateRequest issuesRequest, String issuetypeStr, String jiraKey) {
issuesRequest.setPlatform(key); issuesRequest.setPlatform(key);
String jiraKey = validateJiraKey(issuesRequest.getProjectId());
JSONObject fields = new JSONObject(); JSONObject fields = new JSONObject();
JSONObject project = new JSONObject(); JSONObject project = new JSONObject();
@ -309,8 +307,9 @@ public class JiraPlatform extends AbstractIssuePlatform {
@Override @Override
public void updateIssue(IssuesUpdateRequest request) { public void updateIssue(IssuesUpdateRequest request) {
JiraConfig jiraConfig = setUserConfig(); setUserConfig();
JSONObject param = buildUpdateParam(request, jiraConfig.getIssuetype()); Project project = getProject();
JSONObject param = buildUpdateParam(request, getIssueType(project.getIssueConfig()), project.getJiraKey());
handleIssueUpdate(request); handleIssueUpdate(request);
jiraClientV2.updateIssue(request.getPlatformId(), JSONObject.toJSONString(param)); jiraClientV2.updateIssue(request.getPlatformId(), JSONObject.toJSONString(param));
} }
@ -406,9 +405,11 @@ public class JiraPlatform extends AbstractIssuePlatform {
add("timetracking"); add("timetracking");
add("attachment"); add("attachment");
}}; }};
JiraConfig config = getConfig();
String projectKey = getProjectId(this.projectId); String projectKey = getProjectId(this.projectId);
Map<String, JiraCreateMetadataResponse.Field> createMetadata = jiraClientV2.getCreateMetadata(projectKey, config.getIssuetype()); Project project = getProject();
Map<String, JiraCreateMetadataResponse.Field> createMetadata = jiraClientV2.getCreateMetadata(projectKey, getIssueType(project.getIssueConfig()));
String userOptions = getUserOptions(projectKey); String userOptions = getUserOptions(projectKey);
List<CustomFieldDao> fields = new ArrayList<>(); List<CustomFieldDao> fields = new ArrayList<>();
char filedKey = 'A'; char filedKey = 'A';
@ -451,6 +452,24 @@ public class JiraPlatform extends AbstractIssuePlatform {
return issueTemplateDao; return issueTemplateDao;
} }
public String getIssueType(String configStr) {
ProjectIssueConfig projectConfig = super.getProjectConfig(configStr);
String jiraIssueType = projectConfig.getJiraIssueType();
if (StringUtils.isBlank(jiraIssueType)) {
MSException.throwException("请在项目中配置 Jira 问题类型!");
}
return jiraIssueType;
}
public String getStoryType(String configStr) {
ProjectIssueConfig projectConfig = super.getProjectConfig(configStr);
String jiraStoryType = projectConfig.getJiraStoryType();
if (StringUtils.isBlank(jiraStoryType)) {
MSException.throwException("请在项目中配置 Jira 需求类型!");
}
return jiraStoryType;
}
private void setCustomFiledType(JiraCreateMetadataResponse.Schema schema, CustomFieldDao customFieldDao, String userOptions) { private void setCustomFiledType(JiraCreateMetadataResponse.Schema schema, CustomFieldDao customFieldDao, String userOptions) {
Map<String, String> fieldTypeMap = new HashMap() {{ Map<String, String> fieldTypeMap = new HashMap() {{
put("summary", CustomFieldType.INPUT.getValue()); put("summary", CustomFieldType.INPUT.getValue());
@ -574,7 +593,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
if (StringUtils.isNotBlank(val.getAccountId())) { if (StringUtils.isNotBlank(val.getAccountId())) {
jsonObject.put("value", val.getAccountId()); jsonObject.put("value", val.getAccountId());
} else { } else {
jsonObject.put("value", val.getKey()); jsonObject.put("value", val.getName());
} }
jsonObject.put("text", val.getDisplayName()); jsonObject.put("text", val.getDisplayName());
options.add(jsonObject); options.add(jsonObject);

View File

@ -55,6 +55,31 @@ public abstract class JiraAbstractClient extends BaseClient {
return fields; return fields;
} }
public List<JiraIssueType> getIssueType(String projectKey) {
JiraIssueProject project = getProject(projectKey);
String url = getUrl("/issuetype/project?projectId={0}");
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, project.getId());
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
MSException.throwException(e.getMessage());
}
return (List<JiraIssueType>) getResultForList(JiraIssueType.class, response);
}
public JiraIssueProject getProject(String projectKey) {
String url = getUrl("/project/" + projectKey);
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
MSException.throwException(e.getMessage());
}
return (JiraIssueProject) getResultForObject(JiraIssueProject.class, response);
}
public List<JiraUser> getAssignableUser(String projectKey) { public List<JiraUser> getAssignableUser(String projectKey) {
String url = getBaseUrl() + "/user/assignable/search?project={1}"; String url = getBaseUrl() + "/user/assignable/search?project={1}";
ResponseEntity<String> response = null; ResponseEntity<String> response = null;
@ -160,6 +185,10 @@ public abstract class JiraAbstractClient extends BaseClient {
return ENDPOINT + PREFIX; return ENDPOINT + PREFIX;
} }
protected String getUrl(String path) {
return getBaseUrl() + path;
}
public void setConfig(JiraConfig config) { public void setConfig(JiraConfig config) {
if (config == null) { if (config == null) {
MSException.throwException("config is null"); MSException.throwException("config is null");

View File

@ -0,0 +1,12 @@
package io.metersphere.track.issue.domain;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ProjectIssueConfig {
private String jiraIssueType;
private String jiraStoryType;
private String projectKey;
}

View File

@ -0,0 +1,12 @@
package io.metersphere.track.issue.domain.jira;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class JiraIssueProject {
private String id;
private String name;
private String key;
}

View File

@ -0,0 +1,12 @@
package io.metersphere.track.issue.domain.jira;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class JiraIssueType {
private String id;
private String name;
private String untranslatedName;
}

View File

@ -8,6 +8,7 @@ import lombok.Setter;
public class JiraUser { public class JiraUser {
private String accountId; private String accountId;
private String key; private String key;
private String name;
private String displayName; private String displayName;
private String emailAddress; private String emailAddress;
private Boolean active; private Boolean active;

View File

@ -0,0 +1,12 @@
package io.metersphere.track.request.issues;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class JiraIssueTypeRequest {
private String projectId;
private String workspaceId;
private String jiraKey;
}

View File

@ -64,6 +64,7 @@ public class DemandService {
} }
issueRequest.setWorkspaceId(workspaceId); issueRequest.setWorkspaceId(workspaceId);
issueRequest.setProjectId(projectId);
List<AbstractIssuePlatform> platformList = IssueFactory.createPlatforms(platforms, issueRequest); List<AbstractIssuePlatform> platformList = IssueFactory.createPlatforms(platforms, issueRequest);
platformList.forEach(platform -> { platformList.forEach(platform -> {
List<DemandDTO> demand = platform.getDemandList(projectId); List<DemandDTO> demand = platform.getDemandList(projectId);

View File

@ -29,7 +29,9 @@ import io.metersphere.track.dto.TestPlanFunctionResultReportDTO;
import io.metersphere.track.dto.TestPlanSimpleReportDTO; import io.metersphere.track.dto.TestPlanSimpleReportDTO;
import io.metersphere.track.issue.*; import io.metersphere.track.issue.*;
import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.PlatformUser;
import io.metersphere.track.issue.domain.jira.JiraIssueType;
import io.metersphere.track.issue.domain.zentao.ZentaoBuild; import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
import io.metersphere.track.request.issues.JiraIssueTypeRequest;
import io.metersphere.track.request.testcase.AuthUserIssueRequest; import io.metersphere.track.request.testcase.AuthUserIssueRequest;
import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesRequest;
import io.metersphere.track.request.testcase.IssuesUpdateRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest;
@ -647,12 +649,26 @@ public class IssuesService {
public IssueTemplateDao getThirdPartTemplate(String projectId) { public IssueTemplateDao getThirdPartTemplate(String projectId) {
if (StringUtils.isNotBlank(projectId)) { if (StringUtils.isNotBlank(projectId)) {
Project project = projectService.getProjectById(projectId); Project project = projectService.getProjectById(projectId);
IssuesRequest issuesRequest = new IssuesRequest(); return IssueFactory.createPlatform(IssuesManagePlatform.Jira.toString(), getDefaultIssueRequest(projectId, project.getWorkspaceId()))
issuesRequest.setProjectId(projectId);
issuesRequest.setWorkspaceId(project.getWorkspaceId());
return IssueFactory.createPlatform(IssuesManagePlatform.Jira.toString(), issuesRequest)
.getThirdPartTemplate(); .getThirdPartTemplate();
} }
return new IssueTemplateDao(); return new IssueTemplateDao();
} }
public IssuesRequest getDefaultIssueRequest(String projectId, String workspaceId) {
IssuesRequest issuesRequest = new IssuesRequest();
issuesRequest.setProjectId(projectId);
issuesRequest.setWorkspaceId(workspaceId);
return issuesRequest;
}
public List<JiraIssueType> getIssueTypes(JiraIssueTypeRequest request) {
IssuesRequest issuesRequest = getDefaultIssueRequest(request.getProjectId(), request.getWorkspaceId());
JiraPlatform platform = (JiraPlatform) IssueFactory.createPlatform(IssuesManagePlatform.Jira.toString(), issuesRequest);
if (StringUtils.isNotBlank(request.getJiraKey())) {
return platform.getIssueTypes(request.getJiraKey());
} else {
return new ArrayList<>();
}
}
} }

View File

@ -193,3 +193,6 @@ UPDATE test_case
ALTER TABLE `test_plan_report_content` ADD COLUMN `error_report_cases` LONGTEXT COMMENT '误报状态接口用例'; ALTER TABLE `test_plan_report_content` ADD COLUMN `error_report_cases` LONGTEXT COMMENT '误报状态接口用例';
ALTER TABLE `test_plan_report_content` ADD COLUMN `error_report_scenarios` LONGTEXT COMMENT '误报状态场景用例'; ALTER TABLE `test_plan_report_content` ADD COLUMN `error_report_scenarios` LONGTEXT COMMENT '误报状态场景用例';
-- 缺陷相关配置
ALTER TABLE project ADD issue_config TEXT NULL;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -43,14 +43,9 @@
<el-form-item :label-width="labelWidth" :label="$t('project.tapd_id')" v-if="tapd"> <el-form-item :label-width="labelWidth" :label="$t('project.tapd_id')" v-if="tapd">
<el-input v-model="form.tapdId" autocomplete="off"></el-input> <el-input v-model="form.tapdId" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.jira_key')" v-if="jira">
<el-input v-model="form.jiraKey" autocomplete="off"/> <project-jira-config v-if="jira" :label-width="labelWidth" :form="form"/>
<ms-instructions-icon effect="light">
<template>
<img class="jira-image" src="../../../../assets/jira-key.png"/>
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.zentao_id')" v-if="zentao"> <el-form-item :label-width="labelWidth" :label="$t('project.zentao_id')" v-if="zentao">
<el-input v-model="form.zentaoId" autocomplete="off"></el-input> <el-input v-model="form.zentaoId" autocomplete="off"></el-input>
<ms-instructions-icon effect="light"> <ms-instructions-icon effect="light">
@ -100,7 +95,7 @@
import { import {
getCurrentProjectID, getCurrentProjectID,
getCurrentUser, getCurrentUserId, getCurrentUser, getCurrentUserId,
getCurrentWorkspaceId, hasLicense, getCurrentWorkspaceId,
listenGoBack, listenGoBack,
removeGoBackListener removeGoBackListener
} from "@/common/js/utils"; } from "@/common/js/utils";
@ -124,10 +119,12 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import MsTableHeader from "@/business/components/common/components/MsTableHeader"; import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter"; import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {ISSUE_PLATFORM_OPTION} from "@/common/js/table-constants"; import {ISSUE_PLATFORM_OPTION} from "@/common/js/table-constants";
import ProjectJiraConfig from "@/business/components/project/menu/components/ProjectJiraConfig";
export default { export default {
name: "EditProject", name: "EditProject",
components: { components: {
ProjectJiraConfig,
MsInstructionsIcon, MsInstructionsIcon,
TemplateSelect, TemplateSelect,
MsResourceFiles, MsResourceFiles,
@ -220,9 +217,10 @@ export default {
this.createVisible = true; this.createVisible = true;
listenGoBack(this.handleClose); listenGoBack(this.handleClose);
if (row) { if (row) {
row.issueConfigObj = row.issueConfig ? JSON.parse(row.issueConfig) : {};
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
} else { } else {
this.form = {}; this.form = {issueConfigObj: {}};
} }
this.platformOptions = []; this.platformOptions = [];
this.platformOptions.push(...ISSUE_PLATFORM_OPTION); this.platformOptions.push(...ISSUE_PLATFORM_OPTION);
@ -257,6 +255,7 @@ export default {
this.form.protocal = protocol; this.form.protocal = protocol;
this.form.workspaceId = getCurrentWorkspaceId(); this.form.workspaceId = getCurrentWorkspaceId();
this.form.createUser = getCurrentUserId(); this.form.createUser = getCurrentUserId();
this.form.issueConfig = JSON.stringify(this.form.issueConfigObj);
this.result = this.$post("/project/" + saveType, this.form, () => { this.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false; this.createVisible = false;
this.reload(); this.reload();

View File

@ -0,0 +1,61 @@
<template>
<div>
<el-form-item :label-width="labelWidth" :label="$t('project.jira_key')">
<el-input v-model="form.jiraKey" autocomplete="off" @blur="getIssueTypeOption"/>
<ms-instructions-icon effect="light">
<template>
<img class="jira-image" src="@/assets/jira-key.png"/>
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('organization.integration.jira_issuetype')" prop="issuetype">
<el-select filterable v-model="form.issueConfigObj.jiraIssueType">
<el-option v-for="item in issueTypes" :key="item.id" :label="item.name" :value="item.untranslatedName">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('organization.integration.jira_storytype')" prop="storytype">
<el-select filterable v-model="form.issueConfigObj.jiraStoryType">
<el-option v-for="item in issueTypes" :key="item.id" :label="item.name" :value="item.untranslatedName">
</el-option>
</el-select>
</el-form-item>
</div>
</template>
<script>
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
import {getJiraIssueType} from "@/network/Issue";
import {getCurrentWorkspaceId} from "@/common/js/utils";
export default {
name: "ProjectJiraConfig",
components: {MsInstructionsIcon},
props: ['labelWidth', 'form'],
data() {
return {
issueTypes: []
}
},
mounted() {
this.getIssueTypeOption();
},
methods: {
getIssueTypeOption() {
this.issueTypes = [];
getJiraIssueType({
projectId: this.form.id,
workspaceId: getCurrentWorkspaceId(),
jiraKey: this.form.jiraKey
}, (data) => {
this.issueTypes = data;
});
}
}
}
</script>
<style scoped>
.el-input, .el-textarea {
width: 80%;
}
</style>

View File

@ -13,22 +13,6 @@
<el-form-item :label="$t('organization.integration.jira_url')" prop="url"> <el-form-item :label="$t('organization.integration.jira_url')" prop="url">
<el-input v-model="form.url" :placeholder="$t('organization.integration.input_jira_url')"/> <el-input v-model="form.url" :placeholder="$t('organization.integration.input_jira_url')"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('organization.integration.jira_issuetype')" prop="issuetype">
<el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/>
<ms-instructions-icon effect="light">
<template>
<img class="jira-image" src="@/assets/jira-type.png"/>
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label="$t('organization.integration.jira_storytype')" prop="storytype">
<el-input v-model="form.storytype" :placeholder="$t('organization.integration.input_jira_storytype')"/>
<ms-instructions-icon effect="light">
<template>
<img class="jira-image" src="@/assets/jira-type.png"/>
</template>
</ms-instructions-icon>
</el-form-item>
</el-form> </el-form>
</div> </div>

View File

@ -151,3 +151,7 @@ export function isThirdPartEnable(callback) {
callback(project.platform !== LOCAL); callback(project.platform !== LOCAL);
}); });
} }
export function getJiraIssueType(param, callback) {
return basePost('/issues/jira/issuetype', param, callback);
}