# Conflicts:
#	com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar
This commit is contained in:
shangguochao 2022-07-05 14:36:14 +08:00
commit 90e139546f
7 changed files with 204 additions and 42 deletions

View File

@ -2,6 +2,9 @@ package com.actionsoft.apps.coe.pal.cooperation.dto;
import org.apache.xpath.operations.Bool;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 小组成员
* @Created by sunlh
@ -21,6 +24,8 @@ public class CooperationManageListTeamMemberDto {
private String roleId;
private String roleName;
private int roleType;
private List<Integer> roleTypes = new ArrayList<>();
private List<String> roleIds = new ArrayList<>();
public CooperationManageListTeamMemberDto() {
}
@ -97,8 +102,26 @@ public class CooperationManageListTeamMemberDto {
this.roleName = roleName;
}
public void addRoleName(String roleName) {
this.roleName = this.roleName == null ? roleName : this.roleName + ","+ roleName;
}
public List<Integer> getRoleTypes() {
return roleTypes;
}
public void setRoleTypes(List<Integer> roleTypes) {
this.roleTypes = roleTypes;
}
public int getRoleType() {
return roleType;
int num = 3;
for (Integer roleType : this.roleTypes) {
if (num > roleType){
num = roleType;
}
}
return num;
}
public void setRoleType(int roleType) {
@ -113,4 +136,11 @@ public class CooperationManageListTeamMemberDto {
this.close = close;
}
public List<String> getRoleIds() {
return roleIds;
}
public void setRoleIds(List<String> roleIds) {
this.roleIds = roleIds;
}
}

View File

@ -582,11 +582,16 @@ public class CooperationWeb extends ActionWeb {
Map<String, CoeCooperationRoleModel> roleMap = new HashMap<>();
Map<String,CooperationManageListTeamMemberDto> userMap = new HashMap<>();
List<CoeCooperationMemberModel> members = api.queryCooperationTeamMemberList(teamId);
for (CoeCooperationMemberModel member : members) {
UserModel user = SDK.getORGAPI().getUser(member.getUserId());
if (user != null) {
CooperationManageListTeamMemberDto dto = new CooperationManageListTeamMemberDto();
CooperationManageListTeamMemberDto dto = userMap.get(user.getUID());
if (null == dto){
dto = new CooperationManageListTeamMemberDto();
}
dto.setUserName(user.getUserName());
dto.setClose(user.isClosed());
dto.setEmail(user.getEmail());
@ -595,20 +600,23 @@ public class CooperationWeb extends ActionWeb {
dto.setTeamId(teamId);
dto.setTeamName(team.getTeamName());
dto.setUserId(member.getUserId());
//Todo: 新权限多角色设置
//新权限多角色设置
dto.setRoleId(member.getRoleId());
dto.getRoleIds().add(member.getRoleId());
CoeCooperationRoleModel role;
if (roleMap.containsKey(member.getRoleId())) {
role = roleMap.get(member.getRoleId());
} else {
role = api.queryCooperationRoleByUser(teamId, member.getUserId());
role = api.queryCooperationRole(member.getRoleId());
roleMap.put(role.getId(), role);
}
dto.setRoleName(role.getRoleName());
dto.setRoleType(role.getRoleType());
detailDto.getMembers().add(dto);
dto.addRoleName(role.getRoleName());
dto.getRoleTypes().add(role.getRoleType());
userMap.put(user.getUID(),dto);
}
}
detailDto.getMembers().addAll(userMap.values());
detailDto.getMembers().sort((c1, c2)-> {
int index = c1.getRoleType() - c2.getRoleType();
if (index != 0) {
@ -637,9 +645,11 @@ public class CooperationWeb extends ActionWeb {
JSONArray userArr = JSONArray.parseArray(userIds);
CoeCooperationMemberDao memberDao = new CoeCooperationMemberDao();
for (int i = 0; i < userArr.size(); i++) {
CoeCooperationMemberModel memberModel = memberDao.getModelByTeamUser(teamId, userArr.getString(i));
if (memberModel != null) {
roleIds.add(memberModel.getRoleId());
List<CoeCooperationMemberModel> teamRoles = memberDao.getTeamRolesByUser(teamId, userArr.getString(i));
if (teamRoles != null && !teamRoles.isEmpty()) {
for (CoeCooperationMemberModel teamRole : teamRoles) {
roleIds.add(teamRole.getRoleId());
}
}
}
List<CooperationRoleDto> dtoList = new ArrayList<>();
@ -684,6 +694,8 @@ public class CooperationWeb extends ActionWeb {
if (team == null) {
return ResponseObject.newErrResponse("保存失败,小组不存在").toString();
}
Timestamp now = new Timestamp(System.currentTimeMillis());
List<CoeCooperationMemberModel> memberList = new ArrayList<>();
boolean isOlderVersion = SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IsOlderVersion", true);
if (isOlderVersion){
// 查询当前设置的角色
@ -706,7 +718,12 @@ public class CooperationWeb extends ActionWeb {
}
}
for (int i = 0; i < userIds.size(); i++) {
api.updateCooperationUserRole(teamId, userIds.getString(i), roleId, _uc.getUID());
//删除原有角色
api.removeCooperationMemeber(teamId,userIds.getString(i));
CoeCooperationMemberModel memberModel = new CoeCooperationMemberModel(UUIDGener.getUUID(),teamId,userIds.getString(i),roleId,_uc.getUID(),now,_uc.getUID(),now);
memberList.add(memberModel);
//重新添加多角色
api.createCooperationMemebers(memberList);
}
}else {
//设置多角色的校验
@ -729,15 +746,14 @@ public class CooperationWeb extends ActionWeb {
if (!flag) {
return ResponseObject.newErrResponse("不允许修改,小组中必须至少存在一位管理员用户").toString();
}
}else {
break;
}
}
//设置多角色
Timestamp now = new Timestamp(System.currentTimeMillis());
for (int i = 0; i < userIds.size(); i++) {
//删除原有角色
api.removeCooperationMemeber(teamId,userIds.getString(i));
List<CoeCooperationMemberModel> memberList = new ArrayList<>();
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);
@ -1297,6 +1313,8 @@ public class CooperationWeb extends ActionWeb {
}
// 保存
api.createCooperationMemebers(memberModels);
//更新用户权限缓存
CooperationCache.updateTeamInfo(teamId);
return ro.toString();
}

View File

@ -2900,6 +2900,11 @@ public class CoEPALController {
}
@Mapping("com.actionsoft.apps.coe.pal_processlevel_repository_create_save_Designer")
public String saveCreatePalProcessLevelRepositoryDesigner(UserContext me, String wsId, String teamId, String category, String method, String parentId, String container,Integer securityLevel,String name) {
CoeProcessLevelWeb web = new CoeProcessLevelWeb(me);
return web.saveCreatePalProcessLevelRepositoryDesigner(wsId, teamId, category, method, parentId, container,securityLevel,name);
}
/**
* 校验重名功能

View File

@ -162,6 +162,17 @@ public class CoeCooperationMemberDao extends DaoObject<CoeCooperationMemberModel
return DBSql.getObject(sql, rowMapper(), new Object[]{teamId, userId});
}
/**
* 根据用户获取多角色信息
* @param teamId
* @param userId
* @return
*/
public List<CoeCooperationMemberModel> getTeamRolesByUser(String teamId, String userId) {
String where = CoeCooperationMemberModel.TEAMID +" = ? AND " + CoeCooperationMemberModel.USERID + " = ?";
return query(where,teamId,userId).list();
}
/**
* 获取指定小组下的指定角色的用户
* @param teamId

View File

@ -47,7 +47,7 @@ public class SynchronousOrgJob implements IJob {
String plRid1 = UUIDGener.getUUID();
String id1 = UUIDGener.getUUID();
orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT limit 20");
orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT ");
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
@ -190,7 +190,7 @@ public class SynchronousOrgJob implements IJob {
if(orgdepartmentList.size()>0){
for(int i=0;i<orgdepartmentList.size();i++){
/* for(int i=0;i<orgdepartmentList.size();i++){
//新建一个uuid
String shapeId1 = UUIDGener.getObjectId();
@ -216,7 +216,7 @@ public class SynchronousOrgJob implements IJob {
elements.put(shapeId1, shape1);
}
}
}*/
}

View File

@ -2492,8 +2492,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
// 排序
propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0));
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(m.getId());
StringBuilder content = new StringBuilder();
StringBuilder sb = new StringBuilder();
JSONObject refs = new JSONObject();
@ -2614,16 +2612,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
boolean isRequired = attributeModel.getIsRequired();
/****************************************判断如果添加组织架构则修改显示值 by zhaolei*******************************************************************/
String input = null;
if(attributeModel.getKey().contains("Process_Architecture") && (repositoryPathData.size()!=index)) {
String name = ((JSONObject) repositoryPathData.get(index)).getString("name");
input="<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + name + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ name +"' isRequired='" + isRequired + "' onblur='saveContent($(this));' readonly=true />";
index++;
}else{
input="<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ inputValue +"' isRequired='" + isRequired + "' onblur='saveContent($(this));'/>";
}
//String input = "<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ inputValue +"' " + event + "/>";
String input = "<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ inputValue +"' " + event + "/>";
String type = attributeModel.getType();
@ -2653,7 +2642,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
event = "readonly='readonly' data-value="+ dataArr +" groupPath=\"" + attributeModel.getGroupPath() + "\" ref="+ refObj +" onclick=\"openRelationAwsorgDialog($(this))\"";
input = "<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" isRequired='" + isRequired + "' data-originvalue='" + inputValue + "' " + event + "/>";
} else if("DateTimePicker".equals(type)) {
input = "<input class=\"awsui-textbox\" id=\"dateTimePicker_"+id+"\" name=\"dateTimePicker\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='" + inputValue + "' value='" + inputValue + "' isRequired='" + isRequired + "' onblur='saveContent($(this));'>" + "</input>";
input = "<input class=\"awsui-textbox\" id=\"" + id + "\" name=\"dateTimePicker\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='" + inputValue + "' value='" + inputValue + "' isRequired='" + isRequired + "' onblur='saveContent($(this));'>" + "</input>";
}else if ("table".equals(type)){
JSONObject table = JSON.parseObject(jsonValue);
@ -8004,6 +7993,120 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
// 保存文件属性
PALRepositoryAPIManager.getInstance().updateRepositoryProperty(model.getId());
// 小组权限设置
if (!UtilString.isEmpty(teamId)) {
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
}
ro.put("id", id);
// 操作行为日志记录
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_CREATE, CoEOpLogConst.INFO_REPOSITORY_CREATE);
}
return ro.toString();
}
public String saveCreatePalProcessLevelRepositoryDesigner(String wsId, String teamId, String category, String method, String parentId, String container,Integer securityLevel,String name){
ResponseObject ro = ResponseObject.newOkResponse();
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String parentVersionId = "";
int level = 1;
if (parentId.length() < 36) {// 父节点是大类
parentVersionId = parentId;
} else {
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(parentId);
parentVersionId = parentModel.getVersionId();
level = parentModel.getLevel() + 1;
}
int orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId(parentId, wsId) + 1;
String uid = _uc.getUID();
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, wsId, name, "", orderIndex, parentVersionId, category, true, 1,
id, false, method, "0", level, null, null, uid, uid, nowTime, null, null, null, null, null, null, null, null, null,securityLevel);
// 创建
try {
coeProcessLevel.insert(model);
// 流程发布用户组权限和父级同步
PALRepositoryModel parentModel = (PALRepositoryModel) coeProcessLevel.getInstance(parentId);
if (parentModel != null) {
PublishUserGroupPerm dao = new PublishUserGroupPerm();
List<PublishUserGroupPermModel> list = dao.getAllPermsByResourceId(parentModel.getVersionId());
for (PublishUserGroupPermModel parentPModel : list) {
PublishUserGroupPermModel newPModel = new PublishUserGroupPermModel();
newPModel.setId(UUIDGener.getUUID());
newPModel.setGroupId(parentPModel.getGroupId());
newPModel.setPermType(parentPModel.getPermType());
newPModel.setResourceId(model.getId());
dao.insert(newPModel);
}
}
} catch (Exception e) {
e.printStackTrace();
}
// 如果有模板复制模板中的内容
if (container != null && !"".equals(container) && !"_blank".equals(container)) {
PALMethodTemplateModel templateModel = PALMethodTemplateCache.getCache().get(container);
BaseModel defineModel;
if (category.contains("bpmn2")) {
defineModel = CoeDesignerUtil.createBPMNModel(model.getId(), 0);
} else {
defineModel = CoeDesignerUtil.createModel(model.getId(), 0);
}
defineModel.setDefinition(copyDefine(model.getId(), templateModel.getDefine().toString()));
if (category.contains("bpmn2")) {
CoeDesignerAPIManager.getInstance().storeDefinitionOfBpmn((BPMNModel) defineModel);
} else {
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);
}
// 保存模型属性(依照最新的属性进行保存不再取模板属性)
// String tempId = templateModel.getDefine().getString("uuid");
// String json = CoePropertyUtil.getPropertyValue(tempId + "_attr");
// if (!UtilString.isEmpty(json)) {
// JSONArray jsonArr = JSONArray.parseArray(json);
// for (int i = 0; i < jsonArr.size(); i++) {
// JSONObject attribute = jsonArr.getJSONObject(i);
// attribute.put("value", "");
// }
// try {
// PALRepositoryAPIManager.getInstance().updatePropertysByPLId(model.getId(), jsonArr);
// } catch (SQLException e) {
// e.printStackTrace();
// }
// }
}
// 保存文件属性
PALRepositoryAPIManager.getInstance().updateRepositoryProperty(model.getId());
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(parentId);
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
// 一级架构默认值处理
int index=1;
if(repositoryPathData.size()>0){
for(int i=0;i<repositoryPathData.size();i++){
String name1=((JSONObject) repositoryPathData.get(i)).getString("name");
if(UtilString.isNotEmpty(name1)){
propertyDao.updatePropertyByPropertyId(model.getId(), "Process_Architecture_L"+index, name1);
index++;
}
}
}
// 小组权限设置
if (!UtilString.isEmpty(teamId)) {
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
@ -8018,16 +8121,15 @@ public class CoeProcessLevelWeb extends ActionWeb {
/***************************************************获取当前文件位置 byzhaolei**********************************************/
// 获取当前文件路径
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(parentId);
StringBuffer sb = new StringBuffer();
StringBuffer sb = new StringBuffer();
if(repositoryPathData.size()>0){
for(int i=0;i<repositoryPathData.size();i++){
String name=((JSONObject) repositoryPathData.get(i)).getString("name");
sb.append(name).append("\\");
}
}
for(int i=0;i<repositoryPathData.size();i++){
String name2=((JSONObject) repositoryPathData.get(i)).getString("name");
sb.append(name2).append("\\");
}
}
String keywordStr = sb.deleteCharAt(sb.length() - 1).toString();//去掉最后一个逗号
String keywordStr = sb.deleteCharAt(sb.length() - 1).toString();//去掉最后一个逗号
ro.put("repositoryPathData",keywordStr);
return ro.toString();
@ -8035,7 +8137,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
/**
*校验是否存在重复标题
* @param title
@ -8270,11 +8371,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
}
PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(m.getMethodId());
List<PALMethodAttributeGroupModel> groups = methodModel.getGroup();
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> propertys = dao.getPropertysByPlid(uuid, null);
// 排序
propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0));
Boolean flag1=false;