diff --git a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java index 4a4d22895a..ac4c4ccbe4 100644 --- a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java @@ -1,5 +1,6 @@ package io.metersphere.track.issue; +import com.alibaba.fastjson.JSONObject; import io.metersphere.base.domain.IssuesDao; import io.metersphere.base.domain.IssuesWithBLOBs; import io.metersphere.commons.constants.IssuesManagePlatform; @@ -9,6 +10,7 @@ import io.metersphere.commons.utils.SessionUtils; import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest; +import io.metersphere.track.request.testcase.TestCaseBatchRequest; import org.apache.commons.lang3.StringUtils; import java.util.List; @@ -39,13 +41,23 @@ public class LocalPlatform extends LocalAbstractPlatform { @Override public void addIssue(IssuesUpdateRequest issuesRequest) { + String issueStatus = "new"; + if (StringUtils.isNotBlank(issuesRequest.getCustomFields())) { + List fields = JSONObject.parseArray(issuesRequest.getCustomFields(), TestCaseBatchRequest.CustomFiledRequest.class); + for (TestCaseBatchRequest.CustomFiledRequest field : fields) { + if (StringUtils.equals("状态", field.getName())) { + issueStatus = (String) field.getValue(); + break; + } + } + } SessionUser user = SessionUtils.getUser(); String id = UUID.randomUUID().toString(); IssuesWithBLOBs issues = new IssuesWithBLOBs(); BeanUtils.copyBean(issues, issuesRequest); issues.setId(id); issues.setPlatformId(id); - issues.setStatus("new"); + issues.setStatus(issueStatus); issues.setReporter(user.getId()); issues.setCreateTime(System.currentTimeMillis()); issues.setUpdateTime(System.currentTimeMillis());