camunda工作流(我的代办)

/**
 * 我的待办
 * @param pn
 * @param ps
 * @return
 * @throws IOException
 */
@SieMethodOperation(code = "attendance.myProcess.toDoList.search"  , name = "考勤服务我的待办查询",type = "search",url= "/process/td")
@PostMapping(value = "/process/td/{pn}/{ps}")
public PageResultVO processToDoList(@RequestBody MyProcessParamVO paramVO, @PathVariable Integer pn, @PathVariable Integer ps) throws IOException,ParseException {
    //通过userId获取中文名
    String userId = SecurityUtils.getCurrentUserLogin();
    if(null == paramVO.getTitle() || paramVO.getTitle().isEmpty()){
        paramVO.setTitle("%");
    }else {
        paramVO.setTitle("%" + paramVO.getTitle() + "%");
    }
    //查询查出我的待办
    List<Task> list = taskService.createTaskQuery()
        .taskAssignee(userId)
        .processVariableValueLike("title",paramVO.getTitle())
        .processInstanceId(paramVO.getInstanceId())
        .taskCreatedAfter(null == paramVO.getStart() ? null : DtmStringFormat.strYmdToDate(paramVO.getStart()))
        .taskCreatedBefore(null == paramVO.getEnd() ? null : DtmStringFormat.strYmdToDate(paramVO.getEnd()))
        .listPage(pn * ps,ps);
    long count = taskService.createTaskQuery()
        .taskAssignee(userId)
        .processVariableValueLike("title",paramVO.getTitle())
        .processInstanceId(paramVO.getInstanceId())
        .taskCreatedAfter(null == paramVO.getStart() ? null : DtmStringFormat.strYmdToDate(paramVO.getStart()))
        .taskCreatedBefore(null == paramVO.getEnd() ? null : DtmStringFormat.strYmdToDate(paramVO.getEnd()))
        .count();
    //初始化结果集
    List<ProcessMyCommonVO> dataList = new ArrayList<ProcessMyCommonVO>();
    for(Task task : list){
        HistoricProcessInstance historic = historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceId(task.getProcessInstanceId())
            .singleResult();
        if(null != historic){
            //初始化
            ProcessMyCommonVO processVO = new ProcessMyCommonVO(task.getProcessInstanceId(),
                historyService.createHistoricVariableInstanceQuery().processInstanceId(historic.getId()).variableName("appName").singleResult().getValue().toString(),
                task.getId(),
                AttendanceUtil.resolveTypeByBusinessKey(historic.getBusinessKey()),
                historyService.createHistoricVariableInstanceQuery().processInstanceId(historic.getId()).variableName("instanceFormType").singleResult().getValue().toString(),
                historic.getBusinessKey(),
                historyService.createHistoricVariableInstanceQuery().processInstanceId(task.getProcessInstanceId()).variableName("title").singleResult().getValue().toString(),
                historic.getStartUserId(),
                sendGet(UrlConstant.GET_ZHNAME_BY_UID+historic.getStartUserId(),null),
                DtmStringFormat.dateTimeToStrYmdHms(historic.getStartTime()),
                null
            );
            //设置状态
            if("completed".equals(historic.getState().toLowerCase())){
                processVO.setWfState("completed");
            }
            if("active".equals(historic.getState().toLowerCase())){
                //驳回状态
                initActiveProcessInfo(historic, task, processVO);
            }
            dataList.add(processVO);
        }
    }
    return new PageResultVO(GlobalReturnCode.SUCCESS_CODE, "SUCCESS",ps,pn,(int)count,AttendanceUtil.processSortByStartDateDesc(dataList));
}复制代码

界面实例:



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值