package com.galaxis.manatee.controller;

import com.dingtalk.api.response.OapiProcessinstanceGetResponse;
import com.galaxis.manatee.dao.DingTalkProcessInstanceDao;
import com.galaxis.manatee.entity.ding.DingTalkProcessInstance;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zcj
 * @version 0.1
 * @date 2020/2/6 7:14 下午
 */
@Slf4j
@RestController
public class DataStructureTestController {

    private DingTalkProcessInstanceDao dingTalkProcessInstanceDao;

    public DataStructureTestController(DingTalkProcessInstanceDao dingTalkProcessInstanceDao) {
        this.dingTalkProcessInstanceDao = dingTalkProcessInstanceDao;
    }

    @GetMapping("/testData")
    public void testData(){
        DingTalkProcessInstance dingTalkProcessInstance=dingTalkProcessInstanceDao.findById("774cd621-e754-4893-8d84-e1fc96fc5e2c").get();
        OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceTopVo=dingTalkProcessInstance.getProcessInstance();
        List<OapiProcessinstanceGetResponse.FormComponentValueVo> list= processInstanceTopVo.getFormComponentValues();
        list.forEach(a->{
            log.info(a.getName()+"///"+a.getValue());
        });
    }
}
