forked from Gitlink/microservices
Merge pull request '同步更新issue企业标识' (#908) from wanjia9506/microservices:dev_data_compatible_127659 into master
This commit is contained in:
commit
c001df36d8
|
@ -385,4 +385,15 @@ public class PmsProjectIssuesController extends BaseController {
|
|||
public void exportIssues(HttpServletResponse response, @ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId) {
|
||||
pmsProjectIssuesService.exportIssues(response, pmProjectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步更新issue企业标识
|
||||
* 说明:旧issues数据直接通过pmProjectId与pms建立关联,新需求要与企业建立关联,故需要同步更新issue企业标识
|
||||
*/
|
||||
@PutMapping("/updateIssueEnterpriseIdentifier")
|
||||
@ApiOperation(value = "同步更新issue企业标识")
|
||||
public AjaxResult updateIssueEnterpriseIdentifier() {
|
||||
boolean result = pmsProjectIssuesService.updateIssueEnterpriseIdentifier();
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package com.microservices.pms.project.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ForgeIssues {
|
||||
private Integer id;
|
||||
|
||||
private Integer trackerId;
|
||||
|
||||
private Integer projectId;
|
||||
|
||||
private String subject;
|
||||
|
||||
private Date dueDate;
|
||||
|
||||
private Integer categoryId;
|
||||
|
||||
private Integer statusId;
|
||||
|
||||
private Integer assignedToId;
|
||||
|
||||
private Integer priorityId;
|
||||
|
||||
private Integer fixedVersionId;
|
||||
|
||||
private Integer authorId;
|
||||
|
||||
private Date createdOn;
|
||||
|
||||
private Date updatedOn;
|
||||
|
||||
private Date startDate;
|
||||
|
||||
private Integer doneRatio;
|
||||
|
||||
private Float estimatedHours;
|
||||
|
||||
private Integer parentId;
|
||||
|
||||
private Integer rootId;
|
||||
|
||||
private Integer lft;
|
||||
|
||||
private Integer rgt;
|
||||
|
||||
private Boolean isPrivate;
|
||||
|
||||
private Date closedOn;
|
||||
|
||||
private Integer projectIssuesIndex;
|
||||
|
||||
private String issueType;
|
||||
|
||||
private Integer token;
|
||||
|
||||
private String issueTagsValue;
|
||||
|
||||
private Boolean isLock;
|
||||
|
||||
private String issueClassify;
|
||||
|
||||
private String refName;
|
||||
|
||||
private String branchName;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer blockchainTokenNum;
|
||||
|
||||
private Long pmProjectId;
|
||||
|
||||
private Long pmSprintId;
|
||||
|
||||
private Integer pmIssueType;
|
||||
|
||||
private BigDecimal timeScale;
|
||||
|
||||
private Integer childCount;
|
||||
private Long changerId;
|
||||
|
||||
private Integer fakeId;
|
||||
|
||||
private String enterpriseIdentifier;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.microservices.pms.project.mapper;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.pms.project.domain.ForgeIssues;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Slave
|
||||
@Mapper
|
||||
public interface ForgeIssuesMapper {
|
||||
|
||||
List<ForgeIssues> getBriefIssues();
|
||||
|
||||
int updateForIssues(ForgeIssues forgeIssues);
|
||||
}
|
|
@ -91,4 +91,6 @@ public interface PmsProjectMapper
|
|||
PmsProject selectPmsProjectById(Long id);
|
||||
|
||||
List<Long> selectProjectIdsByAssigneeUserId(@Param("enterpriseIdentifier") String enterpriseIdentifier, @Param("gitlinkUserId") Long gitlinkUserId);
|
||||
|
||||
String selectEnterpriseIdentifierByProjectId(@Param("pmProjectId") Long pmProjectId);
|
||||
}
|
||||
|
|
|
@ -15,9 +15,11 @@ import com.microservices.pms.enterprise.service.IPmsEnterpriseService;
|
|||
import com.microservices.pms.enums.ProjectIssueStatus;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqStatus;
|
||||
import com.microservices.pms.product.service.IPmsProductRequirementService;
|
||||
import com.microservices.pms.project.domain.ForgeIssues;
|
||||
import com.microservices.pms.project.domain.PmsProject;
|
||||
import com.microservices.pms.project.domain.SimpleRepository;
|
||||
import com.microservices.pms.project.domain.vo.*;
|
||||
import com.microservices.pms.project.mapper.ForgeIssuesMapper;
|
||||
import com.microservices.pms.project.mapper.PmsProjectMapper;
|
||||
import com.microservices.pms.project.mapper.PmsProjectSprintMapper;
|
||||
import com.microservices.pms.project.mapper.PmsProjectTestsheetMapper;
|
||||
|
@ -83,6 +85,8 @@ public class PmsProjectIssuesService {
|
|||
private PmsProjectTestsheetMapper pmsProjectTestsheetMapper;
|
||||
@Resource
|
||||
private PmsProjectMapper pmsProjectMapper;
|
||||
@Resource
|
||||
private ForgeIssuesMapper forgeIssuesMapper;
|
||||
|
||||
|
||||
public JSONObject selectPmsProjectIssuesList(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
|
||||
|
@ -776,4 +780,20 @@ public class PmsProjectIssuesService {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateIssueEnterpriseIdentifier() {
|
||||
Long currentUserId = SecurityUtils.getGitlinkUserId();
|
||||
if (currentUserId == null || currentUserId != 831) {
|
||||
return false;
|
||||
}
|
||||
List<ForgeIssues> forgeIssuesList = forgeIssuesMapper.getBriefIssues();
|
||||
for (ForgeIssues forgeIssues : forgeIssuesList) {
|
||||
String enterpriseIdentifier = pmsProjectMapper.selectEnterpriseIdentifierByProjectId(forgeIssues.getPmProjectId());
|
||||
if (enterpriseIdentifier != null) {
|
||||
forgeIssues.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
forgeIssuesMapper.updateForIssues(forgeIssues);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.microservices.pms.project.mapper.ForgeIssuesMapper">
|
||||
<resultMap id="BaseResultMap" type="com.microservices.pms.project.domain.ForgeIssues">
|
||||
<id column="id" property="id" jdbcType="INTEGER" />
|
||||
<result column="tracker_id" property="trackerId" jdbcType="INTEGER" />
|
||||
<result column="project_id" property="projectId" jdbcType="INTEGER" />
|
||||
<result column="subject" property="subject" jdbcType="VARCHAR" />
|
||||
<result column="due_date" property="dueDate" jdbcType="DATE" />
|
||||
<result column="category_id" property="categoryId" jdbcType="INTEGER" />
|
||||
<result column="status_id" property="statusId" jdbcType="INTEGER" />
|
||||
<result column="assigned_to_id" property="assignedToId" jdbcType="INTEGER" />
|
||||
<result column="priority_id" property="priorityId" jdbcType="INTEGER" />
|
||||
<result column="fixed_version_id" property="fixedVersionId" jdbcType="INTEGER" />
|
||||
<result column="author_id" property="authorId" jdbcType="INTEGER" />
|
||||
<result column="created_on" property="createdOn" jdbcType="TIMESTAMP" />
|
||||
<result column="updated_on" property="updatedOn" jdbcType="TIMESTAMP" />
|
||||
<result column="start_date" property="startDate" jdbcType="DATE" />
|
||||
<result column="done_ratio" property="doneRatio" jdbcType="INTEGER" />
|
||||
<result column="estimated_hours" property="estimatedHours" jdbcType="REAL" />
|
||||
<result column="parent_id" property="parentId" jdbcType="INTEGER" />
|
||||
<result column="root_id" property="rootId" jdbcType="INTEGER" />
|
||||
<result column="lft" property="lft" jdbcType="INTEGER" />
|
||||
<result column="rgt" property="rgt" jdbcType="INTEGER" />
|
||||
<result column="is_private" property="isPrivate" jdbcType="BIT" />
|
||||
<result column="closed_on" property="closedOn" jdbcType="TIMESTAMP" />
|
||||
<result column="project_issues_index" property="projectIssuesIndex" jdbcType="INTEGER" />
|
||||
<result column="issue_type" property="issueType" jdbcType="VARCHAR" />
|
||||
<result column="token" property="token" jdbcType="INTEGER" />
|
||||
<result column="issue_tags_value" property="issueTagsValue" jdbcType="VARCHAR" />
|
||||
<result column="is_lock" property="isLock" jdbcType="BIT" />
|
||||
<result column="issue_classify" property="issueClassify" jdbcType="VARCHAR" />
|
||||
<result column="ref_name" property="refName" jdbcType="VARCHAR" />
|
||||
<result column="branch_name" property="branchName" jdbcType="VARCHAR" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
<result column="blockchain_token_num" property="blockchainTokenNum" jdbcType="INTEGER" />
|
||||
<result column="pm_project_id" property="pmProjectId" jdbcType="BIGINT" />
|
||||
<result column="pm_sprint_id" property="pmSprintId" jdbcType="BIGINT" />
|
||||
<result column="pm_issue_type" property="pmIssueType" jdbcType="INTEGER" />
|
||||
<result column="time_scale" property="timeScale" jdbcType="DECIMAL" />
|
||||
<result column="child_count" property="childCount" jdbcType="INTEGER" />
|
||||
<result column="changer_id" property="changerId" jdbcType="BIGINT" />
|
||||
<result column="fake_id" property="fakeId" jdbcType="INTEGER" />
|
||||
<result column="enterprise_identifier" property="enterpriseIdentifier" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<update id="updateForIssues">
|
||||
UPDATE issues
|
||||
set enterprise_identifier = #{enterpriseIdentifier}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getBriefIssues" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
id, pm_project_id, enterprise_identifier
|
||||
FROM
|
||||
issues
|
||||
WHERE pm_project_id IS NOT NULL AND (enterprise_identifier IS NULL OR enterprise_identifier = '');
|
||||
</select>
|
||||
</mapper>
|
|
@ -180,6 +180,12 @@
|
|||
where pp.project_assignee_id = #{gitlinkUserId}
|
||||
and pe.enterprise_identifier = #{enterpriseIdentifier}
|
||||
</select>
|
||||
<select id="selectEnterpriseIdentifierByProjectId" resultType="java.lang.String">
|
||||
select pe.enterprise_identifier
|
||||
from pms_project pp
|
||||
left join pms_enterprise pe on pe.id = pp.pms_enterprise_id
|
||||
where pp.id = #{pmProjectId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPmsProject" parameterType="PmsProject" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pms_project
|
||||
|
|
Loading…
Reference in New Issue