fix: jira模板同步缺陷

This commit is contained in:
chenjianxing 2021-12-14 12:37:57 +08:00 committed by jianxing
parent fdee6c370f
commit a628ea36b4
8 changed files with 50 additions and 33 deletions

View File

@ -1,6 +1,7 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.CustomFieldTemplate;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.CustomFieldTemplateDao;
import org.apache.ibatis.annotations.Param;
@ -10,4 +11,6 @@ public interface ExtCustomFieldTemplateMapper {
List<String> getCustomFieldIds(@Param("templateId") String templateId);
List<CustomFieldTemplateDao> list(@Param("request") CustomFieldTemplate request);
List<CustomFieldDao> lisSimple(@Param("request") CustomFieldTemplate request);
}

View File

@ -19,4 +19,16 @@
where cft.template_id = #{request.templateId}
</if>
</select>
<select id="lisSimple" resultType="io.metersphere.dto.CustomFieldDao">
select
template_id, required, default_value, custom_data,
cft.id as id,
cf.name as name, cf.type as type
from custom_field_template cft
inner join custom_field cf
on cft.field_id = cf.id
<if test="request.templateId != null">
where cft.template_id = #{request.templateId}
</if>
</select>
</mapper>

View File

@ -7,6 +7,7 @@ import io.metersphere.base.domain.CustomFieldTemplateExample;
import io.metersphere.base.mapper.CustomFieldMapper;
import io.metersphere.base.mapper.CustomFieldTemplateMapper;
import io.metersphere.base.mapper.ext.ExtCustomFieldTemplateMapper;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.CustomFieldTemplateDao;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -51,6 +52,10 @@ public class CustomFieldTemplateService {
return extCustomFieldTemplateMapper.list(request);
}
public List<CustomFieldDao> lisSimple(CustomFieldTemplate request) {
return extCustomFieldTemplateMapper.lisSimple(request);
}
public void deleteByTemplateId(String templateId) {
if (StringUtils.isNotBlank(templateId)) {
CustomFieldTemplateExample example = new CustomFieldTemplateExample();

View File

@ -13,7 +13,7 @@ import io.metersphere.commons.constants.IssuesStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.IntegrationRequest;
import io.metersphere.dto.CustomFieldTemplateDao;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.IssueTemplateDao;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
@ -476,8 +476,11 @@ public class IssuesService {
IssueTemplateDao template = issueTemplateService.getTemplate(projectId);
CustomFieldTemplate request = new CustomFieldTemplate();
request.setTemplateId(template.getId());
List<CustomFieldTemplateDao> customFields = customFieldTemplateService.list(request);
List<CustomFieldDao> customFields = customFieldTemplateService.lisSimple(request);
return getCustomFieldsValuesString(customFields);
}
public String getCustomFieldsValuesString(List<CustomFieldDao> customFields) {
JSONArray fields = new JSONArray();
customFields.forEach(item -> {
JSONObject field = new JSONObject(true);

@ -1 +1 @@
Subproject commit cf8337c9a6341d8c9eb7f5c9bef897083b0d2951
Subproject commit a41ba52f5495bc68f84a07643442d2b0e9524786

View File

@ -18,6 +18,7 @@
v-else-if="data.type === 'cascadingSelect'"
expand-trigger="hover"
@change="handleChange"
:props="{label: 'text'}"
:options="data.options"
v-model="data[prop]">
</el-cascader>
@ -128,9 +129,6 @@ export default {
memberOptions: [],
};
},
created() {
this.initOption(this.data.options);
},
mounted() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.memberOptions = response.data;
@ -145,15 +143,6 @@ export default {
this.$set(this.form, this.data.name, this.data[this.prop]);
}
},
initOption(options) {
if (options) {
options.forEach(i => {
i.label = i.text;
this.$set(i, 'label', i.text);
this.initOption(i.children);
});
}
}
}
};
</script>

View File

@ -179,24 +179,22 @@ export default {
},
methods: {
open(data) {
let initAddFuc = this.initEdit;
getCurrentProject((responseData) => {
this.currentProject = responseData;
if (hasLicense() && this.currentProject && this.currentProject.thirdPartTemplate && this.currentProject.platform === JIRA) {
getIssueThirdPartTemplate()
.then((template) => {
this.issueTemplate = template;
this.getThirdPartyInfo();
initAddFuc(data);
});
} else {
getIssueTemplate()
.then((template) => {
this.issueTemplate = template;
this.getThirdPartyInfo();
initAddFuc(data);
});
}
this.result.loading = true;
this.$nextTick(() => {
getCurrentProject((responseData) => {
this.currentProject = responseData;
if (hasLicense() && this.currentProject && this.currentProject.thirdPartTemplate && this.currentProject.platform === JIRA) {
getIssueThirdPartTemplate()
.then((template) => {
this.init(template, data);
});
} else {
getIssueTemplate()
.then((template) => {
this.init(template, data);
});
}
});
});
if(data&&data.id){
@ -216,6 +214,12 @@ export default {
currentUser: () => {
return getCurrentUser();
},
init(template, data) {
this.issueTemplate = template;
this.getThirdPartyInfo();
this.initEdit(data);
this.result.loading = false;
},
getThirdPartyInfo() {
let platform = this.issueTemplate.platform;
if (platform === 'Zentao') {

View File

@ -117,6 +117,7 @@ export function buildCustomFields(data, param, template) {
hasField = true;
customFields[index].name = item.name;
customFields[index].value = item.defaultValue;
customFields[index].type = item.type;
break;
}
}