流程发布同步发布角色/绩效图/发布校验上传附件/伴随发布

This commit is contained in:
zhal 2022-08-14 22:20:39 +08:00
parent 7ada17edc1
commit ed6400380b
4 changed files with 313 additions and 9 deletions

View File

@ -552,7 +552,39 @@ public class PublisherController {
ProcessPublishWeb web = new ProcessPublishWeb(me); ProcessPublishWeb web = new ProcessPublishWeb(me);
return web.createOutputPrReports(wsId, teamId, uuids); return web.createOutputPrReports(wsId, teamId, uuids);
} }
/**
* 查询发布流程中支持文件形状属性上传附件
* @param me
* @param uuids
* @param teamId
* @param wsId
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.publisher_get_publishFlow_files")
public String getPublishFlowFiles(UserContext me, String uuids, String teamId, String wsId) {
ProcessPublishWeb web = new ProcessPublishWeb(me);
return web.getPublishFlowFiles(wsId, teamId, uuids);
}
/**
* 将关联未发布数据插入发布表中
* @param me
* @param uuids
* @param teamId
* @param wsId
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal.publisher_get_RelevancyPublish")
public String RelevancyPublish(UserContext me, String uuids, String teamId, String wsId,String bindid) {
ProcessPublishWeb web = new ProcessPublishWeb(me);
return web.RelevancyPublish(wsId, teamId, uuids,bindid);
}
/** /**
* 查询流程的其他版本并默认查询结果的第一条创建流程手册 * 查询流程的其他版本并默认查询结果的第一条创建流程手册
* @param me * @param me

View File

@ -36,9 +36,14 @@ import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository; import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelAutoBean; import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelAutoBean;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl; import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.apps.coe.pal.pal.repository.util.RepositoryTreeUtil; import com.actionsoft.apps.coe.pal.pal.repository.util.RepositoryTreeUtil;
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil; import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
import com.actionsoft.apps.coe.pal.publisher.client.dao.PublisherClientDao; import com.actionsoft.apps.coe.pal.publisher.client.dao.PublisherClientDao;
@ -90,6 +95,7 @@ import org.apache.commons.lang.StringUtils;
public class ProcessPublishWeb extends ActionWeb { public class ProcessPublishWeb extends ActionWeb {
private UserContext _uc; private UserContext _uc;
public ProcessPublishWeb() { public ProcessPublishWeb() {
} }
@ -2573,6 +2579,133 @@ public class ProcessPublishWeb extends ActionWeb {
return ro.toString(); return ro.toString();
} }
/**
* 获取流程节点文件进行判断
* @param wsId
* @param teamId
* @param uuids
* @return
*/
public String getPublishFlowFiles(String wsId, String teamId, String uuids){
StringBuilder sb = new StringBuilder();
ResponseObject ro = ResponseObject.newOkResponse();
StringBuilder sb1 = new StringBuilder();
StringBuilder modelsb = new StringBuilder();
JSONArray array = JSONArray.parseArray(uuids);
if(array.size()==0){
ro.put("result","error");
}else{
for (int i = 0; i < array.size(); i++) {
String uuid = array.getString(i);
// 校验
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid);
if (model == null) {
throw new AWSException("没有找到文件:" + uuid);
}
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(uuid, "");
if (oldPropertyList != null && oldPropertyList.size() > 0) {
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
//获取文件属性中支持文件
if(propertyModel.getPropertyId().equals("support_files")){
String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
String[] splitRelationFileId;
if(relationFileId!=null){
splitRelationFileId=relationFileId.split(",");
//获取关联表单模型id
List<Map<String, Object>> fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]);
for (Map<String, Object> shape : fileElements) {
String tempShapeId = shape.get("id").toString();
UpFileDao dao = new UpFileDao();
// 文件根据relationFileId 文件类型 查询
List<UpfileModel> list2 = dao.search(splitRelationFileId[0], tempShapeId, "s");
if(list2.size()==0){
sb.append("模型名称:").append(shape.get("plName")).append("中节点名称:").append("'"+shape.get("name")+"'").append("未上传附件,请检查").append(",");
}
}
}
}
}
}
if (sb.length() > 0) {
sb1=sb.deleteCharAt(sb.length()-1);
ro.put("sb",sb1);
ro.put("result","error");
}
}
}
return ro.toString();
}
/**
* 获取关联表单模型插入流程发布中
* @param wsId
* @param teamId
* @param uuids
* @return
*/
public String RelevancyPublish(String wsId, String teamId, String uuids,String bindId){
ResponseObject ro = ResponseObject.newOkResponse();
JSONArray array = JSONArray.parseArray(uuids);
if(array.size()==0){
ro.put("result","error");
}else{
for (int i = 0; i < array.size(); i++) {
String uuid = array.getString(i);
// 校验
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid);
if (model == null) {
throw new AWSException("没有找到文件:" + uuid);
}
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(uuid, "");
if (oldPropertyList != null && oldPropertyList.size() > 0) {
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
//获取文件属性中支持文件
if(propertyModel.getPropertyId().equals("support_files")){
String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
String[] splitRelationFileId;
if(relationFileId!=null){
splitRelationFileId=relationFileId.split(",");
RowMap rowMap=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",splitRelationFileId[0]);
String ispublish=rowMap.getString("ISPUBLISH");
if(ispublish.equals("0")) {
BO bo=new BO();
bo.set("PUBLISHFILEID", splitRelationFileId[0]);
bo.set("PUBLISHFILENAME", rowMap.getString("PLNAME"));
bo.set("PUBLISHDESC", "");
bo.set("PROCESSDEFID", bindId);
bo.set("TASKID", "");
i = SDK.getBOAPI().create("BO_ACT_COE_PUBLISH_N", bo, bindId, _uc.getUID());
}
}
}
}
}
}
}
return ro.toString();
}
/** /**
* 查询流程的其他版本并默认查询结果的第一条创建流程手册 * 查询流程的其他版本并默认查询结果的第一条创建流程手册
* *

View File

@ -0,0 +1,101 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
import com.actionsoft.bpms.bpmn.engine.listener.ListenerConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.exception.AWSException;
import com.actionsoft.exception.BPMNError;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
public class PublishFormBeforeSaveEvent extends InterruptListener implements InterruptListenerInterface {
@Override
public String getDescription() {
return "发布表单保存前附件校验";
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public boolean execute(ProcessExecutionContext param) throws Exception {
List<BO> gridData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(param.getProcessInstance().getId()).list();
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
if (gridData.size() > 0) {
for (BO rowData : gridData) {
//下面一行示例代码可以获取Ajax子表的每行记录的新建状态
String publishfileid = String.valueOf(rowData.getString("PUBLISHFILEID"));//注意isCreate并不是BO的一个字段该字段是有接口上层赋值的
// 校验
PALRepositoryModel model = PALRepositoryCache.getCache().get(publishfileid);
if (model == null) {
throw new AWSException("没有找到文件:" + publishfileid);
}
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(publishfileid, "");
if (oldPropertyList != null && oldPropertyList.size() > 0) {
for (PALRepositoryPropertyModel propertyModel : oldPropertyList) {
//获取文件属性中支持文件
if (propertyModel.getPropertyId().equals("support_files")) {
String relationFileId = JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
String[] splitRelationFileId;
if (relationFileId != null) {
splitRelationFileId = relationFileId.split(",");
//获取关联表单模型id
List<Map<String, Object>> fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]);
for (Map<String, Object> shape : fileElements) {
String tempShapeId = shape.get("id").toString();
UpFileDao dao = new UpFileDao();
// 文件根据relationFileId 文件类型 查询
List<UpfileModel> list2 = dao.search(splitRelationFileId[0], tempShapeId, "s");
if (list2.size() == 0) {
sb.append("模型名称:").append(shape.get("plName")).append("中节点名称:").append("'" + shape.get("name") + "'").append("未上传附件,请检查!!!").append(",").append("</br>");
}
}
}
}
}
}
if (sb.length() > 0) {
sb1 = sb.deleteCharAt(sb.length() - 1);
throw new BPMNError("0313", sb1.toString());
}
}
}
return true;
}
}

View File

@ -403,9 +403,38 @@ function initPublishData(data, type, pageNumber, start){
// 初始化数据 // 初始化数据
function selectPublishData(data, type, pageNumber, start) { function selectPublishData(data, type, pageNumber, start) {
//渲染到前台的流程架构L1L2L3 //渲染到前台的流程架构L1L2L3
var ids = [];
for (var i = 0; i < data.length; i++) {
var temp = data[i];
if ((temp.methodId == 'control.policy' || temp.methodId == 'data.form' || temp.methodId.indexOf('process.') > -1) && temp.methodId != 'default') {
ids.push(temp.publishFileId);
}
}
//校验模型中支持文件附件是否上传
var param = {
sid : sid,
cmd : "com.actionsoft.apps.coe.pal.publisher_get_publishFlow_files",
wsId: wsId,
uuids: JSON.stringify(ids)
}
$.ajax({
url : "./jd",
type : "POST",
data : param,
success : function(r) {
if (r.result == 'ok') {
if(r.data.result=='error'){
$('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', '');
$.simpleAlert(r.data.sb,"error",3000);
return;
}
}
}
});
var param = { var param = {
cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs', cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs',
@ -744,6 +773,8 @@ function addProcess(type) {
$.simpleAlert('请选择创建流程手册的时间', 'info'); $.simpleAlert('请选择创建流程手册的时间', 'info');
return; return;
} }
disabledButton(); disabledButton();
setTimeout(function() { setTimeout(function() {
// 获取说明内容 // 获取说明内容
@ -899,6 +930,10 @@ function initChangedData(changeFileId) {
var selectedTaskId = ""; var selectedTaskId = "";
selectedTaskId = createReport(changeTemp[i].category, changeTemp[i].methodId, selectedId, selectedTaskId); selectedTaskId = createReport(changeTemp[i].category, changeTemp[i].methodId, selectedId, selectedTaskId);
// 更新数据 // 更新数据
changeTemp[i].changedFileIdNew = selectedId; changeTemp[i].changedFileIdNew = selectedId;
changeTemp[i].changedFileNameNew = changeTemp[i].targetFiles[j].text; changeTemp[i].changedFileNameNew = changeTemp[i].targetFiles[j].text;
@ -1240,7 +1275,6 @@ function getStopBatchResult(type) {
// 获取已有的流程手册 // 获取已有的流程手册
function queryBatchReport(data) { function queryBatchReport(data) {
debugger;
var ids = []; var ids = [];
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var temp = data[i]; var temp = data[i];
@ -1302,6 +1336,11 @@ function createReport(category, method, uuid, taskId) {
return taskId; return taskId;
} }
// 批量创建流程手册 // 批量创建流程手册
function createBatchReport(data, createTime) { function createBatchReport(data, createTime) {
var ids = []; var ids = [];
@ -1320,6 +1359,10 @@ function createBatchReport(data, createTime) {
} }
return data; return data;
} }
var param = { var param = {
sid : sid, sid : sid,
cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_reports_create", cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_reports_create",
@ -1387,7 +1430,6 @@ function getOutputName(category, method) {
//单个流程立即创建流程手册 //单个流程立即创建流程手册
function quickCreateReport(obj, object, type) { function quickCreateReport(obj, object, type) {
debugger;
var taskId; var taskId;
var category = obj.category; var category = obj.category;
var method = obj.methodId; var method = obj.methodId;
@ -1414,7 +1456,6 @@ function quickCreateReport(obj, object, type) {
$(object).text(targetFileName); $(object).text(targetFileName);
} }
}else{ }else{
debugger;
//更新数据记录 //更新数据记录
if (type == 'new') { if (type == 'new') {
var fileName = obj.publishFileName + ' V' + obj.fileVersion + '-' + getOutputName(category, method); var fileName = obj.publishFileName + ' V' + obj.fileVersion + '-' + getOutputName(category, method);
@ -1845,7 +1886,6 @@ function formSave(isTransact){
$.simpleAlert('发布内容不能为空', 'info'); $.simpleAlert('发布内容不能为空', 'info');
return false; return false;
} }
debugger;
var index = 0; var index = 0;
if (!($("#publisher_new_tr").css('display') == 'none') && newTemp.length > 0) { if (!($("#publisher_new_tr").css('display') == 'none') && newTemp.length > 0) {
index++; index++;
@ -2269,9 +2309,7 @@ function downloadReport(uuid, taskId) {
uuid: uuid uuid: uuid
}, },
success : function(r) { success : function(r) {
debugger;
if (r.result == "ok") { if (r.result == "ok") {
debugger;
window.open (r.data.url); window.open (r.data.url);
} else { } else {