增加废止带出附件功能

This commit is contained in:
zhal 2023-06-14 14:36:32 +08:00
parent ac1abfc792
commit a84b05836b
4 changed files with 194 additions and 7 deletions

View File

@ -1912,6 +1912,42 @@ public class ProcessPublishWeb extends ActionWeb {
}
BO stopBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").detailByBindId(bindId);
if (stopBo != null) {
String stopId=stopBo.getString("STOPFILEID");
/******************** 附件 **********************/
// 文件或节点自身附件
JSONArray js = new JSONArray();
UpFileDao upFileDao = new UpFileDao();
StringBuilder sqlWhere = new StringBuilder();
ArrayList<String> isNumberAscArray = new ArrayList<String>();
sqlWhere.append(" and PALREPOSITORYID ='").append(stopId).append("'").append(" ORDER BY FILENAME ASC");
;
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();
if (!upFileName.contains(".xml")) {
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl("f", jb, upfileModel);
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());
}
}
stopObj.put("upfileId", js);
stopObj.put("stopFileName", stopBo.getString("STOPFILENAME"));
stopObj.put("stopFileId", stopBo.getString("STOPFILEID"));
PALRepositoryModel model = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID"));
@ -3008,9 +3044,9 @@ public class ProcessPublishWeb extends ActionWeb {
taskIn.getActivityDefId());
boolean isModify = FormEngineHelper.getInstance().isFormDataModify(userTaskModel, _uc);
proNumber = isModify;
// if("obj_c643c74dc6800001bd741d7e1e40e4b0".equals(taskIn.getActivityDefId())) {
// proNumber = true;
// }
// if("obj_c643c74dc6800001bd741d7e1e40e4b0".equals(taskIn.getActivityDefId())) {
// proNumber = true;
// }
}
ro.put("proNumber", proNumber);
BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId);
@ -3369,6 +3405,126 @@ public class ProcessPublishWeb extends ActionWeb {
obj.put("stopDesc", stopBo.getString("STOPDESC"));
obj.put("taskId", stopBo.getString("TASKID"));
stopArr.add(obj);
PALRepositoryModel stopmodel = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID"));
String stopId=stopBo.getString("STOPFILEID");
String methodId=stopmodel.getMethodId();
/******************** 附件 ************************/
// 文件或节点自身附件
JSONArray js = new JSONArray();
UpFileDao upFileDao = new UpFileDao();
StringBuilder sqlWhere = new StringBuilder();
ArrayList<String> isNumberAscArray = new ArrayList<String>();
sqlWhere.append(" and PALREPOSITORYID ='").append(stopId).append("'").append(" ORDER BY FILENAME ASC");
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
if (fileList != null && fileList.size() > 0)
for (UpfileModel upfileModel : fileList)
if (methodId.contains("data")) {
if ("s".equals(upfileModel.getType())) {
JSONObject jb = new JSONObject();
//按照附件编号排序
String fileNamel = upfileModel.getFileName();
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(""))) {
if (fileNamel.indexOf("附件") == 0) {
int indexOf2 = 3;
if (fileNamel.contains(":")) {
indexOf2 = fileNamel.indexOf(":");
} else if (fileNamel.contains("")) {
indexOf2 = fileNamel.indexOf("");
}
String numberStr = fileNamel.substring(2, indexOf2);
if (isNumeric(numberStr) && !"".equals(numberStr)) {
isNumberAscArray.add("true");
int fileNumber = Integer.parseInt(numberStr);
jb.put("file_number", fileNumber);
} else {
isNumberAscArray.add("false");
}
} else {
isNumberAscArray.add("false");
}
} else {
isNumberAscArray.add("false");
}
String upfileId = upfileModel.getUuid();
String shape_uuid = upfileModel.getShape_uuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl("s", jb, upfileModel);
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 fileNamel = upfileModel.getFileName();
if (UtilString.isNotEmpty(fileNamel) && fileNamel.contains("附件") && fileNamel.length() > 2 && (fileNamel.contains(":") || fileNamel.contains(""))) {
if (fileNamel.indexOf("附件") == 0) {
int indexOf2 = 3;
if (fileNamel.contains(":")) {
indexOf2 = fileNamel.indexOf(":");
} else if (fileNamel.contains("")) {
indexOf2 = fileNamel.indexOf("");
}
String numberStr = fileNamel.substring(2, indexOf2);
if (isNumeric(numberStr) && !"".equals(numberStr)) {
isNumberAscArray.add("true");
int fileNumber = Integer.parseInt(numberStr);
jb.put("file_number", fileNumber);
} else {
isNumberAscArray.add("false");
}
} else {
isNumberAscArray.add("false");
}
} else {
isNumberAscArray.add("false");
}
String upfileId = upfileModel.getUuid();
String upFileName = upfileModel.getFileName();
jb.put("upfileId", upfileId);
jb.put("upFileName", upFileName);
String openUrl = "";
ResponseObject ros = getUrl("f", jb, upfileModel);
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());
}
}
boolean contains = isNumberAscArray.contains("false");
if (!contains) {
try {
js.sort(Comparator.comparing(objs -> (JSON.parseObject(objs.toString())).getInteger("file_number")));
} catch (Exception e) {
throw new AWSQuotaException("附件格式请以《附件1:XXXXXX》格式命名");
}
}
obj.put("upfileId", js);
}
}
}

View File

@ -474,6 +474,13 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes);
System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:"
+ (endTimes - startTime) / 1000 / 60 + "分钟");
List<BO> readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",processExecutionContext.getProcessInstance().getId()).list();
if(readCountBO.size()>0){
SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+processExecutionContext.getProcessInstance().getTitle()+"文件有失败记录,请及时处理!!!");
}
}
}

View File

@ -260,7 +260,7 @@ function initHtml() {
// newHtml += '<button name="save" type="button" class="awsui-btn" onclick="saveFormData(\'new\');">保存</button>';
newHtml += '<button name="delete" type="button" class="awsui-btn awsui-btn-danger" onclick="deleteFile(\'new\');">删除</button>';
newHtml += '<button name="refreshManual" type="button" class="awsui-btn awsui-btn" onclick="refreshManuals(\''+$("#processInstId").val()+'\',\''+"1"+'\');">重新生成手册</button>';
newHtml += '<button name="getFiles" type="button" class="awsui-btn awsui-btn" onclick="getFiles();">生成附件</button>';
newHtml += '<button name="showFiles" type="button" class="awsui-btn awsui-btn" onclick="getFiles();">生成附件</button>';
}
//newHtml += '<button name="add" type="button" class="awsui-btn awsui-btn-blue" onclick="addProcess(\'new\');">新增</button>';
// newHtml += '<button name="save" type="button" class="awsui-btn" onclick="saveFormData(\'new\');">保存</button>';
@ -293,7 +293,7 @@ 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>';
changeHtml += '<button name="delete" type="button" class="awsui-btn awsui-btn" onclick="refreshManuals(\''+$("#processInstId").val()+'\',\''+"2"+'\');">重新生成手册</button>';
changeHtml += '<button name="delete" type="button" class="awsui-btn awsui-btn" onclick="getFiles()">生成附件</button>';
changeHtml += '<button name="showFiles" type="button" class="awsui-btn awsui-btn" onclick="getFiles()">生成附件</button>';
}
//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>';
@ -779,6 +779,21 @@ 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.stopFileName + ' 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.stopFileId + '" style="cursor: pointer;" onclick="downloadReport(\'' + curr.stopFileId + '\',\'' + curr.taskId + '\')"><i class="awsui-iconfont" style="font-size: 12px;">&#xe653;</i></span>';
@ -789,7 +804,14 @@ function showlist(data, type, pageNumber, start){
html += '<td ' + tableTdCss + '><input name="check" ' + checkboxPerm + ' class="awsui-checkbox" data-id="' + curr.stopFileId + '" type="checkbox" type="awsui-checkbox"></td>';
html += '<td ' + tableTdCss + '>' + s + '</td>';
html += '<td ' + tableTdCss + '><a href="javascript:void(0);" onclick="openPortalPage(\'' + curr.stopFileId + '\', \'' + curr.taskId + '\')">' + fileName + '</a></td>';
html += '<td ' + tableTdCss + '>' + reportName + '</td>';
/*html += '<td ' + tableTdCss + '>' + reportName + '</td>';*/
if(fName!=''){
html += '<td ' + tableTdCss + '></p>' + reportName + fName +'</td>';
}else{
html += '<td ' + tableTdCss + '>' + reportName +'</td>';
}
html += '<td style="padding:1px;"><textarea onblur="changeDesc(\'stop\',\'' + curr.stopFileId + '\', this)" style="width:100%;height:30px;" ' + textareaPerm + ' class="awsui-input">' + curr.stopDesc + '</textarea></td>';
html += '</tr>';
}
@ -1116,7 +1138,8 @@ function openPortalPage(uuid, taskId) {
* @param uuid
*/
function refreshManuals(processInstId,type) {
//FormToolBarAction.BTN_SAVE();
$.simpleAlert("正在创建", "loading");
FormToolBarAction.BTN_SAVE();
var param = {
sid : sid,
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_Refresh_Manual",
@ -1129,6 +1152,7 @@ function refreshManuals(processInstId,type) {
dataType : "JSON",
data : param,
success : function(r) {
$.simpleAlert('close');
if (r.result == 'ok') {
AWSFormUtil.refreshPage();
} else {