package com.jeeplus.centerservice.controller.ccpm;

import com.jeeplus.centerservice.service.ccpm.flow.FlowService;
import org.springframework.http.ResponseEntity;
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;
import java.util.Map;

@RestController
@RequestMapping("ccpm_flow")
public class FlowController {

    @Resource
    private FlowService flowService;

    /**
     * 获取流程历史
     * @param procInsId
     * @return
     */
    @GetMapping("getHistoicFlowList")
    public ResponseEntity getHistoicFlowList(String procInsId) {
        List<Map<String, Object>> histoicFlowList = flowService.getHistoicFlowList(procInsId);
        return ResponseEntity.ok (histoicFlowList);
    }

    /**
     * 获取流程流向图
     * @param procInsId
     * @return
     */
    @GetMapping("getFlowChart")
    public ResponseEntity getFlowChart(String procInsId) {
        List<Map<String, Object>> flowChart = flowService.getFlowChart(procInsId);
        return ResponseEntity.ok (flowChart);
    }
}
