package com.tykj.workflowcore.user.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.tykj.workflowcore.user.util.HttpUtil;
import io.swagger.annotations.Api;
import liquibase.pro.packaged.J;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "同步数据")
@RestController
@RequestMapping("/syn")
public class synchronizationDataController {

    @Autowired
    HttpUtil httpUtil;

    @GetMapping("/test")
    public void test(){
        CloseableHttpResponse response = httpUtil.request(HttpUtil.HttpMethodName.GET, "http://192.168.102.171:8880/organization/all", null, null);
        String s = httpUtil.closeableHttpResponse2String(response);
        //开始解析json
        JSONObject responseJson = JSONObject.parseObject(s);
        JSONArray dataArray = responseJson.getJSONArray("data");
        
        System.out.println("s");
    }
}
