|
@@ -91,8 +91,6 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
@Autowired
|
|
@Autowired
|
|
private AppManageUtil appManageUtil;
|
|
private AppManageUtil appManageUtil;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
private final ReentrantLock lock = new ReentrantLock();
|
|
private final ReentrantLock lock = new ReentrantLock();
|
|
private final String UNCHECK_TAG_BASE_PATH = "AppInfouncheckTag:";
|
|
private final String UNCHECK_TAG_BASE_PATH = "AppInfouncheckTag:";
|
|
|
|
|
|
@@ -117,7 +115,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
appBaseInfo.setDelFlag(1);
|
|
appBaseInfo.setDelFlag(1);
|
|
baseInfoMapper.insert(appBaseInfo);
|
|
baseInfoMapper.insert(appBaseInfo);
|
|
|
|
|
|
- // 提交至工作流的表单信息(将用户id换成用户账号,字典值换成字典文本)
|
|
|
|
|
|
+ // 提交至工作流的表单信息(将用户id换成用户账账号)
|
|
AppBaseInfo sendCheck_appBaseInfo = appBaseInfo;
|
|
AppBaseInfo sendCheck_appBaseInfo = appBaseInfo;
|
|
sendCheck_appBaseInfo.setAdmin(customMapper.queryUsernameByUserId(appBaseInfo.getAdmin()));
|
|
sendCheck_appBaseInfo.setAdmin(customMapper.queryUsernameByUserId(appBaseInfo.getAdmin()));
|
|
if (appBaseInfo.getDevelopUser()!=null)
|
|
if (appBaseInfo.getDevelopUser()!=null)
|
|
@@ -128,19 +126,17 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
sendCheck_appBaseInfo.setRequirementUser(customMapper.queryUsernameByUserId(appBaseInfo.getRequirementUser()));
|
|
sendCheck_appBaseInfo.setRequirementUser(customMapper.queryUsernameByUserId(appBaseInfo.getRequirementUser()));
|
|
if (appBaseInfo.getBusinessUser()!=null)
|
|
if (appBaseInfo.getBusinessUser()!=null)
|
|
sendCheck_appBaseInfo.setBusinessUser(customMapper.queryUsernameByUserId(appBaseInfo.getBusinessUser()));
|
|
sendCheck_appBaseInfo.setBusinessUser(customMapper.queryUsernameByUserId(appBaseInfo.getBusinessUser()));
|
|
-// sendCheck_appBaseInfo.setType(sysDictService.queryDictTextByKey("app_type", appBaseInfo.getType()));
|
|
|
|
-// sendCheck_appBaseInfo.setStatus(sysDictService.queryDictTextByKey("app_status", appBaseInfo.getStatus()));
|
|
|
|
AppDocInfo appDocInfo = appInfo.getAppDocInfoDTO();
|
|
AppDocInfo appDocInfo = appInfo.getAppDocInfoDTO();
|
|
boolean hasEnvInfo = false;
|
|
boolean hasEnvInfo = false;
|
|
if (appInfo.getAppEnvInfoDTO()!=null) hasEnvInfo = appInfo.getAppEnvInfoDTO().size()>0;
|
|
if (appInfo.getAppEnvInfoDTO()!=null) hasEnvInfo = appInfo.getAppEnvInfoDTO().size()>0;
|
|
|
|
+ boolean tag; // 流程发送结果标志
|
|
|
|
+ String appid = appBaseInfo.getId();
|
|
// 简易注册模式下添加基础信息即可
|
|
// 简易注册模式下添加基础信息即可
|
|
if (appBaseInfo.getAddType().equals("easy")){
|
|
if (appBaseInfo.getAddType().equals("easy")){
|
|
- boolean tag = appManageUtil.sendCheckWordFlow(sendCheck_appBaseInfo, "021", loginUser.getUsername(), "admin");
|
|
|
|
|
|
+ tag = appManageUtil.sendCheckWordFlow(sendCheck_appBaseInfo, "021", loginUser.getUsername(), "admin");
|
|
// 发起流程失败则删除数据库内数据
|
|
// 发起流程失败则删除数据库内数据
|
|
- if (tag){
|
|
|
|
- return "提交成功";
|
|
|
|
- } else {
|
|
|
|
- baseInfoMapper.deleteAppInfoNotLogic(appBaseInfo.getId());
|
|
|
|
|
|
+ if (!tag){
|
|
|
|
+ customMapper.deleteAppBaseInfoNotLogic(appid);
|
|
return "提交失败";
|
|
return "提交失败";
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
@@ -152,17 +148,25 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
AppManageUtil appManageUtil = new AppManageUtil();
|
|
AppManageUtil appManageUtil = new AppManageUtil();
|
|
appRegisterWorkFlowFormEntity = appManageUtil.TransitionEnvInfoToAppRegisterWorkFlowForm(appRegisterWorkFlowFormEntity, appInfo.getAppEnvInfoDTO());
|
|
appRegisterWorkFlowFormEntity = appManageUtil.TransitionEnvInfoToAppRegisterWorkFlowForm(appRegisterWorkFlowFormEntity, appInfo.getAppEnvInfoDTO());
|
|
}
|
|
}
|
|
- appManageUtil.sendCheckWordFlow(appRegisterWorkFlowFormEntity, "022",loginUser.getUsername(),"admin");
|
|
|
|
|
|
+ tag = appManageUtil.sendCheckWordFlow(appRegisterWorkFlowFormEntity, "022", loginUser.getUsername(), "admin");
|
|
|
|
+ // 发起流程失败则删除数据库内数据
|
|
|
|
+ if (!tag){
|
|
|
|
+ customMapper.deleteAppBaseInfoNotLogic(appid);
|
|
|
|
+ customMapper.deleteAppDocInfoNotLogic(appid);
|
|
|
|
+ customMapper.deleteAppEnvInfoNotLogic(appid);
|
|
|
|
+ customMapper.deleteAppUserInfoNotLogic(appid);
|
|
|
|
+ return "提交失败";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- String appid = appBaseInfo.getId();
|
|
|
|
-
|
|
|
|
// 添加应用用户信息
|
|
// 添加应用用户信息
|
|
- appInfo.getUserInfo().forEach(userid -> {
|
|
|
|
- AppUserInfo userInfo = new AppUserInfo();
|
|
|
|
- userInfo.setAppid(appid);
|
|
|
|
- userInfo.setUserid(userid);
|
|
|
|
- userInfoMapper.insert(userInfo);
|
|
|
|
- });
|
|
|
|
|
|
+ if (appInfo.getUserInfo()!=null){
|
|
|
|
+ appInfo.getUserInfo().forEach(userid -> {
|
|
|
|
+ AppUserInfo userInfo = new AppUserInfo();
|
|
|
|
+ userInfo.setAppid(appid);
|
|
|
|
+ userInfo.setUserid(userid);
|
|
|
|
+ userInfoMapper.insert(userInfo);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
// 添加应用环境信息
|
|
// 添加应用环境信息
|
|
if (hasEnvInfo){
|
|
if (hasEnvInfo){
|
|
@@ -172,9 +176,10 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 添加应用文档信息
|
|
// 添加应用文档信息
|
|
- appDocInfo.setAppid(appid);
|
|
|
|
- docInfoMapper.insert(appDocInfo);
|
|
|
|
-
|
|
|
|
|
|
+ if (appDocInfo!=null){
|
|
|
|
+ appDocInfo.setAppid(appid);
|
|
|
|
+ docInfoMapper.insert(appDocInfo);
|
|
|
|
+ }
|
|
return "提交成功";
|
|
return "提交成功";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -183,6 +188,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
* @param ids 应用id集合
|
|
* @param ids 应用id集合
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional
|
|
@Override
|
|
@Override
|
|
public Boolean deleteAppInfo(String[] ids) {
|
|
public Boolean deleteAppInfo(String[] ids) {
|
|
// 需先判断用户是否拥有所删除的应用信息的权限(平台管理员-应用管理员)
|
|
// 需先判断用户是否拥有所删除的应用信息的权限(平台管理员-应用管理员)
|
|
@@ -238,7 +244,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Boolean editBaseInfo(AppBaseInfo baseInfo) throws Exception {
|
|
|
|
|
|
+ public Boolean editBaseInfo(AppBaseInfo baseInfo) {
|
|
|
|
|
|
int i = baseInfoMapper.updateById(baseInfo);
|
|
int i = baseInfoMapper.updateById(baseInfo);
|
|
// 保存成功解除反审核状态
|
|
// 保存成功解除反审核状态
|
|
@@ -246,6 +252,11 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
return i>0;
|
|
return i>0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 修改应用环境信息
|
|
|
|
+ * @param editEnvInfoEntity
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public Boolean editEnvInfo(AppEditEnvInfoEntity editEnvInfoEntity) {
|
|
public Boolean editEnvInfo(AppEditEnvInfoEntity editEnvInfoEntity) {
|
|
@@ -350,7 +361,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
* @param key 模糊查询关键字
|
|
* @param key 模糊查询关键字
|
|
* @param type 应用类型
|
|
* @param type 应用类型
|
|
* @param status 应用状态
|
|
* @param status 应用状态
|
|
- * @param userid 用户id
|
|
|
|
|
|
+ * @param userid 用户id (暂放)
|
|
* @return 应用基础信息集合
|
|
* @return 应用基础信息集合
|
|
*/
|
|
*/
|
|
|
|
|
|
@@ -372,7 +383,6 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
appBaseInfoS.add(baseInfo);
|
|
appBaseInfoS.add(baseInfo);
|
|
});
|
|
});
|
|
redisUtil.set("appManagerInfo", appManagerInfo, 60*60*24);
|
|
redisUtil.set("appManagerInfo", appManagerInfo, 60*60*24);
|
|
- // 使用 Collections.sort() 方法进行排序
|
|
|
|
|
|
|
|
return appBaseInfoS;
|
|
return appBaseInfoS;
|
|
// if(userid!=null){
|
|
// if(userid!=null){
|
|
@@ -409,9 +419,10 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<AppEnvInfo> queryEnvInfoByAppId(String appid) {
|
|
public List<AppEnvInfo> queryEnvInfoByAppId(String appid) {
|
|
|
|
+ // 该用户是否可以查看当前应用的应用信息
|
|
List<AppEnvInfo> envInfos = envInfoMapper.
|
|
List<AppEnvInfo> envInfos = envInfoMapper.
|
|
- selectList(new QueryWrapper<AppEnvInfo>().eq("appid", appid));
|
|
|
|
- return envInfos;
|
|
|
|
|
|
+ selectList(new QueryWrapper<AppEnvInfo>().eq("appid", appid));
|
|
|
|
+ return envInfos;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -429,7 +440,6 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
* 应用用户查询功能
|
|
* 应用用户查询功能
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public AppEditUserInfoEntity queryAppUser(AppUserInfoQueryParams queryParams) {
|
|
public AppEditUserInfoEntity queryAppUser(AppUserInfoQueryParams queryParams) {
|
|
List<Map<String, Object>> appUserInfos = new ArrayList<>();
|
|
List<Map<String, Object>> appUserInfos = new ArrayList<>();
|
|
@@ -454,15 +464,15 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
|
|
|
// 判断当前用户是否可进行编辑操作
|
|
// 判断当前用户是否可进行编辑操作
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
- String managerId = "";
|
|
|
|
- Map<String, String> appManagerInfo = new HashMap<>();
|
|
|
|
- appManagerInfo = (Map<String, String>) redisUtil.get("appManagerInfo");
|
|
|
|
|
|
+ String managerId;
|
|
|
|
+ Map<String, String> appManagerUserInfo; // 应用管理员信息
|
|
// 先从 redis 查询应用管理员信息,如果为空,则查询数据库
|
|
// 先从 redis 查询应用管理员信息,如果为空,则查询数据库
|
|
- if (appManagerInfo == null) {
|
|
|
|
|
|
+ appManagerUserInfo = (Map<String, String>) redisUtil.get("appManagerInfo");
|
|
|
|
+ if (appManagerUserInfo == null) {
|
|
AppBaseInfo baseInfoPO = baseInfoMapper.selectById(queryParams.getAppid());
|
|
AppBaseInfo baseInfoPO = baseInfoMapper.selectById(queryParams.getAppid());
|
|
managerId = baseInfoPO.getAdmin();
|
|
managerId = baseInfoPO.getAdmin();
|
|
}else {
|
|
}else {
|
|
- managerId = appManagerInfo.get(queryParams.getAppid());
|
|
|
|
|
|
+ managerId = appManagerUserInfo.get(queryParams.getAppid());
|
|
}
|
|
}
|
|
editUserInfoEntity.setIsEdit(loginUser.getId().equals(managerId));
|
|
editUserInfoEntity.setIsEdit(loginUser.getId().equals(managerId));
|
|
AppBaseInfo appBaseInfo = baseInfoMapper.selectById(queryParams.getAppid());
|
|
AppBaseInfo appBaseInfo = baseInfoMapper.selectById(queryParams.getAppid());
|
|
@@ -470,12 +480,12 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
appUserInfos.forEach(map -> {
|
|
appUserInfos.forEach(map -> {
|
|
String roleNameInfo = appManageUtil.baseInfoToUserInfoRoles(appBaseInfo, (String) map.get("id"));
|
|
String roleNameInfo = appManageUtil.baseInfoToUserInfoRoles(appBaseInfo, (String) map.get("id"));
|
|
List<String> roleIds = sysUserRoleService.listByAppId(queryParams.getAppid(), (String) map.get("id"));
|
|
List<String> roleIds = sysUserRoleService.listByAppId(queryParams.getAppid(), (String) map.get("id"));
|
|
-
|
|
|
|
|
|
+ // 查询角色名信息
|
|
if (!roleIds.isEmpty()){
|
|
if (!roleIds.isEmpty()){
|
|
- // 查询角色名信息
|
|
|
|
QueryWrapper<SysRole> sysRoleQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysRole> sysRoleQueryWrapper = new QueryWrapper<>();
|
|
sysRoleQueryWrapper.select("role_name").in("id", roleIds);
|
|
sysRoleQueryWrapper.select("role_name").in("id", roleIds);
|
|
List<SysRole> sysRoles = sysRoleMapper.selectList(sysRoleQueryWrapper);
|
|
List<SysRole> sysRoles = sysRoleMapper.selectList(sysRoleQueryWrapper);
|
|
|
|
+ // 角色信息拼接
|
|
if (!sysRoles.isEmpty()&&!roleNameInfo.isEmpty()){
|
|
if (!sysRoles.isEmpty()&&!roleNameInfo.isEmpty()){
|
|
roleNameInfo =roleNameInfo +", "+ sysRoles.stream()
|
|
roleNameInfo =roleNameInfo +", "+ sysRoles.stream()
|
|
.map(SysRole::getRoleName)
|
|
.map(SysRole::getRoleName)
|
|
@@ -489,7 +499,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
map.put("roles", roleNameInfo);
|
|
map.put("roles", roleNameInfo);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }else { // 作为添加表单时的查询(查询全部用户), 角色分配用户时亦使用
|
|
|
|
|
|
+ }else { // 作为添加表单时的查询(查询全部用户)
|
|
appUserInfos = sysUserService.userComplexCondition(queryParams.getUserids(),
|
|
appUserInfos = sysUserService.userComplexCondition(queryParams.getUserids(),
|
|
queryParams.getUsername(),
|
|
queryParams.getUsername(),
|
|
queryParams.getRealname(),
|
|
queryParams.getRealname(),
|
|
@@ -497,7 +507,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
queryParams.getFilteruserids(),
|
|
queryParams.getFilteruserids(),
|
|
queryParams.getPageNo());
|
|
queryParams.getPageNo());
|
|
}
|
|
}
|
|
- // 如果查询到的用户不为空,则取appUserInfos最后一个值为total值,并将appUserInfos最后一个值删除
|
|
|
|
|
|
+ // 如果查询到的用户不为空,则取appUserInfos最后一个值为total值(分页使用),并将appUserInfos最后一个值删除
|
|
if (!appUserInfos.isEmpty()){
|
|
if (!appUserInfos.isEmpty()){
|
|
editUserInfoEntity.setTotal((Integer) appUserInfos.get(appUserInfos.size()-1).get("total"));
|
|
editUserInfoEntity.setTotal((Integer) appUserInfos.get(appUserInfos.size()-1).get("total"));
|
|
appUserInfos.remove(appUserInfos.size()-1);
|
|
appUserInfos.remove(appUserInfos.size()-1);
|
|
@@ -609,6 +619,8 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
public boolean isAppAdminOrDevOrOpe(String appid) {
|
|
public boolean isAppAdminOrDevOrOpe(String appid) {
|
|
// 获取当前登录用户
|
|
// 获取当前登录用户
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+ // 如果是平台管理员
|
|
|
|
+ if (loginUser.getUsername().equals("admin")) return true;
|
|
AppBaseInfo baseInfo = baseInfoMapper.selectById(appid);
|
|
AppBaseInfo baseInfo = baseInfoMapper.selectById(appid);
|
|
if (baseInfo!=null){
|
|
if (baseInfo!=null){
|
|
if (baseInfo.getAdmin().equals(loginUser.getId())) return true;
|
|
if (baseInfo.getAdmin().equals(loginUser.getId())) return true;
|
|
@@ -619,10 +631,12 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- // 判断当前用户是否有编辑当前信息的权限
|
|
|
|
|
|
+ // 判断当前用户是否为当前应用的应用管理员
|
|
public boolean hasEditCurrentInfoPermission(String appid){
|
|
public boolean hasEditCurrentInfoPermission(String appid){
|
|
// 获取当前登录用户
|
|
// 获取当前登录用户
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+ // 如果是平台管理员
|
|
|
|
+ if (loginUser.getUsername().equals("admin")) return true;
|
|
// 查询基础信息的应用管理员id,比较是否和当前登录用户一致
|
|
// 查询基础信息的应用管理员id,比较是否和当前登录用户一致
|
|
QueryWrapper<AppBaseInfo> baseInfoPOQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<AppBaseInfo> baseInfoPOQueryWrapper = new QueryWrapper<>();
|
|
baseInfoPOQueryWrapper.select("admin").eq("id", appid);
|
|
baseInfoPOQueryWrapper.select("admin").eq("id", appid);
|
|
@@ -654,7 +668,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- // 应用审核通过后一系列创建应用一级菜单、默认角色、授权操作(完整注册时)
|
|
|
|
|
|
+ // 应用审核通过后续处理
|
|
public <T> void afterAppCheckPass(String appid, T formData) {
|
|
public <T> void afterAppCheckPass(String appid, T formData) {
|
|
AppBaseInfo appBaseInfo = baseInfoMapper.queryAppBaseInfoById(appid);
|
|
AppBaseInfo appBaseInfo = baseInfoMapper.queryAppBaseInfoById(appid);
|
|
appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
|
|
appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
|
|
@@ -670,12 +684,12 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
// 设置消息模板编码
|
|
// 设置消息模板编码
|
|
message.setTemplateCode("app_examineAndapprove");
|
|
message.setTemplateCode("app_examineAndapprove");
|
|
Map<String, String> templateParam = new HashMap<>();
|
|
Map<String, String> templateParam = new HashMap<>();
|
|
- templateParam.put("resultText","通过");
|
|
|
|
|
|
+ templateParam.put("resultText","应用"+appBaseInfo.getName()+"注册审核通过");
|
|
message.setTemplateParam(templateParam);
|
|
message.setTemplateParam(templateParam);
|
|
sysBaseApi.sendTemplateAnnouncement(message);
|
|
sysBaseApi.sendTemplateAnnouncement(message);
|
|
|
|
|
|
|
|
|
|
- // 判断该信息是否为完整注册
|
|
|
|
|
|
+ // 该信息为完整注册时,通过审核后添加默认角色、菜单权限、菜单信息
|
|
if (appBaseInfo.getAddType().equals("full")){
|
|
if (appBaseInfo.getAddType().equals("full")){
|
|
// 添加默认角色信息
|
|
// 添加默认角色信息
|
|
SysRole role = new SysRole();
|
|
SysRole role = new SysRole();
|
|
@@ -683,6 +697,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
role.setRoleCode("default"); // 设置角色编码
|
|
role.setRoleCode("default"); // 设置角色编码
|
|
role.setAppName(appBaseInfo.getName()) ; // 设置角色的应用名称
|
|
role.setAppName(appBaseInfo.getName()) ; // 设置角色的应用名称
|
|
role.setRoleName(appBaseInfo.getName()+"_默认用户角色"); // 设置角色名
|
|
role.setRoleName(appBaseInfo.getName()+"_默认用户角色"); // 设置角色名
|
|
|
|
+ role.setDescription(appBaseInfo.getName()+"默认角色"); // 设置备注
|
|
sysRoleService.save(role); // 添加角色
|
|
sysRoleService.save(role); // 添加角色
|
|
|
|
|
|
// 获取角色编码
|
|
// 获取角色编码
|
|
@@ -701,19 +716,39 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
sysUserController.addSysUserRole(sysUserRoleVO);
|
|
sysUserController.addSysUserRole(sysUserRoleVO);
|
|
|
|
|
|
// 创建该应用的一级菜单
|
|
// 创建该应用的一级菜单
|
|
- SysPermission sysPermission = new SysPermission();
|
|
|
|
- sysPermission.setName(appBaseInfo.getName());
|
|
|
|
- sysPermission.setAppId(appid);
|
|
|
|
- sysPermission.setUrl(appBaseInfo.getMenuInfo());
|
|
|
|
- // 设置组件(即 菜单路径去掉第一个 "/")
|
|
|
|
- String component = sysPermission.getUrl().replaceFirst("^/", "");
|
|
|
|
- sysPermission.setComponent(component);
|
|
|
|
- sysPermission.setMenuType(0);
|
|
|
|
- sysPermission.setRoute(true);
|
|
|
|
- sysPermissionService.addPermission(sysPermission);
|
|
|
|
-
|
|
|
|
- // 授予应用默认角色访问一级菜单权限
|
|
|
|
- sysRolePermissionService.saveRolePermission(roleid, sysPermission.getId(),"");
|
|
|
|
|
|
+ // 首先判断菜单是否已存在
|
|
|
|
+ SysPermission hassysPermission = customMapper.queryUrlByUrl(appBaseInfo.getMenuInfo());
|
|
|
|
+ if (hassysPermission == null){
|
|
|
|
+ SysPermission sysPermission = new SysPermission();
|
|
|
|
+ sysPermission.setName(appBaseInfo.getName());
|
|
|
|
+ sysPermission.setAppId(appid);
|
|
|
|
+ sysPermission.setUrl(appBaseInfo.getMenuInfo());
|
|
|
|
+ // 设置组件(即 菜单路径去掉第一个 "/")
|
|
|
|
+ String component = sysPermission.getUrl().replaceFirst("^/", "");
|
|
|
|
+ sysPermission.setComponent(component);
|
|
|
|
+ sysPermission.setMenuType(0);
|
|
|
|
+ sysPermission.setRoute(true);
|
|
|
|
+ sysPermissionService.addPermission(sysPermission);
|
|
|
|
+ // 授予应用默认角色访问一级菜单权限
|
|
|
|
+ sysRolePermissionService.saveRolePermission(roleid, sysPermission.getId(),"");
|
|
|
|
+ }else {
|
|
|
|
+ // 授予应用默认角色访问一级菜单权限
|
|
|
|
+ sysRolePermissionService.saveRolePermission(roleid, hassysPermission.getId(),"");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 应用注册 撤销后续处理(删除插入的数据)
|
|
|
|
+ @Override
|
|
|
|
+ public void afterUnsendAppRegisterFlow(long workID) {
|
|
|
|
+ // 通过workID获取应用id
|
|
|
|
+ String appid = customMapper.getAppidByWorkID(workID);
|
|
|
|
+ String addType = customMapper.queryAppRegisterTypeByAppid(appid);
|
|
|
|
+ customMapper.deleteAppBaseInfoNotLogic(appid);
|
|
|
|
+ if (addType.equals("full")){
|
|
|
|
+ customMapper.deleteAppDocInfoNotLogic(appid);
|
|
|
|
+ customMapper.deleteAppEnvInfoNotLogic(appid);
|
|
|
|
+ customMapper.deleteAppUserInfoNotLogic(appid);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|