From 437630eb8104150a9ec16a5870809499ca891370 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 11 Nov 2020 17:02:26 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20zentao=E7=BB=84=E4=BB=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9C=B0=E5=9D=80=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/ZentaoSetting.vue | 40 ++++++++++++++----- frontend/src/i18n/en-US.js | 2 + frontend/src/i18n/zh-CN.js | 2 + frontend/src/i18n/zh-TW.js | 2 + 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue b/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue index 64f9b5205f..512ac51e8f 100644 --- a/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue +++ b/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue @@ -10,6 +10,9 @@ + + + @@ -63,7 +66,12 @@ export default { required: true, message: this.$t('organization.integration.input_app_key'), trigger: ['change', 'blur'] - } + }, + url: { + required: true, + message: this.$t('organization.integration.input_zentao_url'), + trigger: ['change', 'blur'] + }, }, } }, @@ -71,12 +79,16 @@ export default { save() { this.$refs['form'].validate(valid => { if (valid) { - + let formatUrl = this.form.url.trim(); + if (!formatUrl.endsWith('/')) { + formatUrl = formatUrl + '/'; + } const {lastOrganizationId} = getCurrentUser(); let param = {}; let auth = { account: this.form.account, password: this.form.password, + url: formatUrl, }; param.organizationId = lastOrganizationId; param.platform = ZEN_TAO; @@ -106,6 +118,7 @@ export default { let config = JSON.parse(data.configuration); this.$set(this.form, 'account', config.account); this.$set(this.form, 'password', config.password); + this.$set(this.form, 'url', config.url); } else { this.clear(); } @@ -114,19 +127,26 @@ export default { clear() { this.$set(this.form, 'account', ''); this.$set(this.form, 'password', ''); + this.$set(this.form, 'url', ''); this.$nextTick(() => { this.$refs.form.clearValidate(); }); }, testConnection() { - if (this.form.account && this.form.password) { - this.$parent.result = this.$get("issues/auth/" + ZEN_TAO, () => { - this.$success(this.$t('organization.integration.verified')); - }); - } else { - this.$warning(this.$t('organization.integration.not_integrated')); - return false; - } + this.$refs['form'].validate(valid => { + if (valid) { + if (this.form.account && this.form.password) { + this.$parent.result = this.$get("issues/auth/" + ZEN_TAO, () => { + this.$success(this.$t('organization.integration.verified')); + }); + } else { + this.$warning(this.$t('organization.integration.not_integrated')); + return false; + } + } else { + return false; + } + }) }, cancelIntegration() { if (this.form.account && this.form.password) { diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 2fbdc80cc1..55284b52e2 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -262,6 +262,8 @@ export default { input_app_key: 'Please enter the key', input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/', input_jira_issuetype: 'Please enter the question type', + zentao_url: 'Zentao url', + input_zentao_url: 'Please enter Zentao address, for example: http://xx.xx.xx.xx/zentao/', use_tip: 'Usage guidelines:', use_tip_tapd: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"', use_tip_jira: 'Jira software server authentication information is account password, Jira software cloud authentication information is account + token (account settings-security-create API token)', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index b77911f571..bb7f14c105 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -262,6 +262,8 @@ export default { input_app_key: '请输入密钥', input_jira_url: '请输入Jira地址,例:https://metersphere.atlassian.net/', input_jira_issuetype: '请输入问题类型', + zentao_url: 'Zentao 地址', + input_zentao_url: '请输入Zentao地址,例:http://xx.xx.xx.xx/zentao/', use_tip: '使用指引:', use_tip_tapd: 'Tapd Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询', use_tip_jira: 'Jira software server 认证信息为 账号密码,Jira software cloud 认证信息为 账号+令牌(账户设置-安全-创建API令牌)', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 43cc46c469..847aed50d8 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -264,6 +264,8 @@ export default { input_app_key: '請輸入密鑰', input_jira_url: '請輸入Jira地址,例:https://metersphere.atlassian.net/', input_jira_issuetype: '請輸入問題類型', + zentao_url: 'Zentao 地址', + input_zentao_url: '請輸入Zentao地址,例:http://xx.xx.xx.xx/zentao/', use_tip: '使用指引:', use_tip_tapd: 'Tapd Basic Auth 賬號信息在"公司管理-安全與集成-開放平臺"中查詢', use_tip_jira: 'Jira software server 認證信息為 賬號密碼,Jira software cloud 認證信息為 賬號+令牌(賬戶設置-安全-創建API令牌)', From 919f08431d078bb989918f849572ab2cbaada9f3 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 13 Nov 2020 17:01:36 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E9=9B=86=E6=88=90zentao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/IssuesManagePlatform.java | 2 +- .../metersphere/track/issue/IssueFactory.java | 10 +- .../{JiraIssue.java => JiraPlatform.java} | 4 +- .../{LocalIssue.java => LocalPlatform.java} | 4 +- .../{TapdIssue.java => TapdPlatform.java} | 4 +- .../track/issue/ZentaoPlatform.java | 219 ++++++++++++++++++ .../metersphere/track/issue/ZentaoUtils.java | 26 +++ 7 files changed, 258 insertions(+), 11 deletions(-) rename backend/src/main/java/io/metersphere/track/issue/{JiraIssue.java => JiraPlatform.java} (98%) rename backend/src/main/java/io/metersphere/track/issue/{LocalIssue.java => LocalPlatform.java} (94%) rename backend/src/main/java/io/metersphere/track/issue/{TapdIssue.java => TapdPlatform.java} (98%) create mode 100644 backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java create mode 100644 backend/src/main/java/io/metersphere/track/issue/ZentaoUtils.java diff --git a/backend/src/main/java/io/metersphere/commons/constants/IssuesManagePlatform.java b/backend/src/main/java/io/metersphere/commons/constants/IssuesManagePlatform.java index d1ace27122..0e6540740d 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/IssuesManagePlatform.java +++ b/backend/src/main/java/io/metersphere/commons/constants/IssuesManagePlatform.java @@ -1,5 +1,5 @@ package io.metersphere.commons.constants; public enum IssuesManagePlatform { - Tapd, Jira, Local + Tapd, Jira, Local, Zentao } diff --git a/backend/src/main/java/io/metersphere/track/issue/IssueFactory.java b/backend/src/main/java/io/metersphere/track/issue/IssueFactory.java index 3592094890..b578caac05 100644 --- a/backend/src/main/java/io/metersphere/track/issue/IssueFactory.java +++ b/backend/src/main/java/io/metersphere/track/issue/IssueFactory.java @@ -10,11 +10,13 @@ import java.util.List; public class IssueFactory { public static AbstractIssuePlatform createPlatform(String platform, IssuesRequest addIssueRequest) { if (StringUtils.equals(IssuesManagePlatform.Tapd.toString(), platform)) { - return new TapdIssue(addIssueRequest); + return new TapdPlatform(addIssueRequest); } else if (StringUtils.equals(IssuesManagePlatform.Jira.toString(), platform)) { - return new JiraIssue(addIssueRequest); - } else if (StringUtils.equals("LOCAL", platform)) { - return new LocalIssue(addIssueRequest); + return new JiraPlatform(addIssueRequest); + } else if (StringUtils.equals(IssuesManagePlatform.Zentao.toString(), platform)) { + return new ZentaoPlatform(addIssueRequest); + } else if (StringUtils.equals("LOCAL", platform)) { + return new LocalPlatform(addIssueRequest); } return null; } diff --git a/backend/src/main/java/io/metersphere/track/issue/JiraIssue.java b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java similarity index 98% rename from backend/src/main/java/io/metersphere/track/issue/JiraIssue.java rename to backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java index 40a1277f90..981b76e2ef 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraIssue.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -28,10 +28,10 @@ import java.util.List; import java.util.UUID; import java.util.stream.Collectors; -public class JiraIssue extends AbstractIssuePlatform { +public class JiraPlatform extends AbstractIssuePlatform { - public JiraIssue(IssuesRequest issuesRequest) { + public JiraPlatform(IssuesRequest issuesRequest) { super(issuesRequest); } diff --git a/backend/src/main/java/io/metersphere/track/issue/LocalIssue.java b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java similarity index 94% rename from backend/src/main/java/io/metersphere/track/issue/LocalIssue.java rename to backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java index b75946b726..bbbd12df8f 100644 --- a/backend/src/main/java/io/metersphere/track/issue/LocalIssue.java +++ b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java @@ -10,9 +10,9 @@ import io.metersphere.track.request.testcase.IssuesRequest; import java.util.List; import java.util.UUID; -public class LocalIssue extends AbstractIssuePlatform { +public class LocalPlatform extends AbstractIssuePlatform { - public LocalIssue(IssuesRequest issuesRequest) { + public LocalPlatform(IssuesRequest issuesRequest) { super(issuesRequest); } diff --git a/backend/src/main/java/io/metersphere/track/issue/TapdIssue.java b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java similarity index 98% rename from backend/src/main/java/io/metersphere/track/issue/TapdIssue.java rename to backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java index 3df46f4291..2b01f5b468 100644 --- a/backend/src/main/java/io/metersphere/track/issue/TapdIssue.java +++ b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java @@ -24,10 +24,10 @@ import java.util.List; import java.util.UUID; import java.util.stream.Collectors; -public class TapdIssue extends AbstractIssuePlatform { +public class TapdPlatform extends AbstractIssuePlatform { - public TapdIssue(IssuesRequest issueRequest) { + public TapdPlatform(IssuesRequest issueRequest) { super(issueRequest); } diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java new file mode 100644 index 0000000000..e0b7a99fa7 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -0,0 +1,219 @@ +package io.metersphere.track.issue; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.metersphere.base.domain.*; +import io.metersphere.commons.constants.IssuesManagePlatform; +import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.request.testcase.IssuesRequest; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.util.*; +import java.util.stream.Collectors; + +public class ZentaoPlatform extends AbstractIssuePlatform { + + public ZentaoPlatform(IssuesRequest issuesRequest) { + super(issuesRequest); + } + + @Override + String getProjectId() { +// TestCaseWithBLOBs testCase = testCaseService.getTestCase(testCaseId); +// Project project = projectService.getProjectById(testCase.getProjectId()); + // todo return getZentao ID + return "002"; + } + + @Override + public List getIssue() { + List list = new ArrayList<>(); + + TestCaseIssuesExample example = new TestCaseIssuesExample(); + example.createCriteria().andTestCaseIdEqualTo(testCaseId); + + List issues = extIssuesMapper.getIssues(testCaseId, IssuesManagePlatform.Zentao.toString()); + + List issuesIds = issues.stream().map(Issues::getId).collect(Collectors.toList()); + issuesIds.forEach(issuesId -> { + Issues dto = getZentaoIssues(issuesId); + if (StringUtils.isBlank(dto.getId())) { + // 缺陷不存在,解除用例和缺陷的关联 + TestCaseIssuesExample issuesExample = new TestCaseIssuesExample(); + issuesExample.createCriteria() + .andTestCaseIdEqualTo(testCaseId) + .andIssuesIdEqualTo(issuesId); + testCaseIssuesMapper.deleteByExample(issuesExample); + issuesMapper.deleteByPrimaryKey(issuesId); + } else { + dto.setPlatform(IssuesManagePlatform.Zentao.toString()); + // 缺陷状态为 关闭,则不显示 + if (!StringUtils.equals("closed", dto.getStatus())) { + list.add(dto); + } + } + }); + return list; + + } + + private Issues getZentaoIssues(String bugId) { + String projectId = getProjectId(); + + String session = login(); + + String config = getPlatformConfig(IssuesManagePlatform.Zentao.toString()); + JSONObject object = JSON.parseObject(config); + String account = object.getString("account"); + String password = object.getString("password"); + String url = object.getString("url"); + url = ZentaoUtils.getUrl(url, account, password); + System.out.println(url); + HttpEntity requestEntity = new HttpEntity<>(new HttpHeaders()); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity responseEntity = restTemplate.exchange("http://xx/zentao/bug-view-"+ bugId +".json?zentaosid=" + session, HttpMethod.POST, requestEntity, String.class); + String body = responseEntity.getBody(); + JSONObject obj = JSONObject.parseObject(body); + System.out.println(obj); + if (obj != null) { + JSONObject data = obj.getJSONObject("data"); + JSONArray bugs = data.getJSONArray("bugs"); + for (int j = 0; j < bugs.size(); j++) { + JSONObject bug = bugs.getJSONObject(j); + String id = bug.getString("id"); + String title = bug.getString("title"); + String description = bug.getString("steps"); + Long createTime = bug.getLong("openedDate"); + String status = bug.getString("status"); + String reporter = bug.getString("openedBy"); + + Issues issues = new Issues(); + issues.setId(id); + issues.setTitle(title); + issues.setDescription(description); + issues.setCreateTime(createTime); + issues.setStatus(status); + issues.setReporter(reporter); + return issues; + } + } + return new Issues(); + } + + @Override + public void addIssue(IssuesRequest issuesRequest) { + String config = getPlatformConfig(IssuesManagePlatform.Zentao.toString()); + String session = login(); + JSONObject object = JSON.parseObject(config); +// String account = object.getString("account"); +// String password = object.getString("password"); + + MultiValueMap paramMap = new LinkedMultiValueMap<>(); + paramMap.add("product", "003"); + paramMap.add("title", issuesRequest.getTitle()); + paramMap.add("openedBuild", "123"); + paramMap.add("steps", issuesRequest.getContent()); + paramMap.add("assignedTo", "admin"); + + HttpEntity requestEntity = new HttpEntity<>(paramMap, new HttpHeaders()); + RestTemplate restTemplate = new RestTemplate(); + System.out.println("zentao add bug"); + ResponseEntity responseEntity = restTemplate.exchange("http://xx/zentao/bug-create-3.json?zentaosid=" + session, HttpMethod.POST, requestEntity, String.class); + String body = responseEntity.getBody(); + JSONObject obj = JSONObject.parseObject(body); + if (obj != null) { + String id = obj.getString("data"); + if (StringUtils.isNotBlank(id)) { + // 用例与第三方缺陷平台中的缺陷关联 + TestCaseIssues testCaseIssues = new TestCaseIssues(); + testCaseIssues.setId(UUID.randomUUID().toString()); + testCaseIssues.setIssuesId(id); + testCaseIssues.setTestCaseId(testCaseId); + testCaseIssuesMapper.insert(testCaseIssues); + + // 插入缺陷表 + Issues issues = new Issues(); + issues.setId(id); + issues.setPlatform(IssuesManagePlatform.Zentao.toString()); + issuesMapper.insert(issues); + } + } + + System.out.println(obj); +// return responseEntity.getBody(); + } + + @Override + public void deleteIssue(String id) { + + } + + @Override + public void testAuth() { + try { + String config = getPlatformConfig(IssuesManagePlatform.Zentao.toString()); + JSONObject object = JSON.parseObject(config); + String account = object.getString("account"); + String password = object.getString("password"); + String url = object.getString("url"); + url = ZentaoUtils.getUrl(url, account, password); + HttpEntity requestEntity = new HttpEntity<>(new HttpHeaders()); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity exchange = restTemplate.exchange(url + "&m=user&f=apilogin", HttpMethod.GET, requestEntity, String.class); + + String body = exchange.getBody(); + JSONObject obj = JSONObject.parseObject(body); + System.out.println(obj); + if (obj != null) { + String errcode = obj.getString("errcode"); + String errmsg = obj.getString("errmsg"); + if (StringUtils.isNotBlank(errcode)) { + MSException.throwException(errmsg); + } + } + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + MSException.throwException("验证失败!"); + } + + } + + + private String login() { + String session = getSession(); + String loginUrl = "http://xx/zentao/user-login.json?zentaosid=" + session; + MultiValueMap paramMap = new LinkedMultiValueMap<>(); + paramMap.add("account", "admin"); + paramMap.add("password", "xx"); + + HttpEntity requestEntity = new HttpEntity<>(paramMap, new HttpHeaders()); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity responseEntity = restTemplate.exchange(loginUrl, HttpMethod.POST, requestEntity, String.class); + return session; + } + + private String getSession() { + RestTemplate restTemplate = new RestTemplate(); + HttpEntity requestEntity = new HttpEntity<>(new HttpHeaders()); + ResponseEntity responseEntity = restTemplate.exchange("http://xx.xxx.xxx.xxx/zentao/api-getsessionid.json", HttpMethod.GET, requestEntity, String.class); + String body = responseEntity.getBody(); + JSONObject obj = JSONObject.parseObject(body); + JSONObject data = obj.getJSONObject("data"); + String session = data.getString("sessionID"); + return session; + } + + @Override + public List getPlatformUser() { + return null; + } +} diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoUtils.java b/backend/src/main/java/io/metersphere/track/issue/ZentaoUtils.java new file mode 100644 index 0000000000..fa34a39224 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoUtils.java @@ -0,0 +1,26 @@ +package io.metersphere.track.issue; + +import io.metersphere.commons.utils.EncryptUtils; + +public class ZentaoUtils { + + /** + * @param code Zentao 应用代号 + * @param key Zentao 密钥 + * @return token + */ + public static String getToken(String code, String key, String time) { + return (String) EncryptUtils.md5Encrypt(code + key + time); + } + + /** + * @param url Zentao url + * @param code Zentao 应用代号 + * @param key Zentao 密钥 + * @return url + */ + public static String getUrl(String url, String code, String key) { + String time = String.valueOf(System.currentTimeMillis());; + return url + "api.php?" + "code=" + code + "&time=" + time + "&token=" + getToken(code, key, time); + } +} From 0c7acfebeae3081bd65ed515cef2ee40bb2d42bd Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 16 Nov 2020 15:45:07 +0800 Subject: [PATCH 3/9] =?UTF-8?q?refactor:=20=E9=A1=B9=E7=9B=AE=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0zentao=E5=85=B3=E8=81=94=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/base/domain/Project.java | 2 + .../base/domain/ProjectExample.java | 70 +++++++++++++++++++ .../metersphere/base/mapper/ProjectMapper.xml | 28 ++++++-- .../migration/V43__project_add_zentao_id.sql | 1 + 4 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V43__project_add_zentao_id.sql diff --git a/backend/src/main/java/io/metersphere/base/domain/Project.java b/backend/src/main/java/io/metersphere/base/domain/Project.java index 4b934ac658..25403e763e 100644 --- a/backend/src/main/java/io/metersphere/base/domain/Project.java +++ b/backend/src/main/java/io/metersphere/base/domain/Project.java @@ -21,5 +21,7 @@ public class Project implements Serializable { private String jiraKey; + private String zentaoId; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ProjectExample.java b/backend/src/main/java/io/metersphere/base/domain/ProjectExample.java index 7c93737e82..8f83d6ad88 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ProjectExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ProjectExample.java @@ -643,6 +643,76 @@ public class ProjectExample { addCriterion("jira_key not between", value1, value2, "jiraKey"); return (Criteria) this; } + + public Criteria andZentaoIdIsNull() { + addCriterion("zentao_id is null"); + return (Criteria) this; + } + + public Criteria andZentaoIdIsNotNull() { + addCriterion("zentao_id is not null"); + return (Criteria) this; + } + + public Criteria andZentaoIdEqualTo(String value) { + addCriterion("zentao_id =", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdNotEqualTo(String value) { + addCriterion("zentao_id <>", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdGreaterThan(String value) { + addCriterion("zentao_id >", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdGreaterThanOrEqualTo(String value) { + addCriterion("zentao_id >=", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdLessThan(String value) { + addCriterion("zentao_id <", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdLessThanOrEqualTo(String value) { + addCriterion("zentao_id <=", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdLike(String value) { + addCriterion("zentao_id like", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdNotLike(String value) { + addCriterion("zentao_id not like", value, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdIn(List values) { + addCriterion("zentao_id in", values, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdNotIn(List values) { + addCriterion("zentao_id not in", values, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdBetween(String value1, String value2) { + addCriterion("zentao_id between", value1, value2, "zentaoId"); + return (Criteria) this; + } + + public Criteria andZentaoIdNotBetween(String value1, String value2) { + addCriterion("zentao_id not between", value1, value2, "zentaoId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/ProjectMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ProjectMapper.xml index a5939ef7bd..4ed30cebfe 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ProjectMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ProjectMapper.xml @@ -10,6 +10,7 @@ + @@ -70,7 +71,8 @@ - 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 @@ -198,6 +208,9 @@ jira_key = #{record.jiraKey,jdbcType=VARCHAR}, + + zentao_id = #{record.zentaoId,jdbcType=VARCHAR}, + @@ -212,7 +225,8 @@ create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, tapd_id = #{record.tapdId,jdbcType=VARCHAR}, - jira_key = #{record.jiraKey,jdbcType=VARCHAR} + jira_key = #{record.jiraKey,jdbcType=VARCHAR}, + zentao_id = #{record.zentaoId,jdbcType=VARCHAR} @@ -241,6 +255,9 @@ jira_key = #{jiraKey,jdbcType=VARCHAR}, + + zentao_id = #{zentaoId,jdbcType=VARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -252,7 +269,8 @@ create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, tapd_id = #{tapdId,jdbcType=VARCHAR}, - jira_key = #{jiraKey,jdbcType=VARCHAR} + jira_key = #{jiraKey,jdbcType=VARCHAR}, + zentao_id = #{zentaoId,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V43__project_add_zentao_id.sql b/backend/src/main/resources/db/migration/V43__project_add_zentao_id.sql new file mode 100644 index 0000000000..11e373adc8 --- /dev/null +++ b/backend/src/main/resources/db/migration/V43__project_add_zentao_id.sql @@ -0,0 +1 @@ +alter table project add zentao_id varchar(50) null; \ No newline at end of file From 4598c10864e0b8f5a1cbd5c23c6f1d8c8c0cd9f3 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 16 Nov 2020 16:04:11 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E9=9B=86=E6=88=90zentao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtProjectMapper.xml | 2 +- .../java/io/metersphere/dto/ProjectDTO.java | 2 +- .../track/issue/ZentaoPlatform.java | 148 +++++++++--------- .../track/service/IssuesService.java | 28 +++- .../business/components/project/MsProject.vue | 7 + 5 files changed, 110 insertions(+), 77 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml index c4c9f8b821..8fdc44d60d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml @@ -4,7 +4,7 @@