462 lines
25 KiB
Java
462 lines
25 KiB
Java
package com.awspaas.user.apps.integration.job;
|
||
|
||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||
import com.actionsoft.bpms.bo.engine.BO;
|
||
import com.actionsoft.bpms.commons.database.RowMap;
|
||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||
import com.actionsoft.bpms.server.SSOUtil;
|
||
import com.actionsoft.bpms.server.UserContext;
|
||
import com.actionsoft.bpms.server.fs.DCContext;
|
||
import com.actionsoft.bpms.util.DBSql;
|
||
import com.actionsoft.exception.AWSException;
|
||
import com.actionsoft.sdk.local.SDK;
|
||
import com.actionsoft.sdk.local.api.AppAPI;
|
||
import com.alibaba.fastjson.JSONArray;
|
||
import org.apache.commons.lang.StringUtils;
|
||
import org.quartz.Job;
|
||
import org.quartz.JobExecutionContext;
|
||
import org.quartz.JobExecutionException;
|
||
|
||
import java.sql.Connection;
|
||
import java.sql.SQLException;
|
||
import java.util.HashMap;
|
||
import java.util.LinkedHashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
/**
|
||
* @PackageName: com.awspaas.user.apps.yili.integration.job
|
||
* @ClassName: UpdateKnowJob
|
||
* @author: wangcy
|
||
* @date: 2022/8/10 14:41
|
||
*/
|
||
public class UpdateKnowJob implements Job {
|
||
|
||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||
|
||
|
||
private static String USERID = "admin";
|
||
|
||
@Override
|
||
|
||
|
||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||
|
||
Connection open = DBSql.open();
|
||
try {
|
||
|
||
|
||
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||
|
||
SSOUtil ssoUtil = new SSOUtil();
|
||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||
UserContext userContext = UserContext.fromSessionId(sid);
|
||
System.out.println("创建维度准备开始===============");
|
||
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY " +
|
||
"where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')";
|
||
|
||
|
||
List<RowMap> list = DBSql.getMaps(open, sql);
|
||
for (RowMap bo : list
|
||
) {
|
||
String repository_sql = " select PLNAME from APP_ACT_COE_PAL_REPOSITORY " +
|
||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')" + " and PLNAME ='" + bo.getString("PLNAME") + "'";
|
||
String PLNAME = DBSql.getString(open, repository_sql);
|
||
System.out.println("repository_sql>>>>>>>>>>>>>>>>>>>" + repository_sql);
|
||
if (StringUtils.isEmpty(PLNAME)) {
|
||
PLNAME = bo.getString("EXT4");
|
||
}
|
||
String add_name = PLNAME + ",";
|
||
|
||
Map names = new LinkedHashMap<>();
|
||
names.put(0, bo.getString("EXT4"));
|
||
names.put(1, PLNAME);
|
||
for (int i = 2; i < 5; i++) {
|
||
String repository_sqls = " select EXT4 from APP_ACT_COE_PAL_REPOSITORY " +
|
||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and EXT4 ='" + PLNAME + "'";//and PLMETHODID !='process.framework'
|
||
String parent_name = DBSql.getString(open, repository_sqls);
|
||
if (names.containsValue(parent_name)) {
|
||
break;
|
||
}
|
||
String util_space = "select PLCATEGORY from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID in ('process') and PLNAME = '" + PLNAME + "'";
|
||
String fisrt_name = DBSql.getString(open, util_space);
|
||
if (names.containsValue(fisrt_name)) {
|
||
break;
|
||
}
|
||
if (fisrt_name.equals("process")) {
|
||
names.put(i, "obj_5020f54928c842b58107c3354e450070");
|
||
}
|
||
if (StringUtils.isEmpty(parent_name)) {
|
||
break;
|
||
}
|
||
PLNAME = parent_name;
|
||
names.put(i, PLNAME);
|
||
add_name = PLNAME + ",";
|
||
}
|
||
add_name = names.get(0) + ",";
|
||
System.out.println("add_name=============="
|
||
+ add_name);
|
||
String dimensionId = "";
|
||
String de_name = "";
|
||
System.out.println("names==========" + names);
|
||
for (int i = names.size() - 1; i >= 0; i--) {
|
||
System.out.println("name" + i + "=================?>>>>>>>>>>" + names.get(i));
|
||
String dimensionId_sql = "SELECT ID FROM APP_ACT_KMS_DIMENSION where ID ='" + names.get(i) + "'";
|
||
dimensionId = DBSql.getString(open, dimensionId_sql);
|
||
String sql_Frameworks = " select EXT4 from APP_ACT_COE_PAL_REPOSITORY " +
|
||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and EXT4 = '" + names.get(i) + "'";//
|
||
String framework = DBSql.getString(open, sql_Frameworks);//&& StringUtils.isEmpty(framework)
|
||
|
||
if (StringUtils.isNotEmpty(dimensionId) || StringUtils.isEmpty(framework)) {
|
||
|
||
} else {
|
||
System.out.println("进入知识");
|
||
String sql_Framework = " select EXT4 from APP_ACT_COE_PAL_REPOSITORY " +
|
||
"where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+"and EXT4 = '" + names.get(i) + "'";//PLMETHODID = 'process.framework' and
|
||
String frameworks = DBSql.getString(open, sql_Framework);//&& StringUtils.isEmpty(framework)
|
||
if (bo.getString("EXT4").equals(names.get(i))) {
|
||
String card_sql = "select ID from APP_ACT_KMS_CARD where ID ='" + names.get(i) + "'";
|
||
String card = DBSql.getString(open, card_sql);
|
||
String card_sql_name = "select CARDNAME from APP_ACT_KMS_CARD where ID ='" + names.get(i) + "'";
|
||
String card_name = DBSql.getString(open, card_sql_name);
|
||
if (StringUtils.isNotEmpty(card)) {
|
||
creadteFile(userContext, open, bo.getString("PLNAME"), add_name);
|
||
|
||
} else {
|
||
|
||
// aslp服务地址
|
||
String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl";
|
||
// 参数定义列表
|
||
Map params_create = new HashMap<String, Object>();
|
||
//保密级别, 0: 普通 1:秘密 2:机密,必填
|
||
params_create.put("securityLevel", 0);
|
||
//知识名称,必填
|
||
params_create.put("knwlName", card_name);
|
||
//是否可以评论,必填
|
||
params_create.put("isComment", true);
|
||
//是否可以评分,必填
|
||
params_create.put("isRate", true);
|
||
//有效期:yyyy-MM-dd,非必填
|
||
params_create.put("validDate", "2099-12-31");
|
||
//只读控制,1:在线阅读和下载 0:在线阅读,必填
|
||
params_create.put("onlineLevel", 1);
|
||
//知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填
|
||
params_create.put("createUser", "admin");
|
||
//知识内容,非必填
|
||
params_create.put("cardContext", "");
|
||
//sid,必填
|
||
params_create.put("sid", userContext.getSessionId());
|
||
AppAPI appAPI_create = SDK.getAppAPI();
|
||
//创建知识
|
||
ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(APPID), aslps_create, params_create);
|
||
System.out.println("ro_create================" + ro_create);
|
||
creadteFile(userContext, open, names.get(i).toString(), add_name);
|
||
}
|
||
|
||
|
||
} else {
|
||
|
||
if (StringUtils.isNotEmpty(dimensionId)) {
|
||
// 调用App
|
||
String sourceAppId = APPID;
|
||
// aslp服务地址
|
||
String aslps_de = "aslp://com.actionsoft.apps.kms/createDimension";
|
||
// 参数定义列表
|
||
Map paramss = new HashMap<String, Object>();
|
||
//发布是否需要审批,默认false,必填
|
||
paramss.put("isExamine", false);
|
||
//是否启用,默认启用,必填
|
||
paramss.put("isEnabled", true);
|
||
//维度类型,1:允许发布知识 2:不允许发布知识,必填
|
||
paramss.put("showType", 1);
|
||
//维度描述,非必填
|
||
paramss.put("memo", "");
|
||
//创建人,非必填
|
||
paramss.put("createUser", "admin");
|
||
|
||
String sql_fa = " select PLNAME from APP_ACT_COE_PAL_REPOSITORY " +
|
||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and EXT4 = '" + names.get(i) + "'";
|
||
String plname = DBSql.getString(open, sql_fa);
|
||
//维度名称,必填
|
||
paramss.put("dimensionName", plname);
|
||
|
||
String dimensionId_sql_i = "SELECT ID FROM APP_ACT_KMS_DIMENSION where ID ='" + names.get(i + 1) + "'";
|
||
de_name = DBSql.getString(open, dimensionId_sql_i);
|
||
//父维度Id:""表示根维度,必填
|
||
paramss.put("parentId", de_name);
|
||
//sid,必填
|
||
paramss.put("sid", userContext.getSessionId());
|
||
AppAPI appAPIs = SDK.getAppAPI();
|
||
//创建维度
|
||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslps_de, paramss);
|
||
|
||
System.out.println("ros==================" + ros);
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
System.out.println("定时器执行完毕");
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
} finally {
|
||
try {
|
||
open.close();
|
||
} catch (SQLException throwables) {
|
||
throwables.printStackTrace();
|
||
}
|
||
}
|
||
}
|
||
|
||
public void creadteFile(UserContext userContext, Connection open, String name, String add_name) {
|
||
/**
|
||
* 这个主要是负责对流程手册进行相关的文件的生成
|
||
*/
|
||
String sourceAppId = APPID;
|
||
// aslp服务地址
|
||
String aslp = "aslp://com.actionsoft.apps.kms/CreateFile";
|
||
|
||
String sql = "SELECT CARDNAME FROM APP_ACT_KMS_CARD WHERE ID = '" + name + "'";
|
||
String id = DBSql.getString(open, sql);
|
||
if (StringUtils.isNotEmpty(id)) {
|
||
BO bos = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("PUBLISHFILENAME = ", name).detail();
|
||
if (bos != null) {
|
||
|
||
|
||
if (StringUtils.isNotEmpty(bos.getString("TASKID"))) {
|
||
|
||
OutputTaskModel model = new OutputTask().getTaskReportById(bos.getString("TASKID"));
|
||
if (model != null) {
|
||
System.out.println(",pdel============" + model);
|
||
System.out.println("123313123123123==========" + model.getProfileId());
|
||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||
System.out.println("dajadfas======" + appProfile);
|
||
if (appProfile == null) {
|
||
throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId());
|
||
}
|
||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||
if (dcProfile == null)
|
||
throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT);
|
||
String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME = '" + bos.getString("PUBLISHFILENAME") + "'";
|
||
String lever = DBSql.getString(open, sql_lever);
|
||
//lever = lever.substring(0,3);
|
||
DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bos.getString("TASKID"), bos.getString("PUBLISHFILENAME") + "_" + lever + ".doc");
|
||
//UtilFile file = new UtilFile(dcContext.getPath());
|
||
|
||
|
||
Map params = new HashMap<String, Object>();
|
||
//知识ID,必填
|
||
params.put("cardId", id);
|
||
//sid,必填
|
||
params.put("sid", userContext.getSessionId());
|
||
|
||
params.put("dc", dcContext);
|
||
AppAPI appAPI = SDK.getAppAPI();
|
||
//创建文件
|
||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||
System.out.println("流程手册的存入=================" + ro);
|
||
}
|
||
}
|
||
|
||
}
|
||
String sql_A = "SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where PLNAME = '" + name + "' AND PLMETHODID != 'process.framework' AND PLMETHODID IN (select distinct PLMETHODID from APP_ACT_COE_PAL_REPOSITORY)";
|
||
List<RowMap> rows = DBSql.getMaps(open, sql_A);
|
||
|
||
for (RowMap bo : rows
|
||
) {
|
||
|
||
/**
|
||
* 这个是模型中的附件获取的并插入的数据信息,需要做修改
|
||
*/
|
||
// 调用App
|
||
|
||
// 参数定义列表
|
||
Map paramss = new HashMap<String, Object>();
|
||
//知识ID,必填
|
||
paramss.put("cardId", id);
|
||
//sid,必填
|
||
paramss.put("sid", userContext.getSessionId());
|
||
|
||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||
|
||
|
||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID != 'process.framework' AND PLNAME= '" + bo.getString("PLNAME") + "'" +
|
||
")";
|
||
List<RowMap> maps = DBSql.getMaps(open, sql_upfile);
|
||
for (RowMap row : maps) {
|
||
UpfileModel upfileModel = new UpfileModel();
|
||
upfileModel.setType(row.getString("FILETYPE"));
|
||
upfileModel.setFileName(row.getString("FILENAME"));
|
||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||
paramss.put("dc", dcContexts);
|
||
AppAPI appAPIs = SDK.getAppAPI();
|
||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss);
|
||
System.out.println("流程模型附件的生成=============" + ros);
|
||
}
|
||
|
||
//DCContext对象,必填
|
||
|
||
//创建文件
|
||
}
|
||
PublishKnow(userContext, open, add_name, id);
|
||
}
|
||
}
|
||
|
||
public void PublishKnow(UserContext userContext, Connection open, String add_name, String id) {
|
||
System.out.println("add_name=================" + add_name);
|
||
/*String result = add_name.substring(0, add_name.length() - 1);
|
||
String[] deptSplit = result.split(",");
|
||
|
||
if (deptSplit.length == 1) {
|
||
result = "'" + deptSplit[0] + "'";
|
||
}
|
||
result = "'" + StringUtils.join(deptSplit, "','") + "'";
|
||
System.out.println(">>>>>NO =" + result);
|
||
|
||
String sql = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME IN (" + result + ") ";
|
||
List<RowMap> maps = DBSql.getMaps(open, sql);
|
||
if (maps.size() == 0) {
|
||
String sql_DIMENSIONNAME = "SELECT PLPARENTID FROM APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process' and PLNAME IN (" + result + ") ";
|
||
String maps_first = DBSql.getString(open, sql_DIMENSIONNAME);
|
||
|
||
if (maps_first.equals("itsystem")) {
|
||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='IT系统' ";
|
||
maps = DBSql.getMaps(open, sql_id);
|
||
} else if (maps_first.equals("control")) {
|
||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='控制' ";
|
||
maps = DBSql.getMaps(open, sql_id);
|
||
} else if (maps_first.equals("process")) {
|
||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='流程制度' ";
|
||
maps = DBSql.getMaps(open, sql_id);
|
||
} else if (maps_first.equals("org")) {
|
||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='组织' ";
|
||
maps = DBSql.getMaps(open, sql_id);
|
||
} else if (maps_first.equals("data")) {
|
||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='数据' ";
|
||
maps = DBSql.getMaps(open, sql_id);
|
||
} else {
|
||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME =(SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where ID ='" + maps_first + "')";
|
||
maps = DBSql.getMaps(open, sql_id);
|
||
}
|
||
}
|
||
String ids = "";
|
||
if (maps.size() != 0) {
|
||
|
||
for (RowMap rowmap : maps
|
||
) {
|
||
ids += rowmap.getString("ID") + ",";
|
||
}
|
||
ids = ids.substring(0, ids.length() - 1);
|
||
|
||
} else {
|
||
for (RowMap rowmap : maps
|
||
) {
|
||
ids += rowmap.getString("ID") + ",";
|
||
}
|
||
ids = ids.substring(0, ids.length() - 1);
|
||
}*/
|
||
|
||
String[] deptSplit_id = add_name.split(",");
|
||
|
||
JSONArray jsonArray = new JSONArray();
|
||
for (String id_names : deptSplit_id
|
||
) {
|
||
jsonArray.add(id_names);
|
||
}
|
||
//jsonObject.put(deptSplit_id);
|
||
id += ",";
|
||
String[] deptSplit_das = id.split(",");
|
||
JSONArray jsonArray_das = new JSONArray();
|
||
for (String das : deptSplit_das
|
||
) {
|
||
jsonArray_das.add(das);
|
||
}
|
||
//jsonObject.put(deptSplit_id);
|
||
|
||
|
||
// 调用App
|
||
String sourceAppId = APPID;
|
||
// aslp服务地址
|
||
String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl";
|
||
// 参数定义列表
|
||
Map params = new HashMap<String, Object>();
|
||
//要发布到的维度ID的JSON数组字符串,必填
|
||
params.put("dimensionIDArray", jsonArray.toString());
|
||
//要发布的知识ID的JSON数组字符串,必填
|
||
params.put("knwlIDArray", jsonArray_das.toString());
|
||
//标签的JSON数组字符串,非必填
|
||
|
||
//sid,必填
|
||
params.put("sid", userContext.getSessionId());
|
||
AppAPI appAPI = SDK.getAppAPI();
|
||
//发布知识
|
||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||
|
||
System.out.println("知识发布============" + ro);
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|