Ecology-Dev/JSSBMJ/interface/custom/getWorkflowCreatePermission...

68 lines
2.8 KiB
Plaintext
Raw Normal View History

2025-09-01 21:16:20 +08:00
<%@ page import="weaver.hrm.User" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.workflow.service.NewRequestService" %>
<%@ page import="com.engine.workflow.util.CommonUtil" %>
<%@ page import="com.engine.common.util.ServiceUtil" %>
<%@ page import="com.engine.workflow.service.impl.NewRequestServiceImpl" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Arrays" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%
String workflowid = request.getParameter("workflowid");
List<String> workflowList = new ArrayList<String>();
if(StringUtils.isNotBlank(workflowid)){
workflowList = Arrays.asList(workflowid.split(","));
}
JSONArray jsonArray = new JSONArray();
if(workflowList.size()>0){
Map<String,Object> apidatas = getService(request,response).getWfInfo(ParamUtil.request2Map(request));
JSONObject datasObject = JSONObject.parseObject(JSONObject.toJSONString(apidatas));
if(datasObject.containsKey("datas")){
JSONArray datasArray = datasObject.getJSONArray("datas");
for(int i=0;i<datasArray.size();i++){
JSONObject dataObject = datasArray.getJSONObject(i);
if(dataObject.containsKey("wfbeans")){
JSONArray wfbeansArray = dataObject.getJSONArray("wfbeans");
for(int k=0;k<wfbeansArray.size();k++){
JSONObject wfBeansObject = wfbeansArray.getJSONObject(k);
String id = wfBeansObject.getString("id");
String name = wfBeansObject.getString("name");
if(workflowList.contains(id)){
JSONObject workObject = new JSONObject();
workObject.put("id",id);
workObject.put("name",name);
workObject.put("pcurl","/workflow/request/CreateRequestForward.jsp?workflowid="+id);
workObject.put("mobileurl","/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid="+id);
jsonArray.add(workObject);
}
}
}
}
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data",jsonArray);
%>
<%=jsonObject.toJSONString() %>
<%!
private NewRequestService getService(HttpServletRequest request, HttpServletResponse response){
User user = CommonUtil.getUserByRequest(request,response);
return (NewRequestService) ServiceUtil.getService(NewRequestServiceImpl.class,user);
}
%>