PAL资产库按钮代码提交
This commit is contained in:
parent
b6d895c82c
commit
a4488b98eb
@ -8,7 +8,9 @@ import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryPropertyCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
@ -17,6 +19,7 @@ import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.database.RowMapper;
|
||||
import com.actionsoft.bpms.commons.login.constant.LoginConst;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.RoleModel;
|
||||
@ -45,6 +48,8 @@ import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@ -67,23 +72,20 @@ public class UpateFileStateController {
|
||||
String[] plIdList = plIds.split(",");
|
||||
|
||||
for (String plId : plIdList){
|
||||
|
||||
String date = simpleDateFormat.format(new Date());
|
||||
if ("1".equals(type)) {
|
||||
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
|
||||
bo_eu_pal_repository.set("ISPUBLISH",state);
|
||||
SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository);
|
||||
//修改发布状态 如果用户把一个模型改为已发布,应该把已发布调整为1,同时已停用和审批中调整为0;
|
||||
|
||||
//修改发布状态
|
||||
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISPUBLISH = '" + state + "',ISSTOP=0,ISAPPROVAL=0,MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId
|
||||
+ "'";
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '"+state+"',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '"+plId+"'");
|
||||
count = DBSql.update(updataSql);
|
||||
String sqlt = "UPDATE BO_EU_PAL_FILE1 SET FILESTATE = '" + state + "' WHERE FILEID = '" + plId + "'";
|
||||
int update = DBSql.update(sqlt);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DBSql.update(sqlt);
|
||||
/*
|
||||
String id = DBSql.getString("SELECT ID FROM APP_ACT_COE_PAL_PUBLISH_LIST WHERE PALREPOSITORYID='" + plId + "'");
|
||||
* if (UtilString.isNotEmpty(id)) { PALRepositoryModel model =
|
||||
@ -103,35 +105,46 @@ public class UpateFileStateController {
|
||||
* "'WHERE PALREPOSITORYID='" + plId + "'"); } }
|
||||
*/
|
||||
|
||||
|
||||
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
if (model!=null){
|
||||
PALRepositoryCache.getCache().put(plId,model);
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
if (plModel != null) {
|
||||
PALRepositoryCache.getCache().put(plId, plModel);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
|
||||
if(Integer.valueOf(state) == 1){
|
||||
UpdateDept(model,plId);
|
||||
UpdateDept(plModel,plId);
|
||||
createPermScopeData(plId , me);
|
||||
SDK.getLogAPI().consoleInfo("修改为发布状态后同步权限数据到权限阅览成功===========>");
|
||||
}
|
||||
createFile(plId,me);
|
||||
if (state.equals("1")){
|
||||
createFile(plId,me);
|
||||
}else{
|
||||
String sql = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where ID = '"+plId+"'";
|
||||
String ext4 = DBSql.getString(sql);
|
||||
//获取发布流程组中运行中的流程
|
||||
String processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_fb1c7a54b98b412187388c8bab407362");
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, "admin", "");
|
||||
CancelPublishKnwl(processInstance,me.getSessionId(),ext4);
|
||||
}
|
||||
|
||||
} else if ("2".equals(type)) {
|
||||
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
|
||||
bo_eu_pal_repository.set("ISAPPROVAL",state);
|
||||
SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository);
|
||||
|
||||
// 修改流程文件的审批状态
|
||||
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISAPPROVAL = '" + state + "',MODIFYDATE =TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId
|
||||
+ "'";
|
||||
System.err.println("审批改为设计=======>" + updataSql);
|
||||
count = DBSql.update(updataSql);
|
||||
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
if (model!=null){
|
||||
PALRepositoryCache.getCache().put(plId,model);
|
||||
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
if (plModel != null) {
|
||||
PALRepositoryCache.getCache().put(plId, plModel);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
|
||||
} else if ("3".equals(type)) {
|
||||
// 重新生成手册
|
||||
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
|
||||
String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
|
||||
System.err.println("======手动生成手册id======"+taskId);
|
||||
// 刷新预览加载的表
|
||||
@ -151,21 +164,132 @@ public class UpateFileStateController {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='"
|
||||
+ plId + "'");
|
||||
}
|
||||
if(UtilString.isEmpty(DBSql.getString(sql1)) && UtilString.isEmpty(DBSql.getString(sql2))){
|
||||
System.out.println("发布流程无数据===================================================");
|
||||
////String sql = "SELECT pl.TASKID FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl
|
||||
// // WHERE pl.pid = p.id AND pl.palrepositoryid = ? ORDER BY publishdate DESC";
|
||||
|
||||
//审批改为发布,如果发布表未存数据,则自动生成发布关联表数据,可使部门视图正常使用
|
||||
BO publishN=new BO();
|
||||
publishN.set("PUBLISTHTYPE","N");
|
||||
publishN.set("PUBLISHFILENAME",model.getName());
|
||||
publishN.set("PUBLISHFILEID",plId);
|
||||
//获取发布流程组中运行中的流程
|
||||
String processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_fb1c7a54b98b412187388c8bab407362");
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, "admin", "");
|
||||
SDK.getBOAPI().create("BO_ACT_COE_PUBLISH_N",publishN,processInstance,me);
|
||||
|
||||
|
||||
/*BO publish=new BO();
|
||||
publish.set("PROCESSINSTID",processInstance.getId());
|
||||
publish.set("PUBLISH","1");
|
||||
SDK.getBOAPI().createDataBO("APP_ACT_COE_PAL_PUBLISH",publish,me);*/
|
||||
|
||||
String sql = "insert into APP_ACT_COE_PAL_PUBLISH (ID,PROCESSINSTID,PUBLISH) values ('%s', '%s', '%s')";
|
||||
String id = UUIDGener.getUUID();
|
||||
int update = DBSql.update(String.format(sql, id, processInstance.getId(), '1'));
|
||||
|
||||
|
||||
//BO app_act_coe_pal_publish = SDK.getBOAPI().query("APP_ACT_COE_PAL_PUBLISH").addQuery("BINDID=", processInstance.getId()).detail();
|
||||
RowMap map = DBSql.getMap("select * from APP_ACT_COE_PAL_PUBLISH where BINDID = '" + processInstance.getId() + "'");
|
||||
/*BO publishList=new BO();
|
||||
publishList.set("PID",app_act_coe_pal_publish.getString("ID"));
|
||||
publishList.set("PALREPOSITORYID",plId);
|
||||
SDK.getBOAPI().createDataBO("APP_ACT_COE_PAL_PUBLISH_LIST",publishList,me);*/
|
||||
|
||||
|
||||
String app_act_coe_pal_publishsql = "insert into APP_ACT_COE_PAL_PUBLISH_LIST (ID,PID,PALREPOSITORYID) values ('%s', '%s', '%s')";
|
||||
String app_act_coe_pal_publishid = UUIDGener.getUUID();
|
||||
int app_act_coe_pal_publishupdate = DBSql.update(String.format(app_act_coe_pal_publishsql, app_act_coe_pal_publishid,map.getString("ID"), plId));
|
||||
|
||||
String repetition_TaskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
|
||||
System.err.println("======手动生成手册id======"+repetition_TaskId);
|
||||
// 刷新预览加载的表
|
||||
String repetition_sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + repetition_TaskId + "' WHERE PLID = '" + plId + "'";
|
||||
DBSql.update(sqlr);
|
||||
String repetition_sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
|
||||
String repetition_sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
|
||||
if (UtilString.isNotEmpty(DBSql.getString(repetition_sql1))) {
|
||||
count = DBSql.update(
|
||||
"UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + repetition_TaskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
|
||||
}
|
||||
if (UtilString.isNotEmpty(DBSql.getString(repetition_sql2))) {
|
||||
count = DBSql.update(
|
||||
"UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + repetition_TaskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'");
|
||||
}
|
||||
if (count != 0) {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + repetition_TaskId + "'WHERE PALREPOSITORYID='"
|
||||
+ plId + "'");
|
||||
}
|
||||
}
|
||||
System.err.println("重新生成手册成功=====》" + count);
|
||||
}else if ("4".equals(type)) {
|
||||
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
|
||||
bo_eu_pal_repository.set("ISSTOP",state);
|
||||
SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository);
|
||||
// 修改流程文件的停用状态 如果用户把一个模型改为已停用,应该把已停用调整为1,同时已发布和审批中调整为0;
|
||||
|
||||
// 修改流程文件的停用状态
|
||||
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISSTOP = '" + state + "',ISPUBLISH=0,ISAPPROVAL=0,MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId
|
||||
+ "'";
|
||||
System.err.println("停用改设计=======>" + updataSql);
|
||||
count = DBSql.update(updataSql);
|
||||
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
if (model!=null){
|
||||
PALRepositoryCache.getCache().put(plId,model);
|
||||
|
||||
|
||||
RowMap map = DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + plId + "'");
|
||||
String ext4 = map.getString("EXT4");
|
||||
if (UtilString.isNotEmpty(ext4)){
|
||||
//获取发布流程组中运行中的流程
|
||||
String processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_fb1c7a54b98b412187388c8bab407362");
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, "admin", "");
|
||||
CancelPublishKnwl(processInstance,sid,ext4);
|
||||
}else {
|
||||
System.out.println("该文件未被发布,不进行取消发布知识以及删除索引");
|
||||
}
|
||||
|
||||
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
|
||||
|
||||
|
||||
//更新作废人
|
||||
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
|
||||
|
||||
|
||||
BO bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("PUBLISHFILEID=", plId).detail();
|
||||
|
||||
|
||||
String bindid=bo_act_coe_publish_n.getBindId();
|
||||
|
||||
BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(bindid);
|
||||
|
||||
|
||||
//作废时间
|
||||
Date cancelDate=new Date();
|
||||
SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd");
|
||||
propertyDao.updatePropertyByPropertyId(plId, "obsolescence_time", sdfs.format(cancelDate));
|
||||
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
|
||||
if (plModel != null) {
|
||||
|
||||
DesignerShapeRelationModel designerShapeRelationModel=new DesignerShapeRelationModel();
|
||||
designerShapeRelationModel.setId(UUIDGener.getUUID());
|
||||
designerShapeRelationModel.setFileId(plId);
|
||||
designerShapeRelationModel.setAttrId("nullifier");
|
||||
designerShapeRelationModel.setRelationFileId("00000000-0000-0000-0000-000000000000");
|
||||
designerShapeRelationModel.setRelationShapeId("00000000-0000-0000-0000-000000000000");
|
||||
|
||||
JSONObject js=new JSONObject();
|
||||
js.put("name", publish.getString("APPLYUSERNAME"));
|
||||
js.put("id", publish.getString("APPLYUSERID"));
|
||||
js.put("type", "user");
|
||||
|
||||
designerShapeRelationModel.setRelationShapeText(js.toString());
|
||||
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
dao.insert(designerShapeRelationModel);
|
||||
|
||||
|
||||
PALRepositoryCache.getCache().put(plId, plModel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,22 +343,12 @@ public class UpateFileStateController {
|
||||
}
|
||||
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_e076b01bd0d04bc39e5af12e2c8c188c", me.getUID(), "权限阅览");
|
||||
SDK.getBOAPI().create("BO_ACT_PUBLISH_PERM_SCOPE", scopeBo, processInst, me);
|
||||
}else{
|
||||
oldBo.set("PALVERSIONID" , plVersionid);
|
||||
oldBo.set("PALNAME" , parentModel.getName());
|
||||
//oldBo.set("PERMTYPE" , "0");
|
||||
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '"+palId+"'";
|
||||
RowMap map = DBSql.getMap(sql);
|
||||
if (map!=null){
|
||||
oldBo.set("ORGPERM" ,map.getString("EXT6"));
|
||||
}
|
||||
SDK.getBOAPI().update("BO_ACT_PUBLISH_PERM_SCOPE", oldBo);
|
||||
}
|
||||
}
|
||||
|
||||
private String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) {
|
||||
String taskId = "";
|
||||
if (model.getMethodId().contains("process.")) {
|
||||
if (model.getMethodId().contains("process.") && !"process.scheme".equals(model.getMethodId())) {
|
||||
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid);
|
||||
JSONObject object = JSONObject.parseObject(taskId);
|
||||
if ("ok".equals(object.getString("result"))) {
|
||||
@ -246,7 +360,7 @@ public class UpateFileStateController {
|
||||
if ("ok".equals(object.getString("result"))) {
|
||||
taskId = object.getJSONObject("data").getString("taskId");
|
||||
}
|
||||
} else if ("control.policy".equals(model.getMethodId())) {
|
||||
} else if ("control.policy".equals(model.getMethodId()) || "engineering.standard".equals(model.getMethodId()) || "process.scheme".equals(model.getMethodId())) {
|
||||
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid);
|
||||
JSONObject object = JSONObject.parseObject(taskId);
|
||||
if ("ok".equals(object.getString("result"))) {
|
||||
@ -260,24 +374,29 @@ public class UpateFileStateController {
|
||||
int count = 0;
|
||||
int count2 = 0;
|
||||
try {
|
||||
Map<String, JSONObject> queryRepositoryAttributeById = queryRepositoryAttributeById(id);
|
||||
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
|
||||
/**
|
||||
* 更新部门视图EXT6字段
|
||||
*/
|
||||
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '"+id+"' and ATTRID='Issuing_department'");
|
||||
if(rlatRowMap.size()>0){
|
||||
// 发布部门
|
||||
String dempId = "";
|
||||
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
|
||||
if (null != Issuing_department && !Issuing_department.equals("")) {
|
||||
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
|
||||
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
|
||||
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
|
||||
for (Object PUBDEPTO : PUBDEPTJA) {
|
||||
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
|
||||
dempId += PUBDEPTJO.getString("id")+",";
|
||||
}
|
||||
dempId = dempId.substring(0,dempId.length()-1);
|
||||
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('"+dempId+"') WHERE ID = '"+id+"'");
|
||||
}
|
||||
for(RowMap oneRowMap:rlatRowMap){
|
||||
String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT");
|
||||
JSONObject js=JSONObject.parseObject(relationshapetext);
|
||||
dempId += js.getString("id") + ",";
|
||||
}
|
||||
dempId = dempId.substring(0, dempId.length() - 1);
|
||||
|
||||
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + id + "'");
|
||||
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id);
|
||||
if (plModel != null) {
|
||||
PALRepositoryCache.getCache().put(id, plModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
@ -314,6 +433,29 @@ public class UpateFileStateController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @methodName:
|
||||
* @param:
|
||||
* @return:
|
||||
* @description:获取taskId
|
||||
* @auther: Lizj
|
||||
* @date: 2022/8/5 16:18
|
||||
*/
|
||||
public static String getLastPublishTaskIdByModelId(String repositoryId) {
|
||||
//String sql = "SELECT pl.TASKID FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_N pl WHERE pl.pid = p.id AND pl.palrepositoryid = ? ORDER BY publishdate DESC";
|
||||
String sql = "SELECT pl.TASKID FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl WHERE pl.pid = p.id AND pl.palrepositoryid = ? ORDER BY publishdate DESC";
|
||||
//String sql = "SELECT * FROM (SELECT TASKID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID= ? ORDER BY CREATEDATE DESC) WHERE ROWNUM = 1";
|
||||
String taskId = DBSql.getObject(sql, new RowMapper<String>() {
|
||||
@Override
|
||||
public String mapRow(ResultSet rs, int arg1) throws SQLException {
|
||||
return rs.getString(1);
|
||||
}
|
||||
}, new Object[] { repositoryId });
|
||||
return taskId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建手册,如果是未发布的流程模型,会在N表中创建一个数据
|
||||
* @param plId 流程模型ID
|
||||
@ -405,6 +547,30 @@ public class UpateFileStateController {
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + repetition_TaskId + "'WHERE PALREPOSITORYID='"
|
||||
+ plId + "'");
|
||||
}
|
||||
}else {
|
||||
String sql = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where ID = '"+plId+"'";
|
||||
String ext4 = DBSql.getString(sql);
|
||||
//获取发布流程组中运行中的流程
|
||||
String processDefId = SDK.getRepositoryAPI().getProcessDefIdOfRelease("obj_fb1c7a54b98b412187388c8bab407362");
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, "admin", "");
|
||||
PublishKnow(processInstance, me, ext4,me.getSessionId());
|
||||
|
||||
String sql_card_name = "select * from APP_ACT_KMS_CARD where ID = '"+ext4+"'";
|
||||
RowMap rowMap = DBSql.getMap(sql_card_name);
|
||||
//解决rowMap 为空bug
|
||||
if(null != rowMap && !rowMap.isEmpty()){
|
||||
String caed_name = rowMap.getString("CARDNAME");
|
||||
String[] split_card = caed_name.split("V");
|
||||
JSONArray coontest = new JSONArray(new LinkedList<>());
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
jsonObject.put("documentId", ext4);
|
||||
jsonObject.put("content", "");//信息附件
|
||||
//jsonObject.put("abstract", dcContext);//信息摘要
|
||||
jsonObject.put("title", split_card[0]);//信息标题
|
||||
coontest.add(jsonObject);
|
||||
createIndexesByContent(processInstance,coontest,ext4);
|
||||
}
|
||||
|
||||
}
|
||||
System.err.println("重新生成手册成功=====》" + count);
|
||||
}
|
||||
@ -422,8 +588,6 @@ public class UpateFileStateController {
|
||||
public void createKmsByNew(BO bo, String wsId, ProcessInstance processExecutionContext,
|
||||
String uid) {
|
||||
{
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID"));
|
||||
wsId = model.getWsId();
|
||||
String publishfileid = bo.getString("PUBLISHFILEID");
|
||||
String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + publishfileid + "'";
|
||||
RowMap map = DBSql.getMap(sql_n);
|
||||
@ -515,6 +679,10 @@ public class UpateFileStateController {
|
||||
if (StringUtils.isNotEmpty(cardId)) {
|
||||
String sql_ext4 = "select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '" + cardId + "'";
|
||||
RowMap map = DBSql.getMap(sql_ext4);
|
||||
//此处map可能为空
|
||||
if(null == map){
|
||||
return;
|
||||
}
|
||||
System.out.println("maps======>>>>>>>" + map);
|
||||
System.out.println("fileid==》》》》" + fileid);
|
||||
System.out.println("id==》》》》" + map.getString("ID"));
|
||||
@ -583,7 +751,7 @@ public class UpateFileStateController {
|
||||
//jsonObject.put("abstract", dcContext);//信息摘要
|
||||
jsonObject.put("title", dcContext.getFileName().substring(0,dcContext.getFileName().indexOf(".")));//信息标题
|
||||
coontest.add(jsonObject);
|
||||
createIndexesByContent(processExecutionContext,coontest);
|
||||
createIndexesByContent(processExecutionContext,coontest,cardId);
|
||||
|
||||
}
|
||||
}
|
||||
@ -631,7 +799,7 @@ public class UpateFileStateController {
|
||||
//jsonObject.put("abstract", dcContexts);//信息摘要
|
||||
jsonObject.put("title", dcContexts.getFileName().substring(0,dcContexts.getFileName().indexOf(".")));//信息标题
|
||||
coontest.add(jsonObject);
|
||||
createIndexesByContent(processExecutionContext,coontest);
|
||||
createIndexesByContent(processExecutionContext,coontest,cardId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -645,6 +813,64 @@ public class UpateFileStateController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean deleteIndex(ProcessInstance processExecutionContext,String documentId) {
|
||||
// 调用App
|
||||
String sourceAppId = processExecutionContext.getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.addons.es/deleteIndex";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//索引名称(文档在哪存放),必填
|
||||
params.put("index", "com.actionsoft.apps.kms_kmsdoc_card");
|
||||
//类型(索引中对数据进行逻辑分区。不同 type的文档可能有不同的字段,但最好能够非常相似,比如:存储所有产品到索引products中,但是你有许多不同的产品类别,这些产品共享一种相同的(或非常相似)的模式:他们有一个标题、描述、产品代码和价格。他们只是正好属于“产品”下的一些子类。用type表示不同的类别),必填
|
||||
params.put("type", "kmsdoc_card");
|
||||
//索引ID,入库时给定的ID,非必填
|
||||
params.put("documentId", documentId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//删除索引
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("删除索引成功>>>>>>>>"+ro.isOk());
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消发布知识
|
||||
*
|
||||
* @param processExecutionContext
|
||||
* @param sid
|
||||
* @param knwlId
|
||||
* @return
|
||||
*/
|
||||
public boolean CancelPublishKnwl(ProcessInstance processExecutionContext, String sid, String knwlId) {
|
||||
// 调用App
|
||||
String sourceAppId = processExecutionContext.getAppId();
|
||||
// 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);
|
||||
System.out.println("取消发布的ro=====>>>>" + ro);
|
||||
if(UtilString.isEmpty(knwlId)){//兼容为null报错问题 by yujh
|
||||
knwlId = "";
|
||||
}
|
||||
List<BO> bo_act_document = SDK.getBOAPI().query("BO_ACT_DOCUMENT", true).addQuery("CARDID=", knwlId).list();
|
||||
for (BO bo:
|
||||
bo_act_document) {
|
||||
String documentid = bo.getString("DOCUMENTID");
|
||||
deleteIndex(processExecutionContext,documentid);
|
||||
}
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建索引
|
||||
* @param processExecutionContext 流程实例
|
||||
@ -652,7 +878,8 @@ public class UpateFileStateController {
|
||||
* @return
|
||||
*/
|
||||
|
||||
public boolean createIndexesByContent(ProcessInstance processExecutionContext,JSONArray contents) {
|
||||
public boolean createIndexesByContent(ProcessInstance processExecutionContext,JSONArray contents,String cardId) {
|
||||
System.out.println("开始创建索引>>>>>>>>>>>>>>>>>>>");
|
||||
// 调用App
|
||||
String sourceAppId =processExecutionContext.getAppId() ;
|
||||
// aslp服务地址
|
||||
@ -668,6 +895,18 @@ public class UpateFileStateController {
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//入库操作,创建内容索引(多个)
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("创建结果是什么>>>>>>>>>>>>>>>>>>>"+ro);
|
||||
|
||||
/*if(ro.isOk()){
|
||||
String documentId = ((LinkedHashMap) ro.getData()).get("documentId").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("DOCUMENTID",documentId);
|
||||
bo.set("CARDID",cardId);
|
||||
JSONObject jsonObject = contents.getJSONObject(0);
|
||||
String title = jsonObject.get("title").toString();
|
||||
bo.set("TITLE",title);
|
||||
SDK.getBOAPI().create("BO_ACT_DOCUMENT",bo,processExecutionContext,UserContext.fromUID(processExecutionContext.getCreateUser()));
|
||||
}*/
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
@ -728,169 +967,4 @@ public class UpateFileStateController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模型ID查询所有文件扩展属性
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
public Map<String, JSONObject> queryRepositoryAttributeById(String uuid) {
|
||||
Map<String, JSONObject> result = new HashMap<>();
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid);
|
||||
// 获取所有文件属性
|
||||
List<PALMethodAttributeModel> methodAttrModels = PALRepositoryAPIManager.getInstance().getValidAndUseAttributeModels(plModel.getWsId(), plModel.getMethodId());
|
||||
if (methodAttrModels != null && methodAttrModels.size() > 0) {
|
||||
Map<String, PALMethodAttributeModel> attributeModelMap = new HashMap<>();
|
||||
Map<String, Integer> sortAttrMap = new HashMap<>();
|
||||
if (methodAttrModels != null) {
|
||||
int sort = 0;
|
||||
for (PALMethodAttributeModel attr : methodAttrModels) {
|
||||
attributeModelMap.put(attr.getKey(), attr);
|
||||
sortAttrMap.put(attr.getKey(), ++sort);
|
||||
}
|
||||
}
|
||||
List<PALRepositoryPropertyModel> propertys = PALRepositoryPropertyCache.getPropertyByPlId(plModel.getId());
|
||||
// 排序
|
||||
// propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0));
|
||||
|
||||
for (PALRepositoryPropertyModel property : propertys) {
|
||||
String id = property.getPropertyId();
|
||||
if (!attributeModelMap.containsKey(id) || !attributeModelMap.get(id).getUse()) {
|
||||
continue;
|
||||
}
|
||||
PALMethodAttributeModel attributeModel = attributeModelMap.get(id);
|
||||
// 记录结果集
|
||||
JSONObject attrObj = new JSONObject();
|
||||
attrObj.put("ref", attributeModel.getRef());// ref
|
||||
attrObj.put("type", attributeModel.getType());// 类型 relation string ...
|
||||
attrObj.put("attrId", attributeModel.getKey());// 属性key
|
||||
attrObj.put("attrTitle", attributeModel.getNewTitle());// 属性标题
|
||||
attrObj.put("text", "");// 属性内容单行文本
|
||||
attrObj.put("value", new JSONArray());// 属性内容集,relation或awsorg类型时存储对应的json数据
|
||||
String inputValue = property.getPropertyValue();
|
||||
if ("relation".equals(attributeModel.getType())) {
|
||||
List<String> inputValueList = new ArrayList<>();
|
||||
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey());
|
||||
if (list != null && list.size() > 0) {
|
||||
// 判断是否有重复数据,进行重复过滤
|
||||
Set<String> tempStrs = new HashSet<>();
|
||||
List<DesignerShapeRelationModel> tempList = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DesignerShapeRelationModel model = list.get(i);
|
||||
String str = model.getFileId() + model.getShapeId() + model.getAttrId() + model.getRelationFileId() + model.getRelationShapeId();
|
||||
if (!tempStrs.contains(str)) {
|
||||
tempList.add(model);
|
||||
tempStrs.add(str);
|
||||
}
|
||||
}
|
||||
list = tempList;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DesignerShapeRelationModel model = list.get(i);
|
||||
JSONObject refObj = JSONObject.parseObject(attributeModel.getRef());
|
||||
String relationTyp = refObj.containsKey("type") ? refObj.getString("type") : "shape";
|
||||
if ("file".equals(relationTyp)) {// 关联的模型文件
|
||||
if (model.getRelationFileId().length() < 36) {
|
||||
continue;
|
||||
}
|
||||
List<PALRepositoryModel> list2 = PALRepositoryCache.getByVersionId(plModel.getWsId(), model.getRelationFileId());
|
||||
for (PALRepositoryModel model2 : list2) {
|
||||
if (model2.isUse()) {
|
||||
inputValueList.add(model2.getName());
|
||||
JSONObject tmp = new JSONObject();
|
||||
tmp.put("fileId", model2.getId());
|
||||
tmp.put("name", model2.getName());
|
||||
tmp.put("isFile", true);
|
||||
attrObj.getJSONArray("value").add(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
inputValueList.add(model.getRelationShapeText());
|
||||
JSONObject tmp = new JSONObject();
|
||||
tmp.put("fileId", model.getRelationFileId());
|
||||
tmp.put("shapeId", model.getRelationShapeId());
|
||||
tmp.put("name", model.getRelationShapeText());
|
||||
tmp.put("isFile", false);
|
||||
attrObj.getJSONArray("value").add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
inputValue = org.apache.tools.ant.util.StringUtils.join(inputValueList, ",");
|
||||
}
|
||||
// 关联bpm组织架构
|
||||
if ("awsorg".equals(attributeModel.getType())) {
|
||||
List<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey());
|
||||
List<String> deptValList = new ArrayList<>();
|
||||
List<String> positionValList = new ArrayList<>();
|
||||
List<String> roleValList = new ArrayList<>();
|
||||
List<String> userValList = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
Set<String> filter = new HashSet<String>();// 去重记录
|
||||
list.sort((m1, m2) -> {
|
||||
return m1.getId().compareTo(m2.getId());
|
||||
});
|
||||
for (DesignerShapeRelationModel model : list) {
|
||||
if ("00000000-0000-0000-0000-000000000000".equals(model.getRelationFileId()) && "00000000-0000-0000-0000-000000000000".equals(model.getRelationShapeId())) {
|
||||
JSONObject object = JSONObject.parseObject(model.getRelationShapeText());
|
||||
boolean flag = false;
|
||||
// 查询最新名称
|
||||
if ("department".equals(object.getString("type"))) {
|
||||
DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id"));
|
||||
if (dept != null && !filter.contains(dept.getId())) {
|
||||
deptValList.add(dept.getName());
|
||||
filter.add(dept.getId());
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if ("position".equals(object.getString("type"))) {// 岗位,先用角色代替
|
||||
RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id"));
|
||||
if (role != null && !filter.contains(role.getId())) {
|
||||
positionValList.add(role.getName());
|
||||
filter.add(role.getId());
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if ("user".equals(object.getString("type"))) {
|
||||
UserModel user = SDK.getORGAPI().getUser(object.getString("id"));
|
||||
if (user != null && !filter.contains(user.getUID())) {
|
||||
userValList.add(user.getUserName());
|
||||
filter.add(user.getUID());
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if ("role".equals(object.getString("type"))) {
|
||||
RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id"));
|
||||
if (role != null && !filter.contains(role.getId())) {
|
||||
roleValList.add(role.getName());
|
||||
filter.add(role.getId());
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
attrObj.getJSONArray("value").add(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据组合
|
||||
deptValList.addAll(positionValList);
|
||||
deptValList.addAll(roleValList);
|
||||
deptValList.addAll(userValList);
|
||||
inputValue = org.apache.tools.ant.util.StringUtils.join(deptValList, ",");
|
||||
|
||||
}
|
||||
if (UtilString.isNotEmpty(inputValue)){
|
||||
inputValue = inputValue.replaceAll("'", "'");
|
||||
inputValue = inputValue.replaceAll("\"", """);
|
||||
attrObj.put("text", inputValue);
|
||||
result.put(attributeModel.getKey(), attrObj);
|
||||
}else {
|
||||
attrObj.put("text", inputValue);
|
||||
result.put(attributeModel.getKey(), attrObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user