Merge remote-tracking branch 'origin/dev_PMS' into dev_PMS
This commit is contained in:
commit
bc00c8b2ce
|
@ -209,65 +209,76 @@ public class PmsCommonAsyncServiceImpl implements IPmsCommonAsyncService {
|
|||
@Override
|
||||
public void syncGitlinkOrganizationUserToPmsEnterprise(Long enterpriseId, List<GitLinkUserToEnterpriseInputVo> gitLinkUserToEnterpriseInputVoList) {
|
||||
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseById(enterpriseId);
|
||||
pmsEnterpriseService.increaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
// 获取组织下所有团队
|
||||
List<GitlinkOrganizationTeamVo> gitlinkOrganizationTeamVoList = pmsCommonService.getAllGitlinkOrgTeams(pmsEnterprise.getGitlinkOrgId());
|
||||
// 根据权限标识判断是否为Owner团队
|
||||
Long ownerTeamId = getGitlinkOrgTeamIdByTeamKey(pmsEnterprise, PmsConstants.GITLINK_ORGANIZATION_TEAM_OWNER);
|
||||
Long pmsProjectAdminTeamId = getGitlinkOrgTeamIdByTeamKey(pmsEnterprise, PmsConstants.GITLINK_ORGANIZATION_TEAM_ADMIN);
|
||||
Long pmsUserTeamId = getGitlinkOrgTeamIdByTeamKey(pmsEnterprise, PmsConstants.GITLINK_ORGANIZATION_TEAM_WRITE);
|
||||
try {
|
||||
pmsEnterpriseService.increaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
// 获取组织下所有团队
|
||||
List<GitlinkOrganizationTeamVo> gitlinkOrganizationTeamVoList = pmsCommonService.getAllGitlinkOrgTeams(pmsEnterprise.getGitlinkOrgId());
|
||||
// 根据权限标识判断是否为Owner团队
|
||||
Long ownerTeamId = getGitlinkOrgTeamIdByTeamKey(pmsEnterprise, PmsConstants.GITLINK_ORGANIZATION_TEAM_OWNER);
|
||||
Long pmsProjectAdminTeamId = getGitlinkOrgTeamIdByTeamKey(pmsEnterprise, PmsConstants.GITLINK_ORGANIZATION_TEAM_ADMIN);
|
||||
Long pmsUserTeamId = getGitlinkOrgTeamIdByTeamKey(pmsEnterprise, PmsConstants.GITLINK_ORGANIZATION_TEAM_WRITE);
|
||||
|
||||
JSONObject addUserToTeam = new JSONObject();
|
||||
// 将用户添加到微服务部门中并调整到对应团队中
|
||||
for (GitLinkUserToEnterpriseInputVo gitLinkUserToEnterpriseInputVo : gitLinkUserToEnterpriseInputVoList) {
|
||||
SysUser sysUser = pmsEnterpriseService.getSysUserByGitLinkUserId(gitLinkUserToEnterpriseInputVo.getUserId());
|
||||
// 将用户添加到该部门下的身份
|
||||
remoteUserService.addUserIdentify(pmsEnterprise.getDeptId(), sysUser.getUserId(), gitLinkUserToEnterpriseInputVo.getRoleKey(), SecurityConstants.INNER, SecurityUtils.getUserKey());
|
||||
// 将用户添加到对应团队中
|
||||
addUserToTeam.put("username", sysUser.getUserName());
|
||||
SystemRole systemRole = SystemRole.getSystemRole(gitLinkUserToEnterpriseInputVo.getRoleKey());
|
||||
switch (systemRole) {
|
||||
case PMS_ORG_ADMIN: {
|
||||
gitLinkRequestHelper.doPost(
|
||||
PmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(pmsEnterprise.getEnterpriseIdentifier(), ownerTeamId), addUserToTeam);
|
||||
break;
|
||||
}
|
||||
case PMS_PROJECT_MANAGER: {
|
||||
gitLinkRequestHelper.doPost(
|
||||
PmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(pmsEnterprise.getEnterpriseIdentifier(), pmsProjectAdminTeamId), addUserToTeam);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
gitLinkRequestHelper.doPost(
|
||||
PmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(pmsEnterprise.getEnterpriseIdentifier(), pmsUserTeamId), addUserToTeam);
|
||||
break;
|
||||
JSONObject addUserToTeam = new JSONObject();
|
||||
// 将用户添加到微服务部门中并调整到对应团队中
|
||||
for (GitLinkUserToEnterpriseInputVo gitLinkUserToEnterpriseInputVo : gitLinkUserToEnterpriseInputVoList) {
|
||||
SysUser sysUser = pmsEnterpriseService.getSysUserByGitLinkUserId(gitLinkUserToEnterpriseInputVo.getUserId());
|
||||
// 将用户添加到该部门下的身份
|
||||
remoteUserService.addUserIdentify(pmsEnterprise.getDeptId(), sysUser.getUserId(), gitLinkUserToEnterpriseInputVo.getRoleKey(), SecurityConstants.INNER, SecurityUtils.getUserKey());
|
||||
// 将用户添加到对应团队中
|
||||
addUserToTeam.put("username", sysUser.getUserName());
|
||||
SystemRole systemRole = SystemRole.getSystemRole(gitLinkUserToEnterpriseInputVo.getRoleKey());
|
||||
switch (systemRole) {
|
||||
case PMS_ORG_ADMIN: {
|
||||
gitLinkRequestHelper.doPost(
|
||||
PmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(pmsEnterprise.getEnterpriseIdentifier(), ownerTeamId), addUserToTeam);
|
||||
break;
|
||||
}
|
||||
case PMS_PROJECT_MANAGER: {
|
||||
gitLinkRequestHelper.doPost(
|
||||
PmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(pmsEnterprise.getEnterpriseIdentifier(), pmsProjectAdminTeamId), addUserToTeam);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
gitLinkRequestHelper.doPost(
|
||||
PmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(pmsEnterprise.getEnterpriseIdentifier(), pmsUserTeamId), addUserToTeam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除除Owner团队、项目管理员团队和普通成员团队外的所有团队
|
||||
gitlinkOrganizationTeamVoList = gitlinkOrganizationTeamVoList
|
||||
.stream()
|
||||
.filter(x -> !ownerTeamId.equals(x.getId()) && !pmsProjectAdminTeamId.equals(x.getId()) && !pmsUserTeamId.equals(x.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (GitlinkOrganizationTeamVo gitlinkOrganizationTeamVo : gitlinkOrganizationTeamVoList) {
|
||||
gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ORGANIZATION_TEAM(pmsEnterprise.getGitlinkOrgId(), gitlinkOrganizationTeamVo.getId()));
|
||||
//删除除Owner团队、项目管理员团队和普通成员团队外的所有团队
|
||||
gitlinkOrganizationTeamVoList = gitlinkOrganizationTeamVoList
|
||||
.stream()
|
||||
.filter(x -> !ownerTeamId.equals(x.getId()) && !pmsProjectAdminTeamId.equals(x.getId()) && !pmsUserTeamId.equals(x.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (GitlinkOrganizationTeamVo gitlinkOrganizationTeamVo : gitlinkOrganizationTeamVoList) {
|
||||
gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ORGANIZATION_TEAM(pmsEnterprise.getGitlinkOrgId(), gitlinkOrganizationTeamVo.getId()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("同步Gitlink组织用户到企业失败:{0}", e);
|
||||
} finally {
|
||||
pmsEnterpriseService.decreaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
}
|
||||
pmsEnterpriseService.decreaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void syncInitPmsEnterpriseData(Long id, Long creatorGitLinkUserId) {
|
||||
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseById(id);
|
||||
pmsEnterpriseService.increaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
Long pmsProjectId = initializePmsProject(id, creatorGitLinkUserId);
|
||||
initializePmsProjectIssues(pmsProjectId, creatorGitLinkUserId);
|
||||
Long pmsProjectSprintId = initializePmsProjectSprint(pmsProjectId, creatorGitLinkUserId);
|
||||
Long pmsTestcaseId = initializePmsTestcase(pmsProjectId, creatorGitLinkUserId);
|
||||
Long pmsTestSheetId = initializePmsTestSheet(pmsProjectId, creatorGitLinkUserId, pmsProjectSprintId, pmsTestcaseId);
|
||||
initializePmsTestReport(pmsProjectId, pmsTestSheetId);
|
||||
pmsEnterpriseService.decreaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
try {
|
||||
pmsEnterpriseService.increaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
Long pmsProjectId = initializePmsProject(id, creatorGitLinkUserId);
|
||||
initializePmsProjectIssues(pmsProjectId, creatorGitLinkUserId);
|
||||
Long pmsProjectSprintId = initializePmsProjectSprint(pmsProjectId, creatorGitLinkUserId);
|
||||
Long pmsTestcaseId = initializePmsTestcase(pmsProjectId, creatorGitLinkUserId);
|
||||
Long pmsTestSheetId = initializePmsTestSheet(pmsProjectId, creatorGitLinkUserId, pmsProjectSprintId, pmsTestcaseId);
|
||||
initializePmsTestReport(pmsProjectId, pmsTestSheetId);
|
||||
} catch (Exception e) {
|
||||
logger.error("初始化企业数据失败:{0}", e);
|
||||
} finally {
|
||||
pmsEnterpriseService.decreaseOpenEnterpriseProcessCount(pmsEnterprise.getGitlinkOrgId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initializePmsTestReport(Long pmsProjectId, Long pmsTestSheetId) {
|
||||
|
|
|
@ -265,11 +265,11 @@ public class PmsEnterpriseServiceImpl implements IPmsEnterpriseService {
|
|||
}
|
||||
|
||||
private String createEnterprise(PmsEnterprise pmsEnterpriseInput, List<GitLinkUserToEnterpriseInputVo> gitLinkUserToEnterpriseInputVoList) {
|
||||
increaseOpenEnterpriseProcessCount(pmsEnterpriseInput.getGitlinkOrgId());
|
||||
// 当前会话中忽略数据权限校验
|
||||
SecurityUtils.setIgnoreDataScopeCheck();
|
||||
checkPmsEnterprise(pmsEnterpriseInput);
|
||||
try {
|
||||
increaseOpenEnterpriseProcessCount(pmsEnterpriseInput.getGitlinkOrgId());
|
||||
// 基于企业信息在若依下新建部门
|
||||
Long deptId = FeignUtils.getReturnData(remoteDeptService.addDeptByPmsEnterprise(pmsEnterpriseInput.getEnterpriseName(), SecurityConstants.INNER));
|
||||
pmsEnterpriseInput.setDeptId(deptId);
|
||||
|
|
|
@ -125,7 +125,7 @@ public class PmsProjectController extends BaseController
|
|||
return toAjax(pmsProjectService.editProjectNotice(pmsProjectNoticeUpdateVo));
|
||||
}
|
||||
|
||||
@RequiresPermissions(value = {"system:notice:query", "pms:pmsProject:noticeManage"}, logical = Logical.OR)
|
||||
@RequiresPermissions(value = {"system:notice:query", "pms:pmsProject:noticeManage", "pms:pmsProject:show", "pms:pmsProject:showMe"}, logical = Logical.OR)
|
||||
@GetMapping("/getNotice/{noticeId}")
|
||||
@ApiOperation(value = "获取项目公告详情")
|
||||
public AjaxResult getProjectNotice( @PathVariable Long noticeId) {
|
||||
|
|
Loading…
Reference in New Issue