package com.business.controller;

import com.alibaba.fastjson.JSONObject;
import com.sooka.system.domain.BaseBusinessEntity;
import com.util.HttpUtil;
import com.util.HttpUtil2;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 对接省平台获取数据信息Controller
 *
 * @author zhe
 * @date 2022-12-17
 */
@RequestMapping("/business/app/GetProvinceController")
@RestController
public class GetProvinceController {

    /**
     * 1 国家民政部-基金会法人登记证书信息-数据查询接口
     * @param baseBusinessEntity
     * @return
     */
    @RequestMapping("getEnterpriseUniscId1")
    public String getEnterpriseUniscId1(@RequestBody BaseBusinessEntity baseBusinessEntity) {
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 1...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 2...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 3...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 4...");
        System.out.println("sending Post to http://www.wangzhe.com 5...");
        Map headerparam = new HashMap();
        headerparam.put("Authorization-Type", "Basic");
        headerparam.put("Authorization", "Basic NjBlODQxNzQyZTIyMDE2NjUzYmQ3NmE4N2QxY2FjMzA6ODhlOWM0NzcxMWZkMTM5YjhiMGMyODlkZjBiMWI5YmQ=Service-ID:qNpU77");
        String url = "http://172.24.5.241:6689";
        String parem = "{\n" +
                "  \"appId\": \"1234\",\n" +
                "  \"charset\": \"utf-8\",\n" +
                "  \"format\": \"JSON\",\n" +
                "  \"timestamp\": \"2022-12-16 10:22:00\",\n" +
                "  \"version\": \"1.0.0\",\n" +
                "  \"enterpriseName\": \"北京阿里巴巴信息技术有限公司\"\n" +
                "}";
        JSONObject jsonStr = new JSONObject();
        jsonStr.put("appId", "1234");
        jsonStr.put("charset", "utf-8");
        jsonStr.put("format", "JSON");
        jsonStr.put("timestamp", "2022-12-16 10:22:00");
        jsonStr.put("version", "1.0.0");
        jsonStr.put("enterpriseName", "北京阿里巴巴信息技术有限公司");
        try{
//            return HttpUtil2.doPost(url + "/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId", jsonStr.toString(), headerparam);
            return HttpUtil2.doPost("http://www.wangzhe.com", jsonStr.toString(), headerparam);
//            return HttpUtil2.doPost("http://182.61.200.7:80", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId666", jsonStr.toString(), headerparam);
        }catch (Exception e){
            e.printStackTrace();
            return "interfaceErrorMsg:" + e.toString();
        }
    }




    @RequestMapping("getEnterpriseUniscId5")
    public String getEnterpriseUniscId5(@RequestBody BaseBusinessEntity baseBusinessEntity) {
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 1...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 2...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 3...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 4...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 5...");
        Map headerparam = new HashMap();
        headerparam.put("Authorization-Type", "Basic");
        headerparam.put("Authorization", "Basic NjBlODQxNzQyZTIyMDE2NjUzYmQ3NmE4N2QxY2FjMzA6ODhlOWM0NzcxMWZkMTM5YjhiMGMyODlkZjBiMWI5YmQ=Service-ID:qNpU77");
        String url = "http://172.24.5.241:6689";
        String parem = "{\n" +
                "  \"appId\": \"1234\",\n" +
                "  \"charset\": \"utf-8\",\n" +
                "  \"format\": \"JSON\",\n" +
                "  \"timestamp\": \"2022-12-16 10:22:00\",\n" +
                "  \"version\": \"1.0.0\",\n" +
                "  \"enterpriseName\": \"北京阿里巴巴信息技术有限公司\"\n" +
                "}";
        JSONObject jsonStr = new JSONObject();
        jsonStr.put("appId", "1234");
        jsonStr.put("charset", "utf-8");
        jsonStr.put("format", "JSON");
        jsonStr.put("timestamp", "2022-12-16 10:22:00");
        jsonStr.put("version", "1.0.0");
        jsonStr.put("enterpriseName", "北京阿里巴巴信息技术有限公司");
        try{
//            return HttpUtil2.doPost(url + "/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
            return HttpUtil2.doPost("http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId", jsonStr.toString(), headerparam);
//            return HttpUtil2.doPost("http://182.61.200.7:80", JSONObject.toJSONString(parem), headerparam);
        }catch (Exception e){
            e.printStackTrace();
            return "interfaceErrorMsg:" + e.toString();
        }
    }

    @RequestMapping("getEnterpriseUniscId")
    public String getEnterpriseUniscId(@RequestBody BaseBusinessEntity baseBusinessEntity) {
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 1...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 2...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 3...");
        Map headerparam = new HashMap();
        headerparam.put("Authorization-Type", "Basic");
        headerparam.put("Authorization", "Basic NjBlODQxNzQyZTIyMDE2NjUzYmQ3NmE4N2QxY2FjMzA6ODhlOWM0NzcxMWZkMTM5YjhiMGMyODlkZjBiMWI5YmQ=Service-ID:qNpU77");
        String url = "http://172.24.5.241:6689";
        String parem = "{\n" +
                "  \"appId\": \"1234\",\n" +
                "  \"charset\": \"utf-8\",\n" +
                "  \"format\": \"JSON\",\n" +
                "  \"timestamp\": \"2022-12-16 10:22:00\",\n" +
                "  \"version\": \"1.0.0\",\n" +
                "  \"enterpriseName\": \"北京阿里巴巴信息技术有限公司\"\n" +
                "}";
        try{
//            return HttpUtil2.doPost(url + "/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
            return HttpUtil2.doPost("http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://182.61.200.7:80", JSONObject.toJSONString(parem), headerparam);
        }catch (Exception e){
            e.printStackTrace();
            return "interfaceErrorMsg:" + e.toString();
        }
    }

    @RequestMapping("getEnterpriseUniscId4")
    public String getEnterpriseUniscId4(@RequestBody BaseBusinessEntity baseBusinessEntity) {
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 1...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 2...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 3...");
        System.out.println("sending Post to http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId 4...");
        Map headerparam = new HashMap();
        headerparam.put("Authorization-Type", "Basic");
        headerparam.put("Authorization", "Basic NjBlODQxNzQyZTIyMDE2NjUzYmQ3NmE4N2QxY2FjMzA6ODhlOWM0NzcxMWZkMTM5YjhiMGMyODlkZjBiMWI5YmQ=Service-ID:qNpU77");
        String url = "http://172.24.5.241:6689";
        String parem = "{\n" +
                "  \"appId\": \"1234\",\n" +
                "  \"charset\": \"utf-8\",\n" +
                "  \"format\": \"JSON\",\n" +
                "  \"timestamp\": \"2022-12-16 10:22:00\",\n" +
                "  \"version\": \"1.0.0\",\n" +
                "  \"enterpriseName\": \"北京阿里巴巴信息技术有限公司\"\n" +
                "}";
        try{
//            return HttpUtil2.doPost(url + "/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
//            return HttpUtil2.doPost("http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
            return HttpUtil.doPost("http://172.24.5.241:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem));
//            return HttpUtil2.doPost("http://182.61.200.7:80", JSONObject.toJSONString(parem), headerparam);
        }catch (Exception e){
            e.printStackTrace();
            return "interfaceErrorMsg:" + e.toString();
        }
    }

    @RequestMapping("getEnterpriseUniscId2")
    public String getEnterpriseUniscId2(@RequestBody BaseBusinessEntity baseBusinessEntity) {
        Map headerparam = new HashMap();
        headerparam.put("Authorization-Type", "Basic");
        headerparam.put("Authorization", "Basic NjBlODQxNzQyZTIyMDE2NjUzYmQ3NmE4N2QxY2FjMzA6ODhlOWM0NzcxMWZkMTM5YjhiMGMyODlkZjBiMWI5YmQ=Service-ID:qNpU77");
        String url = "http://172.24.5.241:6689";
        String parem = "{\n" +
                "  \"appId\": \"1234\",\n" +
                "  \"charset\": \"utf-8\",\n" +
                "  \"format\": \"JSON\",\n" +
                "  \"timestamp\": \"2022-12-16 10:22:00\",\n" +
                "  \"version\": \"1.0.0\",\n" +
                "  \"enterpriseName\": \"北京阿里巴巴信息技术有限公司\"\n" +
                "}";
        try {
            System.out.println("sending Post to http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId 1...");
            System.out.println("sending Post to http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId 2...");
            System.out.println("sending Post to http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId 3...");
            return HttpUtil2.doPost("http://19.133.2.202:6689/api/cegnir/getEnterpriseUniscId", JSONObject.toJSONString(parem), headerparam);
        } catch (Exception e) {
            e.printStackTrace();
            return "interfaceErrorMsg:" + e.toString();
        }
    }

    @RequestMapping("getEnterpriseUniscId3")
    public String getEnterpriseUniscId3(@RequestBody BaseBusinessEntity baseBusinessEntity) {
        Map headerparam = new HashMap();
        headerparam.put("Authorization-Type", "Basic");
        headerparam.put("Authorization", "Basic NjBlODQxNzQyZTIyMDE2NjUzYmQ3NmE4N2QxY2FjMzA6ODhlOWM0NzcxMWZkMTM5YjhiMGMyODlkZjBiMWI5YmQ=Service-ID:qNpU77");
        String url = "http://172.24.5.241:6689";
        String parem = "{\n" +
                "  \"appId\": \"1234\",\n" +
                "  \"charset\": \"utf-8\",\n" +
                "  \"format\": \"JSON\",\n" +
                "  \"timestamp\": \"2022-12-16 10:22:00\",\n" +
                "  \"version\": \"1.0.0\",\n" +
                "  \"enterpriseName\": \"北京阿里巴巴信息技术有限公司\"\n" +
                "}";
        try{
            return HttpUtil2.doPost("http://182.61.200.7:80", JSONObject.toJSONString(parem), headerparam);
        }catch (Exception e){
            e.printStackTrace();
            return "interfaceErrorMsg:" + e.toString();
        }
    }
}
