流程发布,发布时显示模型附件

This commit is contained in:
lihongyu 2022-09-19 11:23:05 +08:00
parent 37613b195d
commit c5352999bc
2 changed files with 493 additions and 167 deletions

View File

@ -4,13 +4,27 @@ import java.io.File;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationTeamModel;
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
import com.actionsoft.apps.coe.pal.log.CoEOpLogConst;
@ -65,9 +79,14 @@ import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.Quota;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.server.fs.dc.DCUtil;
import com.actionsoft.bpms.util.*;
import com.actionsoft.bpms.util.Base64;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.bpms.util.UtilFile;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
@ -80,7 +99,8 @@ import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.commons.lang.StringUtils;
import io.etcd.jetcd.shaded.com.google.gson.Gson;
/**
* 流程发布App
@ -1825,14 +1845,59 @@ public class ProcessPublishWeb extends ActionWeb {
String bindId = publish.getBindId();
BO newBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").detailByBindId(bindId);
if (newBo != null) {
String publishId = newBo.getString("PUBLISHFILEID");
newObj.put("publishDesc", newBo.getString("PUBLISHDESC"));
newObj.put("publishFileName", newBo.getString("PUBLISHFILENAME"));
newObj.put("publishFileId", newBo.getString("PUBLISHFILEID"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(publishId);
if (model != null) {
String id = model.getId();
newObj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
newObj.put("methodId", model.getMethodId());
newObj.put("category", model.getMethodCategory());
// List<Map<String, Object>> shapeMessageJson4 =
// getShapeMessageJson4(publishId);
// 当前流程所有节点
List<String> shapeIds = new ArrayList<>();
List<Map<String, Object>> shapeList = CoeDesignerUtil.getShapeMessageJson2(publishId);// 获取所有节点
if (shapeList != null && shapeList.size() > 0) {
for (Map<String, Object> map : shapeList) {
shapeIds.add((String) map.get("id"));
}
}
/******************** 附件 ************************/
// 文件或节点自身附件
JSONArray js = new JSONArray();
UpFileDao upFileDao = new UpFileDao();
StringBuilder sqlWhere = new StringBuilder();
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'");
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
if (fileList != null && fileList.size() > 0) {
for (UpfileModel upfileModel : fileList) {
if ("f".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl(jb, id, upFileName);
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData()));
String url = parseObject.get("url").toString();
if(url.contains(".xls")) {
openUrl= url;
}else {
openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", "");
}
jb.put("openUrl",openUrl);
js.add(jb.toJSONString());
}
}
}
newObj.put("upfileId", js);
} else {
newObj.put("fileVersion", "1.0");
newObj.put("methodId", "1");
@ -1842,6 +1907,7 @@ public class ProcessPublishWeb extends ActionWeb {
}
BO changeBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").detailByBindId(bindId);
if (changeBo != null) {
String changeId = changeBo.getString("CHANGEFILEID");
changeObj.put("changeFileName", changeBo.getString("CHANGEFILENAME"));
changeObj.put("changedFileNameNew", changeBo.getString("CHANGEDFILENAMENEW"));
changeObj.put("changeFileId", changeBo.getString("CHANGEFILEID"));
@ -1872,6 +1938,49 @@ public class ProcessPublishWeb extends ActionWeb {
array.add(object);
}
}
// List<Map<String, Object>> shapeMessageJson4 =
// getShapeMessageJson4(publishId);
// 当前流程所有节点
List<String> shapeIds = new ArrayList<>();
List<Map<String, Object>> shapeList = CoeDesignerUtil.getShapeMessageJson2(changeId);// 获取所有节点
if (shapeList != null && shapeList.size() > 0) {
for (Map<String, Object> map : shapeList) {
shapeIds.add((String) map.get("id"));
}
}
/******************** 附件 ************************/
// 文件或节点自身附件
JSONArray js = new JSONArray();
UpFileDao upFileDao = new UpFileDao();
StringBuilder sqlWhere = new StringBuilder();
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'");
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
if (fileList != null && fileList.size() > 0) {
for (UpfileModel upfileModel : fileList) {
if ("f".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl(jb, model.getId(), upFileName);
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData()));
String url = parseObject.get("url").toString();
if(url.contains(".xls")) {
openUrl= url;
}else {
openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", "");
}
jb.put("openUrl",openUrl);
js.add(jb.toJSONString());
}
}
}
changeObj.put("upfileId", js);
} else {
changeObj.put("fileVersion", "1.0");
changeObj.put("methodId", "1");
@ -2711,153 +2820,334 @@ public class ProcessPublishWeb extends ActionWeb {
}
}
/************批量流程发布*****************/
public ResponseObject getUrl(JSONObject jb, String id ,String upFileName) {
String sourceAppId = "com.actionsoft.apps.coe.pal";
DCContext sourceDc = new DCContext(_uc,
DCProfileManager.getDCProfile(sourceAppId, "COE_Upfile"), sourceAppId,
"file", id, upFileName);
String downUrl = SDK.getConfAPI().getPortalUrl() + "/r/"
+ sourceDc.getDownloadURL().replace("./", "");
jb.put("downUrl", downUrl);
// 调用App
String sourceAppIds = "com.actionsoft.apps.coe.pal.publisher";
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview";
// 参数定义列表
HashMap<String, Object> params = new HashMap<String, Object>();
// 文档是否允许下载,必填
params.put("isDownload", true);
// 显示文件名,必填
params.put("fileNameOriginal", upFileName);
// PDF转图片处理选项- 0代表只在需要时做转换- 1代表打开即检查是否已转换成图片如未处理强制转换默认0,非必填
params.put("isPDFCovertPNG", 0);
// groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
params.put("extParams", "");
// 文档是否允许打印,必填
params.put("isPrint", true);
// 是否显示顶部工具栏的返回按钮,默认显示,非必填
params.put("isShowBackbtn", true);
// 原文件DC,必填
params.put("sourceDc", sourceDc);
// 是否显示默认预览工具栏,必填
params.put("isShowDefaultToolbar", true);
// 文档是否允许复制true为允许复制转换结果为PDF格式文件false为不可复制转换结果为PNG格式文件注意参数值为false时转换时间稍长,必填
params.put("isCopy", true);
// sessionid,必填
params.put("sid", _uc.getSessionId());
// 文档是否加密,必填
params.put("isEncrypt", false);
AppAPI appAPI = SDK.getAppAPI();
// 文档预览
ResponseObject ros = appAPI.callASLP(appAPI.getAppContext(sourceAppIds), aslp,
params);
return ros;
}
/************ 批量流程发布 *****************/
/**
* 查询流程发布子表数据
*
* @param processInstId
* @param wsId
* @return
*/
public String getPublisherBatchData(String processInstId, String wsId) {
ResponseObject ro = ResponseObject.newOkResponse();
boolean closeFormPage = SDK.getAppAPI().getPropertyBooleanValue(PublisherConf.APPID, "closeFormPage", false);
ro.put("closeFormPage", closeFormPage);
JSONArray newArr = new JSONArray();
JSONArray changeArr = new JSONArray();
JSONArray stopArr = new JSONArray();
boolean proNumber = false;
List<TaskInstance> list = SDK.getTaskQueryAPI().processInstId(processInstId).list();
if (!list.isEmpty()) {
for (TaskInstance taskIn : list) {
// 根据节点表单应用-操作权限-主子表是否可修改控制是否只读
UserTaskModel userTaskModel = UserTaskDefUtil.getModel(taskIn.getProcessDefId(), taskIn.getActivityDefId());
boolean isModify = FormEngineHelper.getInstance().isFormDataModify(userTaskModel, _uc);
proNumber = isModify;
/**
* 查询流程发布子表数据
*
* @param processInstId
* @param wsId
* @return
*/
public String getPublisherBatchData(String processInstId, String wsId) {
ResponseObject ro = ResponseObject.newOkResponse();
boolean closeFormPage = SDK.getAppAPI().getPropertyBooleanValue(PublisherConf.APPID, "closeFormPage", false);
ro.put("closeFormPage", closeFormPage);
JSONArray newArr = new JSONArray();
JSONArray changeArr = new JSONArray();
JSONArray stopArr = new JSONArray();
boolean proNumber = false;
List<TaskInstance> list = SDK.getTaskQueryAPI().processInstId(processInstId).list();
if (!list.isEmpty()) {
for (TaskInstance taskIn : list) {
// 根据节点表单应用-操作权限-主子表是否可修改控制是否只读
UserTaskModel userTaskModel = UserTaskDefUtil.getModel(taskIn.getProcessDefId(),
taskIn.getActivityDefId());
boolean isModify = FormEngineHelper.getInstance().isFormDataModify(userTaskModel, _uc);
proNumber = isModify;
// if("obj_c643c74dc6800001bd741d7e1e40e4b0".equals(taskIn.getActivityDefId())) {
// proNumber = true;
// }
}
}
ro.put("proNumber", proNumber);
BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId);
if (publish != null) {
boolean isEnd = publish.isEnd();
ro.put("isEnd", isEnd);
String bindId = publish.getBindId();
List<BO> newList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindId).list();
if (!isEmpty(newList)) {
for (int i = 0; i < newList.size(); i++) {
JSONObject obj = new JSONObject();
BO newBo = newList.get(i);
if (newBo != null) {
obj.put("publishDesc", newBo.getString("PUBLISHDESC"));
obj.put("publishFileName", newBo.getString("PUBLISHFILENAME"));
obj.put("publishFileId", newBo.getString("PUBLISHFILEID"));
obj.put("processNumber", newBo.getString("PUBLISH_NUMBER"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID"));
if (model != null) {
obj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
obj.put("methodId", model.getMethodId());
obj.put("category", model.getMethodCategory());
} else {
obj.put("fileVersion", "1.0");
obj.put("methodId", "1");
obj.put("category", "1");
}
obj.put("taskId", newBo.getString("TASKID"));
newArr.add(obj);
}
}
}
List<BO> changeList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindId).list();
if (!isEmpty(changeList)) {
for (int j = 0; j < changeList.size(); j++) {
JSONObject obj = new JSONObject();
BO changeBo = changeList.get(j);
if (changeBo != null) {
obj.put("changeFileName", changeBo.getString("CHANGEFILENAME"));
obj.put("changedFileNameNew", changeBo.getString("CHANGEDFILENAMENEW"));
obj.put("changeFileId", changeBo.getString("CHANGEFILEID"));
obj.put("changedDesc", changeBo.getString("CHANGEDDESC"));
obj.put("changedFileIdNew", changeBo.getString("CHANGEDFILEIDNEW"));
obj.put("changedNumber", changeBo.getString("CHANGE_NUMBER"));
obj.put("taskId", changeBo.getString("TASKID"));
JSONArray array = new JSONArray();
PALRepositoryModel model = PALRepositoryCache.getCache().get(changeBo.getString("CHANGEFILEID"));
if (model != null) {
obj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
obj.put("methodId", model.getMethodId());
obj.put("category", model.getMethodCategory());
List<PALRepositoryModel> list2 = PALRepositoryCache.getByVersionId(wsId, model.getVersionId());
if (list2 != null && list2.size() > 0) {
Collections.sort(list2, new Comparator<PALRepositoryModel>() {
@Override
public int compare(PALRepositoryModel o1, PALRepositoryModel o2) {
return VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), true); //升序
}
});
}
for (PALRepositoryModel model2 : list2) {
if (!model2.getId().equals(obj.getString("changeFileId")) && !model2.isPublish()) {
JSONObject object = new JSONObject();
object.put("text", model2.getName());
object.put("id", model2.getId());
object.put("version", VersionUtil.getVersionStr(model2.getVersion()));
array.add(object);
}
}
} else {
obj.put("fileVersion", "1.0");
obj.put("methodId", "1");
obj.put("category", "1");
}
obj.put("targetFiles", array);
PALRepositoryModel targetModel = PALRepositoryCache.getCache().get(changeBo.getString("CHANGEDFILEIDNEW"));
if (targetModel != null) {
obj.put("targetFileVersion", VersionUtil.getVersionStr(targetModel.getVersion()));
obj.put("targetMethodId", targetModel.getMethodId());
obj.put("targetCategory", targetModel.getMethodCategory());
} else {
obj.put("targetFileVersion", "1.0");
obj.put("targetMethodId", "1");
obj.put("targetCategory", "1");
}
changeArr.add(obj);
}
}
}
List<BO> stopList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").addQuery("BINDID=", bindId).list();
if (!isEmpty(stopList)) {
for (int i = 0; i < stopList.size(); i++) {
JSONObject obj = new JSONObject();
BO stopBo = stopList.get(i);
if (stopBo != null) {
obj.put("stopFileName", stopBo.getString("STOPFILENAME"));
obj.put("stopFileId", stopBo.getString("STOPFILEID"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID"));
if (model != null) {
obj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
obj.put("methodId", model.getMethodId());
obj.put("category", model.getMethodCategory());
} else {
obj.put("fileVersion", "1.0");
obj.put("methodId", "1");
obj.put("category", "1");
}
obj.put("stopDesc", stopBo.getString("STOPDESC"));
obj.put("taskId", stopBo.getString("TASKID"));
stopArr.add(obj);
}
}
}
}
ro.put("newData", newArr);
ro.put("changeData", changeArr);
ro.put("stopData", stopArr);
return ro.toString();
}
}
}
ro.put("proNumber", proNumber);
BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId);
if (publish != null) {
boolean isEnd = publish.isEnd();
ro.put("isEnd", isEnd);
String bindId = publish.getBindId();
List<BO> newList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindId).list();
if (!isEmpty(newList)) {
for (int i = 0; i < newList.size(); i++) {
JSONObject obj = new JSONObject();
BO newBo = newList.get(i);
if (newBo != null) {
String publishId = newBo.getString("PUBLISHFILEID");
obj.put("publishDesc", newBo.getString("PUBLISHDESC"));
obj.put("publishFileName", newBo.getString("PUBLISHFILENAME"));
obj.put("publishFileId", newBo.getString("PUBLISHFILEID"));
obj.put("processNumber", newBo.getString("PUBLISH_NUMBER"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID"));
if (model != null) {
String id = model.getId();
String methodCategory = model.getMethodCategory();
obj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
obj.put("methodId", model.getMethodId());
obj.put("category", methodCategory);
// List<Map<String, Object>> shapeMessageJson4 =
// getShapeMessageJson4(publishId);
// 当前流程所有节点
List<String> shapeIds = new ArrayList<>();
List<Map<String, Object>> shapeList = CoeDesignerUtil.getShapeMessageJson2(publishId);// 获取所有节点
if (shapeList != null && shapeList.size() > 0) {
for (Map<String, Object> map : shapeList) {
shapeIds.add((String) map.get("id"));
}
}
/******************** 附件 ************************/
// 文件或节点自身附件
JSONArray js = new JSONArray();
UpFileDao upFileDao = new UpFileDao();
StringBuilder sqlWhere = new StringBuilder();
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'");
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
if (fileList != null && fileList.size() > 0) {
for (UpfileModel upfileModel : fileList) {
if("data".equals(methodCategory)) {
if ("s".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl(jb, id, upFileName);
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData()));
String url = parseObject.get("url").toString();
if(url.contains(".xls")) {
openUrl= url;
}else {
openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", "");
}
jb.put("openUrl",openUrl);
js.add(jb.toJSONString());
}
}else {
if ("f".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl(jb, id, upFileName);
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData()));
String url = parseObject.get("url").toString();
if(url.contains(".xls")) {
openUrl= url;
}else {
openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", "");
}
jb.put("openUrl",openUrl);
js.add(jb.toJSONString());
}
}
}
}
obj.put("upfileId", js);
} else {
obj.put("fileVersion", "1.0");
obj.put("methodId", "1");
obj.put("category", "1");
}
obj.put("taskId", newBo.getString("TASKID"));
newArr.add(obj);
}
}
}
List<BO> changeList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindId).list();
if (!isEmpty(changeList)) {
for (int j = 0; j < changeList.size(); j++) {
JSONObject obj = new JSONObject();
BO changeBo = changeList.get(j);
if (changeBo != null) {
obj.put("changeFileName", changeBo.getString("CHANGEFILENAME"));
obj.put("changedFileNameNew", changeBo.getString("CHANGEDFILENAMENEW"));
obj.put("changeFileId", changeBo.getString("CHANGEFILEID"));
obj.put("changedDesc", changeBo.getString("CHANGEDDESC"));
obj.put("changedFileIdNew", changeBo.getString("CHANGEDFILEIDNEW"));
obj.put("changedNumber", changeBo.getString("CHANGE_NUMBER"));
obj.put("taskId", changeBo.getString("TASKID"));
JSONArray array = new JSONArray();
PALRepositoryModel model = PALRepositoryCache.getCache()
.get(changeBo.getString("CHANGEFILEID"));
if (model != null) {
obj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
obj.put("methodId", model.getMethodId());
obj.put("category", model.getMethodCategory());
List<PALRepositoryModel> list2 = PALRepositoryCache.getByVersionId(wsId,
model.getVersionId());
if (list2 != null && list2.size() > 0) {
Collections.sort(list2, new Comparator<PALRepositoryModel>() {
@Override
public int compare(PALRepositoryModel o1, PALRepositoryModel o2) {
return VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), true); // 升序
}
});
}
for (PALRepositoryModel model2 : list2) {
if (!model2.getId().equals(obj.getString("changeFileId")) && !model2.isPublish()) {
JSONObject object = new JSONObject();
object.put("text", model2.getName());
object.put("id", model2.getId());
object.put("version", VersionUtil.getVersionStr(model2.getVersion()));
array.add(object);
}
}
String changeId = changeBo.getString("CHANGEDFILEIDNEW");
PALRepositoryModel model3 = PALRepositoryCache.getCache().get(changeId);
if(null!= model3) {
String id = model3.getId();
List<String> shapeIds = new ArrayList<>();
String methodCategory = model3.getMethodCategory();
List<Map<String, Object>> shapeList = CoeDesignerUtil.getShapeMessageJson2(changeId);// 获取所有节点
if (shapeList != null && shapeList.size() > 0) {
for (Map<String, Object> map : shapeList) {
shapeIds.add((String) map.get("id"));
}
}
/******************** 附件 ************************/
// 文件或节点自身附件
JSONArray js = new JSONArray();
UpFileDao upFileDao = new UpFileDao();
StringBuilder sqlWhere = new StringBuilder();
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'");
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
if (fileList != null && fileList.size() > 0) {
for (UpfileModel upfileModel : fileList) {
if("data".equals(methodCategory)) {
if ("s".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl(jb, id, upFileName);
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData()));
String url = parseObject.get("url").toString();
if(url.contains(".xls")) {
openUrl= url;
}else {
openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", "");
}
jb.put("openUrl",openUrl);
js.add(jb.toJSONString());
}
}else {
if ("f".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl(jb, id, upFileName);
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData()));
String url = parseObject.get("url").toString();
if(url.contains(".xls")) {
openUrl= url;
}else {
openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", "");
}
jb.put("openUrl",openUrl);
js.add(jb.toJSONString());
}
}
}
}
obj.put("upfileId", js);
}
} else {
obj.put("fileVersion", "1.0");
obj.put("methodId", "1");
obj.put("category", "1");
}
obj.put("targetFiles", array);
PALRepositoryModel targetModel = PALRepositoryCache.getCache()
.get(changeBo.getString("CHANGEDFILEIDNEW"));
if (targetModel != null) {
obj.put("targetFileVersion", VersionUtil.getVersionStr(targetModel.getVersion()));
obj.put("targetMethodId", targetModel.getMethodId());
obj.put("targetCategory", targetModel.getMethodCategory());
} else {
obj.put("targetFileVersion", "1.0");
obj.put("targetMethodId", "1");
obj.put("targetCategory", "1");
}
changeArr.add(obj);
}
}
}
List<BO> stopList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").addQuery("BINDID=", bindId).list();
if (!isEmpty(stopList)) {
for (int i = 0; i < stopList.size(); i++) {
JSONObject obj = new JSONObject();
BO stopBo = stopList.get(i);
if (stopBo != null) {
obj.put("stopFileName", stopBo.getString("STOPFILENAME"));
obj.put("stopFileId", stopBo.getString("STOPFILEID"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID"));
if (model != null) {
obj.put("fileVersion", VersionUtil.getVersionStr(model.getVersion()));
obj.put("methodId", model.getMethodId());
obj.put("category", model.getMethodCategory());
} else {
obj.put("fileVersion", "1.0");
obj.put("methodId", "1");
obj.put("category", "1");
}
obj.put("stopDesc", stopBo.getString("STOPDESC"));
obj.put("taskId", stopBo.getString("TASKID"));
stopArr.add(obj);
}
}
}
}
ro.put("newData", newArr);
ro.put("changeData", changeArr);
ro.put("stopData", stopArr);
return ro.toString();
}
private boolean isEmpty(List<?> list) {
return (list == null || list.size() == 0) ? true : false;

View File

@ -33,7 +33,6 @@ var stopPageSetting = {
}
var isHighSecurity;
$(document).ready(function(){
$('td,th').css('padding-top','0px');
$('td,th').css('padding-bottom','0px');
// $('#alertMsg').css('background', '#fff');
@ -265,15 +264,14 @@ function initHtml() {
// changeHtml += '<button name="save" type="button" class="awsui-btn" onclick="saveFormData(\'change\');">保存</button>';
changeHtml += '<button name="delete" type="button" class="awsui-btn awsui-btn-danger" onclick="deleteFile(\'change\');">删除</button>';
}
if(!$("#userTaskDefId").val()=='obj_c9e5a2e257f00001e2a375d01f601518'){
editPerm=false;
}
/*if($("#userTaskDefId").val()=='obj_c9e5a2e6a2c00001891c127ce9309250'){
editPerm=false;
}*/
//changeHtml += '<button name="add" type="button" class="awsui-btn awsui-btn-blue" onclick="addProcess(\'change\');">新增</button>';
// changeHtml += '<button name="save" type="button" class="awsui-btn" onclick="saveFormData(\'change\');">保存</button>';
//changeHtml += '<button name="delete" type="button" class="awsui-btn awsui-btn-danger" onclick="deleteFile(\'change\');">删除</button>';
if(!$("#userTaskDefId").val()=='obj_c9e5a2e257f00001e2a375d01f601518'){
editPerm=false;
}
changeHtml += '</div>';
changeHtml += '<div id="publish_change_content">';
changeHtml += '<table class="awsui-table awsui-table-thin awsui-table-hover data-table">';
@ -426,7 +424,9 @@ function initPublishData(data, type, pageNumber, start){
// 初始化数据
function selectPublishData(data, type, pageNumber, start) {
//渲染到前台的流程架构L1L2L3
var param = {
cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs',
processInstId: processInstId,
@ -520,6 +520,12 @@ function queryapprove(){
}
});
}
//预览下载附件
function openUrl(url) {
//$.simpleAlert("文件正在处理", "loading");
window.open(url);
}
//by bzp
function showlist(data, type, pageNumber, start){
var tableTdCss = 'style="padding-top: 0;padding-bottom: 0;"';
@ -533,6 +539,20 @@ function showlist(data, type, pageNumber, start){
for (var i = 0, s = start; i < pageLimit; i++, s++) {
var curr;
if ((curr = data[s - 1]) != undefined) {
var fName = '';
var upFileId = curr.upfileId;
if(upFileId!=''&&upFileId!=undefined){
for(var i = 0; i < upFileId.length; i++){
var upFileJson = upFileId[i]
var json=JSON.parse(upFileJson);
var upId = json.upfileId;
var upName = json.upFileName;
var openUrl = json.openUrl;
var downUrl = json.downUrl;
fName += '</p><a href="javascript:void(0);" onclick="openUrl(\'' + openUrl + '\')">' + upName + '&nbsp</a><span id="download_output_' + upId + '" style="cursor: pointer;" onclick="openUrl(\'' + downUrl + '\')"><i class="awsui-iconfont" style="font-size: 12px;">&#xe653;</i></span></p>';
}
}
var fileName = curr.publishFileName + ' V' + curr.fileVersion;
var outputName = getOutputName(curr.category, curr.methodId);
var reportName = '<a href="javascript:void(0);" onclick="openReportFile(\'' + curr.taskId + '\')">' + fileName + "-" + outputName + '</a><span id="download_output_' + curr.publishFileId + '" style="cursor: pointer;" onclick="downloadReport(\'' + curr.publishFileId + '\',\'' + curr.taskId + '\')"><i class="awsui-iconfont" style="font-size: 12px;">&#xe653;</i></span>';
@ -552,7 +572,8 @@ function showlist(data, type, pageNumber, start){
html += '<td ' + tableTdCss + '><input name="check" ' + checkboxPerm + ' class="awsui-checkbox" data-id="' + curr.publishFileId + '" type="checkbox" type="awsui-checkbox"></td>';
html += '<td ' + tableTdCss + '>' + s + '</td>';
html += '<td ' + tableTdCss + '><a href="javascript:void(0);" onclick="openPortalPage(\'' + curr.publishFileId + '\', \'' + curr.taskId + '\')">' + fileName + '</a></td>';
html += '<td ' + tableTdCss + '>' + reportName + '</td>';
html += '<td ' + tableTdCss + '></p>' + reportName +fName+ '</td>';
//html += '<td ' + tableTdCss + '>' + fName + '</td>';
//html += '<td style="padding:1px;"><textarea onblur="changeDesc(\'new\',\'' + curr.publishFileId + '\', this)" style="width:100%;height:30px;" ' + textareaPerm + ' class="awsui-input">' + curr.publishDesc + '</textarea></td>';
html += '<td style="padding:1px;"><span>'+ processNumber +'</span></td>';
html += '</tr>';
@ -573,6 +594,20 @@ function showlist(data, type, pageNumber, start){
for (var i = 0, s = start; i < pageLimit; i++, s++) {
var curr;
if ((curr = data[s - 1]) != undefined) {
var fName = '';
var upFileId = curr.upfileId;
if(upFileId!=''&&upFileId!=undefined){
for(var i = 0; i < upFileId.length; i++){
var upFileJson = upFileId[i]
var json=JSON.parse(upFileJson);
var upId = json.upfileId;
var upName = json.upFileName;
var openUrl = json.openUrl;
var downUrl = json.downUrl;
fName += '</p><a href="javascript:void(0);" onclick="openUrl(\'' + openUrl + '\')">' + upName + '&nbsp</a><span id="download_output_' + upId + '" style="cursor: pointer;" onclick="openUrl(\'' + downUrl + '\')"><i class="awsui-iconfont" style="font-size: 12px;">&#xe653;</i></span></p>';
}
}
var sourceFileName = curr.changeFileName + ' V' + curr.fileVersion;
// 变更目标文件处理
var targetFileName = "";
@ -593,16 +628,11 @@ function showlist(data, type, pageNumber, start){
if (isHighSecurity){
reportName = curr.taskId == 'change' ? quickCreate : reportName;
}
/*if($("#userTaskDefId").val()=='obj_c9e93c345010000148211f97f9c07f00'){
editPerm=false;
if($("#userTaskDefId").val()=='obj_c9e93c345010000148211f97f9c07f00'){
editPerm=false;
}
if($("#userTaskDefId").val()=='obj_c9e5a2e6a2c00001891c127ce9309250'){
editPerm=false;
}*/
if(!$("#userTaskDefId").val()=='obj_c9e5a2e257f00001e2a375d01f601518'){
editPerm=false;
editPerm=false;
}
var checkboxPerm = editPerm ? '' : 'disabled="disabled"';
var textareaPerm = editPerm ? '' : 'readonly';
@ -612,8 +642,10 @@ function showlist(data, type, pageNumber, start){
html += '<td ' + tableTdCss + '>' + sourceFileName + '</td>';
var selectPerm = editPerm ? '<select id="change_' + curr.changeFileId + '"></select>' : '<a href="javascript:void(0);" onclick="openPortalPage(\'' + targetId + '\', \'' + curr.taskId + '\')">' + targetFileName + '</a>';
html += '<td ' + tableTdCss + '>' + selectPerm + '</td>';
html += '<td ' + tableTdCss + ' id="report_' + curr.changeFileId + '">' + reportName + '</td>';
html += '<td style="padding:1px;"><textarea onblur="changeDesc(\'change\',\'' + curr.changeFileId + '\', this)" style="width:100%;height:30px;" ' + textareaPerm + ' class="awsui-input">' + curr.changedDesc + '</textarea></td>';
html += '<td ' + tableTdCss + '></p>' + reportName + fName +'</td>';
//html += '<td ' + tableTdCss + ' id="report_' + curr.changeFileId + '">' + reportName + fName +'</td>';
html += '<td ' + tableTdCss + '>' + curr.changedNumber + '</td>';
//html += '<td style="padding:1px;"><textarea onblur="changeDesc(\'change\',\'' + curr.changeFileId + '\', this)" style="width:100%;height:30px;" ' + textareaPerm + ' class="awsui-input">' + curr.changedDesc + '</textarea></td>';
html += '</tr>';
// select2下拉框处理
var opt1 = {
@ -1313,6 +1345,7 @@ function getStopBatchResult(type) {
// 获取已有的流程手册
function queryBatchReport(data) {
debugger;
var ids = [];
for (var i = 0; i < data.length; i++) {
var temp = data[i];
@ -1915,6 +1948,7 @@ function formSave(isTransact){
$.simpleAlert('发布内容不能为空', 'info');
return false;
}
debugger;
var index = 0;
if (!($("#publisher_new_tr").css('display') == 'none') && newTemp.length > 0) {
index++;
@ -2338,7 +2372,9 @@ function downloadReport(uuid, taskId) {
uuid: uuid
},
success : function(r) {
debugger;
if (r.result == "ok") {
debugger;
window.open (r.data.url);
} else {