package com.njcn.bpm.controller;

import com.njcn.bpm.pojo.vo.task.BpmActivityVO;
import com.njcn.bpm.service.task.IBpmActivityService;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author hongawen
 */
@Tag(name = "管理后台 - 流程活动实例")
@RestController
@RequestMapping("/bpm/activity")
@Validated
public class BpmActivityController extends BaseController {

    @Resource
    private IBpmActivityService activityService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @GetMapping("/list")
    @ApiOperation("生成指定流程实例的高亮流程图")
    @ApiImplicitParam(name = "processInstanceId", value = "查询参数", required = true)
    public HttpResult<List<BpmActivityVO>> getActivityList(String processInstanceId) {
        String methodDescribe = getMethodDescribe("getActivityList");
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, activityService.getActivityListByProcessInstanceId(processInstanceId), methodDescribe);
    }
}
