阅览权限,岗位职级取并集

This commit is contained in:
lihongyu 2023-01-03 05:52:47 +08:00
parent e5f64407af
commit de6da5efb5
3 changed files with 43 additions and 61 deletions

View File

@ -31,8 +31,8 @@ public class DownloadUtil {
* @return
*/
public LinkedHashMap<String,String> outputReportDownload(UserContext _uc, String taskId, String ruuid) {
System.out.println("usercontext>>>>>>>>>>>"+_uc.getUID());
System.out.println("sid>>>>>>>>>>>"+_uc.getSessionId());
//System.out.println("usercontext>>>>>>>>>>>"+_uc.getUID());
//System.out.println("sid>>>>>>>>>>>"+_uc.getSessionId());
LinkedHashMap<String,String> map = new LinkedHashMap<>();
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
ResponseObject result = ResponseObject.newOkResponse();
@ -99,8 +99,8 @@ public class DownloadUtil {
public String getzipURL(String sid,String taskId,String title){
System.out.println("taskid》》》》》》》》》》"+taskId);
System.out.println("fileName》》》》》》》》》》"+title);
//System.out.println("taskid》》》》》》》》》》"+taskId);
//System.out.println("fileName》》》》》》》》》》"+title);
String reportDownloadURL = "";
UserContext me = UserContext.fromSessionId(sid);
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);

View File

@ -267,7 +267,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
} catch (Exception e) {
// TODO: handle exception
}
System.err.println("系统人员=====>" + userList1);
//System.err.println("系统人员=====>" + userList1);
// 项目开发人员
ArrayList<String> userList2 = new ArrayList<String>();
try {
@ -276,7 +276,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
} catch (Exception e) {
// TODO: handle exception
}
System.err.println("项目开发人员=====>" + userList2);
//System.err.println("项目开发人员=====>" + userList2);
// 离退人员
ArrayList<String> userList3 = new ArrayList<String>();
try {
@ -285,7 +285,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
} catch (Exception e) {
// TODO: handle exception
}
System.err.println("离退人员=====>" + userList3);
//System.err.println("离退人员=====>" + userList3);
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGUSER WHERE CLOSED = '0'");
for (RowMap rowMap : maps) {
String userId = rowMap.getString("USERID");
@ -360,7 +360,6 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
try {
AttrSynAslp(processExecutionContext, wsId, filed);
} catch (Exception e) {
// TODO: handle exception
}
@ -368,7 +367,6 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
} catch (Exception e) {
e.printStackTrace();
} finally {
open.close();
}
}
@ -786,7 +784,6 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
* @throws Exception
*/
public String SendEHSQFile(JSONArray jsonArray) throws Exception {
System.out.println("===jsonArray===" + jsonArray);
/**
* 首先需要将传过来的参数进行加密操作,并设置
*/
@ -798,7 +795,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
String date = sdf.format(new Date());
String s1 = date.replaceAll("-", "").replaceAll(" ", "").replaceAll(":", "");
System.out.println("时间>>>>>>>>>>>>" + s1);
//System.out.println("时间>>>>>>>>>>>>" + s1);
String data = system + "##" + s1;
String encrypt = aesUtil.encrypt(data, AES); // 获取加密之后的秘钥
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
@ -806,9 +803,9 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
jsonObject.put("token", encrypt);
jsonObject.put("infos", jsonArray);
HttpUtil httpUtil = new HttpUtil();
System.out.println("jsonobject>>>>>>>>>>>>>>>>>>>" + jsonObject);
System.out.println("发送EHSQ参数>>>>>" + jsonObject);
String s = httpUtil.sendPost(jsonObject, EHSQUrl);
System.out.println("发送到EHSQ是否是正确的>>>>>>>>>" + s);
System.out.println("发送EHSQ结果>>>>>" + s);
return s;
}
@ -820,54 +817,58 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
String level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL");
ArrayList<String> userList = new ArrayList<>();
if ("1".equals(sendType)) {
System.err.println("发送全集团=====>" + instanceById.getTitle());
//System.err.println("发送全集团=====>" + instanceById.getTitle());
userList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject, sendType);
} else {
// 如果都不为空组织/岗位取并集的结果同职级取交集
/**
* 先组织和职级取交集然后再和岗位取并集
*/
if (UtilString.isNotEmpty(org) && UtilString.isNotEmpty(post) && UtilString.isNotEmpty(level)) {
System.err.println("发送组织/岗位/职级=====>" + instanceById.getTitle());
//System.err.println("发送组织/岗位/职级=====>" + instanceById.getTitle());
ArrayList<String> sendOrgList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject,
sendType);
ArrayList<String> sendPostList = sendPost(post, sendOrgList, instanceById, bo_act_coe_publish1,
ArrayList<String> sendLevel = sendLevel(level, sendOrgList, instanceById, bo_act_coe_publish1, jsonObject);
userList = sendPost(post, sendLevel, instanceById, bo_act_coe_publish1,
jsonObject);
userList = sendLevel(level, sendPostList, instanceById, bo_act_coe_publish1, jsonObject);
}
// 如果职级为空组织/岗位取并集
if (UtilString.isNotEmpty(org) && UtilString.isNotEmpty(post) && UtilString.isEmpty(level)) {
System.err.println("发送组织/岗位=====>" + instanceById.getTitle());
//System.err.println("发送组织/岗位=====>" + instanceById.getTitle());
ArrayList<String> sendOrgList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject,
sendType);
userList = sendPost(post, sendOrgList, instanceById, bo_act_coe_publish1, jsonObject);
}
// 如果岗位为空组织/职级取交集
if (UtilString.isNotEmpty(org) && UtilString.isEmpty(post) && UtilString.isNotEmpty(level)) {
System.err.println("发送组织/职级=====>" + instanceById.getTitle());
//System.err.println("发送组织/职级=====>" + instanceById.getTitle());
ArrayList<String> sendOrgList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject,
sendType);
userList = sendLevel(level, sendOrgList, instanceById, bo_act_coe_publish1, jsonObject);
}
// 如果组织为空岗位/职级取交集
/**
* 组织为空 岗位和职级取并集
*/
if (UtilString.isEmpty(org) && UtilString.isNotEmpty(post) && UtilString.isNotEmpty(level)) {
System.err.println("发送岗位/职级=====>" + instanceById.getTitle());
ArrayList<String> sendPostList = sendPost(post, userList, instanceById, bo_act_coe_publish1,
//System.err.println("发送岗位/职级=====>" + instanceById.getTitle());
ArrayList<String> sendLevel2 = sendLevel2(level, userList, instanceById, bo_act_coe_publish1, jsonObject);
userList = sendPost(post, sendLevel2, instanceById, bo_act_coe_publish1,
jsonObject);
userList = sendLevel(level, sendPostList, instanceById, bo_act_coe_publish1, jsonObject);
}
// 如果只有组织不为空
if (UtilString.isNotEmpty(org) && UtilString.isEmpty(post) && UtilString.isEmpty(level)) {
System.err.println("发送组织=====>" + instanceById.getTitle());
//System.err.println("发送组织=====>" + instanceById.getTitle());
userList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject, sendType);
}
// 如果只有岗位不为空
if (UtilString.isEmpty(org) && UtilString.isNotEmpty(post) && UtilString.isEmpty(level)) {
System.err.println("发送岗位=====>" + instanceById.getTitle());
//System.err.println("发送岗位=====>" + instanceById.getTitle());
userList = sendPost(post, userList, instanceById, bo_act_coe_publish1, jsonObject);
}
// 如果只有职级不为空
if (UtilString.isEmpty(org) && UtilString.isEmpty(post) && UtilString.isNotEmpty(level)) {
System.err.println("发送职级=====>" + instanceById.getTitle());
//System.err.println("发送职级=====>" + instanceById.getTitle());
userList = sendLevel2(level, userList, instanceById, bo_act_coe_publish1, jsonObject);
}
@ -907,12 +908,15 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
} else {
postss = "'" + StringUtils.join(posts, "','") + "'";
}
String sql = "select * from ORGUSER where POSITION_NO in (" + postss + ") and userno is not null";
String sql = "select * from ORGUSER where POSITION_NO in (" + postss + ") and userno is not null";
List<RowMap> maps1 = DBSql.getMaps(sql);
for (RowMap rowMap : maps1) {
String userId = rowMap.getString("USERID");
if (!userList.contains(userId)) {
userList.add(userId);
boolean closed = SDK.getORGAPI().getUser(userId).isClosed();
if(!closed) {
userList.add(userId);
}
}
}
@ -942,7 +946,10 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
for (RowMap rowMap : maps2) {
String userId = rowMap.getString("USERID");
if (userList.contains(userId)) {
userList_level.add(userId);
boolean closed = SDK.getORGAPI().getUser(userId).isClosed();
if(!closed) {
userList_level.add(userId);
}
}
}
@ -971,7 +978,10 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
List<RowMap> maps2 = DBSql.getMaps(sql2);
for (RowMap rowMap : maps2) {
String userId = rowMap.getString("USERID");
userList_level.add(userId);
boolean closed = SDK.getORGAPI().getUser(userId).isClosed();
if(!closed) {
userList_level.add(userId);
}
}
}
return userList_level;
@ -1079,34 +1089,6 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
}
}
}
/**
* 创建线程发送待阅
*
* @param list 人员集合
* @param startTime 开始时间
* @param jsonObject 发送的json串
* @param processExecutionContext 流程数据
*/
/*
* public void course(List<String[]> list,long startTime,JSONObject
* jsonObject,ProcessExecutionContext processExecutionContext){ //
* 创建线程来实现为每300人为一个的线程跑待阅 ExecutorService service =
* Executors.newFixedThreadPool(4); service.execute(new Runnable() {
*
* @Override public void run() { int i=0; for (String[] resrt:list ) {
*
* if ((list.size()-1)==i){ long endTime = System.currentTimeMillis();
*
* long time = endTime - startTime; long itmes = time/1000/60/60; BO
* bo_eu_pal_read_log = SDK.getBOAPI().query("BO_EU_PAL_READ_LOG",
* true).addQuery("PROCESSID = ",
* processExecutionContext.getProcessInstance().getId()).detail();
* bo_eu_pal_read_log.set("ENDTIMES",endTime);
* bo_eu_pal_read_log.set("TIMECOUNT",itmes);
* SDK.getBOAPI().update("BO_EU_PAL_READ_LOG",bo_eu_pal_read_log); } try {
* SendOARead(jsonObject,processExecutionContext,resrt); } catch
* (DocumentException e) { e.printStackTrace(); } i++; } } }); }
*/
/**
* 创建待阅日志

View File

@ -4134,7 +4134,7 @@ public class PALRepositoryQueryAPIManager {
// 都不为空时
if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(postPerm) && UtilString.isNotEmpty(levelPerm)) {
if ((getOrgPerm(orgPerm, uc) || getPostPerm(postPerm, uc)) && getLevelPerm(levelPerm, uc)) {
if ((getOrgPerm(orgPerm, uc) && getLevelPerm(levelPerm, uc) )||getPostPerm(postPerm, uc) ) {
return true;
}
// 职级为空时
@ -4149,7 +4149,7 @@ public class PALRepositoryQueryAPIManager {
}
// 组织为空时
} else if (UtilString.isNotEmpty(postPerm) && UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(orgPerm)) {
if (getPostPerm(postPerm, uc) && getLevelPerm(levelPerm, uc)) {
if (getPostPerm(postPerm, uc) || getLevelPerm(levelPerm, uc)) {
return true;
}
// 组织岗位为空时