feat: 用户信息添加Jira信息配置
This commit is contained in:
parent
8c89fb31e9
commit
056246c112
|
@ -1,8 +1,7 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class User implements Serializable {
|
public class User implements Serializable {
|
||||||
|
@ -34,5 +33,7 @@ public class User implements Serializable {
|
||||||
|
|
||||||
private String createUser;
|
private String createUser;
|
||||||
|
|
||||||
|
private String platformInfo;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -16,15 +16,21 @@ public interface UserMapper {
|
||||||
|
|
||||||
int insertSelective(User record);
|
int insertSelective(User record);
|
||||||
|
|
||||||
|
List<User> selectByExampleWithBLOBs(UserExample example);
|
||||||
|
|
||||||
List<User> selectByExample(UserExample example);
|
List<User> selectByExample(UserExample example);
|
||||||
|
|
||||||
User selectByPrimaryKey(String id);
|
User selectByPrimaryKey(String id);
|
||||||
|
|
||||||
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
|
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
|
||||||
|
|
||||||
|
int updateByExampleWithBLOBs(@Param("record") User record, @Param("example") UserExample example);
|
||||||
|
|
||||||
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
|
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(User record);
|
int updateByPrimaryKeySelective(User record);
|
||||||
|
|
||||||
|
int updateByPrimaryKeyWithBLOBs(User record);
|
||||||
|
|
||||||
int updateByPrimaryKey(User record);
|
int updateByPrimaryKey(User record);
|
||||||
}
|
}
|
|
@ -17,6 +17,9 @@
|
||||||
<result column="last_project_id" jdbcType="VARCHAR" property="lastProjectId" />
|
<result column="last_project_id" jdbcType="VARCHAR" property="lastProjectId" />
|
||||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.User">
|
||||||
|
<result column="platform_info" jdbcType="LONGVARCHAR" property="platformInfo" />
|
||||||
|
</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">
|
||||||
|
@ -79,6 +82,25 @@
|
||||||
id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id,
|
id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id,
|
||||||
last_organization_id, phone, `source`, last_project_id, create_user
|
last_organization_id, phone, `source`, last_project_id, create_user
|
||||||
</sql>
|
</sql>
|
||||||
|
<sql id="Blob_Column_List">
|
||||||
|
platform_info
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.UserExample" resultMap="ResultMapWithBLOBs">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
|
</if>
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
,
|
||||||
|
<include refid="Blob_Column_List" />
|
||||||
|
from user
|
||||||
|
<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.UserExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<if test="distinct">
|
<if test="distinct">
|
||||||
|
@ -93,9 +115,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 user
|
from user
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
@ -114,12 +138,14 @@
|
||||||
`password`, `status`, create_time,
|
`password`, `status`, create_time,
|
||||||
update_time, `language`, last_workspace_id,
|
update_time, `language`, last_workspace_id,
|
||||||
last_organization_id, phone, `source`,
|
last_organization_id, phone, `source`,
|
||||||
last_project_id, create_user)
|
last_project_id, create_user, platform_info
|
||||||
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
|
||||||
#{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
#{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR},
|
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR},
|
||||||
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
|
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
|
||||||
#{lastProjectId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR})
|
#{lastProjectId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{platformInfo,jdbcType=LONGVARCHAR}
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
|
||||||
insert into user
|
insert into user
|
||||||
|
@ -166,6 +192,9 @@
|
||||||
<if test="createUser != null">
|
<if test="createUser != null">
|
||||||
create_user,
|
create_user,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="platformInfo != null">
|
||||||
|
platform_info,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -210,6 +239,9 @@
|
||||||
<if test="createUser != null">
|
<if test="createUser != null">
|
||||||
#{createUser,jdbcType=VARCHAR},
|
#{createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="platformInfo != null">
|
||||||
|
#{platformInfo,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
|
||||||
|
@ -263,11 +295,35 @@
|
||||||
<if test="record.createUser != null">
|
<if test="record.createUser != null">
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.platformInfo != null">
|
||||||
|
platform_info = #{record.platformInfo,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 user
|
||||||
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
|
`name` = #{record.name,jdbcType=VARCHAR},
|
||||||
|
email = #{record.email,jdbcType=VARCHAR},
|
||||||
|
`password` = #{record.password,jdbcType=VARCHAR},
|
||||||
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
|
`language` = #{record.language,jdbcType=VARCHAR},
|
||||||
|
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
|
||||||
|
last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR},
|
||||||
|
phone = #{record.phone,jdbcType=VARCHAR},
|
||||||
|
`source` = #{record.source,jdbcType=VARCHAR},
|
||||||
|
last_project_id = #{record.lastProjectId,jdbcType=VARCHAR},
|
||||||
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
|
platform_info = #{record.platformInfo,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 user
|
update user
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
|
@ -330,9 +386,30 @@
|
||||||
<if test="createUser != null">
|
<if test="createUser != null">
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="platformInfo != null">
|
||||||
|
platform_info = #{platformInfo,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.User">
|
||||||
|
update user
|
||||||
|
set `name` = #{name,jdbcType=VARCHAR},
|
||||||
|
email = #{email,jdbcType=VARCHAR},
|
||||||
|
`password` = #{password,jdbcType=VARCHAR},
|
||||||
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
|
`language` = #{language,jdbcType=VARCHAR},
|
||||||
|
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
|
||||||
|
last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR},
|
||||||
|
phone = #{phone,jdbcType=VARCHAR},
|
||||||
|
`source` = #{source,jdbcType=VARCHAR},
|
||||||
|
last_project_id = #{lastProjectId,jdbcType=VARCHAR},
|
||||||
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
|
platform_info = #{platformInfo,jdbcType=LONGVARCHAR}
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.User">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.User">
|
||||||
update user
|
update user
|
||||||
set `name` = #{name,jdbcType=VARCHAR},
|
set `name` = #{name,jdbcType=VARCHAR},
|
||||||
|
|
|
@ -145,14 +145,7 @@ public class UserController {
|
||||||
@PostMapping("/update/current")
|
@PostMapping("/update/current")
|
||||||
@MsAuditLog(module = "personal_information_personal_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
|
@MsAuditLog(module = "personal_information_personal_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
|
||||||
public UserDTO updateCurrentUser(@RequestBody User user) {
|
public UserDTO updateCurrentUser(@RequestBody User user) {
|
||||||
String currentUserId = SessionUtils.getUserId();
|
return userService.updateCurrentUser(user);
|
||||||
if (!StringUtils.equals(currentUserId, user.getId())) {
|
|
||||||
MSException.throwException(Translator.get("not_authorized"));
|
|
||||||
}
|
|
||||||
userService.updateUser(user);
|
|
||||||
UserDTO userDTO = userService.getUserDTO(user.getId());
|
|
||||||
SessionUtils.putUser(SessionUser.fromUser(userDTO));
|
|
||||||
return SessionUtils.getUser();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/switch/source/org/{sourceId}")
|
@PostMapping("/switch/source/org/{sourceId}")
|
||||||
|
|
|
@ -16,6 +16,8 @@ public class BaseQueryRequest {
|
||||||
|
|
||||||
private String workspaceId;
|
private String workspaceId;
|
||||||
|
|
||||||
|
private String organizationId;
|
||||||
|
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
|
||||||
private List<String> moduleIds;
|
private List<String> moduleIds;
|
||||||
|
|
|
@ -21,4 +21,12 @@ public class UserDTO extends User {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public static class PlatformInfo {
|
||||||
|
private String jiraAccount;
|
||||||
|
private String jiraPassword;
|
||||||
|
private String tapdUserName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.service;
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcelFactory;
|
import com.alibaba.excel.EasyExcelFactory;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
|
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
|
||||||
|
@ -1358,4 +1359,29 @@ public class UserService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserDTO updateCurrentUser(User user) {
|
||||||
|
String currentUserId = SessionUtils.getUserId();
|
||||||
|
if (!StringUtils.equals(currentUserId, user.getId())) {
|
||||||
|
MSException.throwException(Translator.get("not_authorized"));
|
||||||
|
}
|
||||||
|
updateUser(user);
|
||||||
|
UserDTO userDTO = getUserDTO(user.getId());
|
||||||
|
SessionUtils.putUser(SessionUser.fromUser(userDTO));
|
||||||
|
return SessionUtils.getUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserDTO.PlatformInfo getCurrentPlatformInfo(String orgId, String userId) {
|
||||||
|
User user = userMapper.selectByPrimaryKey(userId);
|
||||||
|
String platformInfoStr = user.getPlatformInfo();
|
||||||
|
if (StringUtils.isBlank(orgId) || StringUtils.isBlank(platformInfoStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JSONObject platformInfos = JSONObject.parseObject(platformInfoStr);
|
||||||
|
JSONObject platformInfo = platformInfos.getJSONObject(orgId);
|
||||||
|
if (platformInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSONObject.parseObject(JSONObject.toJSONString(platformInfo), UserDTO.PlatformInfo.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,11 @@ import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.controller.request.IntegrationRequest;
|
import io.metersphere.controller.request.IntegrationRequest;
|
||||||
import io.metersphere.dto.CustomFieldItemDTO;
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
|
import io.metersphere.dto.UserDTO;
|
||||||
import io.metersphere.service.IntegrationService;
|
import io.metersphere.service.IntegrationService;
|
||||||
import io.metersphere.service.ProjectService;
|
import io.metersphere.service.ProjectService;
|
||||||
import io.metersphere.service.ResourceService;
|
import io.metersphere.service.ResourceService;
|
||||||
|
import io.metersphere.service.UserService;
|
||||||
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.TestCaseService;
|
import io.metersphere.track.service.TestCaseService;
|
||||||
|
@ -48,6 +50,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
protected ExtIssuesMapper extIssuesMapper;
|
protected ExtIssuesMapper extIssuesMapper;
|
||||||
protected ResourceService resourceService;
|
protected ResourceService resourceService;
|
||||||
protected RestTemplate restTemplateIgnoreSSL;
|
protected RestTemplate restTemplateIgnoreSSL;
|
||||||
|
protected UserService userService;
|
||||||
|
|
||||||
protected String testCaseId;
|
protected String testCaseId;
|
||||||
protected String projectId;
|
protected String projectId;
|
||||||
|
@ -81,12 +84,13 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);
|
this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);
|
||||||
this.projectService = CommonBeanFactory.getBean(ProjectService.class);
|
this.projectService = CommonBeanFactory.getBean(ProjectService.class);
|
||||||
this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);
|
this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);
|
||||||
|
this.userService = CommonBeanFactory.getBean(UserService.class);
|
||||||
this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class);
|
this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class);
|
||||||
this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class);
|
this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class);
|
||||||
this.resourceService = CommonBeanFactory.getBean(ResourceService.class);
|
this.resourceService = CommonBeanFactory.getBean(ResourceService.class);
|
||||||
this.testCaseId = issuesRequest.getTestCaseId();
|
this.testCaseId = issuesRequest.getTestCaseId();
|
||||||
this.projectId = issuesRequest.getProjectId();
|
this.projectId = issuesRequest.getProjectId();
|
||||||
//
|
|
||||||
this.restTemplateIgnoreSSL = restTemplate;
|
this.restTemplateIgnoreSSL = restTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,4 +195,8 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected UserDTO.PlatformInfo getUserPlatInfo(String orgId, String userId) {
|
||||||
|
return userService.getCurrentPlatformInfo(orgId, userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ import io.metersphere.commons.constants.IssuesStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.EncryptUtils;
|
import io.metersphere.commons.utils.EncryptUtils;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.dto.CustomFieldItemDTO;
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
|
import io.metersphere.dto.UserDTO;
|
||||||
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.JiraAddIssueResponse;
|
import io.metersphere.track.issue.domain.JiraAddIssueResponse;
|
||||||
|
@ -44,14 +46,21 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
super(issuesRequest);
|
super(issuesRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JiraConfig getConfig() {
|
public JiraConfig getConfig(String orgId) {
|
||||||
|
JiraConfig jiraConfig = null;
|
||||||
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
||||||
if (StringUtils.isNotBlank(config)) {
|
if (StringUtils.isNotBlank(config)) {
|
||||||
return JSONObject.parseObject(config, JiraConfig.class);
|
jiraConfig = JSONObject.parseObject(config, JiraConfig.class);
|
||||||
} else {
|
UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(orgId, SessionUtils.getUserId());
|
||||||
return null;
|
if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getJiraAccount())
|
||||||
|
&& StringUtils.isNotBlank(userPlatInfo.getJiraPassword())) {
|
||||||
|
jiraConfig.setAccount(userPlatInfo.getJiraAccount());
|
||||||
|
jiraConfig.setPassword(userPlatInfo.getJiraPassword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
validateConfig(jiraConfig);
|
||||||
|
return jiraConfig;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||||
|
@ -64,7 +73,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
} else {
|
} else {
|
||||||
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||||
}
|
}
|
||||||
setConfig();
|
setConfig(issuesRequest.getOrganizationId());
|
||||||
issues.forEach(item -> {
|
issues.forEach(item -> {
|
||||||
String issuesId = item.getId();
|
String issuesId = item.getId();
|
||||||
parseIssue(item, jiraClientV2.getIssues(issuesId));
|
parseIssue(item, jiraClientV2.getIssues(issuesId));
|
||||||
|
@ -118,7 +127,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filter(List<IssuesDao> issues) {
|
public void filter(List<IssuesDao> issues) {
|
||||||
setConfig();
|
setConfig(null);
|
||||||
issues.forEach((issuesDao) -> {
|
issues.forEach((issuesDao) -> {
|
||||||
parseIssue(issuesDao, jiraClientV2.getIssues(issuesDao.getId()));
|
parseIssue(issuesDao, jiraClientV2.getIssues(issuesDao.getId()));
|
||||||
if (StringUtils.isBlank(issuesDao.getId())) {
|
if (StringUtils.isBlank(issuesDao.getId())) {
|
||||||
|
@ -138,10 +147,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
List<DemandDTO> list = new ArrayList<>();
|
List<DemandDTO> list = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String key = this.getProjectId(projectId);
|
String key = validateJiraKey(projectId);
|
||||||
if (StringUtils.isBlank(key)) {
|
|
||||||
MSException.throwException("未关联Jira 项目Key");
|
|
||||||
}
|
|
||||||
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
||||||
JSONObject object = JSON.parseObject(config);
|
JSONObject object = JSON.parseObject(config);
|
||||||
|
|
||||||
|
@ -186,25 +192,31 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void validateConfig(JiraConfig config) {
|
||||||
public void addIssue(IssuesUpdateRequest issuesRequest) {
|
|
||||||
issuesRequest.setPlatform(IssuesManagePlatform.Jira.toString());
|
|
||||||
|
|
||||||
JiraConfig config = getConfig();
|
|
||||||
jiraClientV2.setConfig(config);
|
jiraClientV2.setConfig(config);
|
||||||
|
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
MSException.throwException("jira config is null");
|
MSException.throwException("jira config is null");
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(config.getIssuetype())) {
|
if (StringUtils.isBlank(config.getIssuetype())) {
|
||||||
MSException.throwException("Jira 问题类型为空");
|
MSException.throwException("Jira 问题类型为空");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String jiraKey = getProjectId(issuesRequest.getProjectId());
|
private String validateJiraKey(String projectId) {
|
||||||
|
String jiraKey = getProjectId(projectId);
|
||||||
if (StringUtils.isBlank(jiraKey)) {
|
if (StringUtils.isBlank(jiraKey)) {
|
||||||
MSException.throwException("未关联Jira 项目Key");
|
MSException.throwException("未关联Jira 项目Key");
|
||||||
}
|
}
|
||||||
|
return jiraKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addIssue(IssuesUpdateRequest issuesRequest) {
|
||||||
|
issuesRequest.setPlatform(IssuesManagePlatform.Jira.toString());
|
||||||
|
|
||||||
|
JiraConfig config = setConfig(issuesRequest.getOrganizationId());// todo
|
||||||
|
|
||||||
|
String jiraKey = validateJiraKey(issuesRequest.getProjectId());
|
||||||
|
|
||||||
String content = issuesRequest.getDescription();
|
String content = issuesRequest.getDescription();
|
||||||
|
|
||||||
|
@ -275,7 +287,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void testAuth() {
|
public void testAuth() {
|
||||||
setConfig();
|
setConfig(null);
|
||||||
jiraClientV2.getIssueCreateMetadata();
|
jiraClientV2.getIssueCreateMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,13 +306,14 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
return project.getJiraKey();
|
return project.getJiraKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfig() {
|
public JiraConfig setConfig(String orgId) {
|
||||||
JiraConfig config = getConfig();
|
JiraConfig config = getConfig(orgId);
|
||||||
jiraClientV2.setConfig(config);
|
jiraClientV2.setConfig(config);
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IssuesWithBLOBs getJiraIssues(IssuesWithBLOBs issuesDao, String issueId) {
|
public IssuesWithBLOBs getJiraIssues(IssuesWithBLOBs issuesDao, String issueId) {
|
||||||
setConfig();
|
setConfig(null);
|
||||||
if (issuesDao == null) {
|
if (issuesDao == null) {
|
||||||
issuesDao = new IssuesDao();
|
issuesDao = new IssuesDao();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
||||||
public class IssuesUpdateRequest extends IssuesWithBLOBs {
|
public class IssuesUpdateRequest extends IssuesWithBLOBs {
|
||||||
private String content;
|
private String content;
|
||||||
private String testCaseId;
|
private String testCaseId;
|
||||||
|
private String organizationId;
|
||||||
|
|
||||||
private List<String> tapdUsers;
|
private List<String> tapdUsers;
|
||||||
/**
|
/**
|
||||||
* zentao bug 处理人
|
* zentao bug 处理人
|
||||||
|
|
|
@ -4,3 +4,6 @@ ALTER TABLE api_scenario ADD version INT(10) DEFAULT 0 NULL COMMENT '版本号';
|
||||||
ALTER TABLE load_test ADD scenario_version INT(10) DEFAULT 0 NULL COMMENT '关联的接口自动化版本号';
|
ALTER TABLE load_test ADD scenario_version INT(10) DEFAULT 0 NULL COMMENT '关联的接口自动化版本号';
|
||||||
|
|
||||||
ALTER TABLE load_test ADD scenario_id varchar(255) NULL COMMENT '关联的场景自动化ID';
|
ALTER TABLE load_test ADD scenario_id varchar(255) NULL COMMENT '关联的场景自动化ID';
|
||||||
|
|
||||||
|
-- 对接Jira等平台认证信息
|
||||||
|
ALTER TABLE `user` ADD platform_info LONGTEXT NULL COMMENT ' 其他平台对接信息';
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
|
@ -0,0 +1,29 @@
|
||||||
|
<template>
|
||||||
|
<el-form label-position="right" label-width="100px" size="small">
|
||||||
|
<el-form-item :label="'Jira 信息'">
|
||||||
|
<ms-instructions-icon size="10" :content="'该信息为对接 Jira 的用户认证信息,若未填写,则使用组织中配置的默认信息'"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="'Jira ' + $t('organization.integration.account')" prop="account">
|
||||||
|
<el-input v-model="data.jiraAccount" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="'Jira ' + $t('organization.integration.password')" prop="password">
|
||||||
|
<el-input v-model="data.jiraPassword" auto-complete="new-password"
|
||||||
|
:placeholder="$t('organization.integration.input_api_password')" show-password/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
|
||||||
|
export default {
|
||||||
|
name: "JiraUserInfo",
|
||||||
|
components: {MsInstructionsIcon},
|
||||||
|
props: ['data'],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.instructions-icon {
|
||||||
|
margin-left: -5px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -51,6 +51,8 @@
|
||||||
<el-input v-model="form.phone" autocomplete="off"/>
|
<el-input v-model="form.phone" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<jira-user-info v-if="hasJira" :data="currentPlatformInfo"/>
|
||||||
|
<tapd-user-info v-if="hasTapd" :data="currentPlatformInfo"/>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<ms-dialog-footer
|
<ms-dialog-footer
|
||||||
@cancel="updateVisible = false"
|
@cancel="updateVisible = false"
|
||||||
|
@ -79,20 +81,27 @@
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {TokenKey} from "../../../../common/js/constants";
|
import {TokenKey} from "../../../../common/js/constants";
|
||||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
|
import {
|
||||||
|
getCurrentOrganizationId,
|
||||||
|
getCurrentUser,
|
||||||
|
listenGoBack,
|
||||||
|
removeGoBackListener
|
||||||
|
} from "../../../../common/js/utils";
|
||||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||||
import {EMAIL_REGEX, PHONE_REGEX} from "@/common/js/regex";
|
import {EMAIL_REGEX, PHONE_REGEX} from "@/common/js/regex";
|
||||||
|
import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo";
|
||||||
|
import TapdUserInfo from "@/business/components/settings/personal/TapdUserInfo";
|
||||||
|
import {getIntegrationService} from "@/network/organization";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsPersonSetting",
|
name: "MsPersonSetting",
|
||||||
components: {MsDialogFooter, MsTableOperatorButton},
|
components: {TapdUserInfo, JiraUserInfo, MsDialogFooter, MsTableOperatorButton},
|
||||||
inject: [
|
inject: [
|
||||||
'reload'
|
'reload'
|
||||||
],
|
],
|
||||||
|
@ -105,8 +114,15 @@ export default {
|
||||||
tableData: [],
|
tableData: [],
|
||||||
updatePath: '/user/update/current',
|
updatePath: '/user/update/current',
|
||||||
updatePasswordPath: '/user/update/password',
|
updatePasswordPath: '/user/update/password',
|
||||||
form: {},
|
form: {platformInfo: {}},
|
||||||
|
currentPlatformInfo: {
|
||||||
|
jiraAccount: '',
|
||||||
|
jiraPassword: '',
|
||||||
|
tapdUserName: ''
|
||||||
|
},
|
||||||
ruleForm: {},
|
ruleForm: {},
|
||||||
|
hasJira: false,
|
||||||
|
hasTapd: false,
|
||||||
rule: {
|
rule: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: this.$t('member.input_name'), trigger: 'blur'},
|
{required: true, message: this.$t('member.input_name'), trigger: 'blur'},
|
||||||
|
@ -168,11 +184,36 @@ export default {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
return getCurrentUser();
|
return getCurrentUser();
|
||||||
},
|
},
|
||||||
edit(row) {
|
edit: function (row) {
|
||||||
this.updateVisible = true;
|
this.updateVisible = true;
|
||||||
this.form = Object.assign({}, row);
|
this.form = Object.assign({}, row);
|
||||||
|
this.getPlatformInfo(row);
|
||||||
listenGoBack(this.handleClose);
|
listenGoBack(this.handleClose);
|
||||||
},
|
},
|
||||||
|
getPlatformInfo(row) {
|
||||||
|
if (row.platformInfo) {
|
||||||
|
this.form.platformInfo = JSON.parse(row.platformInfo);
|
||||||
|
} else {
|
||||||
|
this.form.platformInfo = {};
|
||||||
|
}
|
||||||
|
let orgId = getCurrentOrganizationId();
|
||||||
|
if (!this.form.platformInfo[orgId]) {
|
||||||
|
this.form.platformInfo[orgId] = {};
|
||||||
|
}
|
||||||
|
this.currentPlatformInfo = this.form.platformInfo[orgId];
|
||||||
|
this.result = getIntegrationService((data) => {
|
||||||
|
let platforms = data.map(d => d.platform);
|
||||||
|
if (platforms.indexOf("Tapd") !== -1) {
|
||||||
|
this.hasTapd = true;
|
||||||
|
}
|
||||||
|
if (platforms.indexOf("Jira") !== -1) {
|
||||||
|
this.hasJira = true;
|
||||||
|
}
|
||||||
|
// if (platforms.indexOf("Zentao") !== -1) {
|
||||||
|
// this.zentao = true;
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
},
|
||||||
editPassword(row) {
|
editPassword(row) {
|
||||||
this.editPasswordVisible = true;
|
this.editPasswordVisible = true;
|
||||||
listenGoBack(this.handleClose);
|
listenGoBack(this.handleClose);
|
||||||
|
@ -190,7 +231,10 @@ export default {
|
||||||
updateUser(updateUserForm) {
|
updateUser(updateUserForm) {
|
||||||
this.$refs[updateUserForm].validate(valid => {
|
this.$refs[updateUserForm].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.result = this.$post(this.updatePath, this.form, response => {
|
let param = {};
|
||||||
|
Object.assign(param, this.form);
|
||||||
|
param.platformInfo = JSON.stringify(this.form.platformInfo);
|
||||||
|
this.result = this.$post(this.updatePath, param, response => {
|
||||||
this.$success(this.$t('commons.modify_success'));
|
this.$success(this.$t('commons.modify_success'));
|
||||||
localStorage.setItem(TokenKey, JSON.stringify(response.data));
|
localStorage.setItem(TokenKey, JSON.stringify(response.data));
|
||||||
this.updateVisible = false;
|
this.updateVisible = false;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<template>
|
||||||
|
<el-form label-position="right" label-width="100px" size="small">
|
||||||
|
<el-form-item :label="'Tapd 昵称'">
|
||||||
|
<ms-instructions-icon size="10" effect="light">
|
||||||
|
<template>
|
||||||
|
<img class="jira-image" src="../../../../assets/tapd-user.png"/>
|
||||||
|
</template>
|
||||||
|
</ms-instructions-icon>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="'Tapd 昵称'" prop="account">
|
||||||
|
<el-input v-model="data.tapdUserName" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
|
||||||
|
export default {
|
||||||
|
name: "TapdUserInfo",
|
||||||
|
components: {MsInstructionsIcon},
|
||||||
|
props: ['data'],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.instructions-icon {
|
||||||
|
margin-left: -5px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -76,7 +76,7 @@ import {buildCustomFields, getTemplate, parseCustomField} from "@/common/js/cust
|
||||||
import CustomFiledComponent from "@/business/components/settings/workspace/template/CustomFiledComponent";
|
import CustomFiledComponent from "@/business/components/settings/workspace/template/CustomFiledComponent";
|
||||||
import TestCaseIssueList from "@/business/components/track/issue/TestCaseIssueList";
|
import TestCaseIssueList from "@/business/components/track/issue/TestCaseIssueList";
|
||||||
import IssueEditDetail from "@/business/components/track/issue/IssueEditDetail";
|
import IssueEditDetail from "@/business/components/track/issue/IssueEditDetail";
|
||||||
import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
|
import {getCurrentOrganizationId, getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
|
||||||
import {getIssueTemplate} from "@/network/custom-field-template";
|
import {getIssueTemplate} from "@/network/custom-field-template";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -234,6 +234,7 @@ export default {
|
||||||
let param = {};
|
let param = {};
|
||||||
Object.assign(param, this.form);
|
Object.assign(param, this.form);
|
||||||
param.projectId = this.projectId;
|
param.projectId = this.projectId;
|
||||||
|
param.organizationId = getCurrentOrganizationId();
|
||||||
buildCustomFields(this.form, param, this.issueTemplate);
|
buildCustomFields(this.form, param, this.issueTemplate);
|
||||||
if (this.isPlan) {
|
if (this.isPlan) {
|
||||||
param.testCaseIds = [this.caseId];
|
param.testCaseIds = [this.caseId];
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import {getCurrentOrganizationId} from "@/common/js/utils";
|
||||||
|
import {get} from "@/common/js/ajax";
|
||||||
|
|
||||||
|
export function getIntegrationService(success) {
|
||||||
|
return get("/service/integration/all/" + getCurrentOrganizationId(), response => {
|
||||||
|
let data = response.data;
|
||||||
|
if (success) {
|
||||||
|
success(response.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue