会议召开流程归档动作 更新主流程字段 提交主流程到下一节点
This commit is contained in:
parent
1b575da679
commit
6fc428cbc0
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<String, String> mainDataMap = new HashMap<>();
|
||||
List<Map<String, String>> 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<String, String> 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<String> errorMsg = new HashSet<>();
|
||||
if (CollectionUtils.isNotEmpty(detailMapList)) {
|
||||
for (Map<String, String> detail : detailMapList) {
|
||||
dealMainFlow(requestInfo, detail, updateDetailSql, errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据错误信息,返回提示
|
||||
if (CollectionUtils.isNotEmpty(errorMsg)) {
|
||||
requestInfo.getRequestManager().setMessagecontent(StringUtils.join(errorMsg, "<br/>"));
|
||||
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<String, String> detail, String updateDetailSql, Set<String> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue