Commit 7f87dafb authored by Quxl's avatar Quxl

增加流程详情查询接口

parent 479147fa
...@@ -26,7 +26,7 @@ import com.egolm.workflow.interfaces.WorkflowService; ...@@ -26,7 +26,7 @@ import com.egolm.workflow.interfaces.WorkflowService;
public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService, WorkflowCallback { public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService, WorkflowCallback {
@Override @Override
public List<Map<String, Object>> queryHistoryWorkList(String sUserID, Page page) { public List<Map<String, Object>> queryHistoryWorkListByUserID(String sUserID, Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate(); JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
TFlowLog log = new TFlowLog(); TFlowLog log = new TFlowLog();
log.setsTaskType(TaskType.start); log.setsTaskType(TaskType.start);
...@@ -47,7 +47,7 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService ...@@ -47,7 +47,7 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService
} }
@Override @Override
public List<Map<String, Object>> queryWorkList(String sUserID, Page page) { public List<Map<String, Object>> queryWorkListByUserID(String sUserID, Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate(); JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
List<Object> objs = new ArrayList<Object>(); List<Object> objs = new ArrayList<Object>();
List<String> strs = new ArrayList<String>(); List<String> strs = new ArrayList<String>();
...@@ -63,13 +63,29 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService ...@@ -63,13 +63,29 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService
} }
@Override @Override
public List<Map<String, Object>> queryTaskList(String sUserID, Page page) { public List<Map<String, Object>> queryTaskListByUserID(String sUserID, Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate(); JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
String sql = "select ft.* from t_flow_task ft, t_flow_user fu where (ft.sTaskID = fu.sTaskID and fu.sUserID = ?) or ft.sAcceptorID = ?"; String sql = "select ft.* from t_flow_task ft, t_flow_user fu where (ft.sTaskID = fu.sTaskID and fu.sUserID = ?) or ft.sAcceptorID = ?";
sql = "select t.*, f.sFlowName from (" + sql + ") t left join t_flow f on f.sFlowID = t.sFlowID"; sql = "select t.*, f.sFlowName from (" + sql + ") t left join t_flow f on f.sFlowID = t.sFlowID";
return jdbcTemplate.limit(sql, page, sUserID, sUserID); return jdbcTemplate.limit(sql, page, sUserID, sUserID);
} }
public Map<String, Object> queryTaskByID(String sTaskID) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
Map<String, Object> map = jdbcTemplate.queryForMap("select * from t_flow_task where sTaskID = ?", sTaskID);
String sFlowID = (String)map.get("sFlowID");
String sNodeID = (String)map.get("sNodeID");
TFlow flow = this.queryFlowById(sFlowID);
String settings = flow.getsFlowSettings();
Map<?, ?> settongsMap = JSON.parseObject(settings);
Map<?, ?> nodesMap = (Map<?, ?>)settongsMap.get("nodes");
Map<?, ?> nodeMap = (Map<?, ?>)nodesMap.get(sNodeID);
Map<?, ?> transfersMap = (Map<?, ?>)nodeMap.get("transfers");
map.put("transfers", transfersMap);
map.put("sFlowSettings", settings);
return map;
}
@Override @Override
@Transactional @Transactional
public TFlowTask start(String sFlowName, String sUserID, Map<String, Object> vars) { public TFlowTask start(String sFlowName, String sUserID, Map<String, Object> vars) {
...@@ -129,7 +145,7 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService ...@@ -129,7 +145,7 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService
} }
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate(); JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
TFlowTask task = jdbcTemplate.queryForBean("select * from t_flow_task where sTaskID = ?", TFlowTask.class, sTaskID); TFlowTask task = jdbcTemplate.queryForBean("select * from t_flow_task where sTaskID = ?", TFlowTask.class, sTaskID);
TFlow flow = jdbcTemplate.queryForBean("select * from t_flow where sFlowID = ?", TFlow.class, task.getsFlowID()); TFlow flow = this.queryFlowById(task.getsFlowID());
Map<String, Object> mergedVars = new HashMap<String, Object>(); Map<String, Object> mergedVars = new HashMap<String, Object>();
String vars_json = task.getsVars(); String vars_json = task.getsVars();
Map<?, ?> dbVars = JSON.parseObject(vars_json); Map<?, ?> dbVars = JSON.parseObject(vars_json);
...@@ -269,9 +285,9 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService ...@@ -269,9 +285,9 @@ public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService
} }
@Override @Override
public Map<String, Object> queryFlowMapById(String sFlowID) { public TFlow queryFlowById(String sFlowID) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate(); JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
return jdbcTemplate.queryForMap("select * from t_flow where sFlowID = ?", sFlowID); return jdbcTemplate.queryForBean("select * from t_flow where sFlowID = ?", TFlow.class, sFlowID);
} }
@Override @Override
......
...@@ -17,11 +17,13 @@ public interface WorkflowEngine { ...@@ -17,11 +17,13 @@ public interface WorkflowEngine {
* @param page * @param page
* @return * @return
*/ */
List<Map<String, Object>> queryHistoryWorkList(String sUserID, Page page); List<Map<String, Object>> queryHistoryWorkListByUserID(String sUserID, Page page);
List<Map<String, Object>> queryWorkList(String sUserID, Page page); List<Map<String, Object>> queryWorkListByUserID(String sUserID, Page page);
List<Map<String, Object>> queryTaskList(String sUserID, Page page); List<Map<String, Object>> queryTaskListByUserID(String sUserID, Page page);
Map<String, Object> queryTaskByID(String sTaskID);
TFlowTask start(String sFlowName, String sUserID, Map<String, Object> vars); TFlowTask start(String sFlowName, String sUserID, Map<String, Object> vars);
......
...@@ -29,7 +29,7 @@ public interface WorkflowService { ...@@ -29,7 +29,7 @@ public interface WorkflowService {
* @param sFlowID * @param sFlowID
* @return * @return
*/ */
Map<String, Object> queryFlowMapById(String sFlowID); TFlow queryFlowById(String sFlowID);
/** /**
* 修改流程定义 * 修改流程定义
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment