方案图、工程技术标准添加默认附件
This commit is contained in:
parent
da8800fe2b
commit
95adf703a9
Binary file not shown.
@ -3702,6 +3702,25 @@ public class CoEPALController {
|
||||
return web.createOutputPrReports(wsId, teamId, uuids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取相关支持文件
|
||||
*
|
||||
* @param me
|
||||
* @param uuids
|
||||
* @param teamId
|
||||
* @param wsId
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.actionsoft.apps.coe.pal.getrelatedSupportFiles")
|
||||
public String getrelatedSupportFiles(UserContext me, String uuids, String teamId, String wsId) {
|
||||
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
|
||||
return web.getrelatedSupportFiles(wsId, teamId, uuids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 重新生成手册
|
||||
*
|
||||
|
||||
@ -4,20 +4,12 @@ import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.actionsoft.apps.AppsConst;
|
||||
@ -884,7 +876,6 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
if (UtilString.isNotEmpty(url)) {
|
||||
String titles = objects.getJSONObject(i).getString("title");
|
||||
|
||||
System.out.println("titles============" + titles);
|
||||
if (titles.equals("角色模型")) {
|
||||
objects.getJSONObject(i).put("nocheck", true);
|
||||
jsonArr_new.add(objects.getJSONObject(i));
|
||||
@ -905,7 +896,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}
|
||||
macroLibraries.put("treeData", jsonArr_new.toString());
|
||||
|
||||
} else if (attrId.equals("R_relevant_flies") || attrId.equals("related_files")) {//相关文件
|
||||
} else if (attrId.equals("R_relevant_flies") || attrId.equals("related_files") || attrId.equals("related_support_files")) {//相关文件
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
JSONObject jsonObject = objects.getJSONObject(i);
|
||||
String isParent = jsonObject.getString("isParent");
|
||||
@ -1366,7 +1357,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
RowMap stoprowMap = DBSql.getMap("SELECT ISSTOP FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISUSE=?", name, 1);
|
||||
if (stoprowMap.getString("ISSTOP").equals("0")) {
|
||||
//如果为相关文件 未发布不可选中
|
||||
if (attrId.equals("R_relevant_flies") || attrId.equals("related_files")) {
|
||||
if (attrId.equals("R_relevant_flies") || attrId.equals("related_files") || attrId.equals("related_support_files")) {
|
||||
|
||||
if (model.getName().equals("流程架构图")) {
|
||||
continue;
|
||||
@ -4285,6 +4276,23 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getrelatedSupportFiles(String wsId, String teamId, String uuids) {
|
||||
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ro.put("data", result);
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建手册
|
||||
*
|
||||
@ -4572,6 +4580,13 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重新生成手册(文件状态批量修改)
|
||||
* @param me
|
||||
* @param plIds
|
||||
* @return
|
||||
*/
|
||||
public String RefreshManualChangeFile(UserContext me, String plIds) {
|
||||
int count = 0;
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
@ -4584,22 +4599,48 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
|
||||
if (model != null) {
|
||||
String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
|
||||
System.err.println("======手动生成手册id======" + taskId);
|
||||
|
||||
// 刷新预览加载的表
|
||||
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
|
||||
DBSql.update(sqlr);
|
||||
String sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
|
||||
String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
|
||||
if (UtilString.isNotEmpty(DBSql.getString(sql1))) {
|
||||
String sql1 = "SELECT ID,BINDID,TASKID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
|
||||
String sql2 = "SELECT ID,BINDID,TASKID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
|
||||
if (DBSql.getMap(sql1)!=null) {
|
||||
count = DBSql.update("UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
|
||||
|
||||
JSONArray filed = new JSONArray(new LinkedList<>());
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
|
||||
.addQuery("BINDID=", DBSql.getMap(sql1).getString("BINDID"))
|
||||
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
|
||||
CreateKmsByupdate(taskId,plId,model.getWsId(), filed, me, bo_act_coe_publish,
|
||||
plId);
|
||||
|
||||
}
|
||||
if (UtilString.isNotEmpty(DBSql.getString(sql2))) {
|
||||
if (DBSql.getMap(sql2)!=null) {
|
||||
count = DBSql.update("UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + taskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'");
|
||||
|
||||
JSONArray filed = new JSONArray(new LinkedList<>());
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
|
||||
.addQuery("BINDID=", DBSql.getMap(sql2).getString("BINDID"))
|
||||
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
|
||||
CreateKmsByupdate(taskId,plId, model.getWsId(), filed, me, bo_act_coe_publish,
|
||||
plId);
|
||||
|
||||
}
|
||||
if (count != 0) {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='" + plId + "'");
|
||||
}
|
||||
|
||||
// 将旧的知识取消发布或者移动到废止发布中
|
||||
String sql_c = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + plId + "'";
|
||||
RowMap map1 = DBSql.getMap(sql_c);
|
||||
if (StringUtils.isNotEmpty(map1.getString("EXT4"))) {
|
||||
CancelPublishKnwl( me.getSessionId(),
|
||||
map1.getString("EXT4"));
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '" + plId + "'");
|
||||
}
|
||||
System.err.println("重新生成手册成功=====》" + count);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -4609,5 +4650,453 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发布生成kms知识
|
||||
*
|
||||
* @param bo 更新发布清单表
|
||||
* @param wsId 知识库id
|
||||
* @param filed 发布清单的发布id
|
||||
* @param processExecutionContext 流程数据
|
||||
* @param bo_act_coe_publish 发布表
|
||||
* @param uid 账户集合
|
||||
*/
|
||||
public void CreateKmsByupdate(String taskId,String plId, String wsId, JSONArray filed, UserContext me,
|
||||
BO bo_act_coe_publish, String uid) {
|
||||
{
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
wsId = model.getWsId();
|
||||
String publishfileid = plId;
|
||||
filed.add(publishfileid);
|
||||
DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' where id = '" + publishfileid + "'");
|
||||
String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + publishfileid + "'";
|
||||
RowMap map = DBSql.getMap(sql_n);
|
||||
if (StringUtils.isEmpty(map.getString("EXT4"))) {
|
||||
// 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);
|
||||
//知识名称,必填
|
||||
String level = "";
|
||||
if (map != null) {
|
||||
String pver = map.getString("PLVER");
|
||||
if (UtilString.isNotEmpty(pver)) {
|
||||
if (pver.contains(".00")) {
|
||||
String levels = pver;
|
||||
String[] plvers = levels.split("\\.");
|
||||
plvers[1] = plvers[1].replaceAll("0", "");
|
||||
level = plvers[0] + "." + plvers[1];
|
||||
} else {
|
||||
level = pver + ".0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
params_create.put("knwlName", map.getString("PLNAME") + "V" + level);
|
||||
//是否可以评论,必填
|
||||
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", me.getSessionId());
|
||||
AppAPI appAPI_create = SDK.getAppAPI();
|
||||
//创建知识
|
||||
ResponseObject ro_create = appAPI_create.callASLP(
|
||||
appAPI_create.getAppContext("com.actionsoft.apps.coe.pal"),
|
||||
aslps_create, params_create);
|
||||
// System.out.println("ro_create================" + ro_create);
|
||||
String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString();
|
||||
JSONArray jsonArray1 = new JSONArray();
|
||||
//根据表单字段判断是否发送全公司,1为全公司,0为部分人员,发送全公司的则授权公司id,只有部门则授权部门,如果包含部门,职级,岗位则授权该范围的人员id
|
||||
|
||||
if (bo_act_coe_publish.getString("SEND_SCOP").equals("1")) {
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "company");
|
||||
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
|
||||
jsonArray1.add(jsonObjecta);
|
||||
} else {
|
||||
String departId = bo_act_coe_publish.getString("SEND_SCOPE_ORG");
|
||||
if (StringUtils.isNotEmpty(departId)
|
||||
&& StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_LEVEL"))
|
||||
&& StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_POST"))) {
|
||||
String strs[] = departId.split(",");
|
||||
for (String departmentid : strs) {
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "department");
|
||||
jsonObjecta.put("assignmentId", departmentid);
|
||||
jsonArray1.add(jsonObjecta);
|
||||
}
|
||||
} else {
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
|
||||
for (String user_id : list) {
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "user");
|
||||
jsonObjecta.put("assignmentId", user_id);
|
||||
jsonArray1.add(jsonObjecta);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AddKnwlAC( jsonArray1, me.getSessionId(),
|
||||
cardId);
|
||||
|
||||
String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '" + cardId + "' 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 ID = '" + publishfileid + "'";
|
||||
int update = DBSql.update(update_sql);
|
||||
System.out.println("更新id为:" + publishfileid + "版本为:的知识对应的资产库的EXT4的影响行数为" + update);
|
||||
creadteFile("BO_ACT_COE_PUBLISH_C", me,
|
||||
cardId, " CHANGEDFILEIDNEW=");
|
||||
}
|
||||
// 将旧的知识取消发布或者移动到废止发布中
|
||||
String publishfileid_old = plId;
|
||||
String sql_c = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + publishfileid_old + "'";
|
||||
RowMap map1 = DBSql.getMap(sql_c);
|
||||
if (StringUtils.isNotEmpty(map1.getString("EXT4"))) {
|
||||
CancelPublishKnwl(me.getSessionId(),
|
||||
map1.getString("EXT4"));
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '" + publishfileid_old + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 取消发布知识
|
||||
*
|
||||
* @param processExecutionContext
|
||||
* @param sid
|
||||
* @param knwlId
|
||||
* @return
|
||||
*/
|
||||
public boolean CancelPublishKnwl(String sid, String knwlId) {
|
||||
// 调用App
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal";
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CancelPublishKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
// sid,如果为空,则需要传createUser参数,非必填
|
||||
params.put("sid", sid);
|
||||
// 知识ID,必填
|
||||
params.put("knwlId", knwlId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
// 取消发布知识(全部维度)
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 给知识授权
|
||||
*
|
||||
* @param processExecutionContext
|
||||
* @param jsonArray
|
||||
* @param sid
|
||||
* @param knwlId
|
||||
* @return
|
||||
*/
|
||||
public boolean AddKnwlAC(JSONArray jsonArray, String sid,
|
||||
String knwlId) {
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal";
|
||||
// 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);
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建附件及文件
|
||||
*
|
||||
* @param processExecutionContext
|
||||
* @param bo_name
|
||||
* @param userContext
|
||||
* @param cardId
|
||||
* @param fileid
|
||||
*/
|
||||
public void creadteFile(String bo_name, UserContext userContext,
|
||||
String cardId, String fileid) {
|
||||
/**
|
||||
* 这个主要是负责对流程手册进行相关的文件的生成
|
||||
*/
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal";
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CreateFile";
|
||||
|
||||
if (StringUtils.isNotEmpty(cardId)) {
|
||||
String sql_ext4 = "select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '" + cardId + "'";
|
||||
RowMap map = DBSql.getMap(sql_ext4);
|
||||
RowMap rowMap = DBSql
|
||||
.getMap("SELECT * FROM " + bo_name + " where " + fileid + " '" + map.getString("ID") + "'");
|
||||
// BO bos =
|
||||
// SDK.getBOAPI().query(bo_name,true).addQuery(fileid,"17e7d198-1656-4a2c-8912-a81850170be9").detail();
|
||||
if (rowMap != null) {
|
||||
|
||||
if (StringUtils.isNotEmpty(rowMap.getString("TASKID"))) {
|
||||
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID"));
|
||||
if (model != null) {
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
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 = "";
|
||||
if (bo_name.equals("BO_ACT_COE_PUBLISH_N")) {
|
||||
sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"
|
||||
+ rowMap.getString("PUBLISHFILEID") + "'";
|
||||
|
||||
} else if (bo_name.equals("BO_ACT_COE_PUBLISH_C")) {
|
||||
sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"
|
||||
+ rowMap.getString("CHANGEDFILEIDNEW") + "'";
|
||||
}
|
||||
String lever = DBSql.getString(sql_lever);
|
||||
// lever = lever.substring(0,3);
|
||||
if (lever.length() == 5 && lever.substring(4).equals("0")) {
|
||||
lever.substring(0, 3);
|
||||
} else if (lever.length() == 1) {
|
||||
lever = lever + ".0";
|
||||
}
|
||||
String filename = "";
|
||||
if (bo_name.equals("BO_ACT_COE_PUBLISH_N")) {
|
||||
filename = rowMap.getString("PUBLISHFILENAME");
|
||||
} else if (bo_name.equals("BO_ACT_COE_PUBLISH_C")) {
|
||||
filename = rowMap.getString("CHANGEDFILENAMENEW");
|
||||
}
|
||||
DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(),
|
||||
model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc");
|
||||
// UtilFile file = new UtilFile(dcContext.getPath());
|
||||
|
||||
Map params = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
params.put("cardId", cardId);
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
|
||||
params.put("dc", dcContext);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//创建文件
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
JSONArray coontest = new JSONArray(new LinkedList<>());
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
jsonObject.put("documentId", cardId);
|
||||
jsonObject.put("content", "");//信息附件
|
||||
jsonObject.put("abstract", dcContext);//信息摘要
|
||||
jsonObject.put("title", dcContext.getFileName().substring(0,dcContext.getFileName().indexOf(".")));//信息标题
|
||||
coontest.add(jsonObject);
|
||||
createIndexesByContent(coontest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
String sql_A = "SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where ID = '" + map.getString("ID")
|
||||
+ "' AND PLMETHODID != 'process.framework' AND PLMETHODID IN (select distinct PLMETHODID from APP_ACT_COE_PAL_REPOSITORY)";
|
||||
List<RowMap> rows = DBSql.getMaps(sql_A);
|
||||
|
||||
for (RowMap bo : rows) {
|
||||
|
||||
/**
|
||||
* 这个是模型中的附件获取的并插入的数据信息,需要做修改
|
||||
*/
|
||||
// 调用App
|
||||
|
||||
// 参数定义列表
|
||||
Map paramss = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
paramss.put("cardId", cardId);
|
||||
//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 ID= '"
|
||||
+ map.getString("ID") + "'" + ") and FILETYPE='f' ORDER BY FILENAME ASC";
|
||||
List<RowMap> maps = DBSql.getMaps(sql_upfile);
|
||||
for (RowMap row : maps) {
|
||||
if (!row.getString("FILENAME").contains(".xml")) {
|
||||
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);
|
||||
|
||||
JSONArray coontest = new JSONArray(new LinkedList<>());
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
jsonObject.put("documentId", cardId);
|
||||
jsonObject.put("content", "");//信息附件
|
||||
jsonObject.put("abstract", dcContexts);//信息摘要
|
||||
jsonObject.put("title", dcContexts.getFileName().substring(0,dcContexts.getFileName().indexOf(".")));//信息标题
|
||||
coontest.add(jsonObject);
|
||||
createIndexesByContent(coontest);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
PublishKnow(userContext, cardId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建索引
|
||||
* @param processExecutionContext 流程实例
|
||||
* @param contents 索引内容
|
||||
* @return
|
||||
*/
|
||||
|
||||
public boolean createIndexesByContent(JSONArray contents) {
|
||||
// 调用App
|
||||
String sourceAppId="com.actionsoft.apps.coe.pal";
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexesByContent";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//索引内容(JSONArray格式, JSONArray中包含JSONObject, JSONObject的内容同创建单个索引),必填
|
||||
params.put("contents", contents);
|
||||
//索引名称(文档在哪存放),必填
|
||||
params.put("index", "com.actionsoft.apps.kms_kmsdoc_card");
|
||||
//类型(索引中对数据进行逻辑分区。不同 type的文档可能有不同的字段,但最好能够非常相似,比如:存储所有产品到索引products中,但是你有许多不同的产品类别,这些产品共享一种相同的(或非常相似)的模式:他们有一个标题、描述、产品代码和价格。他们只是正好属于“产品”下的一些子类。用type表示不同的类别),必填
|
||||
params.put("type", "kmsdoc_card");
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//入库操作,创建内容索引(多个)
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发布知识
|
||||
*
|
||||
* @param processExecutionContext
|
||||
* @param userContext
|
||||
* @param id
|
||||
*/
|
||||
public void PublishKnow(UserContext userContext, String id) {
|
||||
|
||||
String sql = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where id in (select PLPARENTID from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '"
|
||||
+ id + "')";
|
||||
List<RowMap> maps = DBSql.getMaps(sql);
|
||||
String ids = "";
|
||||
for (RowMap rowmap : maps) {
|
||||
ids += rowmap.getString("EXT4") + ",";
|
||||
}
|
||||
String[] deptSplit_id = ids.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);
|
||||
|
||||
if (!jsonArray_das.isEmpty() && !jsonArray.isEmpty()) {
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal";
|
||||
// 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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -2837,8 +2837,12 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
}
|
||||
if ("user".equals(object.getString("type"))) {
|
||||
UserModel user = SDK.getORGAPI().getUser(object.getString("id"));
|
||||
String username=user.getUserName();
|
||||
if (user != null && !filter.contains(user.getUID())) {
|
||||
object.put("name", user.getUserName());
|
||||
if(user.isClosed()==true){
|
||||
username=user.getUserName()+"(已注销)";
|
||||
}
|
||||
object.put("name", username);
|
||||
filter.add(user.getUID());
|
||||
dataArr.add(object);
|
||||
}
|
||||
@ -8767,9 +8771,175 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_CREATE, CoEOpLogConst.INFO_REPOSITORY_CREATE);
|
||||
}
|
||||
|
||||
//创建方案图
|
||||
if(method.equals("process.scheme")){
|
||||
createEngineeringStandard("1",model.getId(),wsId);
|
||||
}else if(method.equals("engineering.standard")){
|
||||
createEngineeringStandard("2",model.getId(),wsId);
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据类型创建方案图/工程技术工程标准
|
||||
* @param creartType
|
||||
* @return
|
||||
*/
|
||||
public String createEngineeringStandard(String creartType,String uuid,String wsId){
|
||||
|
||||
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
try {
|
||||
PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid);
|
||||
|
||||
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(plModel.getId(), 0);
|
||||
if (defineModel == null) {
|
||||
defineModel = CoeDesignerUtil.createModel(plModel.getId(), 0);
|
||||
defineModel.setCreateHistory(false);
|
||||
}
|
||||
|
||||
String define = defineModel.getDefinition();
|
||||
JSONObject definition = JSONObject.parseObject(define);
|
||||
JSONObject elements = definition.getJSONObject("elements");
|
||||
|
||||
//新建一个uuid
|
||||
String shapeId = UUIDGener.getObjectId();
|
||||
//拿到基础结构
|
||||
JSONObject shape;
|
||||
if (creartType.equals("1")) {
|
||||
shape = ShapeUtils.getProcessShapeDefinitionByName("process.scheme", "card");
|
||||
shape.put("id", shapeId);
|
||||
DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT3='card' where id = '"+uuid+"'");
|
||||
|
||||
} else {
|
||||
shape = ShapeUtils.getProcessShapeDefinitionByName("engineering.standard", "regulation");
|
||||
shape.put("id", shapeId);
|
||||
shape.put("text", "工程技术标准");
|
||||
DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT3='regulation' where id = '"+uuid+"'");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//图形的数据属性配置
|
||||
List<PALMethodAttributeModel> attributeModels = CoeDesignerShapeAPIManager.getInstance().getAllValidShapeAttributeModels(wsId, plModel.getMethodId());
|
||||
for (PALMethodAttributeModel attributeModel : attributeModels) {
|
||||
|
||||
//todo:根据importProperty的类型获取具体保存数据值
|
||||
JSONObject arributeObj = new JSONObject();
|
||||
arributeObj.put("key", attributeModel.getKey());
|
||||
arributeObj.put("isRequired", attributeModel.getIsRequired());
|
||||
arributeObj.put("ref", attributeModel.getRef());
|
||||
arributeObj.put("readonly", attributeModel.getReadonly());
|
||||
arributeObj.put("scope", attributeModel.getScope());
|
||||
arributeObj.put("name", attributeModel.getTitle());
|
||||
arributeObj.put("id", attributeModel.getKey());
|
||||
arributeObj.put("type", attributeModel.getType());
|
||||
arributeObj.put("groupPath", attributeModel.getGroupPath());
|
||||
arributeObj.put("desc", attributeModel.getDesc());
|
||||
arributeObj.put("value", attributeModel.getValue());
|
||||
|
||||
JSONArray dataAttributes = shape.getJSONArray("dataAttributes");
|
||||
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
|
||||
for (Object attribute : dataAttributes) {
|
||||
JSONObject obj = (JSONObject) attribute;
|
||||
if (obj.containsKey("attributesJsonArray")) {
|
||||
obj.getJSONArray("attributesJsonArray").add(arributeObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JSONObject props = shape.getJSONObject("props");// 位置大小
|
||||
|
||||
props.put("zindex", 0);
|
||||
props.put("x", Integer.parseInt("400"));
|
||||
props.put("y", Integer.parseInt("166"));
|
||||
props.put("w", Integer.parseInt("110"));
|
||||
props.put("h", Integer.parseInt("50"));
|
||||
|
||||
props.put("zindex", 1);
|
||||
|
||||
elements.put(shapeId, shape);
|
||||
|
||||
// 设置画布大小
|
||||
DiagramsUtil.setDiagramHeightWidth(definition, elements);
|
||||
defineModel.setDefinition(definition.toString());
|
||||
// 保存文件
|
||||
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
|
||||
|
||||
|
||||
|
||||
//先获取附件模版
|
||||
String repositoryName = "!form-ui-file-";
|
||||
BO bo = SDK.getBOAPI().query("BO_EU_SYSTEM_DEMO_FILE").addQuery("FILESTATE=", true).detail();
|
||||
List<FormFile> files = SDK.getBOAPI().getFiles(bo.getId(), "SYSTEMFILE");
|
||||
FormFile formFile = files.get(0);
|
||||
DCContext sourceDc = SDK.getBOAPI().getFileDCContext(formFile, repositoryName);
|
||||
sourceDc.setSession(this.getContext());
|
||||
|
||||
InputStream originfile = SDK.getDCAPI().read(sourceDc);
|
||||
|
||||
|
||||
String shpId = "";
|
||||
if (creartType.equals("1")) {
|
||||
for (String key : elements.keySet()) {
|
||||
JSONObject shape1 = elements.getJSONObject(key);
|
||||
if ("card".equals(shape1.getString("name"))) {
|
||||
shpId = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
for (String key : elements.keySet()) {
|
||||
JSONObject shape1 = elements.getJSONObject(key);
|
||||
if ("regulation".equals(shape1.getString("name"))) {
|
||||
shpId = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int lastDotIndex = formFile.getFileName().lastIndexOf(".");
|
||||
String name = formFile.getFileName().substring(0, lastDotIndex);
|
||||
|
||||
boolean writeFileTodisk = writeFileTodisk(this.getContext(), shpId, formFile.getFileName(),
|
||||
originfile, uuid, "s");
|
||||
System.out.println("writeFileTodisk = " + writeFileTodisk);
|
||||
|
||||
|
||||
DCPluginProfile dcProfilepdf = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration",
|
||||
"migration");
|
||||
DCContext dcContextpdf = new DCContext(this.getContext(), dcProfilepdf, "com.actionsoft.apps.coe.pal.datamigration",
|
||||
"policyFile", uuid, formFile.getFileName());
|
||||
boolean write = SDK.getDCAPI().write(originfile, dcContextpdf);
|
||||
System.out.println("write = " + write);
|
||||
|
||||
ro.put("result", "ok");
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
ro.put("result", "error");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验和创建末级流程绩效文件夹
|
||||
*
|
||||
@ -8887,6 +9057,9 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户选择类型创建相应制度图形
|
||||
*
|
||||
@ -8896,7 +9069,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
public String CreateSystemModelBySelectType(String wsId, String title, String type, String method, String uuid, String parentId) {
|
||||
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
|
||||
try {
|
||||
PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid);
|
||||
|
||||
@ -8910,8 +9082,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
JSONObject definition = JSONObject.parseObject(define);
|
||||
JSONObject elements = definition.getJSONObject("elements");
|
||||
|
||||
|
||||
|
||||
//新建一个uuid
|
||||
String shapeId = UUIDGener.getObjectId();
|
||||
//拿到基础结构
|
||||
|
||||
Loading…
Reference in New Issue
Block a user