forked from Gitlink/microservices
Compare commits
39 Commits
dev_testCa
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
c001df36d8 | |
|
|
d216d3d0b8 | |
|
|
35f94f3ac5 | |
|
|
fb850bad71 | |
|
|
2fef3cbc24 | |
|
|
9786975fe1 | |
|
|
dbcdb468ab | |
|
|
7d16bccea8 | |
|
|
85913c605a | |
|
|
79136717ef | |
|
|
64b4c36635 | |
|
|
db6b1cfe10 | |
|
|
f459e84521 | |
|
|
6f63a0de72 | |
|
|
e6322835db | |
|
|
0e83fa62ce | |
|
|
ea2d703a5e | |
|
|
143fa631ce | |
|
|
e48ce7f4b0 | |
|
|
f61b11bc93 | |
|
|
83f86f623d | |
|
|
6e7ae41dac | |
|
|
e9137d30ba | |
|
|
0b69e3bafa | |
|
|
dcea028be3 | |
|
|
5199a829f5 | |
|
|
1354a2b7a0 | |
|
|
e6413d1efe | |
|
|
fe7c642a08 | |
|
|
3c2b288068 | |
|
|
71e5c84a1a | |
|
|
6f7d969ce9 | |
|
|
992a07f154 | |
|
|
94061dc01c | |
|
|
713104e353 | |
|
|
05533c9475 | |
|
|
63e9d65b60 | |
|
|
103beae4d8 | |
|
|
edb5e65035 |
|
|
@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
|
@ -172,6 +173,12 @@ public class PmsDashboardController extends BaseController {
|
|||
}
|
||||
todoProjectIssuesSearchVo.setPmProjectIds(StringUtils.join(projectList.stream().map(PmsProject::getId).toArray(), ","));
|
||||
JSONObject result = pmsProjectIssuesService.selectMyTodoPmsProjectIssuesList(todoProjectIssuesSearchVo);
|
||||
|
||||
// 判断projectList中是否存在projectAssigneeId和当前用户id相等
|
||||
Long currentUserId = SecurityUtils.getGitlinkUserId();
|
||||
boolean isProjectAssigner = projectList.stream()
|
||||
.anyMatch(project -> currentUserId != null && currentUserId.equals(project.getProjectAssigneeId()));
|
||||
result.put("isProjectAssigner", isProjectAssigner);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 项目管理-文档库Controller
|
||||
*
|
||||
*
|
||||
* @author wanjia
|
||||
* @date 2024-01-08
|
||||
*/
|
||||
|
|
@ -30,8 +30,7 @@ import java.util.List;
|
|||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
|
||||
})
|
||||
public class PmsDocumentController extends BaseController
|
||||
{
|
||||
public class PmsDocumentController extends BaseController {
|
||||
@Autowired
|
||||
private IPmsDocumentService pmsDocumentService;
|
||||
|
||||
|
|
@ -46,8 +45,7 @@ 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(@Validated PmsDocumentSearchVo pmsDocumentSearchVo) {
|
||||
return pmsDocumentService.selectPmsDocumentVoList(pmsDocumentSearchVo);
|
||||
}
|
||||
|
||||
|
|
@ -58,8 +56,7 @@ public class PmsDocumentController extends BaseController
|
|||
@Log(title = "项目管理-文档库", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation(value = "导出项目管理-文档库列表", hidden = true)
|
||||
public void export(HttpServletResponse response, PmsDocument pmsDocument)
|
||||
{
|
||||
public void export(HttpServletResponse response, PmsDocument pmsDocument) {
|
||||
List<PmsDocument> list = pmsDocumentService.selectPmsDocumentList(pmsDocument);
|
||||
ExcelUtil<PmsDocument> util = new ExcelUtil<PmsDocument>(PmsDocument.class);
|
||||
util.exportExcel(response, list, "项目管理-文档库数据");
|
||||
|
|
@ -71,8 +68,7 @@ public class PmsDocumentController extends BaseController
|
|||
// @RequiresPermissions("pms:document:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "获取项目管理-文档库详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id, @ApiParam("企业id") @RequestParam(name = "enterpriseId") Long enterpriseId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id, @ApiParam("企业id") @RequestParam(name = "enterpriseId") Long enterpriseId) {
|
||||
return success(pmsDocumentService.selectPmsDocumentDetailVoByIdAndEnterpriseId(id, enterpriseId));
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +79,7 @@ public class PmsDocumentController extends BaseController
|
|||
@Log(title = "项目管理-文档库", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增项目管理-文档库")
|
||||
public AjaxResult add(@RequestBody @Validated PmsDocumentInputVo pmsDocumentInputVo)
|
||||
{
|
||||
public AjaxResult add(@RequestBody @Validated PmsDocumentInputVo pmsDocumentInputVo) {
|
||||
return toAjax(pmsDocumentService.insertPmsDocument(pmsDocumentInputVo.toPmsDocument()));
|
||||
}
|
||||
|
||||
|
|
@ -95,8 +90,7 @@ public class PmsDocumentController extends BaseController
|
|||
@Log(title = "新增附件类型文档", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/fileType")
|
||||
@ApiOperation(value = "新增附件类型文档")
|
||||
public AjaxResult addFileTypeDoc(@RequestBody @Validated PmsFileTypeDocumentInputVo pmsFileTypeDocumentInputVo)
|
||||
{
|
||||
public AjaxResult addFileTypeDoc(@RequestBody @Validated PmsFileTypeDocumentInputVo pmsFileTypeDocumentInputVo) {
|
||||
return toAjax(pmsDocumentService.insertPmsFileTypeDocument(pmsFileTypeDocumentInputVo));
|
||||
}
|
||||
|
||||
|
|
@ -107,8 +101,7 @@ public class PmsDocumentController extends BaseController
|
|||
@Log(title = "项目管理-文档库", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改项目管理-文档库")
|
||||
public AjaxResult edit(@RequestBody PmsDocumentUpdateVo pmsDocumentUpdateVo)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody PmsDocumentUpdateVo pmsDocumentUpdateVo) {
|
||||
return toAjax(pmsDocumentService.updatePmsDocument(pmsDocumentUpdateVo.toPmsDocument()));
|
||||
}
|
||||
|
||||
|
|
@ -117,12 +110,11 @@ public class PmsDocumentController extends BaseController
|
|||
*/
|
||||
// @RequiresPermissions("pms:document:remove")
|
||||
@Log(title = "项目管理-文档库", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除项目管理-文档库")
|
||||
public AjaxResult remove(@PathVariable Long[] ids,
|
||||
@ApiParam("企业id") @RequestParam(name = "enterpriseId") Long enterpriseId,
|
||||
@ApiParam("项目id") @RequestParam(name = "pmsProjectId", defaultValue = "0") Long pmsProjectId)
|
||||
{
|
||||
@ApiParam("项目id") @RequestParam(name = "pmsProjectId", defaultValue = "0") Long pmsProjectId) {
|
||||
return toAjax(pmsDocumentService.deletePmsDocumentByIds(ids, enterpriseId, pmsProjectId));
|
||||
}
|
||||
|
||||
|
|
@ -131,8 +123,16 @@ public class PmsDocumentController extends BaseController
|
|||
*/
|
||||
@GetMapping(value = "/optionalWikiRepoList")
|
||||
@ApiOperation(value = "导入wiki时可选的仓库列表")
|
||||
public AjaxResult getOptionalWikiRepoList(@Validated OptionalWikiReposSearchVo optionalWikiReposSearchVo)
|
||||
{
|
||||
public AjaxResult getOptionalWikiRepoList(@Validated OptionalWikiReposSearchVo optionalWikiReposSearchVo) {
|
||||
return success(pmsDocumentService.getOptionalWikiRepoList(optionalWikiReposSearchVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文档类型文件
|
||||
*/
|
||||
@GetMapping(value = "/downloadDoc/{docId}")
|
||||
@ApiOperation(value = "下载文档类型文件")
|
||||
public void downloadDoc(@PathVariable String enterpriseIdentifier, @PathVariable Long docId, HttpServletResponse response) {
|
||||
pmsDocumentService.downloadDoc(response, enterpriseIdentifier, docId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
|||
import com.microservices.pms.document.domain.PmsDocument;
|
||||
import com.microservices.pms.document.domain.vo.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -93,4 +94,6 @@ public interface IPmsDocumentService
|
|||
* @return
|
||||
*/
|
||||
JSONObject getOptionalWikiRepoList(OptionalWikiReposSearchVo optionalWikiReposSearchVo);
|
||||
|
||||
void downloadDoc(HttpServletResponse response, String enterpriseIdentifier, Long docId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.microservices.common.core.constant.HttpStatus;
|
|||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.file.FileUtils;
|
||||
import com.microservices.common.core.web.page.Breadcrumb;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
|
|
@ -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 lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -28,7 +30,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -38,13 +45,13 @@ import static com.microservices.common.httpClient.constant.GitLinkConstants.DATA
|
|||
|
||||
/**
|
||||
* 项目管理-文档库Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author wanjia
|
||||
* @date 2024-01-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PmsDocumentServiceImpl implements IPmsDocumentService
|
||||
{
|
||||
public class PmsDocumentServiceImpl implements IPmsDocumentService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PmsDocumentServiceImpl.class);
|
||||
@Resource
|
||||
private PmsDocumentMapper pmsDocumentMapper;
|
||||
|
|
@ -69,13 +76,12 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
|
||||
/**
|
||||
* 查询项目管理-文档库
|
||||
*
|
||||
*
|
||||
* @param id 项目管理-文档库主键
|
||||
* @return 项目管理-文档库
|
||||
*/
|
||||
@Override
|
||||
public PmsDocument selectPmsDocumentByIdAndEnterpriseId(Long id, Long enterpriseId)
|
||||
{
|
||||
public PmsDocument selectPmsDocumentByIdAndEnterpriseId(Long id, Long enterpriseId) {
|
||||
boolean isEnterpriseAdmin = pmsCommonService.hasDocsManageRole(enterpriseId);
|
||||
return pmsDocumentMapper.selectPmsDocumentByIdAndEnterpriseId(id, enterpriseId, isEnterpriseAdmin, SecurityUtils.getUsername());
|
||||
}
|
||||
|
|
@ -97,13 +103,12 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
|
||||
/**
|
||||
* 查询项目管理-文档库列表
|
||||
*
|
||||
*
|
||||
* @param pmsDocument 项目管理-文档库
|
||||
* @return 项目管理-文档库
|
||||
*/
|
||||
@Override
|
||||
public List<PmsDocument> selectPmsDocumentList(PmsDocument pmsDocument)
|
||||
{
|
||||
public List<PmsDocument> selectPmsDocumentList(PmsDocument pmsDocument) {
|
||||
checkAuthAndReturnAdminStatus(pmsDocument.getPmsEnterpriseId());
|
||||
return pmsDocumentMapper.selectPmsDocumentList(pmsDocument);
|
||||
}
|
||||
|
|
@ -116,7 +121,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
pmsDocumentSearchVo.setCurrentUserName(currentUserName);
|
||||
startPage();
|
||||
List<PmsDocument> pmsDocumentList = pmsDocumentMapper.selectPmsDocumentListBySearchInput(pmsDocumentSearchVo);
|
||||
GenericsTableDataInfo<PmsDocumentVo> page = toPage(pmsDocumentList,this::buildPmsDocumentVo);
|
||||
GenericsTableDataInfo<PmsDocumentVo> page = toPage(pmsDocumentList, this::buildPmsDocumentVo);
|
||||
//构建面包屑列表
|
||||
if (pmsDocumentSearchVo.getParentId() != 0) {
|
||||
List<Breadcrumb> breadcrumbs = buildBreadcrumbs(pmsDocumentSearchVo.getParentId());
|
||||
|
|
@ -132,21 +137,53 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseById(enterpriseId);
|
||||
Map<String, String> queryParams = buildRepoListQueryParams(optionalWikiReposSearchVo);
|
||||
try {
|
||||
return gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ORGANIZATION_REPO_LIST(pmsEnterprise.getEnterpriseIdentifier(), queryParams));
|
||||
return gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ORGANIZATION_REPO_LIST(pmsEnterprise.getEnterpriseIdentifier(), queryParams));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadDoc(HttpServletResponse response, String enterpriseIdentifier, Long docId) {
|
||||
PmsEnterprise enterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
|
||||
PmsDocument pmsDocument = selectPmsDocumentByIdAndEnterpriseId(docId, enterprise.getId());
|
||||
if (!pmsDocument.getDocType().equals(PmsDocumentType.DOCUMENT.getKey())) {
|
||||
throw new ServiceException("当前接口仅允许下载文档类型");
|
||||
}
|
||||
Path tempFilePath = null;
|
||||
try {
|
||||
String docFileName = pmsDocument.getName() + ".md";
|
||||
FileUtils.setAttachmentResponseHeader(response, docFileName);
|
||||
// 创建临时文件
|
||||
tempFilePath = Files.createTempFile(pmsDocument.getName(), ".md");
|
||||
String content = "";
|
||||
if (pmsDocument.getContent() != null) {
|
||||
content = pmsDocument.getContent();
|
||||
}
|
||||
Files.write(tempFilePath, content.getBytes(StandardCharsets.UTF_8));
|
||||
FileUtils.writeBytes(tempFilePath.toString(), response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("文档下载失败:{}", e.getMessage());
|
||||
throw new ServiceException("文档下载失败");
|
||||
} finally {
|
||||
if (tempFilePath != null) {
|
||||
try {
|
||||
Files.deleteIfExists(tempFilePath);
|
||||
} catch (IOException e) {
|
||||
log.error("删除临时文件失败:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目管理-文档库
|
||||
*
|
||||
*
|
||||
* @param pmsDocument 项目管理-文档库
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPmsDocument(PmsDocument pmsDocument)
|
||||
{
|
||||
public int insertPmsDocument(PmsDocument pmsDocument) {
|
||||
checkPmsProjectById(pmsDocument.getPmsProjectId());
|
||||
checkAuthAndReturnAdminStatus(pmsDocument.getPmsEnterpriseId());
|
||||
String currentUserName = SecurityUtils.getUsername();
|
||||
|
|
@ -169,13 +206,12 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
|
||||
/**
|
||||
* 修改项目管理-文档库
|
||||
*
|
||||
*
|
||||
* @param pmsDocument 项目管理-文档库
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePmsDocument(PmsDocument pmsDocument)
|
||||
{
|
||||
public int updatePmsDocument(PmsDocument pmsDocument) {
|
||||
checkPmsProjectById(pmsDocument.getPmsProjectId());
|
||||
String currentUserName = SecurityUtils.getUsername();
|
||||
boolean isEnterpriseAdmin = checkAuthAndReturnAdminStatus(pmsDocument.getPmsEnterpriseId());
|
||||
|
|
@ -195,8 +231,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePmsDocumentByIds(Long[] ids, Long enterpriseId, Long projectId)
|
||||
{
|
||||
public int deletePmsDocumentByIds(Long[] ids, Long enterpriseId, Long projectId) {
|
||||
checkPmsProjectById(projectId);
|
||||
String currentUserName = SecurityUtils.getUsername();
|
||||
boolean isEnterpriseAdmin = checkAuthAndReturnAdminStatus(enterpriseId);
|
||||
|
|
@ -207,13 +242,12 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
|
||||
/**
|
||||
* 删除项目管理-文档库信息
|
||||
*
|
||||
*
|
||||
* @param id 项目管理-文档库主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePmsDocumentById(Long id, Long enterpriseId, Long projectId)
|
||||
{
|
||||
public int deletePmsDocumentById(Long id, Long enterpriseId, Long projectId) {
|
||||
checkPmsProjectById(projectId);
|
||||
String currentUserName = SecurityUtils.getUsername();
|
||||
boolean isEnterpriseAdmin = checkAuthAndReturnAdminStatus(enterpriseId);
|
||||
|
|
@ -306,7 +340,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
throw new ServiceException("文件类型的文档名称个数与文件标识个数不匹配");
|
||||
}
|
||||
List<PmsDocument> pmsDocumentList = new ArrayList<>();
|
||||
for (int i=0; i < names.length; i++) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
PmsDocument pmsDocument = new PmsDocument();
|
||||
BeanUtils.copyProperties(pmsFileTypeDocumentInputVo, pmsDocument);
|
||||
pmsDocument.setName(names[i]);
|
||||
|
|
@ -376,7 +410,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
queryParams.put("pm_project_repository_ids", unlinkedRepoIdsString);
|
||||
}
|
||||
queryParams.put("search", optionalWikiReposSearchVo.getSearch());
|
||||
queryParams.put("page" , String.valueOf(optionalWikiReposSearchVo.getPage()));
|
||||
queryParams.put("page", String.valueOf(optionalWikiReposSearchVo.getPage()));
|
||||
queryParams.put("limit", String.valueOf(optionalWikiReposSearchVo.getLimit()));
|
||||
queryParams.put("sort_by", optionalWikiReposSearchVo.getSortBy());
|
||||
queryParams.put("sort_direction", "desc");
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ public class ProductReqSpecsController extends BaseController {
|
|||
@Log(title = "需求", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/activePlan")
|
||||
@ApiOperation(value = "需求纳入计划")
|
||||
public AjaxResult activePlan(@RequestBody @Validated ProductReqSpecsActivePlanVo productReqSpecsActivePlanVo) {
|
||||
public AjaxResult activePlan(@PathVariable String enterpriseIdentifier, @RequestBody @Validated ProductReqSpecsActivePlanVo productReqSpecsActivePlanVo) {
|
||||
productReqSpecsActivePlanVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
return toAjax(pmsProductRequirementService.activePlan(productReqSpecsActivePlanVo));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,12 @@ public class ProductReqSpecsActivePlanVo {
|
|||
@NotNull
|
||||
private Long projectId;
|
||||
|
||||
@ApiModelProperty(value = "企业标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
|
||||
public PmsProjectIssuesInputVo toPmsProjectIssuesInputVo(PmsProductRequirement reqSpecs, List<String> forgeFileIdentifierList) {
|
||||
PmsProjectIssuesInputVo issue = new PmsProjectIssuesInputVo();
|
||||
issue.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
issue.setSubject(reqSpecs.getTitle());
|
||||
issue.setPmProjectId(projectId);
|
||||
issue.setStatusId(ProjectIssueStatus.RESOLVING.getId());
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
|||
* @date 2024-06-20
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibraryRepositoriesService {
|
||||
public class PmsProductLibraryRepositoriesServiceImpl extends ProductLibraryCommonService implements IPmsProductLibraryRepositoriesService {
|
||||
@Autowired
|
||||
private PmsProductLibraryRepositoriesMapper pmsProductLibraryRepositoriesMapper;
|
||||
@Autowired
|
||||
|
|
@ -328,7 +328,15 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
pmsProductLibraryRepositoriesSearch.setPmsEnterpriseIdentifier(enterpriseIdentifier);
|
||||
return PageUtils.toPage(
|
||||
pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesList(pmsProductLibraryRepositoriesSearch),
|
||||
PmsProductLibraryRepositories::toPmsProductLibraryRepositoriesSimpleVo);
|
||||
this::toPmsProductLibraryRepositoriesSimpleVo);
|
||||
}
|
||||
|
||||
private PmsProductLibraryRepositoriesSimpleVo toPmsProductLibraryRepositoriesSimpleVo(PmsProductLibraryRepositories productLibraryRepositories) {
|
||||
PmsProductLibraryRepositoriesSimpleVo target = productLibraryRepositories.toPmsProductLibraryRepositoriesSimpleVo();
|
||||
if (StringUtils.isNotEmpty(externalUrl)) {
|
||||
target.setUrl(target.getUrl().replace(nexusUrl, externalUrl));
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import com.microservices.system.api.utils.FeignUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -60,7 +61,7 @@ import java.util.stream.Collectors;
|
|||
* @author OTTO
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductLibraryServiceImpl implements IPmsProductLibraryService {
|
||||
public class PmsProductLibraryServiceImpl extends ProductLibraryCommonService implements IPmsProductLibraryService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PmsProductLibraryServiceImpl.class);
|
||||
@Autowired
|
||||
|
|
@ -158,6 +159,9 @@ public class PmsProductLibraryServiceImpl implements IPmsProductLibraryService {
|
|||
)
|
||||
);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(externalUrl)) {
|
||||
pmsProductLibrarySimpleVo.setUrl(pmsProductLibrarySimpleVo.getUrl().replace(nexusUrl, externalUrl));
|
||||
}
|
||||
return pmsProductLibrarySimpleVo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.microservices.pms.productLibrary.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
public abstract class ProductLibraryCommonService {
|
||||
|
||||
@Value("${nexus.proxy.externalUrl:}")
|
||||
public String externalUrl;
|
||||
@Value("${nexus.proxy.targetAddr:}")
|
||||
public String nexusUrl;
|
||||
}
|
||||
|
|
@ -44,7 +44,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) {
|
||||
public AjaxResult list(@PathVariable String enterpriseIdentifier, PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
|
||||
pmsProjectIssuesSearchVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo);
|
||||
return success(result);
|
||||
}
|
||||
|
|
@ -384,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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.microservices.pms.project.controller;
|
|||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.pms.project.domain.vo.PmsPersonalWeeklyIssuesSearchVo;
|
||||
import com.microservices.pms.project.domain.vo.PmsPersonalWeeklyReportSearchVo;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectIssuesInputVo;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectIssuesSearchVo;
|
||||
import com.microservices.pms.project.service.PmsProjectIssuesService;
|
||||
|
|
@ -35,20 +37,62 @@ public class PmsProjectWeeklyReportController {
|
|||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "项目周报列表")
|
||||
public AjaxResult list(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo)
|
||||
public AjaxResult list(@PathVariable String enterpriseIdentifier, PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo)
|
||||
{
|
||||
pmsProjectIssuesSearchVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssuesList(pmsProjectIssuesSearchVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询周报-个人工作项统计
|
||||
*/
|
||||
@GetMapping("/personal")
|
||||
@ApiOperation(value = "周报-个人工作项统计")
|
||||
public AjaxResult getPersonalWeeklyReport(@PathVariable String enterpriseIdentifier, PmsPersonalWeeklyReportSearchVo pmsPersonalWeeklyReportSearchVo)
|
||||
{
|
||||
JSONObject result = pmsProjectIssuesService.getPersonalIssuesStatistics(enterpriseIdentifier, pmsPersonalWeeklyReportSearchVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/personalIssueList")
|
||||
@ApiOperation(value = "周报-个人工作项列表")
|
||||
public AjaxResult getPersonalIssueList(@PathVariable String enterpriseIdentifier, PmsPersonalWeeklyIssuesSearchVo pmsPersonalWeeklyIssuesSearchVo)
|
||||
{
|
||||
pmsPersonalWeeklyIssuesSearchVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
JSONObject result = pmsProjectIssuesService.getPersonalIssueList(pmsPersonalWeeklyIssuesSearchVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询周报-项目组工作项统计
|
||||
*/
|
||||
@GetMapping("/projectTeam")
|
||||
@ApiOperation(value = "周报-项目组工作项统计")
|
||||
public AjaxResult getProjectTeamWeeklyReport(@PathVariable String enterpriseIdentifier)
|
||||
{
|
||||
JSONObject result = pmsProjectIssuesService.getProjectTeamIssuesStatistics(enterpriseIdentifier);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/projectIssueList")
|
||||
@ApiOperation(value = "周报-项目组工作项列表")
|
||||
public AjaxResult getProjectIssueList(@PathVariable String enterpriseIdentifier, PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo)
|
||||
{
|
||||
pmsProjectIssuesSearchVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
JSONObject result = pmsProjectIssuesService.getProjectIssueList(pmsProjectIssuesSearchVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目项目周报
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "新增项目周报")
|
||||
public AjaxResult add(@RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo)
|
||||
public AjaxResult add(@PathVariable String enterpriseIdentifier, @RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo)
|
||||
{
|
||||
JSONObject result = pmsProjectIssuesService.insertPmsProjectIssues(pmsProjectIssuesInputVo);
|
||||
pmsProjectIssuesInputVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
JSONObject result = pmsProjectIssuesService.insertPmsProjectWeeklyReportIssues(pmsProjectIssuesInputVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
|
@ -59,18 +103,18 @@ public class PmsProjectWeeklyReportController {
|
|||
@ApiOperation(value = "编辑项目周报")
|
||||
public AjaxResult edit(@PathVariable("id") Long id, @RequestBody PmsProjectIssuesInputVo pmsProjectIssuesInputVo)
|
||||
{
|
||||
JSONObject result = pmsProjectIssuesService.updatePmsProjectIssues(id, pmsProjectIssuesInputVo);
|
||||
JSONObject result = pmsProjectIssuesService.updatePmsProjectWeeklyReportIssues(id, pmsProjectIssuesInputVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目周报
|
||||
*/
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@ApiParam( "周报id数组,为-1时删除全部")@PathVariable Long[] ids, @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@ApiParam( "周报id")@PathVariable Long id)
|
||||
{
|
||||
|
||||
JSONObject result = pmsProjectIssuesService.deletePmsProjectIssueByIds(ids, pmProjectId);
|
||||
JSONObject result = pmsProjectIssuesService.deletePmsProjectWeeklyReportIssueByIds(id);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
|
@ -78,10 +122,10 @@ public class PmsProjectWeeklyReportController {
|
|||
* 查看项目周报
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult query(@PathVariable("id") Long id, @ApiParam( "项目Id")@RequestParam(name = "pmProjectId") Long pmProjectId)
|
||||
public AjaxResult query(@PathVariable String enterpriseIdentifier, @PathVariable("id") Long id)
|
||||
{
|
||||
|
||||
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssueById(id, pmProjectId);
|
||||
JSONObject result = pmsProjectIssuesService.selectPmsProjectIssueByIdAndEnterPrise(id, enterpriseIdentifier);
|
||||
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,46 @@
|
|||
package com.microservices.pms.project.domain.vo;
|
||||
|
||||
import com.microservices.common.core.utils.ServletUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@ApiModel("个人周报工作项搜索对象")
|
||||
public class PmsPersonalWeeklyIssuesSearchVo {
|
||||
|
||||
@ApiModelProperty(value = "用户gitlink用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "企业标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
|
||||
@ApiModelProperty(value = "工作项名称搜索关键词")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty(value = "状态值,可多个状态逗号隔开")
|
||||
private String statusIds;
|
||||
|
||||
@ApiModelProperty(value = "排序方式: issues.updated_on 更新时间 issues.created_on 创建时间 issue_priorities.position 优先级")
|
||||
private String sortBy;
|
||||
|
||||
@ApiModelProperty(value = "排序方向:asc 正序 desc 倒序")
|
||||
private String sortDirection;
|
||||
|
||||
@ApiModelProperty(value = "本周工作项页码")
|
||||
private String thisWeekPage;
|
||||
|
||||
@ApiModelProperty(value = "分页数")
|
||||
private String thisWeekLimit;
|
||||
|
||||
@ApiModelProperty(value = "本周工作项页码")
|
||||
private String nextWeekPage;
|
||||
|
||||
@ApiModelProperty(value = "分页数")
|
||||
private String nextWeekLimit;
|
||||
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = ServletUtils.urlDecode(keyword);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.microservices.pms.project.domain.vo;
|
||||
|
||||
import com.microservices.common.core.utils.ServletUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("个人周报工作项统计对象")
|
||||
public class PmsPersonalWeeklyReportSearchVo {
|
||||
|
||||
@ApiModelProperty(value = "用户gitlink用户id", hidden = true)
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "企业标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
}
|
||||
|
|
@ -9,7 +9,10 @@ import lombok.Data;
|
|||
@ApiModel("项目工作项搜索对象")
|
||||
public class PmsProjectIssuesSearchVo {
|
||||
|
||||
@ApiModelProperty(value = "项目id", required = true)
|
||||
@ApiModelProperty(value = "企业标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private String pmProjectId;
|
||||
|
||||
@ApiModelProperty(value = "项目迭代id")
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -89,4 +89,8 @@ public interface PmsProjectMapper
|
|||
void updatePmsProjectNoProduct(@Param("projectIdList") List<Long> projectIdList);
|
||||
|
||||
PmsProject selectPmsProjectById(Long id);
|
||||
|
||||
List<Long> selectProjectIdsByAssigneeUserId(@Param("enterpriseIdentifier") String enterpriseIdentifier, @Param("gitlinkUserId") Long gitlinkUserId);
|
||||
|
||||
String selectEnterpriseIdentifierByProjectId(@Param("pmProjectId") Long pmProjectId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,8 @@ public interface PmsProjectSprintMapper
|
|||
Integer selectOpeningSprintLastWeekIterationCount(@Param("pmProjectId") Long pmProjectId);
|
||||
|
||||
PmsProjectSprintStatisticsVo selectPmsProjectSprintStatisticsByProjectId(@Param("pmProjectId") Long pmProjectId);
|
||||
|
||||
int selectNewSprintCurrentNaturalWeekCount(@Param("projectId") Long projectId);
|
||||
|
||||
int selectCompleteSprintCurrentNaturalWeekCount(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,4 +68,8 @@ public interface PmsProjectTestsheetMapper
|
|||
int deletePmsProjectTestsheetByProjectId(@Param("projectId") Long projectId);
|
||||
|
||||
Integer selectCountBySprintId(@Param("sprintId") Long sprintId);
|
||||
|
||||
int selectNewTestSheetCurrentNaturalWeekCount(@Param("projectId") Long projectId);
|
||||
|
||||
int selectCompleteTestSheetCurrentNaturalWeekCount(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
|||
import com.microservices.pms.project.domain.PmsProject;
|
||||
import com.microservices.pms.project.domain.vo.*;
|
||||
import com.microservices.system.api.domain.SimpleSysUser;
|
||||
import com.microservices.system.api.domain.SysNotice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -100,4 +99,6 @@ public interface IPmsProjectService
|
|||
JSONObject getMyRepositoriesStatistics(Long repositoryId);
|
||||
|
||||
PmsProject selectPmsProjectByIdNoCheckRole(Long pmsProjectId);
|
||||
|
||||
List<Long> selectProjectIdsByAssigneeUserId(String enterpriseIdentifier, Long gitlinkUserId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONArray;
|
|||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.pms.common.service.IPmsCommonService;
|
||||
|
|
@ -14,9 +15,14 @@ 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;
|
||||
import com.microservices.pms.utils.PmsConstants;
|
||||
import com.microservices.pms.utils.PmsGitLinkRequestUrl;
|
||||
import com.microservices.pms.utils.PmsUtils;
|
||||
|
|
@ -31,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
|
|
@ -72,6 +79,14 @@ public class PmsProjectIssuesService {
|
|||
|
||||
@Autowired
|
||||
private IPmsCommonService pmsCommonService;
|
||||
@Resource
|
||||
private PmsProjectSprintMapper pmsProjectSprintMapper;
|
||||
@Resource
|
||||
private PmsProjectTestsheetMapper pmsProjectTestsheetMapper;
|
||||
@Resource
|
||||
private PmsProjectMapper pmsProjectMapper;
|
||||
@Resource
|
||||
private ForgeIssuesMapper forgeIssuesMapper;
|
||||
|
||||
|
||||
public JSONObject selectPmsProjectIssuesList(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
|
||||
|
|
@ -92,6 +107,7 @@ public class PmsProjectIssuesService {
|
|||
for (int i = 0; i < issues.size(); i++) {
|
||||
JSONObject issue = issues.getJSONObject(i);
|
||||
setIssueAssignersState(issue, gitlinkUserNickNameMap);
|
||||
setIssuePmsProjectName(issue);
|
||||
issues.set(i, issue);
|
||||
}
|
||||
issueListResult.put("issues", issues);
|
||||
|
|
@ -99,6 +115,60 @@ public class PmsProjectIssuesService {
|
|||
return issueListResult;
|
||||
}
|
||||
|
||||
public JSONObject enrichProjectIssueList(JSONObject issueListResult) {
|
||||
HashMap<Long, String> gitlinkUserNickNameMap = new HashMap<>();
|
||||
if (issueListResult.containsKey("this_week_all_issues")) {
|
||||
JSONArray issues = issueListResult.getJSONArray("this_week_all_issues");
|
||||
if (issues != null) {
|
||||
for (int i = 0; i < issues.size(); i++) {
|
||||
JSONObject issue = issues.getJSONObject(i);
|
||||
setIssueAssignersState(issue, gitlinkUserNickNameMap);
|
||||
setIssuePmsProjectName(issue);
|
||||
issues.set(i, issue);
|
||||
}
|
||||
issueListResult.put("this_week_all_issues", issues);
|
||||
}
|
||||
}
|
||||
if (issueListResult.containsKey("next_week_all_issues")) {
|
||||
JSONArray issues = issueListResult.getJSONArray("next_week_all_issues");
|
||||
if (issues != null) {
|
||||
for (int i = 0; i < issues.size(); i++) {
|
||||
JSONObject issue = issues.getJSONObject(i);
|
||||
setIssueAssignersState(issue, gitlinkUserNickNameMap);
|
||||
setIssuePmsProjectName(issue);
|
||||
issues.set(i, issue);
|
||||
}
|
||||
issueListResult.put("next_week_all_issues", issues);
|
||||
}
|
||||
}
|
||||
if (issueListResult.containsKey("close_task_issues")) {
|
||||
JSONArray issues = issueListResult.getJSONArray("close_task_issues");
|
||||
if (issues != null) {
|
||||
for (int i = 0; i < issues.size(); i++) {
|
||||
JSONObject issue = issues.getJSONObject(i);
|
||||
setIssueAssignersState(issue, gitlinkUserNickNameMap);
|
||||
setIssuePmsProjectName(issue);
|
||||
issues.set(i, issue);
|
||||
}
|
||||
issueListResult.put("close_task_issues", issues);
|
||||
}
|
||||
}
|
||||
return issueListResult;
|
||||
}
|
||||
|
||||
private void setIssuePmsProjectName(JSONObject issue) {
|
||||
if (issue.containsKey("pm_project_id")) {
|
||||
Long pmProjectId = issue.getLong("pm_project_id");
|
||||
if (pmProjectId == null) {
|
||||
return;
|
||||
}
|
||||
PmsProject pmsProject = pmsProjectMapper.selectPmsProjectById(pmProjectId);
|
||||
if (pmsProject != null) {
|
||||
issue.put("pm_project_name", pmsProject.getProjectName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject insertPmsProjectIssuesRestricted(PmsProjectIssuesInputVo pmsProjectIssuesInputVo) {
|
||||
PmsProject pmsProject = pmsProjectService.selectAndCheckPmsProjectById(pmsProjectIssuesInputVo.getPmProjectId());
|
||||
if (pmsProject.getPmsProductId() != null
|
||||
|
|
@ -115,6 +185,11 @@ public class PmsProjectIssuesService {
|
|||
return gitLinkRequestHelper.doPost(PmsGitLinkRequestUrl.CREATE_ISSUE(), issueInput);
|
||||
}
|
||||
|
||||
public JSONObject insertPmsProjectWeeklyReportIssues(PmsProjectIssuesInputVo pmsProjectIssuesInputVo) {
|
||||
JSONObject issueInput = convertPmsProjectIssuesInputVoToIssueInputJSON(pmsProjectIssuesInputVo);
|
||||
return gitLinkRequestHelper.doPost(PmsGitLinkRequestUrl.CREATE_ISSUE(), issueInput);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject updatePmsProjectIssues(Long id, PmsProjectIssuesInputVo pmsProjectIssuesInputVo) {
|
||||
PmsProject pmsProject = pmsProjectService.selectAndCheckPmsProjectById(pmsProjectIssuesInputVo.getPmProjectId());
|
||||
|
|
@ -152,7 +227,7 @@ public class PmsProjectIssuesService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (PmsConstants.PROJECT_ISSUE_TYPE_WEEKLY_REPORT.equals(updatedIssue.getString("pm_issue_type"))
|
||||
if (PmsConstants.PROJECT_ISSUE_TYPE_PERSONAL_WEEKLY_REPORT.equals(updatedIssue.getString("pm_issue_type"))
|
||||
&& updatedIssue.getString("root_id") != null
|
||||
&& !updatedIssue.getJSONObject("author").getLong("id").equals(SecurityUtils.getGitlinkUserId())) {
|
||||
throw new ServiceException("非本人周报,不可编辑");
|
||||
|
|
@ -161,6 +236,27 @@ public class PmsProjectIssuesService {
|
|||
return gitLinkRequestHelper.doPut(PmsGitLinkRequestUrl.UPDATE_ISSUE(id), issueInput);
|
||||
}
|
||||
|
||||
public JSONObject updatePmsProjectWeeklyReportIssues(Long id, PmsProjectIssuesInputVo pmsProjectIssuesInputVo) {
|
||||
JSONObject updatedIssue;
|
||||
try {
|
||||
updatedIssue = gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE(id, null));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
isIssueCreatedByCurrentUser(updatedIssue);
|
||||
JSONObject issueInput = convertPmsProjectIssuesInputVoToIssueInputJSON(pmsProjectIssuesInputVo);
|
||||
return gitLinkRequestHelper.doPut(PmsGitLinkRequestUrl.UPDATE_ISSUE(id), issueInput);
|
||||
}
|
||||
|
||||
private static void isIssueCreatedByCurrentUser(JSONObject updatedIssue) {
|
||||
if ((PmsConstants.PROJECT_ISSUE_TYPE_PERSONAL_WEEKLY_REPORT.equals(updatedIssue.getString("pm_issue_type"))
|
||||
|| PmsConstants.PROJECT_ISSUE_TYPE_GROUP_WEEKLY_REPORT.equals(updatedIssue.getString("pm_issue_type")))
|
||||
&& updatedIssue.getString("root_id") != null
|
||||
&& !updatedIssue.getJSONObject("author").getLong("id").equals(SecurityUtils.getGitlinkUserId())) {
|
||||
throw new ServiceException("非本人周报,不可编辑");
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject batchUpdatePmsProjectIssues(Long pmProjectId, PmsProjectIssuesBatchUpdateVo pmsProjectIssuesUpdateVo) {
|
||||
pmsProjectService.selectAndCheckPmsProjectById(pmProjectId);
|
||||
//转换为issue入参
|
||||
|
|
@ -180,6 +276,17 @@ public class PmsProjectIssuesService {
|
|||
}
|
||||
}
|
||||
|
||||
public JSONObject selectPmsProjectIssueByIdAndEnterPrise(Long id, String enterpriseIdentifier) {
|
||||
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
|
||||
try {
|
||||
JSONObject result = setProjectIssueUserState(gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE(id, null)));
|
||||
result.put("pm_enterprise_name", pmsEnterprise.getEnterpriseName());
|
||||
return result;
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject selectPmsProjectIssueByIdNoCheckRole(Long id, Long pmProjectId) {
|
||||
PmsProject pmsProject = pmsProjectService.selectPmsProjectByIdNoCheckRole(pmProjectId);
|
||||
try {
|
||||
|
|
@ -309,6 +416,17 @@ public class PmsProjectIssuesService {
|
|||
return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ISSUES_BATCH(pmProjectId), jsonObject);
|
||||
}
|
||||
|
||||
public JSONObject deletePmsProjectWeeklyReportIssueByIds(Long id) {
|
||||
JSONObject updatedIssue;
|
||||
try {
|
||||
updatedIssue = gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_ISSUE(id, null));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
isIssueCreatedByCurrentUser(updatedIssue);
|
||||
return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_WEEKLY_REPORT_ISSUE(id));
|
||||
}
|
||||
|
||||
public JSONObject selectPmsProjectIssueStatus() {
|
||||
return gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_REPO_ISSUE_DEFAULT_STATUS());
|
||||
}
|
||||
|
|
@ -574,4 +692,108 @@ public class PmsProjectIssuesService {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject getPersonalIssuesStatistics(String enterpriseIdentifier, PmsPersonalWeeklyReportSearchVo pmsPersonalWeeklyReportSearchVo) {
|
||||
Long gitlinkUserId = SecurityUtils.getGitlinkUserId();
|
||||
pmsPersonalWeeklyReportSearchVo.setUserId(gitlinkUserId);
|
||||
pmsPersonalWeeklyReportSearchVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
JSONObject issueSearch = new JSONObject();
|
||||
convertObjectToJSONObject(pmsPersonalWeeklyReportSearchVo, issueSearch, null);
|
||||
try {
|
||||
return enrichProjectIssueList(gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_WEEKLY_ISSUES_PERSONAL(issueSearch)));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject getProjectTeamIssuesStatistics(String enterpriseIdentifier) {
|
||||
List<Long> pmProjectIds = pmsProjectService.selectProjectIdsByAssigneeUserId(enterpriseIdentifier, SecurityUtils.getGitlinkUserId());
|
||||
String pmProjectIdsStr = StringUtils.join(pmProjectIds, ",");
|
||||
JSONObject result = gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_WEEKLY_ISSUES_GROUP(enterpriseIdentifier, pmProjectIdsStr));
|
||||
enrichProjectInfo(result);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public void enrichProjectInfo(JSONObject inputJson) {
|
||||
if (inputJson == null) {
|
||||
return;
|
||||
}
|
||||
// 遍历最外层 key
|
||||
for (String projectIdStr : inputJson.keySet()) {
|
||||
Long projectId;
|
||||
try {
|
||||
projectId = Long.valueOf(projectIdStr); // 转换为 Long
|
||||
} catch (NumberFormatException e) {
|
||||
// 非数字字符串跳过处理
|
||||
continue;
|
||||
}
|
||||
// 查询项目信息
|
||||
PmsProject project = pmsProjectMapper.selectPmsProjectById(projectId);
|
||||
|
||||
JSONObject innerData = inputJson.getJSONObject(projectIdStr);
|
||||
if (project != null) {
|
||||
// 将项目信息转换为 JSONObject
|
||||
JSONObject projectInfo = new JSONObject();
|
||||
projectInfo.put("projectId", project.getId());
|
||||
projectInfo.put("projectName", project.getProjectName());
|
||||
projectInfo.put("enterpriseId", project.getPmsEnterpriseId());
|
||||
projectInfo.put("createdTime", project.getCreateTime());
|
||||
// 将 projectInfo 插入到原 JSON 的对应层级中
|
||||
|
||||
innerData.put("project_info", projectInfo);
|
||||
}
|
||||
|
||||
// 统计新建迭代数
|
||||
innerData.put("this_week_new_sprint_count", pmsProjectSprintMapper.selectNewSprintCurrentNaturalWeekCount(projectId));
|
||||
// 统计完成迭代数
|
||||
innerData.put("this_week_complete_sprint_count", pmsProjectSprintMapper.selectCompleteSprintCurrentNaturalWeekCount(projectId));
|
||||
// 统计新建测试单数
|
||||
innerData.put("this_week_new_test_sheet_count", pmsProjectTestsheetMapper.selectNewTestSheetCurrentNaturalWeekCount(projectId));
|
||||
// 统计完成测试单数
|
||||
innerData.put("this_week_complete_test_sheet_count", pmsProjectTestsheetMapper.selectCompleteTestSheetCurrentNaturalWeekCount(projectId));
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject getProjectIssueList(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
|
||||
List<Long> pmProjectIds = pmsProjectService.selectProjectIdsByAssigneeUserId(
|
||||
pmsProjectIssuesSearchVo.getEnterpriseIdentifier(),
|
||||
StringUtils.isEmpty(pmsProjectIssuesSearchVo.getAssignerId()) ? SecurityUtils.getGitlinkUserId() : Long.valueOf(pmsProjectIssuesSearchVo.getAssignerId()));
|
||||
String pmProjectIdsStr = StringUtils.join(pmProjectIds, ",");
|
||||
pmsProjectIssuesSearchVo.setPmProjectIds(pmProjectIdsStr);
|
||||
JSONObject issueSearch = new JSONObject();
|
||||
convertObjectToJSONObject(pmsProjectIssuesSearchVo, issueSearch, null);
|
||||
try {
|
||||
return setProjectIssueListUserState(gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_GROUP_ISSUE_LIST(issueSearch)));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject getPersonalIssueList(PmsPersonalWeeklyIssuesSearchVo pmsPersonalWeeklyIssuesSearchVo) {
|
||||
pmsPersonalWeeklyIssuesSearchVo.setUserId(pmsPersonalWeeklyIssuesSearchVo.getUserId() == null ? SecurityUtils.getGitlinkUserId() : pmsPersonalWeeklyIssuesSearchVo.getUserId());
|
||||
JSONObject issueSearch = new JSONObject();
|
||||
convertObjectToJSONObject(pmsPersonalWeeklyIssuesSearchVo, issueSearch, null);
|
||||
try {
|
||||
return enrichProjectIssueList(gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_PERSONAL_ISSUE_LIST(issueSearch)));
|
||||
} catch (URISyntaxException e) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ public class PmsProjectRepositoryServiceImpl implements IPmsProjectRepositorySer
|
|||
*/
|
||||
@Override
|
||||
public int insertPmsProjectRepository(PmsProjectRepository pmsProjectRepository) {
|
||||
pmsProjectService.selectAndCheckPmsProjectById(pmsProjectRepository.getPmsProjectId());
|
||||
//仓库已被关联,返回错误提示
|
||||
if (pmsProjectRepositoryMapper.countPmsProjectRepositoryByProjectRepositoryId(pmsProjectRepository.getProjectRepositoryId()) > 0) {
|
||||
throw new ServiceException("代码库id:[%s]已被关联", pmsProjectRepository.getProjectRepositoryId());
|
||||
|
|
|
|||
|
|
@ -396,6 +396,11 @@ public class PmsProjectServiceImpl implements IPmsProjectService {
|
|||
return pmsProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectProjectIdsByAssigneeUserId(String enterpriseIdentifier, Long gitlinkUserId) {
|
||||
return pmsProjectMapper.selectProjectIdsByAssigneeUserId(enterpriseIdentifier, gitlinkUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PmsProject selectAndCheckPmsProjectById(String idStr) {
|
||||
if (StringUtils.isEmpty(idStr)) {
|
||||
|
|
|
|||
|
|
@ -122,9 +122,14 @@ public class PmsConstants {
|
|||
public final static String PROJECT_ISSUE_TYPE_BUG = "3";
|
||||
|
||||
/**
|
||||
* 项目工作项——周报类型
|
||||
* 项目工作项——个人周报类型
|
||||
*/
|
||||
public final static String PROJECT_ISSUE_TYPE_WEEKLY_REPORT = "4";
|
||||
public final static String PROJECT_ISSUE_TYPE_PERSONAL_WEEKLY_REPORT = "4";
|
||||
|
||||
/**
|
||||
* 项目工作项——项目组周报类型
|
||||
*/
|
||||
public final static String PROJECT_ISSUE_TYPE_GROUP_WEEKLY_REPORT = "5";
|
||||
|
||||
/**
|
||||
* 疑修筛选类型-全部
|
||||
|
|
|
|||
|
|
@ -146,7 +146,9 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
|
||||
public static GitLinkRequestUrl GET_ISSUE(Long id, Long pmProjectId) throws URISyntaxException {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("pm_project_id", String.valueOf(pmProjectId));
|
||||
if (pmProjectId != null) {
|
||||
params.put("pm_project_id", String.valueOf(pmProjectId));
|
||||
}
|
||||
return getGitLinkRequestUrl(buildUri(String.format(
|
||||
"/api/pm/issues/%s", id), params
|
||||
));
|
||||
|
|
@ -164,6 +166,12 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl DELETE_WEEKLY_REPORT_ISSUE(Long id) {
|
||||
return getGitLinkRequestUrl(String.format(
|
||||
"/api/pm/issues/%s", id
|
||||
));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl DELETE_ISSUES_BATCH(Long pmProjectId) {
|
||||
String path = String.format("/api/pm/issues/batch_destroy?pm_project_id=%s", pmProjectId);
|
||||
return getGitLinkRequestUrl(path);
|
||||
|
|
@ -439,4 +447,25 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
public static GitLinkRequestUrl GET_ACTION_RUN_DATA(String owner, String workflows) {
|
||||
return getGitLinkRequestUrl(String.format("/api/pm/action_runs?owner_id=%s&workflows=%s", owner, workflows), "data");
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_WEEKLY_ISSUES_PERSONAL(JSONObject issueSearch) throws URISyntaxException {
|
||||
return getGitLinkRequestUrl(
|
||||
buildUri("/api/pm/weekly_issues/personal.json", issueSearch));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_WEEKLY_ISSUES_GROUP(String enterpriseIdentifier, String pmProjectIds){
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/pm/weekly_issues/group.json?enterprise_identifier=%s&pm_project_ids=%s", enterpriseIdentifier, pmProjectIds));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_GROUP_ISSUE_LIST(JSONObject params) throws URISyntaxException {
|
||||
|
||||
return getGitLinkRequestUrl(
|
||||
buildUri("/api/pm/weekly_issues/group_issues.json", params));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_PERSONAL_ISSUE_LIST(JSONObject issueSearch) throws URISyntaxException {
|
||||
return getGitLinkRequestUrl(
|
||||
buildUri("/api/pm/weekly_issues/personal_issues.json", issueSearch));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -173,6 +173,19 @@
|
|||
from pms_project
|
||||
<include refid="selectWhereBySearchVo"/>
|
||||
</select>
|
||||
<select id="selectProjectIdsByAssigneeUserId" resultType="java.lang.Long">
|
||||
select pp.id
|
||||
from pms_project pp
|
||||
left join pms_enterprise pe on pe.id = pp.pms_enterprise_id
|
||||
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
|
||||
|
|
|
|||
|
|
@ -221,4 +221,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE pms_project_id = #{pmProjectId} AND status = 2
|
||||
) AS `closed_sprint_count`
|
||||
</select>
|
||||
<select id="selectNewSprintCurrentNaturalWeekCount" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from pms_project_sprint
|
||||
where pms_project_id = #{projectId}
|
||||
AND create_time <![CDATA[ >= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w')
|
||||
AND create_time <![CDATA[ <= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w') + INTERVAL 6 DAY
|
||||
</select>
|
||||
<select id="selectCompleteSprintCurrentNaturalWeekCount" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from pms_project_sprint
|
||||
where pms_project_id = #{projectId}
|
||||
AND status = 2
|
||||
AND update_time <![CDATA[ >= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w')
|
||||
AND update_time <![CDATA[ <= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w') + INTERVAL 6 DAY
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -53,6 +53,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectCountBySprintId" resultType="java.lang.Integer">
|
||||
select count(*) from pms_project_testsheet where project_sprint_id = #{sprintId}
|
||||
</select>
|
||||
<select id="selectNewTestSheetCurrentNaturalWeekCount" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from pms_project_testsheet
|
||||
where pms_project_id = #{projectId}
|
||||
AND create_time <![CDATA[ >= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w')
|
||||
AND create_time <![CDATA[ <= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w') + INTERVAL 6 DAY
|
||||
</select>
|
||||
<select id="selectCompleteTestSheetCurrentNaturalWeekCount" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from pms_project_testsheet
|
||||
where pms_project_id = #{projectId}
|
||||
AND status = 2
|
||||
AND update_time <![CDATA[ >= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w')
|
||||
AND update_time <![CDATA[ <= ]]> STR_TO_DATE(DATE_FORMAT(NOW(), '%Y-%V-1'), '%Y-%U-%w') + INTERVAL 6 DAY
|
||||
</select>
|
||||
|
||||
<insert id="insertPmsProjectTestsheet" parameterType="PmsProjectTestsheet" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pms_project_testsheet
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.microservices.wiki.contoller.sys;
|
||||
package com.microservices.wiki.controller.sys;
|
||||
|
||||
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -1,13 +1,11 @@
|
|||
package com.microservices.wiki.contoller.wiki;
|
||||
package com.microservices.wiki.controller.wiki;
|
||||
|
||||
import com.microservices.common.core.constant.HttpStatus;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.wiki.domain.sys.User;
|
||||
import com.microservices.wiki.domain.wiki.Wiki;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiAllVo;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiContent;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiDeleteVo;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiPageVo;
|
||||
import com.microservices.wiki.domain.wiki.vo.*;
|
||||
import com.microservices.wiki.refactoring.response.HttpClientResult;
|
||||
import com.microservices.wiki.refactoring.utils.BeanCopyUtils;
|
||||
import com.microservices.wiki.refactoring.utils.FastJsonUtils;
|
||||
|
|
@ -36,6 +34,9 @@ public class WikiController {
|
|||
@Value("${gitea-wiki-api-base-url}")
|
||||
private String giteaApiBaseUrl;
|
||||
|
||||
@Value("${gitea-hat-wiki-api-base-url}")
|
||||
private String giteaHatApiBaseUrl;
|
||||
|
||||
@Value("${gitea-wiki-token}")
|
||||
private String token;
|
||||
|
||||
|
|
@ -138,6 +139,44 @@ public class WikiController {
|
|||
return new AjaxResult(httpClientResult.getCode(), "", httpClientResult.getContent());
|
||||
}
|
||||
|
||||
@ApiOperation("getWikiRevisions")
|
||||
@GetMapping("/getWikiRevisions")
|
||||
public AjaxResult getWikiRevisions(
|
||||
HttpServletRequest request,
|
||||
@ApiParam(value = "owner of the repo", required = true) @RequestParam(defaultValue = "") String owner,
|
||||
@ApiParam(value = "name of the repo", required = true) @RequestParam(defaultValue = "") String repo,
|
||||
@ApiParam(value = "name of the wikipage", required = true) @RequestParam(defaultValue = "") String pageName,
|
||||
@ApiParam(value = "id of the project", required = true) @RequestParam(defaultValue = "") Integer projectId) throws Exception {
|
||||
String giteaToken = wikiService.getGiteaToken(request, projectId);
|
||||
//未获取有效giteaToken时,赋值内置giteaToken
|
||||
giteaToken = giteaToken == null ? token : giteaToken;
|
||||
WikiRevisionsVo wikiRevisionsVo = wikiService.getWikiRevisions(owner, repo, pageName, giteaApiDomain+giteaApiBaseUrl, giteaToken);
|
||||
return new AjaxResult(HttpStatus.SUCCESS,"操作成功", wikiRevisionsVo);
|
||||
}
|
||||
|
||||
@ApiOperation("getPreviousWiki")
|
||||
@GetMapping("/getPreviousWiki")
|
||||
public AjaxResult getPreviousWiki(
|
||||
HttpServletRequest request,
|
||||
@ApiParam(value = "owner of the repo", required = true) @RequestParam(defaultValue = "") String owner,
|
||||
@ApiParam(value = "name of the repo", required = true) @RequestParam(defaultValue = "") String repo,
|
||||
@ApiParam(value = "name of the wikipage", required = true) @RequestParam(defaultValue = "") String pageName,
|
||||
@ApiParam(value = "id of the project", required = true) @RequestParam(defaultValue = "") Integer projectId,
|
||||
@ApiParam(value = "sha of the project", required = true) @RequestParam(defaultValue = "") String sha) throws Exception {
|
||||
String giteaToken = wikiService.getGiteaToken(request, projectId);
|
||||
//未获取有效giteaToken时,赋值内置giteaToken
|
||||
giteaToken = giteaToken == null ? token : giteaToken;
|
||||
HttpClientResult httpClientResult = wikiService.getPreviousWiki(owner, repo, pageName, sha, giteaApiDomain+giteaHatApiBaseUrl, giteaToken);
|
||||
if (httpClientResult == null) {
|
||||
throw new ServiceException("获取wiki历史版本数据异常");
|
||||
}
|
||||
if (httpClientResult.getCode() != 200) {
|
||||
return new AjaxResult(httpClientResult.getCode(),"操作失败", httpClientResult.getContent());
|
||||
}
|
||||
WikiContent wikiContent = getWikiContent(httpClientResult);
|
||||
return new AjaxResult(httpClientResult.getCode(), "操作成功", wikiContent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -150,7 +189,10 @@ public class WikiController {
|
|||
WikiContent wikiContent = FastJsonUtils.toBean(httpClientResult.getContent(), WikiContent.class);
|
||||
if (wikiContent != null && wikiContent.getLast_commit() != null
|
||||
&& wikiContent.getLast_commit().getAuthor() != null) {
|
||||
wikiContent.setImage_url(userService.getRemoteUserLogoByUserLogin(wikiContent.getLast_commit().getAuthor().getName()));
|
||||
String image_url = userService.getRemoteUserLogoByUserLogin(wikiContent.getLast_commit().getCommiter().getName());
|
||||
wikiContent.setImage_url(image_url);
|
||||
wikiContent.getLast_commit().getCommiter().setImage_url(image_url);
|
||||
wikiContent.getLast_commit().getAuthor().setImage_url(image_url);
|
||||
User commitUser = userService.getUserByLogin(wikiContent.getLast_commit().getAuthor().getName());
|
||||
if(commitUser != null){
|
||||
wikiContent.setUserName(StringUtils.isEmpty(commitUser.getNickname()) ? commitUser.getLogin() : commitUser.getNickname());
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.microservices.wiki.contoller.wiki;
|
||||
package com.microservices.wiki.controller.wiki;
|
||||
|
||||
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
|
|
@ -12,4 +12,6 @@ public class AuthorMessage {
|
|||
private Date date;
|
||||
|
||||
private String email;
|
||||
|
||||
private String image_url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,6 @@ public class CommitMessage {
|
|||
private String message;
|
||||
|
||||
private AuthorMessage author;
|
||||
|
||||
private AuthorMessage commiter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.microservices.wiki.domain.wiki.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WikiRevisionsVo {
|
||||
private List<CommitMessage> commits;
|
||||
|
||||
private Integer count;
|
||||
}
|
||||
|
|
@ -1,18 +1,22 @@
|
|||
package com.microservices.wiki.service.wiki;
|
||||
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.github.jhonnymertz.wkhtmltopdf.wrapper.Pdf;
|
||||
import com.github.jhonnymertz.wkhtmltopdf.wrapper.configurations.WrapperConfig;
|
||||
import com.github.jhonnymertz.wkhtmltopdf.wrapper.params.Param;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.wiki.domain.projects.Projects;
|
||||
import com.microservices.wiki.domain.sys.User;
|
||||
import com.microservices.wiki.domain.sys.UserVo;
|
||||
import com.microservices.wiki.domain.wiki.Wiki;
|
||||
import com.microservices.wiki.domain.wiki.WikiContentSimple;
|
||||
import com.microservices.wiki.domain.wiki.WikiPage;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiCloneLinkVo;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiPageVo;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiRevisionsVo;
|
||||
import com.microservices.wiki.domain.wiki.vo.WikiVo;
|
||||
import com.microservices.wiki.mapper.members.MembersMapper;
|
||||
import com.microservices.wiki.mapper.projects.ProjectsMapper;
|
||||
|
|
@ -20,6 +24,7 @@ import com.microservices.wiki.mapper.team_projects.TeamProjectsMapper;
|
|||
import com.microservices.wiki.refactoring.response.HttpClientResult;
|
||||
import com.microservices.wiki.refactoring.utils.*;
|
||||
import com.microservices.wiki.service.sys.UserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -82,9 +87,9 @@ public class WikiService {
|
|||
urlFormat += "?access_token=" + giteaToken;
|
||||
}
|
||||
String completeUrl = giteaApiDomain + urlFormat;
|
||||
logger.info("completeUrl:" + completeUrl);
|
||||
logger.info("getWikiPages completeUrl:{}", completeUrl);
|
||||
HttpClientResult httpClientResult = HttpClientUtils.doGet(completeUrl, null);
|
||||
logger.info("httpClientResultCode:" + httpClientResult.getCode());
|
||||
logger.info("httpClientResultCode:{}", httpClientResult.getCode());
|
||||
return httpClientResult;
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +111,7 @@ public class WikiService {
|
|||
urlFormat += "?access_token=" + giteaToken;
|
||||
}
|
||||
String completeUrl = URL + urlFormat;
|
||||
logger.info("completeUrl: " + completeUrl);
|
||||
logger.info("getWiki completeUrl: {}", completeUrl);
|
||||
return HttpClientUtils.doGet(completeUrl, null, null);
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +122,7 @@ public class WikiService {
|
|||
Map<String, String> params;
|
||||
WikiVo wikiVo = BeanCopyUtils.beanPropertiesCopy(wiki, WikiVo.class);
|
||||
params = ConvertBean.convertToStringMap(wikiVo);
|
||||
logger.info("completeUrl: " + URL + urlFormat);
|
||||
logger.info("completeUrl: {}{}", URL, urlFormat);
|
||||
String completeUrl = URL + urlFormat;
|
||||
return HttpClientUtils.doPost(completeUrl, null, params);
|
||||
}
|
||||
|
|
@ -129,7 +134,7 @@ public class WikiService {
|
|||
String pageName = wiki.getTitle();
|
||||
String urlFormat = String.format("/repos/%s/%s/wiki/page/%s?access_token=%s", owner, repo, pageName, giteaToken);
|
||||
String completeUrl = URL + urlFormat;
|
||||
logger.info("delete completeUrl " + completeUrl);
|
||||
logger.info("delete completeUrl {}", completeUrl);
|
||||
return HttpClientUtils.doDelete(completeUrl);
|
||||
}
|
||||
|
||||
|
|
@ -140,10 +145,52 @@ public class WikiService {
|
|||
String urlFormat = String.format("/repos/%s/%s/wiki/page/%s?access_token=%s", owner, repo, pageName, giteaToken);
|
||||
WikiVo wikiVo = BeanCopyUtils.beanPropertiesCopy(wiki, WikiVo.class);
|
||||
String completeUrl = URL + urlFormat;
|
||||
logger.info("completeUrl: " + completeUrl);
|
||||
logger.info("completeUrl: {}", completeUrl);
|
||||
return HttpClientUtils.doPatch(completeUrl, ConvertBean.convertToStringMap(wikiVo));
|
||||
}
|
||||
|
||||
public WikiRevisionsVo getWikiRevisions(String owner, String repo, String pageName, String URL, String giteaToken) throws Exception {
|
||||
String urlFormat = String.format("/repos/%s/%s/wiki/revisions/%s", owner, repo, pageName);
|
||||
if (giteaToken != null) {
|
||||
urlFormat += "?access_token=" + giteaToken;
|
||||
}
|
||||
String completeUrl = URL + urlFormat;
|
||||
logger.info("getWikiRevisions completeUrl: {}", completeUrl);
|
||||
HttpClientResult httpClientResult = HttpClientUtils.doGet(completeUrl, null, null);
|
||||
if (httpClientResult == null) {
|
||||
throw new ServiceException("获取wiki历史版本列表数据异常");
|
||||
}
|
||||
if (httpClientResult.getCode() != 200) {
|
||||
throw new ServiceException(httpClientResult.getCode(),"操作失败", httpClientResult.getContent());
|
||||
}
|
||||
WikiRevisionsVo wikiRevisionsVo = JSON.parseObject(httpClientResult.getContent(), WikiRevisionsVo.class);
|
||||
wikiRevisionsVo.getCommits().forEach(commit -> {
|
||||
commit.getCommiter().setImage_url(userService.getRemoteUserLogoByUserLogin(commit.getCommiter().getName()));
|
||||
User commitUser = userService.getUserByLogin(commit.getCommiter().getName());
|
||||
if(commitUser != null){
|
||||
commit.getCommiter().setName(StringUtils.isEmpty(commitUser.getNickname()) ? commitUser.getLogin() : commitUser.getNickname());
|
||||
}
|
||||
|
||||
commit.getAuthor().setImage_url(userService.getRemoteUserLogoByUserLogin(commit.getAuthor().getName()));
|
||||
User authorUser = userService.getUserByLogin(commit.getAuthor().getName());
|
||||
if(authorUser != null){
|
||||
commit.getAuthor().setName(StringUtils.isEmpty(authorUser.getNickname()) ? authorUser.getLogin() : authorUser.getNickname());
|
||||
}
|
||||
});
|
||||
|
||||
return wikiRevisionsVo;
|
||||
}
|
||||
|
||||
public HttpClientResult getPreviousWiki(String owner, String repo, String pageName, String sha, String URL, String giteaToken) throws Exception {
|
||||
String urlFormat = String.format("/repos/%s/%s/wiki/revisions/%s/%s", owner, repo, pageName, sha);
|
||||
if (giteaToken != null) {
|
||||
urlFormat += "?access_token=" + giteaToken;
|
||||
}
|
||||
String completeUrl = URL + urlFormat;
|
||||
logger.info("getPreviousWiki completeUrl: {}", completeUrl);
|
||||
return HttpClientUtils.doGet(completeUrl, null, null);
|
||||
}
|
||||
|
||||
|
||||
public String StringToURLEncode(String s) throws UnsupportedEncodingException {
|
||||
s = java.net.URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "-").replaceAll("\\*", "%2A");
|
||||
|
|
@ -224,7 +271,7 @@ public class WikiService {
|
|||
if (httpClientResult1.getCode() == 200) {
|
||||
WikiContentSimple wikiContentSimple = FastJsonUtils.toBean(httpClientResult1.getContent(), WikiContentSimple.class);
|
||||
fileUtils.writeStringToFile(wikiContentSimple.getContent_base64(), wikiContentSimple.getTitle() + ".md", dirPath);
|
||||
logger.info("wikiContent" + wikiContentSimple.getSimple_content());
|
||||
logger.info("wikiContent:{}", wikiContentSimple.getSimple_content());
|
||||
}
|
||||
}
|
||||
downLoadZip(response, repoName, dirPath);
|
||||
|
|
@ -309,7 +356,7 @@ public class WikiService {
|
|||
org.apache.commons.io.FileUtils.forceDelete(new File(completeDestPath));
|
||||
org.apache.commons.io.FileUtils.forceDelete(new File(dirPath));
|
||||
} catch (IOException e) {
|
||||
logger.warn("delete scratch zip file fail: " + completeDestPath);
|
||||
logger.warn("delete scratch zip file fail: {}", completeDestPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +379,7 @@ public class WikiService {
|
|||
try {
|
||||
org.apache.commons.io.FileUtils.forceDelete(new File(filePath));
|
||||
} catch (IOException e) {
|
||||
logger.warn("delete scratch file fail: " + filePath);
|
||||
logger.warn("delete scratch file fail: {}", filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue