Merge remote-tracking branch 'origin/apps_dev' into apps_dev
This commit is contained in:
commit
3bfb366e43
@ -0,0 +1,72 @@
|
||||
package com.awspaas.user.bpa.job;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class UpdateKnowJobs implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
Connection open = DBSql.open();
|
||||
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("SEND_SCOP=", "1").addQuery("SEND_SCOPE_ORG IS NULL", null).list();
|
||||
for (BO bo:list) {
|
||||
String bindid = bo.getString("BINDID");
|
||||
List<BO> bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID = ", bindid).list();
|
||||
for (BO bo1:bo_act_coe_publish_n) {
|
||||
String publishfileid = bo1.getString("PUBLISHFILEID");
|
||||
RowMap map = DBSql.getMap("select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + publishfileid + "' AND ISPUBLISH = '1' AND ISSTOP='0'");
|
||||
String ext4 = map.getString("EXT4");
|
||||
RowMap map1 = DBSql.getMap("select * from app_act_kms_card where ID = '" + ext4 + "'");
|
||||
if (map1!=null){
|
||||
int update = DBSql.update("delete from sys_ac where RESOURCEID = '" + ext4 + "' AND RESOURCETYPE = 'kms.card'");
|
||||
SDK.getLogAPI().consoleInfo("删除ac授权文件>>>>>>>>>>"+update);
|
||||
JSONArray jsonArray1 = new JSONArray();
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "company");
|
||||
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
|
||||
jsonArray1.add(jsonObjecta);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
AddKnwlAC(jsonArray1,userContext.getSessionId(),ext4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean AddKnwlAC(JSONArray jsonArray, String sid,
|
||||
String knwlId) {
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = "com.awspaas.user.apps.new_performance_indicator_library";
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/AddKnwlAC";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
// [{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填
|
||||
params.put("acList", jsonArray);
|
||||
// sid,如果为空,则需要传createUser参数,非必填
|
||||
params.put("sid", sid);
|
||||
// 知识ID,必填
|
||||
params.put("knwlId", knwlId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
// 给知识授权
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
SDK.getLogAPI().consoleInfo("是否授权成功>>>>>>>>>>>>>>>"+ro.isOk());
|
||||
return ro.isOk();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.awspaas.user.bpa.job;
|
||||
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UpdateSysAcJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
List<RowMap> maps = DBSql.getMaps("select distinct RESOURCEID from sys_ac where RESOURCETYPE = 'kms.card'");
|
||||
List<RowMap> maps1 = DBSql.getMaps("select distinct ID from app_act_kms_card");
|
||||
boolean flag = false;
|
||||
String flag_id = "";
|
||||
for (RowMap rowMap:maps1) {
|
||||
String id = rowMap.getString("ID");
|
||||
for (RowMap rowMap1:
|
||||
maps) {
|
||||
String id1 = rowMap1.getString("ID");
|
||||
flag_id = id1;
|
||||
if (id1.equals(id)){
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag == true){
|
||||
continue;
|
||||
}
|
||||
if (flag == false){
|
||||
DBSql.update("delete from sys_ac where RESOURCETYPE = 'kms.card' and RESOURCEID = '"+flag_id+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user