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