小组角色修改保存接口调整
This commit is contained in:
parent
943714276c
commit
9932a82b65
Binary file not shown.
@ -697,10 +697,19 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
Timestamp now = new Timestamp(System.currentTimeMillis());
|
Timestamp now = new Timestamp(System.currentTimeMillis());
|
||||||
List<CoeCooperationMemberModel> memberList = new ArrayList<>();
|
List<CoeCooperationMemberModel> memberList = new ArrayList<>();
|
||||||
boolean isOlderVersion = SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IsOlderVersion", true);
|
boolean isOlderVersion = SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IsOlderVersion", true);
|
||||||
if (isOlderVersion){
|
|
||||||
|
JSONArray roleIds = new JSONArray();
|
||||||
|
if (!isOlderVersion){
|
||||||
// 查询当前设置的角色
|
// 查询当前设置的角色
|
||||||
String roleId = dataObj.getString("roleId");
|
String roleId = dataObj.getString("roleId");
|
||||||
CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao();
|
roleIds.add(roleId);
|
||||||
|
}else {
|
||||||
|
roleIds = dataObj.getJSONArray("roleId");
|
||||||
|
}
|
||||||
|
//多角色的校验
|
||||||
|
CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao();
|
||||||
|
for (int i = 0; i < roleIds.size(); i++) {
|
||||||
|
String roleId = roleIds.getString(i);
|
||||||
CoeCooperationRoleModel role = roleDao.getInstance(roleId);
|
CoeCooperationRoleModel role = roleDao.getInstance(roleId);
|
||||||
// 如果当前设置的角色不是管理员,查询其他用户是否有管理员角色,小组中必须有至少一位管理员用户
|
// 如果当前设置的角色不是管理员,查询其他用户是否有管理员角色,小组中必须有至少一位管理员用户
|
||||||
if (role.getRoleType() != CoeCooperationConst.ROLE_TYPE_MANAGER) {
|
if (role.getRoleType() != CoeCooperationConst.ROLE_TYPE_MANAGER) {
|
||||||
@ -716,52 +725,21 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
if (!flag) {
|
if (!flag) {
|
||||||
return ResponseObject.newErrResponse("不允许修改,小组中必须至少存在一位管理员用户").toString();
|
return ResponseObject.newErrResponse("不允许修改,小组中必须至少存在一位管理员用户").toString();
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < userIds.size(); i++) {
|
}
|
||||||
//删除原有角色
|
//设置多角色
|
||||||
api.removeCooperationMemeber(teamId,userIds.getString(i));
|
for (int i = 0; i < userIds.size(); i++) {
|
||||||
|
//删除原有角色
|
||||||
|
api.removeCooperationMemeber(teamId,userIds.getString(i));
|
||||||
|
for (int j = 0; j < roleIds.size(); j++) {
|
||||||
|
String roleId = roleIds.getString(j);
|
||||||
CoeCooperationMemberModel memberModel = new CoeCooperationMemberModel(UUIDGener.getUUID(),teamId,userIds.getString(i),roleId,_uc.getUID(),now,_uc.getUID(),now);
|
CoeCooperationMemberModel memberModel = new CoeCooperationMemberModel(UUIDGener.getUUID(),teamId,userIds.getString(i),roleId,_uc.getUID(),now,_uc.getUID(),now);
|
||||||
memberList.add(memberModel);
|
memberList.add(memberModel);
|
||||||
//重新添加多角色
|
|
||||||
api.createCooperationMemebers(memberList);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//设置多角色的校验
|
|
||||||
JSONArray roleIds = dataObj.getJSONArray("roleId");
|
|
||||||
CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao();
|
|
||||||
for (int i = 0; i < roleIds.size(); i++) {
|
|
||||||
String roleId = roleIds.getString(i);
|
|
||||||
CoeCooperationRoleModel role = roleDao.getInstance(roleId);
|
|
||||||
// 如果当前设置的角色不是管理员,查询其他用户是否有管理员角色,小组中必须有至少一位管理员用户
|
|
||||||
if (role.getRoleType() != CoeCooperationConst.ROLE_TYPE_MANAGER) {
|
|
||||||
// 查询其他用户的角色是否有管理员
|
|
||||||
boolean flag = false;
|
|
||||||
List<String> adminUsers = api.queryCooperationAdminUsers(teamId);
|
|
||||||
for (String adminUser : adminUsers) {
|
|
||||||
if (!userIds.contains(adminUser)) {
|
|
||||||
flag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!flag) {
|
|
||||||
return ResponseObject.newErrResponse("不允许修改,小组中必须至少存在一位管理员用户").toString();
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//设置多角色
|
|
||||||
for (int i = 0; i < userIds.size(); i++) {
|
|
||||||
//删除原有角色
|
|
||||||
api.removeCooperationMemeber(teamId,userIds.getString(i));
|
|
||||||
for (int j = 0; j < roleIds.size(); j++) {
|
|
||||||
String roleId = roleIds.getString(j);
|
|
||||||
CoeCooperationMemberModel memberModel = new CoeCooperationMemberModel(UUIDGener.getUUID(),teamId,userIds.getString(i),roleId,_uc.getUID(),now,_uc.getUID(),now);
|
|
||||||
memberList.add(memberModel);
|
|
||||||
}
|
|
||||||
//重新添加多角色
|
|
||||||
api.createCooperationMemebers(memberList);
|
|
||||||
}
|
}
|
||||||
|
//重新添加多角色
|
||||||
|
api.createCooperationMemebers(memberList);
|
||||||
}
|
}
|
||||||
//更新用户权限缓存
|
//更新用户权限缓存
|
||||||
CooperationCache.updateTeamInfo(teamId);
|
CooperationCache.updateTeamInfo(teamId);
|
||||||
@ -824,7 +802,7 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
actionPermOpts.add(actionObj3);
|
actionPermOpts.add(actionObj3);
|
||||||
}else {
|
}else {
|
||||||
JSONObject actionObj1 = new JSONObject();
|
JSONObject actionObj1 = new JSONObject();
|
||||||
actionObj1.put("value", "新增、修改");
|
actionObj1.put("value", "新建流程");
|
||||||
actionObj1.put("label", CoeCooperationConst.ACTION_CREATE_PROCESS);
|
actionObj1.put("label", CoeCooperationConst.ACTION_CREATE_PROCESS);
|
||||||
JSONObject actionObj2 = new JSONObject();
|
JSONObject actionObj2 = new JSONObject();
|
||||||
actionObj2.put("value", "批量创建/替换");
|
actionObj2.put("value", "批量创建/替换");
|
||||||
@ -834,14 +812,14 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
|
|
||||||
|
|
||||||
JSONObject actionObj3 = new JSONObject();
|
JSONObject actionObj3 = new JSONObject();
|
||||||
actionObj1.put("value", "编辑");
|
actionObj3.put("value", "编辑");
|
||||||
actionObj1.put("label", CoeCooperationConst.ACTION_WRITE);
|
actionObj3.put("label", CoeCooperationConst.ACTION_WRITE);
|
||||||
JSONObject actionObj4 = new JSONObject();
|
JSONObject actionObj4 = new JSONObject();
|
||||||
actionObj2.put("value", "删除");
|
actionObj4.put("value", "删除");
|
||||||
actionObj2.put("label", CoeCooperationConst.ACTION_DELETE);
|
actionObj4.put("label", CoeCooperationConst.ACTION_DELETE);
|
||||||
JSONObject actionObj5 = new JSONObject();
|
JSONObject actionObj5 = new JSONObject();
|
||||||
actionObj3.put("value", "版本管理");
|
actionObj5.put("value", "版本管理");
|
||||||
actionObj3.put("label", CoeCooperationConst.ACTION_VERSION);
|
actionObj5.put("label", CoeCooperationConst.ACTION_VERSION);
|
||||||
dataActionPermOpts.add(actionObj3);
|
dataActionPermOpts.add(actionObj3);
|
||||||
dataActionPermOpts.add(actionObj4);
|
dataActionPermOpts.add(actionObj4);
|
||||||
dataActionPermOpts.add(actionObj5);
|
dataActionPermOpts.add(actionObj5);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user