@ -74,6 +74,7 @@ import org.activiti.engine.task.Task;
import org.activiti.image.ProcessDiagramGenerator ;
import org.activiti.spring.ProcessEngineFactoryBean ;
import org.apache.commons.io.FilenameUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.codehaus.jackson.map.ObjectMapper ;
import org.codehaus.jackson.node.ObjectNode ;
import org.slf4j.Logger ;
@ -225,12 +226,12 @@ public class ActivitiController {
private EquipmentCardService equipmentCardService ;
@RequestMapping ( " /showProcessList.do " )
public String showProcessList ( HttpServletRequest request , Model model ) {
System . out . println ( " basic " ) ;
return " /activiti/processList " ;
}
/**
* 流程定义列表
*
@ -307,13 +308,13 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
// page.setTotalCount(processDefinitionQuery.count());
// page.setResult(objects);
// mav.addObject("page", page);
//
// return mav;
}
/**
* 流程定义列表
*
@ -334,8 +335,7 @@ public class ActivitiController {
try { //解决中文乱码问题
wherestr_search_name = new String ( wherestr_search_name . getBytes ( " ISO-8859-1 " ) , " UTF-8 " ) ;
wherestr_search_code = new String ( wherestr_search_code . getBytes ( " ISO-8859-1 " ) , " UTF-8 " ) ;
} catch ( UnsupportedEncodingException e )
{
} catch ( UnsupportedEncodingException e ) {
logger . error ( " Failed to encode search parameters " , e ) ;
}
// Page<Object[]> page1 = new Page<Object[]>(PageUtil.PAGE_SIZE);
@ -395,13 +395,13 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
// page.setTotalCount(processDefinitionQuery.count());
// page.setResult(objects);
// mav.addObject("page", page);
//
// return mav;
}
/**
* 根据流程定义,获取流程所有工序
*
@ -438,8 +438,10 @@ public class ActivitiController {
List < WorkTask > workTasks = ActivitiUtil . activitiImplToWorkTask ( usertasks ) ;
return workTasks ;
}
/**
* 获取流程下一步的所有任务清单
*
* @param request
* @param model
* @returnq
@ -468,6 +470,7 @@ public class ActivitiController {
/**
* 获取流程下一步的所有任务清单, select2选择
*
* @param request
* @param model
* @returnq
@ -512,6 +515,7 @@ public class ActivitiController {
}
return " /activiti/processForSelect " ;
}
/**
* 流程定义列表
*
@ -540,7 +544,6 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
// page.setTotalCount(processDefinitionQuery.count());
// page.setResult(objects);
// mav.addObject("page", page);
@ -552,10 +555,12 @@ public class ActivitiController {
public String taskList ( HttpServletRequest request , Model model ) {
return " /activiti/taskList " ;
}
@RequestMapping ( " /taskList4main.do " )
public String taskList4main ( HttpServletRequest request , Model model ) {
return " /activiti/taskList4main " ;
}
/**
* 获取生产总流程任务列表
*
@ -581,6 +586,7 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
}
/**
* 获取生产总流程任务列表
*
@ -781,8 +787,7 @@ public class ActivitiController {
}
maintenance . setStatus ( todoTask . getTask ( ) . getDescription ( ) ) ;
todoTask . setBusiness ( maintenance ) ;
}
else if ( todoTask . getType ( ) . contains ( ProcessType . Repair_Plan . getId ( ) ) ) {
} else if ( todoTask . getType ( ) . contains ( ProcessType . Repair_Plan . getId ( ) ) ) {
//之前老的单条计划
/*EquipmentRepairPlan maintenancePlan = this.equipmentRepairPlanService.selectById(businessKey);
maintenance=new Maintenance();
@ -807,8 +812,7 @@ public class ActivitiController {
}
maintenance . setStatus ( todoTask . getTask ( ) . getDescription ( ) ) ;
todoTask . setBusiness ( maintenance ) ;
}
else if ( todoTask . getType ( ) . contains ( ProcessType . Lose_Apply . getId ( ) ) ) {
} else if ( todoTask . getType ( ) . contains ( ProcessType . Lose_Apply . getId ( ) ) ) {
EquipmentLoseApply loseApply = this . equipmentLoseApplyService . selectById ( businessKey ) ;
maintenance = new Maintenance ( ) ;
Company company = unitService . getCompById ( loseApply . getBizId ( ) ) ;
@ -930,8 +934,7 @@ public class ActivitiController {
maintenance . setProblem ( overhaul . getProjectDescribe ( ) ) ;
maintenance . setStatus ( todoTask . getTask ( ) . getDescription ( ) ) ;
todoTask . setBusiness ( maintenance ) ;
}
else if ( todoTask . getType ( ) . contains ( ProcessType . Report_Check . getId ( ) ) ) {
} else if ( todoTask . getType ( ) . contains ( ProcessType . Report_Check . getId ( ) ) ) {
RptCreate rptCreate = rptCreateService . selectById ( businessKey ) ;
maintenance = new Maintenance ( ) ;
if ( rptCreate ! = null ) {
@ -1051,8 +1054,10 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
}
/**
* 对json数组排序,
*
* @param jsonArr
* @param sortKey 排序关键字
* @param is_desc is_desc-false升序列 is_desc-true降序 (排序字段为字符串)
@ -1071,6 +1076,7 @@ public class ActivitiController {
Collections . sort ( jsonValues , new Comparator < JSONObject > ( ) {
//排序字段
private final String KEY_NAME = sortKey ;
//重写compare方法
@Override
public int compare ( JSONObject a , JSONObject b ) {
@ -1102,6 +1108,7 @@ public class ActivitiController {
public String donetaskList ( HttpServletRequest request , Model model ) {
return " /activiti/donetaskList " ;
}
/*
* 已办事项
*/
@ -1128,6 +1135,7 @@ public class ActivitiController {
model . addAttribute ( " result " , json ) ;
return new ModelAndView ( " result " ) ;
}
/**
* 获取生产总流程任务列表
*
@ -1160,6 +1168,7 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
}
/**
* 获取生产总流程任务列表
*
@ -1199,24 +1208,48 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
}
@RequestMapping ( " /processInstaceList.do " )
public String processInstaceList ( HttpServletRequest request , Model model ) {
return " /activiti/processInstanceList " ;
}
/**获取所有实例类型*/
/**
* 获取所有实例类型
*/
@RequestMapping ( " /getProcessTypes4Combo.do " )
public ModelAndView getProcessTypes4Combo ( HttpServletRequest request , Model model ) {
JSONArray jsonArray = new JSONArray ( ) ;
ProcessType [ ] types = ProcessType . values ( ) ;
// Read search term from request parameter (for Select2 AJAX) or session
String term = request . getParameter ( " term " ) ;
if ( term = = null | | term . isEmpty ( ) ) {
Object sessionTerm = request . getSession ( ) . getAttribute ( " term " ) ;
if ( sessionTerm ! = null ) {
term = sessionTerm . toString ( ) ;
}
}
if ( term ! = null & & ! term . isEmpty ( ) ) {
for ( ProcessType item : types ) {
if ( item . getName ( ) . contains ( term ) ) {
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " id " , item . getId ( ) ) ;
jsonObject . put ( " text " , item . getName ( ) ) ;
jsonArray . add ( jsonObject ) ;
}
}
} else {
for ( ProcessType item : types ) {
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " id " , item . getId ( ) ) ;
jsonObject . put ( " text " , item . getName ( ) ) ;
jsonArray . add ( jsonObject ) ;
}
}
model . addAttribute ( " result " , jsonArray . toString ( ) ) ;
return new ModelAndView ( " result " ) ;
}
/**
* 获取所有生产流程
*
@ -1244,6 +1277,7 @@ public class ActivitiController {
return new ModelAndView ( " result " ) ;
}
private JSONArray todoTasklistToJsonArray ( List list ) {
SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy-MM-dd HH:mm:ss " ) ;
JSONArray json = new JSONArray ( ) ;
@ -1302,6 +1336,7 @@ public class ActivitiController {
sdf = null ;
return json ;
}
private JSONArray listToJsonArray ( List list ) {
SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy-MM-dd HH:mm:ss " ) ;
JSONArray json = new JSONArray ( ) ;
@ -1339,6 +1374,7 @@ public class ActivitiController {
sdf = null ;
return json ;
}
private JSONArray listToJsonArray_ProcessDefinition ( List list ) {
SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy-MM-dd HH:mm:ss " ) ;
JSONArray json = new JSONArray ( ) ;
@ -1365,6 +1401,7 @@ public class ActivitiController {
sdf = null ;
return json ;
}
/**
* 部署全部流程
*
@ -1456,7 +1493,10 @@ public class ActivitiController {
model . addAttribute ( " result " , result ) ;
return " result " ;
}
/**删除流程*/
/**
* 删除流程
*/
@RequestMapping ( value = " /process/delProcessInstance " )
public String delProcessInstance ( HttpServletRequest request , Model model ,
@RequestParam ( " id " ) String processInstanceId ) {
@ -1473,6 +1513,7 @@ public class ActivitiController {
model . addAttribute ( " result " , result ) ;
return " result " ;
}
/**
* 输出跟踪流程信息
*
@ -1493,6 +1534,7 @@ public class ActivitiController {
}
return activityInfos ;
}
/**
* 输出定义流程信息
*
@ -1769,7 +1811,6 @@ public class ActivitiController {
return result;
}*/
private Map < String , Object > packageTaskInfo ( SimpleDateFormat sdf , Task task , ProcessDefinition processDefinition ) {
Map < String , Object > singleTask = new HashMap < String , Object > ( ) ;
singleTask . put ( " id " , task . getId ( ) ) ;
@ -1808,6 +1849,7 @@ public class ActivitiController {
model . addAttribute ( " result " , result ) ;
return " result " ;
}
/**
* 挂起、激活流程实例
*/
@ -1848,6 +1890,7 @@ public class ActivitiController {
model . addAttribute ( " result " , result ) ;
return " result " ;
}
/**
* 批量签收任务
*/
@ -1875,8 +1918,10 @@ public class ActivitiController {
model . addAttribute ( " result " , result ) ;
return " result " ;
}
/**
* 获得流程节点关联人员
*
* @param request
* @param model
* @param resourceId
@ -1917,6 +1962,7 @@ public class ActivitiController {
/**
* 获得流程节点关联职位
*
* @param request
* @param model
* @param resourceId
@ -1941,6 +1987,7 @@ public class ActivitiController {
model . addAttribute ( " result " , json ) ;
return " result " ;
}
/**
* 导出图片文件到硬盘
*