package test.com.philisense.www.controller.http.web;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.philisense.www.core.text.Convert;
import com.philisense.www.utils.StringUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;


import test.base.HttpUtilsForm;

import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.philisense.www.common.config.CommonConst;

import java.nio.file.Files;
import java.nio.file.Paths;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.ResponseEntity;

public class TestProMenuControllerWithHttpClientForWeb  {




            @BeforeEach
            public void setUpTestDataWithinTransaction() {

            // set up test data within the transaction

            }

            @AfterEach
            public void tearDownWithinTransaction() {

            // execute "tear down" logic within the transaction

            }

            @Test
            @Disabled
            public void testProMenuDeleteByPrimaryKeyForWeb(){
                String id = UUID.randomUUID().toString().replaceAll("-","");
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/delete?recordid="+id;
            	String charset = HttpUtilsForm.UTF8;
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doGet(url, charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }

            @Test
            @Disabled
            public void testProMenuSelectByPrimaryKeyForWeb(){
                String id = UUID.randomUUID().toString().replaceAll("-","");
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/get?recordid="+id;
            	String charset = HttpUtilsForm.UTF8;
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doGet(url, charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }

            @Test
            @Disabled
            public void testProMenuInsertForWeb(){
            	
            	Map<String, Object> headerMap = new HashMap<String, Object>();
            	
            	headerMap.put("Content-Type", "application/json");
            	
            	
            	
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/insert";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                }               
                
            }

            @Test
            @Disabled
            public void testProMenuUpdateForWeb(){
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/update";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }

            @Test
            @Disabled
            public void testProMenuDeleteByMapForWeb(){
	        	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/deleteByMap";
	        	String charset = HttpUtilsForm.UTF8;
	        	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
	            try {
	                //括号里的是前台发送的url连接
	                String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
	                System.out.println(body);                                                       
	            } catch (Exception e) {
	                e.printStackTrace();
	            } 
                
            }

            @Test
            @Disabled
            public void testProMenuUpdateByMapForWeb(){
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/updateByMap";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }


            @Test
            @Disabled
            public void testProMenuGetOneForWeb(){
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/getOne";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }


            @Test
            @Disabled
            public void testProMenuGetAllForWeb(){
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/getAll";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }

            @Test
            @Disabled
            public void testProMenuCountForWeb(){
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/count";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }


            @Test
            @Disabled
            public void testProMenuQueryPageForWeb(){
            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/queryPage";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> params = new HashMap<String, Object>();
                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }

            @Test
            @Disabled
            public void testProMenuInsertBatchForWeb(){

                List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();


                Map<String, Object> params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局



                list.add(params);


                params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


                params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


               	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/insertBatch";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> paramsbody = new HashMap<String, Object>();
                //设置 请求参数
            	paramsbody.put("list",list);//用户Id
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Test
            @Disabled
            public void testProMenuDeleteBatchForWeb(){

                List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();


                Map<String, Object> params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


                params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


                params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局

                list.add(params);


            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/deleteBatch";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> paramsbody = new HashMap<String, Object>();
                //设置 请求参数
            	paramsbody.put("list",list);//用户Id
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }

            @Test
            @Disabled
            public void testProMenuUpdateBatchForWeb(){

                List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();


                Map<String, Object> params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


                params = new HashMap<String, Object>();


                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


                params = new HashMap<String, Object>();

                //设置 请求参数
                params.put("recordid","recordid");//菜单Id
                params.put("id","id");//菜单编号
                params.put("text","text");//菜单名称
                params.put("alias","alias");//别名
                params.put("parentid","parentid");//父菜单ID
                params.put("module","module");//所属模块
                params.put("indexs","indexs");//位置
                params.put("icon","icon");//图标
                params.put("remark","remark");//备注
                params.put("sequences","sequences");//顺序
                params.put("category_type",0);//链接类型 0=模块 1=外链
                params.put("action",0);//操作按钮类型
                params.put("href","href");//链接
                params.put("hreftarget","hreftarget");//弹出目标
                params.put("params","params");//参数
                params.put("target","target");//打开方式 _self _blank
                params.put("is_navi",0);//导航 0=否 1=是
                params.put("enable","enable");//是否可用
                params.put("valid","valid");//是否有效
                params.put("leaf","leaf");//是否叶子
                params.put("systemid","systemid");//系统ID
                params.put("isframe","isframe");//是否frame
                params.put("levelcode","levelcode");//层次码
                params.put("leaftype","leaftype");//节点级别
                params.put("cls","cls");//层叠样式
                params.put("component","component");//前端动态组件路径
                params.put("i18n_name","i18n_name");//菜单国际化
                params.put("redirect","redirect");//重定向路由地址
                params.put("hideInMenu","hideInMenu");//本节隐藏
                params.put("hideChildrenInMenu","hideChildrenInMenu");//隐藏父节点的孩子
                params.put("hideLayout","hideLayout");//是否使用layout布局


                list.add(params);


            	String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/updateBatch";
            	String charset = HttpUtilsForm.UTF8;
            	Map<String, Object> paramsbody = new HashMap<String, Object>();
                //设置 请求参数
            	paramsbody.put("list",list);//用户Id
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(params), charset);
                    System.out.println(body);                                                       
                } catch (Exception e) {
                    e.printStackTrace();
                } 
            }


            @Test
            @Disabled
            public void testexportForProMenuForWeb() throws IOException {
                    /*
                    // 待下载的文件地址
                    String url = CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/export";
                    ResponseEntity<byte[]> rsp = template.getForEntity(url, byte[].class);
                    System.out.println("文件下载请求结果状态码：" + rsp.getStatusCode());

                    String filename = "客户用户表";
                    // 将下载下来的文件内容保存到本地
                    String targetPath = "path_xxx/"+filename+"_ProMenu.xlsx";
                    Files.write(Paths.get(targetPath), Objects.requireNonNull(rsp.getBody(),
                    "未获取到下载文件"));
                    */
            }

            @Test
            @Disabled
            public void testexportTemplateForProMenuForWeb() throws IOException {
                    /*
            	    // 待下载的文件地址
                    String url = CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/exportTemplate";
                    ResponseEntity<byte[]> rsp = template.getForEntity(url, byte[].class);
                    System.out.println("文件下载请求结果状态码：" + rsp.getStatusCode());

                    // 将下载下来的文件内容保存到本地
                    String filename = "客户用户表";
                    // 将下载下来的文件内容保存到本地
                    String targetPath = "path_xxx/"+filename+"_ProMenu.xlsx";
                    Files.write(Paths.get(targetPath), Objects.requireNonNull(rsp.getBody(),
                    "未获取到下载文件"));
                    */
            }

            @Test
            @Disabled
            public void testimportExcelForProMenuForWeb()  {
                /*
            	// 文件上传服务上传接口
                String url = CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/importExcel";
                // 待上传的文件（存在客户端本地磁盘）
                String filename = "客户用户表";
                // 将下载下来的文件内容保存到本地
                String targetPath = "path_xxx/"+filename+"_ProMenu.xlsx";
                // 封装请求参数
                FileSystemResource resource = new FileSystemResource(new File(targetPath));
                MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
                param.add("file", resource);  //服务端MultipartFile uploadFile
                //param.add("param1", "test");   //服务端如果接受额外参数，可以传递


                // 发送请求并输出结果
                System.out.println("--- 开始上传文件 ---");
                String result = template.postForObject(url, param, String.class);
                System.out.println("--- 访问地址：" + result);
                */
            }

    @Test
    @Disabled
    public void testHandleMenuForProMenuForWeb()  {
        try {
            File file = new File("E:\\tmp\\res.json");

            String jsonStr = readerMethod(file);
            if(StringUtils.isNotEmpty(jsonStr)) {
                List<Map<String,Object>> treedata = JSONArray.parseObject(jsonStr,List.class);

                Map<String, Object> menus = new HashMap<>();
                File file1 = new File("E:\\tmp\\menu.json");
                String json1Str = readerMethod(file1);
                if(StringUtils.isNotEmpty(json1Str)) {
                    menus = JSONObject.parseObject(json1Str, Map.class);
                }

                List<Map<String, Object>> list = handleTree(treedata, menus);
//                System.out.println(JSONObject.toJSONString(list));

                String url = HttpUtilsForm.WebconnectURL+CommonConst.WEB_REST_SERVICE_PREFICX+"promenu/insertBatch";
                String charset = HttpUtilsForm.UTF8;
                Map<String, Object> paramsbody = new HashMap<String, Object>();
                //设置 请求参数
                paramsbody.put("list",list);//用户Id
                try {
                    //括号里的是前台发送的url连接
                    String body = HttpUtilsForm.doPost(url, JSON.toJSONString(list), charset);
                    System.out.println(body);
                } catch (Exception e) {
                    e.printStackTrace();
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private static String readerMethod(File file) throws IOException {
        FileReader fileReader = new FileReader(file);
        Reader reader = new InputStreamReader(new FileInputStream(file), "Utf-8");
        int ch = 0;
        StringBuffer sb = new StringBuffer();
        while ((ch = reader.read()) != -1) {
            sb.append((char) ch);
        }
        fileReader.close();
        reader.close();
        String jsonStr = sb.toString();
        return jsonStr;
    }

    private static List<Map<String, Object>> handleTree(List<Map<String,Object>> treedata, Map<String, Object> menus) {
        String parentId = "0";

        List<Map<String, Object>> paramsdata = new ArrayList<Map<String, Object>>();

        List<Map<String, Object>> parenttreedata = new ArrayList<Map<String, Object>>();

        if (null != treedata && treedata.size() > 0) {

            //一级树节点
            for (Map<String, Object> tree : treedata) {
                tree.put("id", tree.get("id") + "");
                tree.put("parentId", tree.get("parentId") + "");
                tree.put("title", tree.get("text"));

                if (tree.get("parentId").equals(parentId)) {
                    tree.put("leaf", "1");
                    tree.put("leaftype", "1");
                    paramsdata.add(handleParams(tree, menus));
                    parenttreedata.add(tree);
                }
            }

            //二级树节点
            List<Map<String, Object>> second_treedata = new ArrayList<Map<String, Object>>();//二级树节点
            for (Map<String, Object> ptree : parenttreedata) {

                List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                for (Map<String, Object> tree : treedata) {
                    tree.put("id", tree.get("id") + "");
                    tree.put("parentId", tree.get("parentId") + "");
                    tree.put("title", tree.get("text"));

                    if (tree.get("parentId").equals(ptree.get("id"))) {
                        tree.put("newParentId", ptree.get("newId") + "");
                        tree.put("newLevelcode", ptree.get("newLevelcode") + "");
                        tree.put("leaf", "1");
                        tree.put("leaftype", "2");
                        ptree.put("leaf", "0");
                        handleLeaf(paramsdata, Convert.toStr(ptree.get("newId"), ""));
                        paramsdata.add(handleParams(tree, menus));
                        second_treedata.add(tree);
                        sontreedata.add(tree);
                    }
                }
                ptree.put("children", sontreedata);
            }

            List<Map<String, Object>> third_treedata = new ArrayList<Map<String, Object>>();//三级树节点
            List<Map<String, Object>> fourth_treedata = new ArrayList<Map<String, Object>>();//四级树节点
            List<Map<String, Object>> fifth_treedata = new ArrayList<Map<String, Object>>();//五级树节点
            List<Map<String, Object>> sixth_treedata = new ArrayList<Map<String, Object>>();//六级树节点

            //三级树节点
            for (Map<String, Object> ptree : second_treedata) {
                List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();

                for (Map<String, Object> tree : treedata) {
                    tree.put("id", tree.get("id") + "");
                    tree.put("parentId", tree.get("parentId") + "");
                    tree.put("title", tree.get("text"));
                    if (tree.get("parentId").equals(ptree.get("id"))) {
                        tree.put("newParentId", ptree.get("newId") + "");
                        tree.put("newLevelcode", ptree.get("newLevelcode") + "");
                        tree.put("leaf", "1");
                        tree.put("leaftype", "3");
                        ptree.put("leaf", "0");
                        handleLeaf(paramsdata, Convert.toStr(ptree.get("newId"), ""));

                        paramsdata.add(handleParams(tree, menus));
                        third_treedata.add(tree);
                        sontreedata.add(tree);
                    }
                }
                ptree.put("children", sontreedata);
            }

            //四级树节点
            for (Map<String, Object> ptree : third_treedata) {

                List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                for (Map<String, Object> tree : treedata) {
                    tree.put("id", tree.get("id") + "");
                    tree.put("parentId", tree.get("parentId") + "");
                    tree.put("title", tree.get("text"));
                    if (tree.get("parentId").equals(ptree.get("id"))) {
                        tree.put("newParentId", ptree.get("newId") + "");
                        tree.put("newLevelcode", ptree.get("newLevelcode") + "");
                        tree.put("leaf", "1");
                        tree.put("leaftype", "4");
                        ptree.put("leaf", "0");
                        handleLeaf(paramsdata, Convert.toStr(ptree.get("newId"), ""));

                        paramsdata.add(handleParams(tree, menus));
                        fourth_treedata.add(tree);
                        sontreedata.add(tree);
                    }
                }
                ptree.put("children", sontreedata);
            }

            //五级树节点
            for (Map<String, Object> ptree : fourth_treedata) {

                List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                for (Map<String, Object> tree : treedata) {
                    tree.put("id", tree.get("id") + "");
                    tree.put("parentId", tree.get("parentId") + "");
                    tree.put("title", tree.get("text"));
                    if (tree.get("parentId").equals(ptree.get("id"))) {
                        tree.put("newParentId", ptree.get("newId") + "");
                        tree.put("newLevelcode", ptree.get("newLevelcode") + "");
                        tree.put("leaf", "1");
                        tree.put("leaftype", "5");
                        ptree.put("leaf", "0");
                        handleLeaf(paramsdata, Convert.toStr(ptree.get("newId"), ""));

                        paramsdata.add(handleParams(tree, menus));
                        fifth_treedata.add(tree);
                        sontreedata.add(tree);
                    }
                }
                ptree.put("children", sontreedata);
            }

            //六级树节点
            for (Map<String, Object> ptree : fifth_treedata) {

                List<Map<String, Object>> sontreedata = new ArrayList<Map<String, Object>>();
                for (Map<String, Object> tree : treedata) {
                    tree.put("id", tree.get("id") + "");
                    tree.put("parentId", tree.get("parentId") + "");
                    tree.put("title", tree.get("text"));
                    if (tree.get("parentId").equals(ptree.get("id"))) {
                        tree.put("newParentId", ptree.get("newId") + "");
                        tree.put("newLevelcode", ptree.get("newLevelcode") + "");
                        tree.put("leaf", "1");
                        tree.put("leaftype", "6");
                        ptree.put("leaf", "0");
                        handleLeaf(paramsdata, Convert.toStr(ptree.get("newId"), ""));

                        paramsdata.add(handleParams(tree, menus));
                        sixth_treedata.add(tree);
                        sontreedata.add(tree);
                    }
                }
                ptree.put("children", sontreedata);
            }

        }
        return paramsdata;
    }

    private static Map<String, Object> handleParams(Map<String, Object> map, Map<String, Object> menus) {
        JSONObject meta = JSONObject.parseObject(JSONObject.toJSONString(map.get("meta")));

        String id = UUID.randomUUID().toString().replace("-", "");
        String newLevelcode = Convert.toStr(map.get("newLevelcode"), "000000000000");
        String newParentId = Convert.toStr(map.get("newParentId"), "000000000000");

        map.put("newLevelcode", newLevelcode + "/" + id);
        map.put("newId", id);
        map.put("newParentId", newParentId);

        Map<String, Object> params = new HashMap<String, Object>();
        String text = Convert.toStr(menus.get(meta.getString("title")), meta.getString("title"));

        //设置 请求参数
        params.put("recordid", id);//菜单Id
        params.put("id", id);//菜单编号
        params.put("text", text);//菜单名称
        params.put("alias", map.get("name"));//别名
        params.put("parentid", map.get("newParentId"));//父菜单ID
        params.put("module", null);//所属模块
        params.put("indexs", null);//位置
        params.put("icon", meta.getString("icon"));//图标
        params.put("remark", null);//备注
        params.put("sequences", "0");//顺序
        params.put("category_type",0);//链接类型 0=模块 1=外链
        params.put("action", 0);//操作按钮类型
        params.put("href", map.get("path"));//链接
        params.put("hreftarget", null);//弹出目标
        params.put("params", null);//参数
        params.put("target", "_blank");//打开方式 _self _blank
        params.put("is_navi",0);//导航 0=否 1=是
        params.put("enable",1);//是否可用
        params.put("valid",1);//是否有效
        params.put("leaf", map.get("leaf"));//是否叶子
        params.put("systemid","000000000001");//系统ID
        params.put("isframe", null);//是否frame
        params.put("levelcode", map.get("newLevelcode"));//层次码
        params.put("leaftype", map.get("leaftype"));//节点级别
        params.put("cls", null);//层叠样式
        params.put("component", map.get("component"));//前端动态组件路径
        params.put("i18n_name", meta.getString("title"));//菜单国际化
        params.put("redirect", map.get("redirect"));//重定向路由地址
        params.put("hideInMenu", "true".equals(meta.getString("show")) ? 0 : 1);//本节隐藏
        params.put("hideChildrenInMenu", "true".equals(meta.getString("hideChildren")) ? 0 : 1);//隐藏父节点的孩子
        params.put("hideLayout", null);//是否使用layout布局
        return params;
    }

    private static void handleLeaf(List<Map<String, Object>> paramsdata, String id) {
        for (Map<String, Object> paramsdatum : paramsdata) {
            if(id.equals(paramsdatum.get("id"))) {
                paramsdatum.put("leaf", "0");
            }
        }
    }

}
