feat(项目管理产品需求重构): 完善产品需求规格逻辑
产品需求模块增加固定模块 Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
parent
248aa2cb6c
commit
f3ce62e437
|
|
@ -108,4 +108,15 @@ public class PmsProductModuleController extends BaseController
|
|||
{
|
||||
return toAjax(pmsProductModuleService.deletePmsProductModuleById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化固定模块
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductModule:manage")
|
||||
@Log(title = "产品模块", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{productIdentifier}/initModule")
|
||||
@ApiOperation(value = "初始化固定模块")
|
||||
public AjaxResult initProductModule(@PathVariable String productIdentifier) {
|
||||
return toAjax(pmsProductModuleService.initProductModule(productIdentifier));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ public class PmsProductModule extends BaseEntity
|
|||
@ApiModelProperty(value = "关联项目ID")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Long pmsProjectId;
|
||||
|
||||
@ApiModelProperty(value = "是否为固定模块")
|
||||
private Boolean isFixedModule;
|
||||
/**
|
||||
* 子模块
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -31,4 +31,7 @@ public class PmsProductModuleDataVo
|
|||
/** 关联产品ID */
|
||||
@ApiModelProperty(value = "关联产品ID")
|
||||
private String pmsProductIdentifier;
|
||||
|
||||
@ApiModelProperty(value = "是否为固定模块")
|
||||
private Boolean isFixedModule;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,10 @@ public interface IPmsProductModuleService
|
|||
/**
|
||||
* 同步产品模块到测试用例模块
|
||||
*
|
||||
* @param testcaseId 测试用例ID
|
||||
* @param projectId 测试用例ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean syncByProductModule(Long projectId);
|
||||
|
||||
int initProductModule(String productIdentifier);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ import org.springframework.context.annotation.Lazy;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -129,14 +132,16 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
|
|||
}
|
||||
checkParentModule(pmsProductModule, name);
|
||||
checkNameDuplicates(pmsProductModule);
|
||||
String currentUsername = SecurityUtils.getUsername();
|
||||
Date now = DateUtils.getNowDate();
|
||||
pmsProductModule.setCreateBy(currentUsername);
|
||||
pmsProductModule.setCreateTime(now);
|
||||
pmsProductModuleMapper.insertPmsProductModule(pmsProductModule);
|
||||
insertModuleDatabase(pmsProductModule);
|
||||
return pmsProductModule.getId();
|
||||
}
|
||||
|
||||
private int insertModuleDatabase(PmsProductModule pmsProductModule) {
|
||||
pmsProductModule.setCreateBy(SecurityUtils.getUsername());
|
||||
pmsProductModule.setCreateTime(DateUtils.getNowDate());
|
||||
return pmsProductModuleMapper.insertPmsProductModule(pmsProductModule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验父模块是否正确
|
||||
*/
|
||||
|
|
@ -383,6 +388,45 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int initProductModule(String productIdentifier) {
|
||||
PmsProduct pmsProduct = pmsProductService.selectPmsProductByIdentifier(productIdentifier);
|
||||
PmsProductModule pmsProductModule = new PmsProductModule();
|
||||
pmsProductModule.setPmsProductIdentifier(pmsProduct.getProductIdentifier());
|
||||
pmsProductModule.setIsFixedModule(true);
|
||||
pmsProductModule.setType(PmsConstants.PRODUCT_TAG_AND_MODULE_TYPE);
|
||||
|
||||
int success = 0;
|
||||
|
||||
pmsProductModule.setModuleName("质量需求");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setParentId(pmsProductModule.getId());
|
||||
pmsProductModule.setModuleName("适应性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("保密性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("安全性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("环境适应性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("可靠性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("可维护性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("可测试性");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
|
||||
pmsProductModule.setParentId(null);
|
||||
pmsProductModule.setModuleName("计算机资源需求");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setParentId(pmsProductModule.getId());
|
||||
pmsProductModule.setModuleName("硬件资源需求");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
pmsProductModule.setModuleName("软件资源需求");
|
||||
success += insertModuleDatabase(pmsProductModule);
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过递归复制树
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="requirementCount" column="requirementCount" />
|
||||
<result property="type" column="type"/>
|
||||
<result property="pmsProjectId" column="pms_project_id"/>
|
||||
<result property="isFixedModule" column="is_fixed_module"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPmsProductModuleVo">
|
||||
|
|
@ -32,7 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
create_by,
|
||||
del_flag,
|
||||
type,
|
||||
pms_project_id
|
||||
pms_project_id,
|
||||
is_fixed_module
|
||||
from pms_product_module
|
||||
</sql>
|
||||
|
||||
|
|
@ -49,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
, m.del_flag
|
||||
, m.type
|
||||
, m.pms_project_id
|
||||
, m.is_fixed_module
|
||||
,(
|
||||
SELECT COUNT(*)
|
||||
FROM pms_product_requirement r
|
||||
|
|
@ -203,6 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="pmsProjectId != null">pms_project_id,</if>
|
||||
<if test="isFixedModule != null">is_fixed_module,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
|
||||
|
|
@ -216,6 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="pmsProjectId != null">#{pmsProjectId},</if>
|
||||
<if test="isFixedModule != null">#{isFixedModule},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -233,6 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="pmsProjectId != null">pms_project_id = #{pmsProjectId},</if>
|
||||
<if test="isFixedModule != null">is_fixed_module = #{isFixedModule},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
Loading…
Reference in New Issue