Compare commits

...

6 Commits

Author SHA1 Message Date
wanjia 8daf024236 cache key update 2024-12-27 09:06:45 +08:00
wanjia 45801b637a cache key update 2024-12-27 09:03:43 +08:00
wanjia eedc7f9e4e cache key update 2024-12-26 16:10:06 +08:00
wanjia 61fd85c5e9 enterprises:tmp cache 2024-12-26 15:51:46 +08:00
wanjia 438e1e6de8 tmp cache 2024-12-26 15:00:18 +08:00
wanjia c49eff7cac tmp cache 2024-12-26 14:31:41 +08:00
40 changed files with 214 additions and 60 deletions

View File

@ -2,9 +2,13 @@ package com.microservices.pms.common.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.service.IRequestCustomService;
import com.microservices.pms.document.domain.vo.PmsDocumentVo;
import com.microservices.pms.enterprise.domain.PmsEnterprise;
import com.microservices.pms.enterprise.mapper.PmsEnterpriseMapper;
import com.microservices.pms.utils.PmsUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
@ -12,6 +16,10 @@ import org.springframework.web.servlet.HandlerMapping;
import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.TimeUnit;
import static com.microservices.pms.utils.PmsConstants.ENTERPRISE_INFO_PREFIX;
/**
* @author otto
*/
@ -20,6 +28,8 @@ import javax.servlet.http.HttpServletRequest;
public class PmsRequestCustomServiceImpl implements IRequestCustomService {
@Autowired
private PmsEnterpriseMapper pmsEnterpriseMapper;
@Autowired
private RedisService redisService;
@Override
public String processRequestDeptId(HttpServletRequest request) {
Object attributeObj = request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
@ -28,8 +38,15 @@ public class PmsRequestCustomServiceImpl implements IRequestCustomService {
if (StringUtils.isEmpty(enterpriseIdentifier)) {
return null;
}
PmsEnterprise pmsEnterprise
= pmsEnterpriseMapper.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
PmsEnterprise pmsEnterprise = new PmsEnterprise();
String enterpriseCacheKey = ENTERPRISE_INFO_PREFIX + enterpriseIdentifier;
if (redisService.hasKey(enterpriseCacheKey)) {
pmsEnterprise = (PmsEnterprise) redisService.getCacheObject(enterpriseCacheKey);
} else {
pmsEnterprise
= pmsEnterpriseMapper.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
redisService.setCacheObject(enterpriseCacheKey, pmsEnterprise, 1L, TimeUnit.HOURS);
}
if (pmsEnterprise == null) {
return null;
}

View File

@ -110,8 +110,8 @@ public class PmsDashboardController extends BaseController {
@ApiOperation(value = "我的项目")
@GetMapping("/myProjects")
@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "当前记录起始索引", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "orderByColumn", value = "排序列更新时间updateTime创建时间createTime", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")})
public GenericsTableDataInfo<PmsProjectDetailVo> myProjects(PmsProjectSearchVo pmsProjectSearchVo) {
return pmsProjectService.selectPmsProjectList(pmsProjectSearchVo);
public GenericsTableDataInfo<PmsProjectDetailVo> myProjects(@PathVariable String enterpriseIdentifier, PmsProjectSearchVo pmsProjectSearchVo) {
return pmsProjectService.selectPmsProjectList(pmsProjectSearchVo, enterpriseIdentifier);
}
/**
@ -178,7 +178,7 @@ public class PmsDashboardController extends BaseController {
startPage();
pmsProductSearchVo.setPmsEnterpriseIdentifier(enterpriseIdentifier);
//获取组织下所有的产品信息
GenericsTableDataInfo<PmsProductDataVo> productsInfo = pmsProductService.selectPmsProductPageList(pmsProductSearchVo);
GenericsTableDataInfo<PmsProductDataVo> productsInfo = pmsProductService.selectPmsProductPageList(pmsProductSearchVo, enterpriseIdentifier);
List<PmsProductDataVo> rows = productsInfo.getRows();
// 统计需求数量

View File

@ -46,9 +46,9 @@ public class PmsDocumentController extends BaseController
@ApiImplicitParam(name = "orderByColumn", value = "排序列更新时间updateTime创建时间createTime", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
})
public GenericsTableDataInfo<PmsDocumentVo> list( @Validated PmsDocumentSearchVo pmsDocumentSearchVo)
public GenericsTableDataInfo<PmsDocumentVo> list(@PathVariable String enterpriseIdentifier, @Validated PmsDocumentSearchVo pmsDocumentSearchVo)
{
return pmsDocumentService.selectPmsDocumentVoList(pmsDocumentSearchVo);
return pmsDocumentService.selectPmsDocumentVoList(pmsDocumentSearchVo, enterpriseIdentifier);
}
/**

View File

@ -56,4 +56,7 @@ public class PmsDocumentSearchVo extends BaseEntity
@JsonIgnore
@ApiModelProperty(value = "当前用户名", hidden = true)
private String currentUserName;
private Integer pageNum;
private Integer pageSize;
}

View File

@ -43,7 +43,7 @@ public interface IPmsDocumentService
/**
* 查询项目管理-文档库列表
*/
GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentVoList(PmsDocumentSearchVo pmsDocumentSearchVo);
GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentVoList(PmsDocumentSearchVo pmsDocumentSearchVo, String enterpriseIdentifier);
/**
* 新增项目管理-文档库

View File

@ -8,6 +8,7 @@ import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.web.page.Breadcrumb;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.common.service.IPmsCommonService;
import com.microservices.pms.document.domain.PmsDocument;
@ -21,6 +22,7 @@ import com.microservices.pms.enums.PmsDocumentType;
import com.microservices.pms.project.mapper.PmsProjectRepositoryMapper;
import com.microservices.pms.project.service.IPmsProjectService;
import com.microservices.pms.utils.PmsGitLinkRequestUrl;
import com.microservices.pms.utils.PmsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.net.URISyntaxException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.microservices.common.core.utils.PageUtils.startPage;
@ -67,6 +70,9 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
@Autowired
private IPmsProjectService pmsProjectService;
@Autowired
private RedisService redisService;
/**
* 查询项目管理-文档库
*
@ -109,7 +115,11 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
}
@Override
public GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentVoList(PmsDocumentSearchVo pmsDocumentSearchVo) {
public GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentVoList(PmsDocumentSearchVo pmsDocumentSearchVo, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(pmsDocumentSearchVo, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (GenericsTableDataInfo<PmsDocumentVo>) redisService.getCacheObject(searchCacheKey);
}
String currentUserName = SecurityUtils.getUsername();
boolean isEnterpriseAdmin = checkAuthAndReturnAdminStatus(pmsDocumentSearchVo.getPmsEnterpriseId());
pmsDocumentSearchVo.setEnterpriseAdmin(isEnterpriseAdmin);
@ -122,6 +132,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
List<Breadcrumb> breadcrumbs = buildBreadcrumbs(pmsDocumentSearchVo.getParentId());
page.setBreadcrumb(breadcrumbs);
}
redisService.setCacheObject(searchCacheKey, page, 1L, TimeUnit.HOURS);
return page;
}

View File

@ -46,7 +46,7 @@ public class PmsProductController extends BaseController {
@Validated PmsProductSearchVo pmsProductSearchVo) {
startPage();
pmsProductSearchVo.setPmsEnterpriseIdentifier(enterpriseIdentifier);
return pmsProductService.selectPmsProductPageList(pmsProductSearchVo);
return pmsProductService.selectPmsProductPageList(pmsProductSearchVo, enterpriseIdentifier);
}
/**

View File

@ -48,8 +48,8 @@ public class PmsProductPlanController extends BaseController {
@ApiImplicitParam(name = "orderByColumn", value = "排序列开始时间startTime结束时间endTime产品需求数productRequirementCount优先级priorityId", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
})
public GenericsTableDataInfo<PmsProductPlanDataVo> list(@Validated PmsProductPlanSearchVo pmsProductPlanSearchVo) {
return pmsProductPlanService.selectPmsProductPlanList(pmsProductPlanSearchVo.toPmsProductPlan());
public GenericsTableDataInfo<PmsProductPlanDataVo> list(@PathVariable String enterpriseIdentifier,@Validated PmsProductPlanSearchVo pmsProductPlanSearchVo) {
return pmsProductPlanService.selectPmsProductPlanList(pmsProductPlanSearchVo.toPmsProductPlan(), enterpriseIdentifier);
}
/**

View File

@ -41,7 +41,7 @@ public class ProductReqSpecsController extends BaseController {
@RequiresPermissions("pms:pmsProduct:show")
@GetMapping("/list")
public GenericsTableDataInfo<ProductReqSpecsDataVo> list(@PathVariable String enterpriseIdentifier, @Validated ProductReqSpecsSearchVo productReqSpecsSearchVo) {
return pmsProductRequirementService.selectReqSpecsList(productReqSpecsSearchVo);
return pmsProductRequirementService.selectReqSpecsList(productReqSpecsSearchVo, enterpriseIdentifier);
}
/**

View File

@ -82,6 +82,9 @@ public class PmsProductPlan extends BaseEntity
@ApiModelProperty(value = "产品需求数")
private Integer productRequirementCount;
private Integer pageNum;
private Integer pageSize;
public PmsProductPlanDataVo toPmsProductPlanDataVo(){
PmsProductPlanDataVo target = new PmsProductPlanDataVo();
BeanUtils.copyProperties(this, target);

View File

@ -26,4 +26,6 @@ public class PmsProductSearchVo extends BaseEntity
/** 是否根据更新时间降序排序 */
@ApiModelProperty(value = "是否根据更新时间降序排序")
private Boolean isDescByUpdateTime=true;
private Integer pageNum;
private Integer pageSize;
}

View File

@ -28,8 +28,8 @@ public class ProductReqSpecsDataVo {
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "需求状态")
private ReqStatusCommonVo status;
// @ApiModelProperty(value = "需求状态")
// private ReqStatusCommonVo status;
@ApiModelProperty(value = "产品需求类型")
private String type;

View File

@ -48,6 +48,9 @@ public class ProductReqSpecsSearchVo {
@ApiModelProperty(value = "创建人")
private String createBy;
private Integer pageNum;
private Integer pageSize;
/**
* 关联项目ID
*/

View File

@ -69,10 +69,12 @@ public interface IPmsProductModuleService
/**
* 查询模块及模块子级ID列表
* @param parentModuleId 父级模块ID
*
* @param parentModuleId 父级模块ID
* @param enterpriseIdentifier
* @return 模块ID列表
*/
List<Long> selectChildrenPmsProductModuleIdList(Long parentModuleId);
List<Long> selectChildrenPmsProductModuleIdList(Long parentModuleId, String enterpriseIdentifier);
/**
* 删除产品下所有模块

View File

@ -30,7 +30,7 @@ public interface IPmsProductPlanService
* @param pmsProductPlan 产品计划
* @return 产品计划集合
*/
public GenericsTableDataInfo<PmsProductPlanDataVo> selectPmsProductPlanList(PmsProductPlan pmsProductPlan);
public GenericsTableDataInfo<PmsProductPlanDataVo> selectPmsProductPlanList(PmsProductPlan pmsProductPlan, String enterpriseIdentifier);
/**
* 新增产品计划

View File

@ -96,7 +96,7 @@ public interface IPmsProductRequirementService
int reviewUserReq(ProductReqReviewVo productReqReviewVo);
GenericsTableDataInfo<ProductReqSpecsDataVo> selectReqSpecsList(ProductReqSpecsSearchVo productReqSpecsSearchVo);
GenericsTableDataInfo<ProductReqSpecsDataVo> selectReqSpecsList(ProductReqSpecsSearchVo productReqSpecsSearchVo, String enterpriseIdentifier);
ProductReqSpecsDetailVo selectReqSpecsDetailById(Long id);

View File

@ -30,7 +30,7 @@ public interface IPmsProductService
* @param pmsProduct 产品
* @return 产品集合
*/
public GenericsTableDataInfo<PmsProductDataVo> selectPmsProductPageList(PmsProductSearchVo pmsProduct);
public GenericsTableDataInfo<PmsProductDataVo> selectPmsProductPageList(PmsProductSearchVo pmsProduct, String enterpriseIdentifier);
/**
* 新增产品

View File

@ -5,6 +5,7 @@ import com.microservices.common.core.utils.DateUtils;
import com.microservices.common.core.utils.PageUtils;
import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.product.domain.PmsProduct;
import com.microservices.pms.product.domain.PmsProductModule;
@ -22,6 +23,7 @@ import com.microservices.pms.project.service.IPmsProjectService;
import com.microservices.pms.project.service.IPmsProjectTestcaseService;
import com.microservices.pms.project.service.IPmsProjectTestsheetCasesService;
import com.microservices.pms.utils.PmsConstants;
import com.microservices.pms.utils.PmsUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -31,6 +33,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -58,6 +61,8 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
@Autowired
@Lazy
private IPmsProjectTestsheetCasesService pmsProjectTestsheetCasesService;
@Autowired
private RedisService redisService;
private final static String NO_MODULE = "无所属模块";
private final static String ALL_MODULE = "全部模块";
@ -344,7 +349,12 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
}
@Override
public List<Long> selectChildrenPmsProductModuleIdList(Long parentModuleId) {
public List<Long> selectChildrenPmsProductModuleIdList(Long parentModuleId, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(parentModuleId, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (List<Long>) redisService.getCacheObject(searchCacheKey);
}
List<PmsProductModule> pmsProductModuleList=new ArrayList<>();
PmsProductModule parentModule = selectPmsProductModuleById(parentModuleId, false);
pmsProductModuleList.add(parentModule);
@ -368,7 +378,9 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
}
}
}
return pmsProductModuleList.stream().map(PmsProductModule::getId).collect(Collectors.toList());
List<Long> result = pmsProductModuleList.stream().map(PmsProductModule::getId).collect(Collectors.toList());
redisService.setCacheObject(searchCacheKey, result, 1L, TimeUnit.HOURS);
return result;
}
@Override

View File

@ -4,6 +4,7 @@ import com.microservices.common.core.exception.ServiceException;
import com.microservices.common.core.utils.DateUtils;
import com.microservices.common.core.utils.PageUtils;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.product.domain.PmsProduct;
import com.microservices.pms.product.domain.PmsProductPlan;
@ -21,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 产品计划Service业务层处理
@ -41,6 +43,8 @@ public class PmsProductPlanServiceImpl implements IPmsProductPlanService {
@Autowired
@Lazy
private IPmsProductRequirementService pmsProductRequirementService;
@Autowired
private RedisService redisService;
/**
* 查询产品计划
@ -69,12 +73,18 @@ public class PmsProductPlanServiceImpl implements IPmsProductPlanService {
* @return 产品计划
*/
@Override
public GenericsTableDataInfo<PmsProductPlanDataVo> selectPmsProductPlanList(PmsProductPlan pmsProductPlan) {
public GenericsTableDataInfo<PmsProductPlanDataVo> selectPmsProductPlanList(PmsProductPlan pmsProductPlan, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(pmsProductPlan, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (GenericsTableDataInfo<PmsProductPlanDataVo>) redisService.getCacheObject(searchCacheKey);
}
pmsProductService.selectPmsProductByIdentifier(pmsProductPlan.getPmsProductIdentifier());
HashMap<String, Object> selectCache = new HashMap<>();
PageUtils.startPage();
return PageUtils.toPage(pmsProductPlanMapper.selectPmsProductPlanList(pmsProductPlan), x -> toPmsProductPlanDataVo(x, selectCache));
GenericsTableDataInfo<PmsProductPlanDataVo> page = PageUtils.toPage(pmsProductPlanMapper.selectPmsProductPlanList(pmsProductPlan), x -> toPmsProductPlanDataVo(x, selectCache));
redisService.setCacheObject(searchCacheKey, page, 1L, TimeUnit.HOURS);
return page;
}
/**

View File

@ -8,6 +8,7 @@ import com.microservices.common.core.exception.ServiceException;
import com.microservices.common.core.utils.*;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.common.service.IPmsCommonService;
import com.microservices.pms.enterprise.domain.PmsEnterprise;
@ -36,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import static com.microservices.common.core.utils.PageUtils.startPage;
@ -77,6 +79,8 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
private RemoteFileService remoteFileService;
@Autowired
private GitLinkRequestHelper gitLinkRequestHelper;
@Autowired
private RedisService redisService;
@Override
public PmsProductRequirement selectPmsProductRequirementById(Long id, boolean checkRole) {
@ -380,10 +384,15 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
}
@Override
public GenericsTableDataInfo<ProductReqSpecsDataVo> selectReqSpecsList(ProductReqSpecsSearchVo productReqSpecsSearchVo) {
public GenericsTableDataInfo<ProductReqSpecsDataVo> selectReqSpecsList(ProductReqSpecsSearchVo productReqSpecsSearchVo, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(productReqSpecsSearchVo, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
GenericsTableDataInfo<ProductReqSpecsDataVo> page = (GenericsTableDataInfo<ProductReqSpecsDataVo>) redisService.getCacheObject(searchCacheKey);
return page;
}
pmsProductService.selectPmsProductByIdentifier(productReqSpecsSearchVo.getPmsProductIdentifier());
if (productReqSpecsSearchVo.getPmsProductModuleId() != null && productReqSpecsSearchVo.getPmsProductModuleId() != 0) {
List<Long> moduleIdList = pmsProductModuleService.selectChildrenPmsProductModuleIdList(productReqSpecsSearchVo.getPmsProductModuleId());
List<Long> moduleIdList = pmsProductModuleService.selectChildrenPmsProductModuleIdList(productReqSpecsSearchVo.getPmsProductModuleId(), enterpriseIdentifier);
productReqSpecsSearchVo.setChildrenModuleIdList(moduleIdList);
}
if (StringUtils.isNotEmpty(productReqSpecsSearchVo.getStatus())) {
@ -392,13 +401,15 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
startPage();
List<PmsProductRequirement> userReqList = pmsProductRequirementMapper.selectReqSpecsList(productReqSpecsSearchVo);
HashMap<String, Object> hashMap = new HashMap<>();
return PageUtils.toPage(userReqList, x -> toProductReqSpecsDataVo(x, hashMap));
GenericsTableDataInfo<ProductReqSpecsDataVo> page = PageUtils.toPage(userReqList, x -> toProductReqSpecsDataVo(x, hashMap));
redisService.setCacheObject(searchCacheKey, page, 1L, TimeUnit.HOURS);
return page;
}
private ProductReqSpecsDataVo toProductReqSpecsDataVo(PmsProductRequirement pmsProductRequirement, HashMap<String, Object> hashMap) {
ProductReqSpecsDataVo productReqSpecsDataVo = pmsProductRequirement.toProductReqSpecsDataVo();
// 设置状态
productReqSpecsDataVo.setStatus(ProductReqStatus.getTypeByKey(pmsProductRequirement.getStatus()));
// // 设置状态
// productReqSpecsDataVo.setStatus(ProductReqStatus.getTypeByKey(pmsProductRequirement.getStatus()));
// 设置产品模块
if (pmsProductRequirement.getPmsProductModuleId() != null) {

View File

@ -8,6 +8,7 @@ import com.microservices.common.core.utils.DateUtils;
import com.microservices.common.core.utils.PageUtils;
import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.common.service.IPmsCommonService;
import com.microservices.pms.enterprise.domain.PmsEnterprise;
@ -38,6 +39,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 产品Service业务层处理
@ -69,6 +71,9 @@ public class PmsProductServiceImpl implements IPmsProductService
@Lazy
private IPmsProjectService pmsProjectService;
@Autowired
private RedisService redisService;
/**
* 查询产品
*
@ -93,10 +98,16 @@ public class PmsProductServiceImpl implements IPmsProductService
* @return 产品
*/
@Override
public GenericsTableDataInfo<PmsProductDataVo> selectPmsProductPageList(PmsProductSearchVo pmsProduct)
public GenericsTableDataInfo<PmsProductDataVo> selectPmsProductPageList(PmsProductSearchVo pmsProduct, String enterpriseIdentifier)
{
String searchCacheKey = PmsUtils.generateCacheKey(pmsProduct, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (GenericsTableDataInfo<PmsProductDataVo>) redisService.getCacheObject(searchCacheKey);
}
HashMap<String, Object> selectCache = new HashMap<>();
return PageUtils.toPage(pmsProductMapper.selectPmsProductList(pmsProduct), x -> toPmsProductDataVo(x, selectCache));
GenericsTableDataInfo<PmsProductDataVo> pageList = PageUtils.toPage(pmsProductMapper.selectPmsProductList(pmsProduct), x -> toPmsProductDataVo(x, selectCache));
redisService.setCacheObject(searchCacheKey, pageList, 1L, TimeUnit.HOURS);
return pageList;
}
private PmsProductDataVo toPmsProductDataVo(PmsProduct pmsProduct, HashMap<String, Object> hashMap) {

View File

@ -257,7 +257,7 @@ public class PmsProductLibraryServiceImpl implements IPmsProductLibraryService {
public GenericsTableDataInfo<DocResultVo> selectDocList(DocSearchVo docSearchVo) {
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(docSearchVo.getEnterpriseIdentifier());
GenericsTableDataInfo<DocResultVo> docTableList = new GenericsTableDataInfo<>();
GenericsTableDataInfo<PmsDocumentVo> pmsDocList = pmsDocumentService.selectPmsDocumentVoList(docSearchVo.toPmsDocumentSearchVo(pmsEnterprise.getId()));
GenericsTableDataInfo<PmsDocumentVo> pmsDocList = pmsDocumentService.selectPmsDocumentVoList(docSearchVo.toPmsDocumentSearchVo(pmsEnterprise.getId()), docSearchVo.getEnterpriseIdentifier());
if (pmsDocList.getRows() != null && !pmsDocList.getRows().isEmpty()) {
PmsProductLibraryRepositories productRepo =
pmsProductLibraryRepositoriesService.getPmsProductLibraryRepositories(true, docSearchVo.getEnterpriseIdentifier(), docSearchVo.getProductRepoName(), null);

View File

@ -43,9 +43,9 @@ public class PmsProjectController extends BaseController
@ApiImplicitParam(name = "orderByColumn", value = "排序列更新时间updateTime创建时间createTime", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
})
public GenericsTableDataInfo<PmsProjectDetailVo> list(PmsProjectSearchVo pmsProjectSearchVo)
public GenericsTableDataInfo<PmsProjectDetailVo> list(@PathVariable String enterpriseIdentifier, PmsProjectSearchVo pmsProjectSearchVo)
{
return pmsProjectService.selectPmsProjectList(pmsProjectSearchVo);
return pmsProjectService.selectPmsProjectList(pmsProjectSearchVo, enterpriseIdentifier);
}
/**

View File

@ -46,8 +46,8 @@ 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) {
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo);
public AjaxResult list(@PathVariable String enterpriseIdentifier, PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo, enterpriseIdentifier);
return success(result);
}

View File

@ -50,13 +50,13 @@ public class PmsProjectTestcaseController extends BaseController {
@ApiImplicitParam(name = "orderByColumn", value = "排序列更新时间updateTime创建时间createTime", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
})
public GenericsTableDataInfo<PmsProjectTestcaseDataVo> list(@Validated PmsProjectTestcaseSearchVo pmsProjectTestcaseSearchVo) {
public GenericsTableDataInfo<PmsProjectTestcaseDataVo> list(@PathVariable String enterpriseIdentifier, @Validated PmsProjectTestcaseSearchVo pmsProjectTestcaseSearchVo) {
PmsProjectTestcase pmsProjectTestcase = pmsProjectTestcaseSearchVo.toPmsProjectTestcase();
if (pmsProjectTestcase.getPmsModuleId() != null && pmsProjectTestcase.getPmsModuleId() != 0) {
List<Long> moduleIdList = pmsProductModuleService.selectChildrenPmsProductModuleIdList(pmsProjectTestcase.getPmsModuleId());
List<Long> moduleIdList = pmsProductModuleService.selectChildrenPmsProductModuleIdList(pmsProjectTestcase.getPmsModuleId(), enterpriseIdentifier);
pmsProjectTestcase.setChildrenModuleIdList(moduleIdList);
}
return pmsProjectTestcaseService.selectPmsProjectTestcasePageList(pmsProjectTestcase);
return pmsProjectTestcaseService.selectPmsProjectTestcasePageList(pmsProjectTestcase, enterpriseIdentifier);
}
/**

View File

@ -48,9 +48,9 @@ public class PmsProjectTestsheetCasesController extends BaseController
@ApiImplicitParam(name = "orderByColumn", value = "排序列更新时间updateTime创建时间createTime", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
})
public GenericsTableDataInfo<PmsProjectTestsheetCaseVo> list(@Validated PmsProjectTestsheetCaseSearchVo searchVo)
public GenericsTableDataInfo<PmsProjectTestsheetCaseVo> list(@PathVariable String enterpriseIdentifier, @Validated PmsProjectTestsheetCaseSearchVo searchVo)
{
return pmsProjectTestsheetCasesService.selectPmsProjectTestsheetCasesList(searchVo);
return pmsProjectTestsheetCasesService.selectPmsProjectTestsheetCasesList(searchVo, enterpriseIdentifier);
}
/**

View File

@ -51,7 +51,7 @@ public class PmsProjectTestsheetIssuesController extends BaseController
@ApiOperation(value = "查询测试单执行用例关联缺陷列表")
@RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR)
@GetMapping("/list/{projectTestsheetCasesId}")
public AjaxResult list(@Validated PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo, @ApiParam("执行测试用例ID") @PathVariable Long projectTestsheetCasesId) {
public AjaxResult list(@PathVariable String enterpriseIdentifier, @Validated PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo, @ApiParam("执行测试用例ID") @PathVariable Long projectTestsheetCasesId) {
PmsProjectTestsheetIssues selectedIssueQuery= new PmsProjectTestsheetIssues();
selectedIssueQuery.setProjectTestsheetCasesId(projectTestsheetCasesId);
List<Long> selectedIds = Optional.ofNullable(pmsProjectTestsheetIssuesService.selectPmsProjectTestsheetIssuesList(selectedIssueQuery)).orElse(Collections.emptyList()).stream()
@ -60,7 +60,7 @@ public class PmsProjectTestsheetIssuesController extends BaseController
return success(new ArrayList<>());
}
pmsProjectIssuesSearchVo.setIds(StringUtils.join(selectedIds, ","));
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo);
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo, enterpriseIdentifier);
return success(result);
}
@ -94,7 +94,8 @@ public class PmsProjectTestsheetIssuesController extends BaseController
@RequiresPermissions(value = {"pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR)
@GetMapping("/unlink/{projectTestsheetCasesId}")
@ApiOperation(value = "查询与执行测试用例未关联缺陷")
public AjaxResult getIssueUnlinks(@Validated PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo,
public AjaxResult getIssueUnlinks(@PathVariable String enterpriseIdentifier,
@Validated PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo,
@ApiParam("执行测试用例ID") @PathVariable Long projectTestsheetCasesId,
@ApiParam("0:获取所有未被任何用例关联过的缺陷默认1:获取所有与当前用例未关联缺陷") Integer isAll) {
PmsProjectTestsheetIssues selectedIssueQuery= new PmsProjectTestsheetIssues();
@ -105,7 +106,7 @@ public class PmsProjectTestsheetIssuesController extends BaseController
selectedIds.addAll(pmsProjectTestsheetIssuesService.selectAllDistinctIssueId());
}
pmsProjectIssuesSearchVo.setExcludeIds(StringUtils.join(selectedIds, ","));
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo);
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo, enterpriseIdentifier);
return success(result);
}

View File

@ -35,9 +35,9 @@ public class PmsProjectWeeklyReportController {
*/
@GetMapping("/list")
@ApiOperation(value = "项目周报列表")
public AjaxResult list(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo)
public AjaxResult list(@PathVariable String enterpriseIdentifier, PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo)
{
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo);
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo, enterpriseIdentifier);
return success(result);
}

View File

@ -149,6 +149,9 @@ public class PmsProjectTestcase extends BaseEntity {
@ApiModelProperty(value = "产品需求规格id")
private Long productReqSpecsId;
private Integer pageNum;
private Integer pageSize;
public PmsProjectTestcaseDataVo toPmsProjectTestcaseDataVo() {
PmsProjectTestcaseDataVo target = new PmsProjectTestcaseDataVo();
BeanUtils.copyProperties(this, target);

View File

@ -24,4 +24,8 @@ public class PmsProjectSearchVo extends BaseEntity{
@ApiModelProperty(value = "产品id")
private Long pmsProductId;
private Integer pageNum;
private Integer pageSize;
private String enterpriseIdentifier;
}

View File

@ -55,6 +55,9 @@ public class PmsProjectTestcaseSearchVo {
@ApiModelProperty(value = "产品需求规格id")
private Long productReqSpecsId;
private Integer pageNum;
private Integer pageSize;
public PmsProjectTestcase toPmsProjectTestcase() {
PmsProjectTestcase target = new PmsProjectTestcase();
BeanUtils.copyProperties(this, target);

View File

@ -32,7 +32,7 @@ public interface IPmsProjectService
*/
List<PmsProject> selectPmsProjectList(PmsProject pmsProject);
GenericsTableDataInfo<PmsProjectDetailVo> selectPmsProjectList(PmsProjectSearchVo pmsProjectSearchVo);
GenericsTableDataInfo<PmsProjectDetailVo> selectPmsProjectList(PmsProjectSearchVo pmsProjectSearchVo, String enterpriseIdentifier);
/**
* 新增项目

View File

@ -30,7 +30,7 @@ public interface IPmsProjectTestcaseService {
* @param pmsProjectTestcase 测试用例管理
* @return 测试用例管理集合
*/
public GenericsTableDataInfo<PmsProjectTestcaseDataVo> selectPmsProjectTestcasePageList(PmsProjectTestcase pmsProjectTestcase);
public GenericsTableDataInfo<PmsProjectTestcaseDataVo> selectPmsProjectTestcasePageList(PmsProjectTestcase pmsProjectTestcase, String enterpriseIdentifier);
/**
* 新增测试用例管理

View File

@ -33,7 +33,7 @@ public interface IPmsProjectTestsheetCasesService
* @param pmsProjectTestsheetCases 测试单执行用例
* @return 测试单执行用例集合
*/
public List<PmsProjectTestsheetCases> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCases pmsProjectTestsheetCases);
public List<PmsProjectTestsheetCases> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCases pmsProjectTestsheetCases, String enterpriseIdentifier);
/**
* 查询测试单执行用例列表数量
@ -57,7 +57,7 @@ public interface IPmsProjectTestsheetCasesService
* @param searchVo 测试单执行用例
* @return 测试单执行用例集合
*/
public GenericsTableDataInfo<PmsProjectTestsheetCaseVo> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCaseSearchVo searchVo);
public GenericsTableDataInfo<PmsProjectTestsheetCaseVo> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCaseSearchVo searchVo, String enterpriseIdentifier);
/**
* 新增测试单执行用例

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.microservices.common.core.exception.ServiceException;
import com.microservices.common.core.utils.DateUtils;
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.common.service.IPmsCommonService;
import com.microservices.pms.dashboard.domain.vo.MyProjectIssuesSearchVo;
@ -34,6 +35,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.net.URISyntaxException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static com.microservices.common.core.utils.DateUtils.YYYY_MM_DD;
import static com.microservices.common.core.utils.JSONUtils.convertObjectToJSONObject;
@ -72,14 +74,22 @@ public class PmsProjectIssuesService {
@Autowired
private IPmsCommonService pmsCommonService;
@Autowired
private RedisService redisService;
public JSONObject selectPmsProjectIssuesList(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(pmsProjectIssuesSearchVo, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (JSONObject) redisService.getCacheObject(searchCacheKey);
}
public JSONObject selectPmsProjectIssuesList(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
pmsProjectService.selectAndCheckPmsProjectById(pmsProjectIssuesSearchVo.getPmProjectId());
JSONObject issueSearch = new JSONObject();
convertObjectToJSONObject(pmsProjectIssuesSearchVo, issueSearch, null);
try {
return setProjectIssueListUserState(gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE_LIST(issueSearch)));
JSONObject issueListResult = setProjectIssueListUserState(gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE_LIST(issueSearch)));
redisService.setCacheObject(searchCacheKey, issueListResult, 1L, TimeUnit.HOURS);
return issueListResult;
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}

View File

@ -10,6 +10,7 @@ import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
import com.microservices.common.redis.service.RedisService;
import com.microservices.pms.common.service.IPmsCommonService;
import com.microservices.pms.enterprise.domain.PmsEnterprise;
import com.microservices.pms.enterprise.service.IPmsEnterpriseService;
@ -44,6 +45,7 @@ import java.util.stream.Collectors;
import static com.microservices.common.core.utils.PageUtils.startPage;
import static com.microservices.common.core.utils.PageUtils.toPage;
import static com.microservices.common.httpClient.constant.GitLinkConstants.DATA_KEY;
import java.util.concurrent.TimeUnit;
/**
* 项目Service业务层处理
@ -96,6 +98,8 @@ public class PmsProjectServiceImpl implements IPmsProjectService {
private PmsProjectTestsheetMapper pmsProjectTestsheetMapper;
@Resource
private PmsProjectTestReportMapper pmsProjectTestReportMapper;
@Autowired
private RedisService redisService;
/**
* 查询项目
@ -131,7 +135,12 @@ public class PmsProjectServiceImpl implements IPmsProjectService {
}
@Override
public GenericsTableDataInfo<PmsProjectDetailVo> selectPmsProjectList(PmsProjectSearchVo pmsProjectSearchVo) {
public GenericsTableDataInfo<PmsProjectDetailVo> selectPmsProjectList(PmsProjectSearchVo pmsProjectSearchVo, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(pmsProjectSearchVo, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (GenericsTableDataInfo<PmsProjectDetailVo>) redisService.getCacheObject(searchCacheKey);
}
startPage();
List<PmsProject> pmsProjectList = pmsProjectMapper.selectPmsProjectListBySearchInput(pmsProjectSearchVo);
List<String> projectIdList = pmsProjectList.stream()
@ -142,7 +151,9 @@ public class PmsProjectServiceImpl implements IPmsProjectService {
projectTotalCount = getProjectIssuesTotalCountByGitLink(projectIdList);
}
JSONObject finalProjectTotalCount = projectTotalCount;
return toPage(pmsProjectList, pmsProject -> buildPmsProjectDetailVo(pmsProject, finalProjectTotalCount));
GenericsTableDataInfo<PmsProjectDetailVo> page = toPage(pmsProjectList, pmsProject -> buildPmsProjectDetailVo(pmsProject, finalProjectTotalCount));
redisService.setCacheObject(searchCacheKey, page, 1L, TimeUnit.HOURS);
return page;
}
@Override

View File

@ -7,6 +7,7 @@ import com.microservices.common.core.utils.JSONUtils;
import com.microservices.common.core.utils.PageUtils;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.redis.service.RedisService;
import com.microservices.common.security.utils.SecurityUtils;
import com.microservices.pms.common.service.IPmsCommonService;
import com.microservices.pms.enterprise.domain.PmsEnterprise;
@ -39,6 +40,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import java.util.concurrent.TimeUnit;
import static com.microservices.common.core.utils.PageUtils.startPage;
@ -70,6 +72,8 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
private PmsProjectTestsheetCasesMapper pmsProjectTestsheetCasesMapper;
@Autowired
private IPmsProductRequirementService pmsProductRequirementService;
@Autowired
private RedisService redisService;
/**
* 查询测试用例管理
@ -94,12 +98,19 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
* @return 测试用例管理
*/
@Override
public GenericsTableDataInfo<PmsProjectTestcaseDataVo> selectPmsProjectTestcasePageList(PmsProjectTestcase pmsProjectTestcase) {
public GenericsTableDataInfo<PmsProjectTestcaseDataVo> selectPmsProjectTestcasePageList(PmsProjectTestcase pmsProjectTestcase, String enterpriseIdentifier) {
String searchCacheKey = PmsUtils.generateCacheKey(pmsProjectTestcase, enterpriseIdentifier);
if (redisService.hasKey(searchCacheKey)) {
return (GenericsTableDataInfo<PmsProjectTestcaseDataVo>) redisService.getCacheObject(searchCacheKey);
}
pmsProjectService.selectPmsProjectById(pmsProjectTestcase.getPmsProjectId());
startPage();
List<PmsProjectTestcase> pmsProjectTestcaseList = pmsProjectTestcaseMapper.selectPmsProjectTestcaseList(pmsProjectTestcase);
HashMap<String, Object> hashMap = new HashMap<>();
return PageUtils.toPage(pmsProjectTestcaseList, x -> toPmsProjectTestcaseDataVo(x, hashMap));
GenericsTableDataInfo<PmsProjectTestcaseDataVo> page = PageUtils.toPage(pmsProjectTestcaseList, x -> toPmsProjectTestcaseDataVo(x, hashMap));
redisService.setCacheObject(searchCacheKey, page, 1L, TimeUnit.HOURS);
return page;
}
private PmsProjectTestcaseDataVo toPmsProjectTestcaseDataVo(PmsProjectTestcase pmsProjectTestcase, HashMap<String, Object> hashMap) {

View File

@ -87,7 +87,7 @@ public class PmsProjectTestsheetCasesServiceImpl implements IPmsProjectTestsheet
* @return 测试单执行用例
*/
@Override
public List<PmsProjectTestsheetCases> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCases pmsProjectTestsheetCases) {
public List<PmsProjectTestsheetCases> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCases pmsProjectTestsheetCases, String enterpriseIdentifier) {
pmsProjectTestsheetService.selectPmsProjectTestsheetById(pmsProjectTestsheetCases.getProjectTestsheetId());
return pmsProjectTestsheetCasesMapper.selectPmsProjectTestsheetCasesList(pmsProjectTestsheetCases);
}
@ -111,7 +111,7 @@ public class PmsProjectTestsheetCasesServiceImpl implements IPmsProjectTestsheet
* @return 测试单执行用例
*/
@Override
public GenericsTableDataInfo<PmsProjectTestsheetCaseVo> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCaseSearchVo searchVo) {
public GenericsTableDataInfo<PmsProjectTestsheetCaseVo> selectPmsProjectTestsheetCasesList(PmsProjectTestsheetCaseSearchVo searchVo, String enterpriseIdentifier) {
pmsProjectTestsheetService.selectPmsProjectTestsheetById(searchVo.getProjectTestsheetId());
PageUtils.startPage();
PmsProjectTestcase pmsProjectTestcase = new PmsProjectTestcase();
@ -120,7 +120,7 @@ public class PmsProjectTestsheetCasesServiceImpl implements IPmsProjectTestsheet
pmsProjectTestcase.getParams().put("testerId", searchVo.getTesterId());
pmsProjectTestcase.getParams().put("testStatus", searchVo.getTestStatus());
if (pmsProjectTestcase.getPmsModuleId() != null && pmsProjectTestcase.getPmsModuleId() != 0) {
List<Long> moduleIdList = pmsProductModuleService.selectChildrenPmsProductModuleIdList(pmsProjectTestcase.getPmsModuleId());
List<Long> moduleIdList = pmsProductModuleService.selectChildrenPmsProductModuleIdList(pmsProjectTestcase.getPmsModuleId(), enterpriseIdentifier);
pmsProjectTestcase.setChildrenModuleIdList(moduleIdList);
}
// 增加时排除已增加到测试单的用例

View File

@ -173,4 +173,6 @@ public class PmsConstants {
* 流水线类型图形化
*/
public final static Integer PIPELINE_TYPE_GRAPHIC = 2;
public final static String ENTERPRISE_INFO_PREFIX = "enterpriseInfo:";
}

View File

@ -1,7 +1,9 @@
package com.microservices.pms.utils;
import com.microservices.common.core.exception.ServiceException;
import com.microservices.common.security.utils.SecurityUtils;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
@ -76,4 +78,26 @@ public class PmsUtils {
}
return "";
}
public static String generateCacheKey(Object searchVo, String enterpriseIdentifier) {
String currentUserName = SecurityUtils.getUsername();
StringBuilder keyBuilder = new StringBuilder("SEARCH:").append(enterpriseIdentifier).append(":").append(currentUserName).append(":").append(searchVo.getClass().getSimpleName());
Field[] fields = searchVo.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true); // 允许访问私有字段
try {
Object value = field.get(searchVo);
if (value != null) {
keyBuilder.append(":").append(field.getName()).append("=").append(value.toString()).append("&");
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
// 移除最后一个 "&"
if (keyBuilder.length() > 0) {
keyBuilder.setLength(keyBuilder.length() - 1);
}
return keyBuilder.toString();
}
}