|
@@ -232,7 +232,9 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
System.out.println("删除应用下角色失败:"+e);
|
|
System.out.println("删除应用下角色失败:"+e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ customMapper.deleteRoleFromPortstationtype(id);
|
|
}
|
|
}
|
|
|
|
+
|
|
// 记录日志
|
|
// 记录日志
|
|
baseCommonService.addLog("删除应用信息:id"+Arrays.toString(ids), CommonConstant.LOG_TYPE_2, 3 );
|
|
baseCommonService.addLog("删除应用信息:id"+Arrays.toString(ids), CommonConstant.LOG_TYPE_2, 3 );
|
|
return true;
|
|
return true;
|
|
@@ -245,8 +247,8 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean editBaseInfo(AppBaseInfo baseInfo) {
|
|
public Boolean editBaseInfo(AppBaseInfo baseInfo) {
|
|
-
|
|
|
|
int i = baseInfoMapper.updateById(baseInfo);
|
|
int i = baseInfoMapper.updateById(baseInfo);
|
|
|
|
+ customMapper.updateRoleToPortstationtype(baseInfo.getId(), baseInfo.getName());
|
|
// 保存成功解除反审核状态
|
|
// 保存成功解除反审核状态
|
|
if (i>0) uncheckLock("AppbaseInfo"+baseInfo.getId());
|
|
if (i>0) uncheckLock("AppbaseInfo"+baseInfo.getId());
|
|
return i>0;
|
|
return i>0;
|
|
@@ -607,7 +609,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
public boolean isAppAdmin() {
|
|
public boolean isAppAdmin() {
|
|
// 获取当前登录用户
|
|
// 获取当前登录用户
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
- List<String> userids = customMapper.queryUseridByAppAdminRole("应用管理员");
|
|
|
|
|
|
+ List<String> userids = customMapper.queryUseridByAppAdminRole();
|
|
return userids.stream().anyMatch(userid -> userid.equals(loginUser.getId()));
|
|
return userids.stream().anyMatch(userid -> userid.equals(loginUser.getId()));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -670,71 +672,74 @@ 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);
|
|
|
|
- appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
|
|
|
|
- // 以通过审批的应用信息为准更新应用信息
|
|
|
|
- int i = baseInfoMapper.updateBaseInfo(appBaseInfo);
|
|
|
|
- // 查询该应用信息
|
|
|
|
-
|
|
|
|
- String toUser = baseInfoMapper.queryUsernameById(appBaseInfo.getCreateBy());
|
|
|
|
- //给申请注册应用信息的用户发送系统消息
|
|
|
|
- TemplateMessageDTO message = new TemplateMessageDTO();
|
|
|
|
- message.setAppId("0");
|
|
|
|
- message.setToUser(toUser);
|
|
|
|
- // 设置消息模板编码
|
|
|
|
- message.setTemplateCode("app_examineAndapprove");
|
|
|
|
- Map<String, String> templateParam = new HashMap<>();
|
|
|
|
- templateParam.put("resultText","应用"+appBaseInfo.getName()+"注册审核通过");
|
|
|
|
- message.setTemplateParam(templateParam);
|
|
|
|
- sysBaseApi.sendTemplateAnnouncement(message);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 该信息为完整注册时,通过审核后添加默认角色、菜单权限、菜单信息
|
|
|
|
- if (appBaseInfo.getAddType().equals("full")){
|
|
|
|
- // 添加默认角色信息
|
|
|
|
- SysRole role = new SysRole();
|
|
|
|
- role.setAppId(appid); // 设置角色所属应用信息
|
|
|
|
- role.setRoleCode("default"); // 设置角色编码
|
|
|
|
- role.setAppName(appBaseInfo.getName()) ; // 设置角色的应用名称
|
|
|
|
- role.setRoleName(appBaseInfo.getName()+"_默认用户角色"); // 设置角色名
|
|
|
|
- role.setDescription(appBaseInfo.getName()+"默认角色"); // 设置备注
|
|
|
|
- sysRoleService.save(role); // 添加角色
|
|
|
|
-
|
|
|
|
- // 获取角色编码
|
|
|
|
- String roleid = role.getId();
|
|
|
|
-
|
|
|
|
- // 查询应用用户id集合
|
|
|
|
- QueryWrapper<AppUserInfo> appUserInfoQueryWrapper = new QueryWrapper<>();
|
|
|
|
- appUserInfoQueryWrapper.select("userid").eq("appid", appid);
|
|
|
|
- List<AppUserInfo> appUserInfos = userInfoMapper.selectList(appUserInfoQueryWrapper);
|
|
|
|
- List<String> useridlist = appUserInfos.stream().map(AppUserInfo::getUserid).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- // 应用默认角色分配给应用用户
|
|
|
|
- SysUserRoleVO sysUserRoleVO = new SysUserRoleVO();
|
|
|
|
- sysUserRoleVO.setRoleId(roleid);
|
|
|
|
- sysUserRoleVO.setUserIdList(useridlist);
|
|
|
|
- sysUserController.addSysUserRole(sysUserRoleVO);
|
|
|
|
-
|
|
|
|
- // 创建该应用的一级菜单
|
|
|
|
- // 首先判断菜单是否已存在
|
|
|
|
- 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(),"");
|
|
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ AppBaseInfo appBaseInfo = baseInfoMapper.queryAppBaseInfoById(appid);
|
|
|
|
+ appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
|
|
|
|
+ // 以通过审批的应用信息为准更新应用信息
|
|
|
|
+ int i = baseInfoMapper.updateBaseInfo(appBaseInfo);
|
|
|
|
+ String toUser = baseInfoMapper.queryUsernameById(appBaseInfo.getCreateBy());
|
|
|
|
+ //给申请注册应用信息的用户发送系统消息
|
|
|
|
+ TemplateMessageDTO message = new TemplateMessageDTO();
|
|
|
|
+ message.setAppId("0");
|
|
|
|
+ message.setToUser(toUser);
|
|
|
|
+ // 设置消息模板编码
|
|
|
|
+ message.setTemplateCode("app_examineAndapprove");
|
|
|
|
+ Map<String, String> templateParam = new HashMap<>();
|
|
|
|
+ templateParam.put("resultText","应用"+appBaseInfo.getName()+"注册审核通过");
|
|
|
|
+ message.setTemplateParam(templateParam);
|
|
|
|
+ sysBaseApi.sendTemplateAnnouncement(message);
|
|
|
|
+
|
|
|
|
+ // 该信息为完整注册时,通过审核后添加默认角色、菜单权限、菜单信息
|
|
|
|
+ if (appBaseInfo.getAddType().equals("full")){
|
|
|
|
+ // 将通过完整注册的应用信息同步给JFlow的角色分类表
|
|
|
|
+ customMapper.addRoleToPortstationtype(appid, appBaseInfo.getName());
|
|
|
|
+ // 添加默认角色信息
|
|
|
|
+ SysRole role = new SysRole();
|
|
|
|
+ role.setAppId(appid); // 设置角色所属应用信息
|
|
|
|
+ role.setRoleCode("default"); // 设置角色编码
|
|
|
|
+ role.setAppName(appBaseInfo.getName()) ; // 设置角色的应用名称
|
|
|
|
+ role.setRoleName(appBaseInfo.getName()+"_默认用户角色"); // 设置角色名
|
|
|
|
+ role.setDescription(appBaseInfo.getName()+"默认角色"); // 设置备注
|
|
|
|
+ sysRoleService.save(role); // 添加角色
|
|
|
|
+
|
|
|
|
+ // 获取角色编码
|
|
|
|
+ String roleid = role.getId();
|
|
|
|
+
|
|
|
|
+ // 查询应用用户id集合
|
|
|
|
+ QueryWrapper<AppUserInfo> appUserInfoQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ appUserInfoQueryWrapper.select("userid").eq("appid", appid);
|
|
|
|
+ List<AppUserInfo> appUserInfos = userInfoMapper.selectList(appUserInfoQueryWrapper);
|
|
|
|
+ List<String> useridlist = appUserInfos.stream().map(AppUserInfo::getUserid).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ // 应用默认角色分配给应用用户
|
|
|
|
+ SysUserRoleVO sysUserRoleVO = new SysUserRoleVO();
|
|
|
|
+ sysUserRoleVO.setRoleId(roleid);
|
|
|
|
+ sysUserRoleVO.setUserIdList(useridlist);
|
|
|
|
+ sysUserController.addSysUserRole(sysUserRoleVO);
|
|
|
|
+
|
|
|
|
+ // 创建该应用的一级菜单
|
|
|
|
+ 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(),"");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ System.out.println("应用审核通过后续处理错误:"+e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|