fix: 分享和导出报告保存国际化信息
This commit is contained in:
parent
82882caa19
commit
6445f5350c
|
@ -463,15 +463,11 @@ public class ShareInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
public ShareInfo createShareInfo(ShareInfo request) {
|
||||
public ShareInfo createShareInfo(ShareInfo shareInfo) {
|
||||
long createTime = System.currentTimeMillis();
|
||||
ShareInfo shareInfo = new ShareInfo();
|
||||
shareInfo.setId(UUID.randomUUID().toString());
|
||||
shareInfo.setCustomData(request.getCustomData());
|
||||
shareInfo.setCreateUserId(request.getCreateUserId());
|
||||
shareInfo.setCreateTime(createTime);
|
||||
shareInfo.setUpdateTime(createTime);
|
||||
shareInfo.setShareType(request.getShareType());
|
||||
shareInfoMapper.insert(shareInfo);
|
||||
return shareInfo;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ public class ShareInfo implements Serializable {
|
|||
|
||||
private String shareType;
|
||||
|
||||
private String lang;
|
||||
|
||||
private String customData;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -433,6 +433,76 @@ public class ShareInfoExample {
|
|||
addCriterion("share_type not between", value1, value2, "shareType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangIsNull() {
|
||||
addCriterion("lang is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangIsNotNull() {
|
||||
addCriterion("lang is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangEqualTo(String value) {
|
||||
addCriterion("lang =", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangNotEqualTo(String value) {
|
||||
addCriterion("lang <>", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangGreaterThan(String value) {
|
||||
addCriterion("lang >", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("lang >=", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangLessThan(String value) {
|
||||
addCriterion("lang <", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangLessThanOrEqualTo(String value) {
|
||||
addCriterion("lang <=", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangLike(String value) {
|
||||
addCriterion("lang like", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangNotLike(String value) {
|
||||
addCriterion("lang not like", value, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangIn(List<String> values) {
|
||||
addCriterion("lang in", values, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangNotIn(List<String> values) {
|
||||
addCriterion("lang not in", values, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangBetween(String value1, String value2) {
|
||||
addCriterion("lang between", value1, value2, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLangNotBetween(String value1, String value2) {
|
||||
addCriterion("lang not between", value1, value2, "lang");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="share_type" jdbcType="VARCHAR" property="shareType" />
|
||||
<result column="lang" jdbcType="VARCHAR" property="lang" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ShareInfo">
|
||||
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
|
||||
|
@ -70,7 +71,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, create_time, create_user_id, update_time, share_type
|
||||
id, create_time, create_user_id, update_time, share_type, lang
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
custom_data
|
||||
|
@ -125,11 +126,11 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ShareInfo">
|
||||
insert into share_info (id, create_time, create_user_id,
|
||||
update_time, share_type, custom_data
|
||||
)
|
||||
update_time, share_type, lang,
|
||||
custom_data)
|
||||
values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUserId,jdbcType=VARCHAR},
|
||||
#{updateTime,jdbcType=BIGINT}, #{shareType,jdbcType=VARCHAR}, #{customData,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
#{updateTime,jdbcType=BIGINT}, #{shareType,jdbcType=VARCHAR}, #{lang,jdbcType=VARCHAR},
|
||||
#{customData,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ShareInfo">
|
||||
insert into share_info
|
||||
|
@ -149,6 +150,9 @@
|
|||
<if test="shareType != null">
|
||||
share_type,
|
||||
</if>
|
||||
<if test="lang != null">
|
||||
lang,
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
custom_data,
|
||||
</if>
|
||||
|
@ -169,6 +173,9 @@
|
|||
<if test="shareType != null">
|
||||
#{shareType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lang != null">
|
||||
#{lang,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
#{customData,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -198,6 +205,9 @@
|
|||
<if test="record.shareType != null">
|
||||
share_type = #{record.shareType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.lang != null">
|
||||
lang = #{record.lang,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.customData != null">
|
||||
custom_data = #{record.customData,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -213,6 +223,7 @@
|
|||
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
share_type = #{record.shareType,jdbcType=VARCHAR},
|
||||
lang = #{record.lang,jdbcType=VARCHAR},
|
||||
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -224,7 +235,8 @@
|
|||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
share_type = #{record.shareType,jdbcType=VARCHAR}
|
||||
share_type = #{record.shareType,jdbcType=VARCHAR},
|
||||
lang = #{record.lang,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -244,6 +256,9 @@
|
|||
<if test="shareType != null">
|
||||
share_type = #{shareType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lang != null">
|
||||
lang = #{lang,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
custom_data = #{customData,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -256,6 +271,7 @@
|
|||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
share_type = #{shareType,jdbcType=VARCHAR},
|
||||
lang = #{lang,jdbcType=VARCHAR},
|
||||
custom_data = #{customData,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -264,7 +280,8 @@
|
|||
set create_time = #{createTime,jdbcType=BIGINT},
|
||||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
share_type = #{shareType,jdbcType=VARCHAR}
|
||||
share_type = #{shareType,jdbcType=VARCHAR},
|
||||
lang = #{lang,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -83,10 +83,11 @@ public class ShareController {
|
|||
return testPlanService.getReport(planId, null);
|
||||
}
|
||||
|
||||
@GetMapping("/report/export/{shareId}/{planId}")
|
||||
public void exportHtmlReport(@PathVariable String shareId, @PathVariable String planId, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
@GetMapping("/report/export/{shareId}/{planId}/{lang}")
|
||||
public void exportHtmlReport(@PathVariable String shareId, @PathVariable String planId,
|
||||
@PathVariable(required = false) String lang, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
shareInfoService.validate(shareId, planId);
|
||||
testPlanService.exportPlanReport(planId, response);
|
||||
testPlanService.exportPlanReport(planId, lang, response);
|
||||
}
|
||||
|
||||
@GetMapping("/test/plan/case/list/failure/{shareId}/{planId}")
|
||||
|
|
|
@ -222,9 +222,9 @@ public class TestPlanController {
|
|||
testPlanService.runBatch(request);
|
||||
}
|
||||
|
||||
@GetMapping("/report/export/{planId}")
|
||||
public void exportHtmlReport(@PathVariable String planId, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
testPlanService.exportPlanReport(planId, response);
|
||||
@GetMapping("/report/export/{planId}/{lang}")
|
||||
public void exportHtmlReport(@PathVariable String planId, @PathVariable(required = false) String lang, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
testPlanService.exportPlanReport(planId, lang, response);
|
||||
}
|
||||
|
||||
@GetMapping("/get/report/export/{planId}")
|
||||
|
@ -232,9 +232,9 @@ public class TestPlanController {
|
|||
return testPlanService.buildPlanReport(planId, true);
|
||||
}
|
||||
|
||||
@GetMapping("/report/db/export/{reportId}")
|
||||
public void exportHtmlDbReport(@PathVariable String reportId, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
testPlanService.exportPlanDbReport(reportId, response);
|
||||
@GetMapping("/report/db/export/{reportId}/{lang}")
|
||||
public void exportHtmlDbReport(@PathVariable String reportId, @PathVariable(required = false) String lang, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
testPlanService.exportPlanDbReport(reportId, lang, response);
|
||||
}
|
||||
|
||||
@GetMapping("/report/{planId}")
|
||||
|
|
|
@ -20,6 +20,11 @@ public class TestPlanSimpleReportDTO extends TestPlanReportContent {
|
|||
private String summary;
|
||||
private String config;
|
||||
|
||||
/**
|
||||
* 导出保存国际化
|
||||
*/
|
||||
private String lang;
|
||||
|
||||
private TestPlanFunctionResultReportDTO functionResult;
|
||||
private TestPlanApiResultReportDTO apiResult;
|
||||
private TestPlanLoadResultReportDTO loadResult;
|
||||
|
|
|
@ -1678,17 +1678,20 @@ public class TestPlanService {
|
|||
return report;
|
||||
}
|
||||
|
||||
public void exportPlanReport(String planId, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
render(buildPlanReport(planId, true), response);
|
||||
public void exportPlanReport(String planId, String lang, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
TestPlanSimpleReportDTO report = buildPlanReport(planId, true);
|
||||
report.setLang(lang);
|
||||
render(report, response);
|
||||
}
|
||||
|
||||
public void exportPlanDbReport(String reportId, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
public void exportPlanDbReport(String reportId, String lang, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
TestPlanSimpleReportDTO report = testPlanReportService.getReport(reportId);
|
||||
buildApiResponse(report.getApiAllCases());
|
||||
buildApiResponse(report.getApiFailureCases());
|
||||
buildScenarioResponse(report.getScenarioAllCases());
|
||||
buildScenarioResponse(report.getScenarioFailureCases());
|
||||
buildLoadResponse(report.getLoadAllCases());
|
||||
report.setLang(lang);
|
||||
render(report, response);
|
||||
}
|
||||
|
||||
|
|
|
@ -311,4 +311,6 @@ ALTER TABLE api_scenario_reference_id ADD url VARCHAR(500) NULL;
|
|||
ALTER TABLE api_scenario_reference_id ADD method VARCHAR(20);
|
||||
ALTER TABLE `api_scenario_reference_id` ADD INDEX index_url ( `url`);
|
||||
ALTER TABLE `api_scenario_reference_id` ADD INDEX index_method ( `method` );
|
||||
ALTER TABLE `api_scenario` ADD INDEX index_project_id ( `project_id`);
|
||||
ALTER TABLE `api_scenario` ADD INDEX index_project_id ( `project_id`);
|
||||
|
||||
ALTER TABLE share_info ADD lang varchar(10) NULL;
|
||||
|
|
|
@ -43,6 +43,7 @@ import TestPlanReportEdit
|
|||
from "@/business/components/track/plan/view/comonents/report/detail/component/TestPlanReportEdit";
|
||||
import {editPlanReport, saveTestPlanReport} from "@/network/test-plan";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {CURRENT_LANGUAGE} from "@/i18n/i18n";
|
||||
export default {
|
||||
name: "TestPlanReportButtons",
|
||||
components: {
|
||||
|
@ -75,6 +76,7 @@ export default {
|
|||
pram.customData = this.report.id;
|
||||
pram.shareType = 'PLAN_DB_REPORT';
|
||||
}
|
||||
pram.lang = localStorage.getItem(CURRENT_LANGUAGE);
|
||||
generateShareInfoWithExpired(pram, (data) => {
|
||||
let thisHost = window.location.host;
|
||||
this.shareUrl = thisHost + "/sharePlanReport" + data.shareUrl;
|
||||
|
@ -128,6 +130,7 @@ export default {
|
|||
if (this.isShare) {
|
||||
config.url = '/share' + config.url;
|
||||
}
|
||||
config.url = config.url + '/' + localStorage.getItem(CURRENT_LANGUAGE);
|
||||
this.result = this.$download(config, this.report.name + '.html',()=>{
|
||||
this.$success(this.$t("organization.integration.successful_operation"));
|
||||
});
|
||||
|
|
|
@ -122,7 +122,9 @@ export default {
|
|||
getReport() {
|
||||
if (this.isTemplate) {
|
||||
this.report = "#report";
|
||||
|
||||
if (this.report.lang) {
|
||||
this.$setLang(this.report.lang);
|
||||
}
|
||||
this.report.config = this.getDefaultConfig(this.report);
|
||||
} else if (this.isDb) {
|
||||
if (this.isShare) {
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
import html2canvas from "html2canvas";
|
||||
import MsTestCaseReportExport from "../../TestCaseReportExport";
|
||||
import TestReportTemplateList from "../../TestReportTemplateList";
|
||||
import {Message} from "element-ui";
|
||||
import {CURRENT_LANGUAGE} from "@/i18n/i18n";
|
||||
|
||||
export default {
|
||||
name: "TestCaseStatisticsReportView",
|
||||
|
@ -221,6 +221,7 @@
|
|||
method: 'get',
|
||||
responseType: 'blob'
|
||||
};
|
||||
config.url = config.url + '/' + localStorage.getItem(CURRENT_LANGUAGE);
|
||||
this.$download(config, name + '.html');
|
||||
},
|
||||
exportReportReset() {
|
||||
|
|
|
@ -25,6 +25,9 @@ export default {
|
|||
this.$error('连接已失效,请重新获取!');
|
||||
return;
|
||||
}
|
||||
if (data.lang) {
|
||||
this.$setLang(data.lang);
|
||||
}
|
||||
if (data.shareType === 'PERFORMANCE_REPORT') {
|
||||
this.reportId = data.customData;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ export default {
|
|||
this.$error('连接已失效,请重新获取!');
|
||||
return;
|
||||
}
|
||||
if (data.lang) {
|
||||
this.$setLang(data.lang);
|
||||
}
|
||||
if (data.shareType === 'PLAN_REPORT') {
|
||||
this.planId = data.customData;
|
||||
} else if (data.shareType === 'PLAN_DB_REPORT') {
|
||||
|
|
Loading…
Reference in New Issue