From 464ce4e2866529eeb19fb1e68af27d1275aeb480 Mon Sep 17 00:00:00 2001 From: OTTO <731554297@qq.com> Date: Tue, 10 Dec 2024 17:26:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E9=9C=80=E6=B1=82=E9=87=8D=E6=9E=84):=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=9C=80=E8=A7=84=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A1=E5=88=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 项目计划仅能基于产品需求规格创建 2. 项目计划不允许编辑标题、正文和附件 3. 项目计划状态值仅能为进行中、已完成、已关闭 4. 如果状态发生变更,需同步产品需规的状态变更: - 项目计划修改为进行中将需规调整为已计划 - 项目计划修改为已完成或已关闭将需规调整为已完成 - 限制需求规格变更中,项目计划不能调整为已完成或已关闭状态 Signed-off-by: OTTO <731554297@qq.com> --- .../mapper/PmsProductRequirementMapper.java | 2 + .../IPmsProductRequirementService.java | 3 + .../PmsProductRequirementServiceImpl.java | 18 ++++ .../PmsProjectIssuesController.java | 91 ++++++++----------- .../domain/vo/PmsProjectIssuesInputVo.java | 12 +++ .../service/PmsProjectIssuesService.java | 38 ++++++++ .../pms/PmsProductRequirementMapper.xml | 6 ++ 7 files changed, 116 insertions(+), 54 deletions(-) diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/mapper/PmsProductRequirementMapper.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/mapper/PmsProductRequirementMapper.java index 4e30160ae..d102369a6 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/mapper/PmsProductRequirementMapper.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/mapper/PmsProductRequirementMapper.java @@ -110,4 +110,6 @@ public interface PmsProductRequirementMapper List selectReqSpecsList(ProductReqSpecsSearchVo productReqSpecsSearchVo); Integer selectReqSpecsCountByIdentifier(@Param("identifier") String identifier); + + PmsProductRequirement selectReqSpecsByProjectReqId(@Param("projectReqId") Long projectReqId); } diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/IPmsProductRequirementService.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/IPmsProductRequirementService.java index c92053682..4c5d17f7b 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/IPmsProductRequirementService.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/IPmsProductRequirementService.java @@ -3,6 +3,7 @@ package com.microservices.pms.product.service; import com.alibaba.fastjson2.JSONObject; import com.microservices.common.core.web.page.GenericsTableDataInfo; import com.microservices.pms.product.domain.PmsProductRequirement; +import com.microservices.pms.product.domain.enums.ProductReqStatus; import com.microservices.pms.product.domain.vo.*; import java.util.List; @@ -125,4 +126,6 @@ public interface IPmsProductRequirementService List selectReqSpecsTypeList(); JSONObject selectReqSpecsAssociatedPlanData(Long reqSpecsId); + + void updateReqSpecsStatusByProjectReqId(Long projectReqId, ProductReqStatus productReqStatus); } diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/impl/PmsProductRequirementServiceImpl.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/impl/PmsProductRequirementServiceImpl.java index 06dcd9e52..95396163a 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/impl/PmsProductRequirementServiceImpl.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/product/service/impl/PmsProductRequirementServiceImpl.java @@ -585,6 +585,24 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS ); } + @Override + public void updateReqSpecsStatusByProjectReqId(Long projectReqId, ProductReqStatus productReqStatus) { + PmsProductRequirement pmsProductRequirement = pmsProductRequirementMapper.selectReqSpecsByProjectReqId(projectReqId); + if (pmsProductRequirement == null) { + throw new ServiceException("项目计划关联的需求规格不存在"); + } + if (productReqStatus.getKey().equals(pmsProductRequirement.getStatus())) { + return; + } + if (ProductReqStatus.COMPLETED_REQ_SPECS.getKey().equals(productReqStatus.getKey())) { + if (ProductReqStatus.CHANGING_REQ_SPECS.getKey().equals(pmsProductRequirement.getStatus())) { + throw new ServiceException("需求规格变更中,项目计划不能调整为已完成或已关闭状态"); + } + } + pmsProductRequirement.setStatus(productReqStatus.getKey()); + updateRequirement(pmsProductRequirement, pmsProductRequirement.getPmsProductIdentifier()); + } + private ProductReqSpecsDetailVo toProductReqSpecsDetailVo(PmsProductRequirement pmsProductRequirement) { ProductReqSpecsDataVo productReqSpecsDataVo = toProductReqSpecsDataVo(pmsProductRequirement, null); ProductReqSpecsDetailVo productReqSpecsDetailVo = productReqSpecsDataVo.toProductReqSpecsDetailVo(); diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/controller/PmsProjectIssuesController.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/controller/PmsProjectIssuesController.java index 61ec32a12..c7aac46a6 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/controller/PmsProjectIssuesController.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/controller/PmsProjectIssuesController.java @@ -2,6 +2,7 @@ package com.microservices.pms.project.controller; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.microservices.common.core.exception.ServiceException; import com.microservices.common.core.web.controller.BaseController; import com.microservices.common.core.web.domain.AjaxResult; import com.microservices.common.core.web.page.GenericsTableDataInfo; @@ -10,6 +11,7 @@ import com.microservices.common.security.annotation.RequiresPermissions; import com.microservices.pms.project.domain.vo.*; import com.microservices.pms.project.service.IPmsProjectTestsheetIssuesService; import com.microservices.pms.project.service.PmsProjectIssuesService; +import com.microservices.pms.utils.PmsConstants; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -30,7 +32,7 @@ import javax.servlet.http.HttpServletResponse; @ApiImplicitParams({ @ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String") }) -public class PmsProjectIssuesController extends BaseController { +public class PmsProjectIssuesController extends BaseController { @Autowired private PmsProjectIssuesService pmsProjectIssuesService; @@ -44,8 +46,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe", "pms:pmsProjectTestsheet:edit"}, logical = Logical.OR) @GetMapping("/list") @ApiOperation(value = "项目工作项列表") - public AjaxResult list(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) - { + public AjaxResult list(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) { JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo); return success(result); } @@ -56,8 +57,11 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions("pms:pmsProjectIssues:add") @PostMapping("/add") @ApiOperation(value = "新增项目工作项") - public AjaxResult add(@RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo) - { + public AjaxResult add(@RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo) { + if (PmsConstants.PROJECT_ISSUE_TYPE_REQUIREMENT.equals(String.valueOf(pmsProjectIssuesInputVo.getPmIssueType())) + && pmsProjectIssuesInputVo.getRootId() == null) { + throw new ServiceException("项目计划仅能基于产品需求规格创建"); + } JSONObject result = pmsProjectIssuesService.insertPmsProjectIssues(pmsProjectIssuesInputVo); return success(result); } @@ -68,8 +72,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions("pms:pmsProjectIssues:edit") @PostMapping("/edit/{id}") @ApiOperation(value = "编辑项目工作项") - public AjaxResult edit(@PathVariable("id") Long id, @RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo) - { + public AjaxResult edit(@PathVariable("id") Long id, @RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo) { JSONObject result = pmsProjectIssuesService.updatePmsProjectIssues(id, pmsProjectIssuesInputVo); return success(result); } @@ -80,10 +83,8 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions("pms:pmsProjectIssues:edit") @PutMapping("/edit/batch") @ApiOperation(value = "批量修改项目工作项") - public AjaxResult batchUpdate(@ApiParam( "项目Id") @RequestParam(name= "pmProjectId") Long pmProjectId, - @RequestBody PmsProjectIssuesBatchUpdateVo pmsProjectIssuesUpdateVo) - { - + public AjaxResult batchUpdate(@ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId, + @RequestBody PmsProjectIssuesBatchUpdateVo pmsProjectIssuesUpdateVo) { JSONObject result = pmsProjectIssuesService.batchUpdatePmsProjectIssues(pmProjectId, pmsProjectIssuesUpdateVo); return success(result); } @@ -93,8 +94,7 @@ public class PmsProjectIssuesController extends BaseController { */ @RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR) @GetMapping("/{id}") - public AjaxResult query(@PathVariable("id") Long id, @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId) - { + public AjaxResult query(@PathVariable("id") Long id, @ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId) { JSONObject result = pmsProjectIssuesService.selectPmsProjectIssueById(id, pmProjectId); return success(result); @@ -105,9 +105,7 @@ public class PmsProjectIssuesController extends BaseController { */ @RequiresPermissions("pms:pmsProjectIssues:remove") @DeleteMapping("/{ids}") - public AjaxResult remove(@ApiParam( "工作项id数组,为-1时删除全部")@PathVariable Long[] ids, @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId) - { - + public AjaxResult remove(@ApiParam("工作项id数组,为-1时删除全部") @PathVariable Long[] ids, @ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId) { JSONObject result = pmsProjectIssuesService.deletePmsProjectIssueByIds(ids, pmProjectId); return success(result); } @@ -118,8 +116,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR) @GetMapping("/issueStatus") @ApiOperation(value = "查询项目工作项状态列表") - public AjaxResult issueStatus() - { + public AjaxResult issueStatus() { JSONObject result = pmsProjectIssuesService.selectPmsProjectIssueStatus(); return success(result); @@ -131,8 +128,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR) @GetMapping("/issuePriorities") @ApiOperation(value = "查询项目工作项优先级列表") - public AjaxResult issuePriorities() - { + public AjaxResult issuePriorities() { JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuePriorities(); return success(result); @@ -145,8 +141,7 @@ public class PmsProjectIssuesController extends BaseController { @GetMapping("/issueTags") @ApiOperation(value = "查询初始的项目工作项标记列表") public AjaxResult issueTags(@ApiParam(name = "pmProjectId", value = "项目Id") Long pmProjectId, - @ApiParam(name = "repositoryId", value = "仓库") Long repositoryId) - { + @ApiParam(name = "repositoryId", value = "仓库") Long repositoryId) { JSONObject result = pmsProjectIssuesService.selectPmsProjectIssueTags(pmProjectId, repositoryId); return success(result); @@ -158,8 +153,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe", "pms:pmsProjectIssuesTag:manage"}, logical = Logical.OR) @GetMapping("/enterpriseIssueTags") @ApiOperation(value = "查询企业下项目工作项标记列表") - public AjaxResult getEnterpriseIssueTags(PmsEnterpriseIssueTagsSearchVo pmsEnterpriseIssueTagsSearchVo) - { + public AjaxResult getEnterpriseIssueTags(PmsEnterpriseIssueTagsSearchVo pmsEnterpriseIssueTagsSearchVo) { JSONObject result = pmsProjectIssuesService.selectPmsEnterpriseIssueTags(pmsEnterpriseIssueTagsSearchVo); return success(result); @@ -171,8 +165,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions("pms:pmsProjectIssuesTag:manage") @PostMapping("/enterpriseIssueTags") @ApiOperation(value = "创建企业下项目工作项标记") - public AjaxResult createEnterpriseIssueTag(@RequestBody PmsEnterpriseIssueTagInputVo pmsEnterpriseIssueTagInputVo) - { + public AjaxResult createEnterpriseIssueTag(@RequestBody PmsEnterpriseIssueTagInputVo pmsEnterpriseIssueTagInputVo) { JSONObject result = pmsProjectIssuesService.createPmsEnterpriseIssueTag(pmsEnterpriseIssueTagInputVo); return success(result); @@ -184,8 +177,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions("pms:pmsProjectIssuesTag:manage") @PutMapping("/enterpriseIssueTags/{tagId}") @ApiOperation(value = "更新企业下项目工作项标记") - public AjaxResult editEnterpriseIssueTag(@PathVariable("tagId") Long tagId, @RequestBody PmsEnterpriseIssueTagUpdateVo pmsEnterpriseIssueTagUpdateVo) - { + public AjaxResult editEnterpriseIssueTag(@PathVariable("tagId") Long tagId, @RequestBody PmsEnterpriseIssueTagUpdateVo pmsEnterpriseIssueTagUpdateVo) { JSONObject result = pmsProjectIssuesService.editPmsEnterpriseIssueTag(tagId, pmsEnterpriseIssueTagUpdateVo); return success(result); @@ -197,8 +189,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions("pms:pmsProjectIssuesTag:manage") @DeleteMapping("/enterpriseIssueTags/{tagId}") @ApiOperation(value = "删除企业下项目工作项标记") - public AjaxResult deleteEnterpriseIssueTag(@PathVariable("tagId") Long tagId) - { + public AjaxResult deleteEnterpriseIssueTag(@PathVariable("tagId") Long tagId) { JSONObject result = pmsProjectIssuesService.deletePmsEnterpriseIssueTag(tagId); return success(result); @@ -210,8 +201,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR) @GetMapping("{repositoryId}/repoBranches") @ApiOperation(value = "查询仓库下分支列表") - public AjaxResult repoBranches(@PathVariable Long repositoryId) - { + public AjaxResult repoBranches(@PathVariable Long repositoryId) { JSONArray result = pmsProjectIssuesService.selectPmsProjectRepoBranches(repositoryId); return success(result); @@ -223,8 +213,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProjectIssues:edit", "pms:pmsProjectIssues:add"}, logical = Logical.OR) @PostMapping("/attachments") @ApiOperation(value = "上传工作项中的附件") - public AjaxResult uploadAttachments(@RequestPart("file") MultipartFile file) - { + public AjaxResult uploadAttachments(@RequestPart("file") MultipartFile file) { JSONObject result = pmsProjectIssuesService.uploadAttachment(file); return success(result); } @@ -235,8 +224,7 @@ public class PmsProjectIssuesController extends BaseController { @RequiresPermissions(value = {"pms:pmsProjectIssues:edit", "pms:pmsProjectIssues:add", "pms:pmsProjectIssues:remove"}, logical = Logical.OR) @DeleteMapping("/attachments/{id}") @ApiOperation(value = "删除工作项中的附件") - public AjaxResult deleteAttachments(@PathVariable Long id) - { + public AjaxResult deleteAttachments(@PathVariable Long id) { JSONObject result = pmsProjectIssuesService.deleteAttachment(id); return success(result); @@ -249,8 +237,7 @@ public class PmsProjectIssuesController extends BaseController { @PostMapping("/link/{issueId}") @ApiOperation(value = "添加项目工作项关联") public AjaxResult addIssueLinks(@ApiParam("工作项id") @PathVariable Long issueId, - @RequestBody PmsProjectIssuesLinkVo pmsProjectIssuesLinkVo) - { + @RequestBody PmsProjectIssuesLinkVo pmsProjectIssuesLinkVo) { JSONObject result = pmsProjectIssuesService.addPmsProjectIssueLink(issueId, pmsProjectIssuesLinkVo); return success(result); @@ -263,8 +250,7 @@ public class PmsProjectIssuesController extends BaseController { @GetMapping("/link/{issueId}") @ApiOperation(value = "查看项目工作项关联") public AjaxResult getIssueLinks(@ApiParam("工作项id") @PathVariable Long issueId, - @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId) - { + @ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId) { JSONObject result = pmsProjectIssuesService.getPmsProjectIssueLink(issueId, pmProjectId); return success(result); @@ -294,12 +280,12 @@ public class PmsProjectIssuesController extends BaseController { @GetMapping("/optionalParentIssue/{issueId}") @ApiOperation(value = "可选择的父工作项列表") public AjaxResult getOptionalParentIssueList( - @ApiParam("页码") Integer pageNum, - @ApiParam("页数") Integer pageSize, - @ApiParam("工作项id") @PathVariable Long issueId, - @ApiParam("需求1 任务2 缺陷3") @RequestParam(name = "pmIssueType") String pmIssueType, - @ApiParam("项目id") @RequestParam(name = "pmProjectId") String pmProjectId, - @ApiParam("搜索关键词") @RequestParam(name = "keyword", required = false) String keyword + @ApiParam("页码") Integer pageNum, + @ApiParam("页数") Integer pageSize, + @ApiParam("工作项id") @PathVariable Long issueId, + @ApiParam("需求1 任务2 缺陷3") @RequestParam(name = "pmIssueType") String pmIssueType, + @ApiParam("项目id") @RequestParam(name = "pmProjectId") String pmProjectId, + @ApiParam("搜索关键词") @RequestParam(name = "keyword", required = false) String keyword ) { @@ -315,8 +301,7 @@ public class PmsProjectIssuesController extends BaseController { @ApiOperation(value = "删除项目工作项关联") public AjaxResult removeIssueLinks(@ApiParam("当前工作项id") @PathVariable Long issueId, @ApiParam("关联工作项id") @PathVariable String linkIssueId, - @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId) - { + @ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId) { JSONObject result = pmsProjectIssuesService.deletePmsProjectIssueLink(issueId, linkIssueId, pmProjectId); return success(result); @@ -328,8 +313,7 @@ public class PmsProjectIssuesController extends BaseController { @PostMapping("/journals/{issueId}") @ApiOperation(value = "新增工作项评论") public AjaxResult addJournals(@ApiParam("工作项id") @PathVariable Long issueId, - @RequestBody PmsProjectIssueJournalInputVo pmsProjectIssueJournalInputVo) - { + @RequestBody PmsProjectIssueJournalInputVo pmsProjectIssueJournalInputVo) { JSONObject result = pmsProjectIssuesService.addPmsProjectIssueJournals(issueId, pmsProjectIssueJournalInputVo); return success(result); } @@ -341,10 +325,9 @@ public class PmsProjectIssuesController extends BaseController { @ApiOperation(value = "删除工作项评论") public AjaxResult removeJournals(@ApiParam("工作项id") @PathVariable Long issueId, @ApiParam("评论id") @PathVariable Long journalId, - @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId, - @ApiParam( "工作项关联的仓库id")@RequestParam(name = "pmProjectRepositoryId", required = false) Long pmProjectRepositoryId - ) - { + @ApiParam("项目Id") @RequestParam(name = "pmProjectId") Long pmProjectId, + @ApiParam("工作项关联的仓库id") @RequestParam(name = "pmProjectRepositoryId", required = false) Long pmProjectRepositoryId + ) { JSONObject result = pmsProjectIssuesService.removePmsProjectIssueJournals(issueId, journalId, pmProjectId, pmProjectRepositoryId); return success(result); } diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/domain/vo/PmsProjectIssuesInputVo.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/domain/vo/PmsProjectIssuesInputVo.java index 1ccf17954..e77fa6172 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/domain/vo/PmsProjectIssuesInputVo.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/domain/vo/PmsProjectIssuesInputVo.java @@ -1,5 +1,7 @@ package com.microservices.pms.project.domain.vo; +import com.alibaba.fastjson2.JSONObject; +import com.microservices.common.core.utils.StringUtils; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -70,4 +72,14 @@ public class PmsProjectIssuesInputVo { @ApiModelProperty(value = "关联工作项id") private Long linkAbleId; + + public boolean isChangeContent(JSONObject issueJson) { + if (StringUtils.isNotEmpty(subject) && !issueJson.getString("subject").equals(subject)) { + return true; + } + if (StringUtils.isNotEmpty(description) && !issueJson.getString("description").equals(description)) { + return true; + } + return attachmentIds != null; + } } diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsProjectIssuesService.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsProjectIssuesService.java index 1927c29f0..203dcce95 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsProjectIssuesService.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsProjectIssuesService.java @@ -9,6 +9,9 @@ import com.microservices.common.security.utils.SecurityUtils; import com.microservices.pms.common.service.IPmsCommonService; import com.microservices.pms.enterprise.domain.PmsEnterprise; 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.PmsProject; import com.microservices.pms.project.domain.SimpleRepository; import com.microservices.pms.project.domain.vo.*; @@ -23,6 +26,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; @@ -53,6 +57,10 @@ public class PmsProjectIssuesService { @Lazy private IPmsProjectService pmsProjectService; + @Autowired + @Lazy + private IPmsProductRequirementService pmsProductRequirementService; + @Autowired @Lazy private IPmsProjectTestsheetIssuesService pmsProjectTestsheetIssuesService; @@ -95,6 +103,7 @@ public class PmsProjectIssuesService { return gitLinkRequestHelper.doPost(PmsGitLinkRequestUrl.CREATE_ISSUE(), issueInput); } + @Transactional(rollbackFor = Exception.class) public JSONObject updatePmsProjectIssues(Long id, PmsProjectIssuesInputVo pmsProjectIssuesInputVo) { pmsProjectService.selectAndCheckPmsProjectById(pmsProjectIssuesInputVo.getPmProjectId()); JSONObject updatedIssue; @@ -102,6 +111,35 @@ public class PmsProjectIssuesService { updatedIssue = gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE(id, pmsProjectIssuesInputVo.getPmProjectId())); } catch (URISyntaxException e) { throw new RuntimeException(e); + } + // 项目计划不允许编辑标题、正文和附件 + if (PmsConstants.PROJECT_ISSUE_TYPE_REQUIREMENT.equals(updatedIssue.getString("pm_issue_type")) + && updatedIssue.getString("root_id") == null) { + if (pmsProjectIssuesInputVo.isChangeContent(updatedIssue)) { + throw new ServiceException("项目计划不允许编辑标题、正文和附件"); + } + if (ProjectIssueStatus.REFUSE.getId().equals(pmsProjectIssuesInputVo.getStatusId()) + || ProjectIssueStatus.NEW.getId().equals(pmsProjectIssuesInputVo.getStatusId())) { + throw new ServiceException("项目计划状态值选择错误"); + } + + // 如果状态发生变更,需同步产品需规的状态变更 + if (pmsProjectIssuesInputVo.getStatusId() != null) { + JSONObject statusJson = updatedIssue.getJSONObject("status"); + if (!statusJson.getString("id").equals(String.valueOf(pmsProjectIssuesInputVo.getStatusId()))) { + // 项目计划修改为进行中将需规调整为已计划 + if (ProjectIssueStatus.RESOLVING.getId().equals(pmsProjectIssuesInputVo.getStatusId())) { + pmsProductRequirementService.updateReqSpecsStatusByProjectReqId(id, ProductReqStatus.PLANNED_REQ_SPECS); + } + // 项目计划修改为已完成或已关闭将需规调整为已完成 + if (ProjectIssueStatus.RESOLVED.getId().equals(pmsProjectIssuesInputVo.getStatusId()) + || ProjectIssueStatus.CLOSE.getId().equals(pmsProjectIssuesInputVo.getStatusId())) { + pmsProductRequirementService.updateReqSpecsStatusByProjectReqId(id, ProductReqStatus.COMPLETED_REQ_SPECS); + } + } + } + + } if (PmsConstants.PROJECT_ISSUE_TYPE_WEEKLY_REPORT.equals(updatedIssue.getString("pm_issue_type")) && updatedIssue.getString("root_id") != null diff --git a/microservices-modules/microservices-modules-pms/src/main/resources/mapper/pms/PmsProductRequirementMapper.xml b/microservices-modules/microservices-modules-pms/src/main/resources/mapper/pms/PmsProductRequirementMapper.xml index 80876e48c..d911cef96 100644 --- a/microservices-modules/microservices-modules-pms/src/main/resources/mapper/pms/PmsProductRequirementMapper.xml +++ b/microservices-modules/microservices-modules-pms/src/main/resources/mapper/pms/PmsProductRequirementMapper.xml @@ -237,6 +237,12 @@ from pms_product_requirement where identifier = #{identifier} +