diff --git a/src/weaver/interfaces/secret/action/ApprovalReviewEndAction.java b/src/weaver/interfaces/secret/action/ApprovalReviewEndAction.java index bbbb60e..90be985 100644 --- a/src/weaver/interfaces/secret/action/ApprovalReviewEndAction.java +++ b/src/weaver/interfaces/secret/action/ApprovalReviewEndAction.java @@ -1,6 +1,5 @@ package weaver.interfaces.secret.action; -import com.engine.secret.exception.CustomizeRunTimeException; import com.engine.secret.util.FlowUtil; import org.apache.commons.lang.StringUtils; import weaver.common.DateUtil; @@ -62,7 +61,8 @@ public class ApprovalReviewEndAction implements Action { String options = requestInfo.getCreatorid() + "-自动提交流程-" + DateUtil.getFullDate(); String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, options); if (!"success".equals(submitResult)) { - throw new CustomizeRunTimeException("requestId[" + mainRequestId + "],流程提交失败"); + requestInfo.getRequestManager().setMessagecontent("requestId[" + mainRequestId + "],流程提交失败"); + return FAILURE_AND_CONTINUE; } return SUCCESS; diff --git a/src/weaver/interfaces/secret/action/MeetingConveningEndAction.java b/src/weaver/interfaces/secret/action/MeetingConveningEndAction.java new file mode 100644 index 0000000..ac48a15 --- /dev/null +++ b/src/weaver/interfaces/secret/action/MeetingConveningEndAction.java @@ -0,0 +1,104 @@ +package weaver.interfaces.secret.action; + +import com.engine.secret.util.FlowUtil; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import weaver.common.DateUtil; +import weaver.conn.RecordSet; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.*; + +import java.util.*; + +/** + * @author:dxfeng + * @createTime: 2025/04/14 + * @version: 1.0 + */ +public class MeetingConveningEndAction implements Action { + RecordSet rs = new RecordSet(); + + @Override + public String execute(RequestInfo requestInfo) { + try { + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + Property[] properties = mainTableInfo.getProperty(); + Map mainDataMap = new HashMap<>(); + List> detailMapList = new ArrayList<>(); + for (Property property : properties) { + mainDataMap.put(property.getName(), property.getValue()); + } + + DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo(); + DetailTable detailTable = detailTableInfo.getDetailTable(0); + String detailTableName = detailTable.getTableDBName(); + String updateDetailSql = "update " + detailTableName + " set zlctjzt = ? where id = ?"; + Row[] rows = detailTable.getRow(); + for (Row row : rows) { + Map detailDataMap = new HashMap<>(mainDataMap); + Cell[] cells = row.getCell(); + String detailId = row.getId(); + for (Cell cell : cells) { + detailDataMap.put(cell.getName(), cell.getValue()); + } + detailDataMap.put("detailId", detailId); + detailMapList.add(detailDataMap); + } + + Set errorMsg = new HashSet<>(); + if (CollectionUtils.isNotEmpty(detailMapList)) { + for (Map detail : detailMapList) { + dealMainFlow(requestInfo, detail, updateDetailSql, errorMsg); + } + } + + // 根据错误信息,返回提示 + if (CollectionUtils.isNotEmpty(errorMsg)) { + requestInfo.getRequestManager().setMessagecontent(StringUtils.join(errorMsg, "
")); + return FAILURE_AND_CONTINUE; + } + + + return SUCCESS; + } catch (Exception e) { + rs.writeLog(e); + requestInfo.getRequestManager().setMessagecontent(e.getMessage()); + return FAILURE_AND_CONTINUE; + } + } + + private void dealMainFlow(RequestInfo requestInfo, Map detail, String updateDetailSql, Set errorMsg) { + String mainRequestId = detail.get("xzxksqdh"); + String conclusion = detail.get("spfhjl"); + String detailId = detail.get("detailId"); + String submitStatus = detail.get("zlctjzt"); + if ("1".equals(submitStatus)) { + // 已经提交成功的流程,不重复处理 + return; + } + // 更新主流程表单的审批复核结论 + String tableNameByRequestId = FlowUtil.getTableNameByRequestId(mainRequestId); + if (StringUtils.isBlank(tableNameByRequestId)) { + errorMsg.add("requestId[" + mainRequestId + "],主流程表单名称获取异常,请确认"); + rs.executeUpdate(updateDetailSql, "2", detailId); + return; + } + + rs.writeLog("mainRequestId==" + mainRequestId); + rs.writeLog("conclusion==" + conclusion); + rs.writeLog("tableNameByRequestId==" + tableNameByRequestId); + + rs.executeUpdate("update " + tableNameByRequestId + " set spfhjl = ? where requestid = ?", conclusion, mainRequestId); + + // 更新完成后,自动提交流程到下一节点 + rs.writeLog("mainRequestId==" + mainRequestId); + String options = requestInfo.getCreatorid() + "-自动提交流程-" + DateUtil.getFullDate(); + String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, options); + if (!"success".equals(submitResult)) { + errorMsg.add("requestId[" + mainRequestId + "],流程提交失败"); + rs.executeUpdate(updateDetailSql, "2", detailId); + } else { + rs.executeUpdate(updateDetailSql, "1", detailId); + } + } +}