架构筛选历史条件未清除问题

This commit is contained in:
qinoy 2023-02-07 17:00:32 +08:00
parent 38a3dac969
commit a9d21891ad
2 changed files with 32 additions and 16 deletions

View File

@ -12225,23 +12225,39 @@ public String deleteReply(String replyid, String messageid) {
*/
public String queryConditionData(String wsId,String teamId) {
ResponseObject ro = ResponseObject.newOkResponse();
JSONObject conditionData = new JSONObject();
// 文件类型
Map<String, String> methodsMap = new HashMap<>();
// 创建人信息
JSONArray createUsers = new JSONArray();
if (UtilString.isNotEmpty(teamId)) {
Set<String> createUserIds = new HashSet<>();
// 获取该小组有权限的资产文件versionId
List<String> repositoryPermByTeam = CoeCooperationAPIManager.getInstance().queryCooperationTeamPermVerIds(teamId);
for (String versionId : repositoryPermByTeam) {
List<PALRepositoryModel> modelList = PALRepositoryCache.getByVersionId(versionId);
modelList.stream().filter(model -> {
return model.isUse();
}).forEach(item->{
createUserIds.add(item.getCreateUser());
if (!"default".equals(item.getMethodId())) { // 过滤文件夹
methodsMap.put(item.getMethodId(), item.getMethodCategory());
}
});
}
List<CoeCooperationMemberModel> memberModelList = CoeCooperationAPIManager.getInstance().queryCooperationTeamMemberList(teamId);
for (CoeCooperationMemberModel memberModel : memberModelList) {
if (_uc.getUID().equals(memberModel.getUserId())) continue;
if (!createUserIds.contains(memberModel.getUserId())) continue; // 过滤没有创建过文件或文件夹的User
JSONObject user = new JSONObject();
UserModel userModel = SDK.getORGAPI().getUser(memberModel.getUserId());
if (userModel == null) {
System.out.println("当前人员【"+memberModel.getUserId()+"】在组织架构中未找到");
continue;
}
user.put("userId",userModel.getUID());
user.put("userName",userModel.getUserNameI18N());
DepartmentModel department = SDK.getORGAPI().getDepartmentByUser(memberModel.getUserId());
if (department == null) {
System.out.println("当前人员【"+memberModel.getUserId()+"】的部门信息在组织架构中未找到");
continue;
}
user.put("deptId",department.getId());
@ -12250,26 +12266,31 @@ public String deleteReply(String replyid, String messageid) {
}
}else {
Set<String> userIds = new HashSet<>();
List<CoeCooperationTeamModel> teamModelList = CoeCooperationAPIManager.getInstance().queryCooperationTeamByWsId(wsId, true);
for (CoeCooperationTeamModel teamModel : teamModelList) {
List<CoeCooperationMemberModel> memberModelList = CoeCooperationAPIManager.getInstance().queryCooperationTeamMemberList(teamModel.getId());
for (CoeCooperationMemberModel memberModel : memberModelList) {
if (_uc.getUID().equals(memberModel.getUserId())) continue;
userIds.add(memberModel.getUserId());
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
Set<String> createUserIds = new HashSet<>();
while (iterator.hasNext()) {
PALRepositoryModel model = iterator.next();
createUserIds.add(model.getCreateUser());
if (!"default".equals(model.getMethodId())) { // 过滤文件夹
methodsMap.put(model.getMethodId(), model.getMethodCategory());
}
}
List<CoeUserModel> records = CoeWorkSpaceDaoFactory.createCoeWorkSpace().getCoeUserMainRecodes(0, 0); // 所有记录条数暂时不分页(已与orguser联合查询)
for (CoeUserModel user : records) {
if (_uc.getUID().equals(user.getUserId())) continue;
if (!createUserIds.contains(user.getUserId())) continue;
userIds.add(user.getUserId());
}
for (String userId : userIds) {
JSONObject user = new JSONObject();
UserModel userModel = SDK.getORGAPI().getUser(userId);
if (userModel == null) {
System.out.println("当前人员【"+userId+"】在组织架构中未找到");
continue;
}
user.put("userId",userModel.getUID());
user.put("userName",userModel.getUserNameI18N());
DepartmentModel department = SDK.getORGAPI().getDepartmentByUser(userId);
if (department == null) {
System.out.println("当前人员【"+userId+"】的部门信息在组织架构中未找到");
continue;
}
user.put("deptId",department.getId());
@ -12321,7 +12342,6 @@ public String deleteReply(String replyid, String messageid) {
// 上一次的筛选条件
JSONObject historyCondition = null;
// String queryCondition = SDK.getPortalAPI().getUserProfileItem(CoEConstant.APP_ID, _uc.getUID(), "process_query_condition", "process_query_condition");
String queryCondition = (String) _uc.getExtParam("query_condition_"+_uc.getSessionId());
if (UtilString.isNotEmpty(queryCondition)){
JSONObject condition = JSONObject.parseObject(queryCondition);
@ -12334,17 +12354,13 @@ public String deleteReply(String replyid, String messageid) {
historyCondition.put("createUsers",new JSONArray());
historyCondition.put("orgIds",new JSONArray());
historyCondition.put("methodIds",new JSONArray());
for (Object o : methodIds) {
JSONObject methodObj = (JSONObject) o;
historyCondition.getJSONArray("methodIds").add(methodObj.getString("methodId"));
}
JSONObject condtions = new JSONObject();
JSONObject condtion = new JSONObject();
condtion.put("createUsers",historyCondition.getJSONArray("createUsers"));
condtion.put("orgIds",historyCondition.getJSONArray("orgIds"));
condtion.put("methodIds",historyCondition.getJSONArray("methodIds"));
condtions.put(_uc.getUID(),condtion);
// SDK.getPortalAPI().setUserProfileItem(CoEConstant.APP_ID,_uc.getUID(),"process_query_condition","process_query_condition",condtions.toJSONString());
_uc.setExtParam("query_condition_"+_uc.getSessionId(),condtions.toJSONString());
}
ro.put("historyCondition",historyCondition);