package com.weaver.seconddev.chapanda.test;

import com.alibaba.fastjson.JSONObject;
import okhttp3.*;

import java.io.IOException;

public class main899 {

    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");

        JSONObject dataJson = new JSONObject();
        dataJson.put("departmentId",2335561);
        dataJson.put("kind",1);
        dataJson.put("requirementType",2);
        dataJson.put("isSecrecy",false);
        dataJson.put("arivalTime","2025-07-17T00:00:00");
        dataJson.put("createBy",402189433);
        dataJson.put("educationInfo","2");
        dataJson.put("requirementCount",2);
        dataJson.put("name","HR001-招聘需求申请流程-sysadmin-2025-07-08");
        dataJson.put("category",2);
        dataJson.put("requirementStatus",10);
        dataJson.put("createDate","2025-07-08T00:00:00");

        //"\n{\n\n\"departmentId\":2335561,\n    \"kind\": 1,\n    \"requirementType\": 2,\n    \"isSecrecy\": false,\n    \"arivalTime\": \"2025-07-17T00:00:00\",\n    \"createBy\": 402189433,\n    \"educationInfo\": \"2\",\n    \"requirementCount\": 2,\n    \"name\": \"HR001-招聘需求申请流程-sysadmin-2025-07-08\",\n    \"category\": 2,\n    \"requirementStatus\": 10,\n    \"createDate\": \"2025-07-08T00:00:00\"\n}\n"

        RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString());
        Request request = new Request.Builder()
                .url("https://openapi.italent.cn/RecruitV6/api/v1/Requirement/CreateRequirement")
                .method("POST", body)
                .addHeader("Authorization", "Bearer X4eTEiMr-9cg3Du4KXRjpkoQda4-74c-5YxSrRDsakpp1pyZyn5zhFESSuTKAc793LcZeDKpX")
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = client.newCall(request).execute();
        int code = response.code();
        String bodyData = response.body().string();
        System.out.println("code:"+code);
        System.out.println("bodyData:"+bodyData);
    }
}
