package com.jay.monitor.data.server.services.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jay.monitor.data.core.utils.ResponseUtils;
import com.jay.monitor.data.server.enums.CommonEnums;
import com.jay.monitor.data.server.models.request.route.RouteDataRequest;
import com.jay.monitor.data.server.models.response.RouteDataResponse;
import com.jay.monitor.data.server.services.IRouteDataService;
import com.xiaoleilu.hutool.http.HttpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @describe ：Swagger 路由数据管理
 * @Author ： liukx
 * @time ： 2019/3/1 - 10:28
 */
@Service("swaggerRouteDataService")
public class SwaggerRouteDataServiceImpl implements IRouteDataService {

    private Logger loggger = LoggerFactory.getLogger(SwaggerRouteDataServiceImpl.class);

    @Value("${swagger2.docUrl}")
    private String swaggerUrl = "/v2/api-docs";

    @Override
    public List<RouteDataResponse> getData(RouteDataRequest routeDataRequest) {
        String responseData = getRouteData(routeDataRequest);
        return analysisData(responseData);
    }

    private String getRouteData(RouteDataRequest routeDataRequest) {
        String url = routeDataRequest.getUrl();
        String projectName = routeDataRequest.getProjectName();
        ResponseUtils.checkParamNull(url, "url");
        ResponseUtils.checkParamNull(projectName, "projectName");
        String docUrl = url + swaggerUrl;

        String responseData = HttpUtil.get(docUrl);

        ResponseUtils.checkNull(responseData, CommonEnums.ROUTE_REQUEST_URL_ERROR);
        return responseData;
    }

    private List<RouteDataResponse> analysisData(String responseData) {
        JSONObject jsonObject = JSON.parseObject(responseData);
        JSONObject paths = jsonObject.getJSONObject("paths");

        List<RouteDataResponse> routeDataResponses = new ArrayList<>();
        if (ObjectUtils.isEmpty(paths)) {
            return routeDataResponses;
        }

        for (String routeUrl : paths.keySet()) {
            RouteDataResponse response = new RouteDataResponse();
            response.setUrl(routeUrl);
            JSONObject urlObject = paths.getJSONObject(routeUrl);
            for (String method : urlObject.keySet()) {
                response.setMethod(method);
                JSONObject methodObject = urlObject.getJSONObject(method);
                String operationId = methodObject.getString("operationId");
                if (!StringUtils.isEmpty(operationId) && operationId.indexOf("_") > 0) {
                    operationId = operationId.split("_")[0];
                }
                String description = methodObject.getString("description");
                String consumes = methodObject.getString("consumes");
                String produces = methodObject.getString("produces");
                String tags = methodObject.getString("tags");
                response.setAuthor(operationId);
                response.setRemark(description);
                response.setProduces(produces);
                response.setConsumes(consumes);
                response.setModule(tags);
            }
            routeDataResponses.add(response);
        }

        return routeDataResponses;
    }


    public static void main(String[] args) {
        String json = "{\"swagger\":\"2.0\",\"info\":{\"description\":\"物料管理\",\"version\":\"http://127.0.0.1:5306/doc.html\",\"title\":\"materiel\",\"termsOfService\":\"http://www.elab-plus.com\",\"license\":{\"url\":\"1.0.0\"}},\"host\":\"192.168.0.16:5555\",\"basePath\":\"/elab-marketing-materiel/\",\"tags\":[{\"name\":\"中介分享物料管理微服务\",\"description\":\"中介分享物料管理微服务\"},{\"name\":\"顾问推送物料微服务\",\"description\":\"顾问推送物料微服务\"}],\"paths\":{\"/materielPush/delete\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"删除推送物料\",\"description\":\"删除推送物料\",\"operationId\":\"duh\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielPushDeleteRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielPush/detail\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"查询推送物料\",\"description\":\"查询推送物料\",\"operationId\":\"duh_1\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"s\",\"description\":\"s\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/单个对象处理«MaterielPushResponseModule»\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielPush/insert\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"新增推送物料\",\"description\":\"新增推送物料\",\"operationId\":\"duh_2\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielPushAddRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielPush/list\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"推送物料列表\",\"description\":\"推送物料列表\",\"operationId\":\"duh_3\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielPushListRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/列表公共出参«MaterielPushResponse»\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielPush/pageList\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"推送物料分页列表\",\"description\":\"推送物料分页列表\",\"operationId\":\"duh_4\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielPushListRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/分页公共出参«MaterielPushResponseModule»\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielPush/update\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"修改推送物料\",\"description\":\"修改推送物料\",\"operationId\":\"duh_5\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielPushUpdateRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielPush/uploadAndInsert\":{\"post\":{\"tags\":[\"顾问推送物料微服务\"],\"summary\":\"上传并新增推送物料\",\"description\":\"上传并新增推送物料\",\"operationId\":\"duh_6\",\"consumes\":[\"multipart/form-data\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"name\":\"file\",\"in\":\"formData\",\"description\":\"file\",\"required\":false,\"type\":\"file\"},{\"name\":\"houseId\",\"in\":\"query\",\"description\":\"houseId\",\"required\":false,\"type\":\"integer\",\"format\":\"int32\"}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielShare/delete\":{\"post\":{\"tags\":[\"中介分享物料管理微服务\"],\"summary\":\"删除分享物料\",\"description\":\"删除分享物料\",\"operationId\":\"duh_7\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielShareDeleteRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielShare/detail\":{\"post\":{\"tags\":[\"中介分享物料管理微服务\"],\"summary\":\"查询分享物料\",\"description\":\"查询分享物料\",\"operationId\":\"duh_8\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"id\",\"description\":\"id\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/单个对象处理«MaterielShareDetailResponse»\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielShare/insert\":{\"post\":{\"tags\":[\"中介分享物料管理微服务\"],\"summary\":\"新增分享物料\",\"description\":\"新增分享物料\",\"operationId\":\"duh_9\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielShareAddRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielShare/pageList\":{\"post\":{\"tags\":[\"中介分享物料管理微服务\"],\"summary\":\"分享物料列表\",\"description\":\"分享物料列表\",\"operationId\":\"duh_10\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielSharePageRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/分页公共出参«MaterielShareDetailResponse»\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}},\"/materielShare/update\":{\"post\":{\"tags\":[\"中介分享物料管理微服务\"],\"summary\":\"修改分享物料\",\"description\":\"修改分享物料\",\"operationId\":\"duh_11\",\"consumes\":[\"application/json\"],\"produces\":[\"application/json;charset=UTF-8\"],\"parameters\":[{\"in\":\"body\",\"name\":\"request\",\"description\":\"request\",\"required\":true,\"schema\":{\"$ref\":\"#/definitions/MaterielShareUpdateRequest\"}}],\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"$ref\":\"#/definitions/公共返回实体\"}},\"201\":{\"description\":\"Created\"},\"401\":{\"description\":\"Unauthorized\"},\"403\":{\"description\":\"Forbidden\"},\"404\":{\"description\":\"Not Found\"}}}}},\"definitions\":{\"MaterielPushAddRequest\":{\"type\":\"object\",\"required\":[\"addressUrl\",\"houseId\",\"orderNo\",\"pushType\",\"status\",\"suffix\",\"title\"],\"properties\":{\"addressUrl\":{\"type\":\"string\",\"example\":\"www.elab.com\",\"description\":\"跳转url\",\"allowEmptyValue\":false},\"category\":{\"type\":\"string\",\"example\":1,\"description\":\"物料类别\",\"allowEmptyValue\":false},\"creator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"创建人\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"orderNo\":{\"type\":\"string\",\"example\":1,\"description\":\"排序号，仅限数字\",\"allowEmptyValue\":false},\"pushType\":{\"type\":\"string\",\"example\":4,\"description\":\"推送类型：0-H5链接，1-视频，2-图片，3-此时此刻，4-PDF\",\"allowEmptyValue\":false},\"remark\":{\"type\":\"string\",\"example\":\"这是描述\",\"description\":\"描述\",\"allowEmptyValue\":false},\"status\":{\"type\":\"string\",\"example\":1,\"description\":\"状态1有效-1无效\",\"allowEmptyValue\":false},\"suffix\":{\"type\":\"string\",\"example\":\".png\",\"description\":\"格式 jpg，gif,pdf，doc，docx，xls,mp3等上传物料文件格式\",\"allowEmptyValue\":false},\"title\":{\"type\":\"string\",\"example\":\"这是推送物料\",\"description\":\"标题\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"修改人\",\"allowEmptyValue\":false},\"videoImageUrl\":{\"type\":\"string\",\"example\":\"sldjfoewo.png\",\"description\":\"图片视频url\",\"allowEmptyValue\":false}},\"title\":\"MaterielPushAddRequest\",\"description\":\"添加推送物料请求体\"},\"MaterielPushDeleteRequest\":{\"type\":\"object\",\"required\":[\"id\"],\"properties\":{\"id\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"id\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"修改人\",\"allowEmptyValue\":false}},\"title\":\"MaterielPushDeleteRequest\",\"description\":\"删除推送物料请求体\"},\"MaterielPushListRequest\":{\"type\":\"object\",\"properties\":{\"appVersion\":{\"type\":\"string\",\"description\":\"版本号\",\"allowEmptyValue\":false},\"authToken\":{\"type\":\"string\",\"description\":\"token\",\"allowEmptyValue\":false},\"environment\":{\"type\":\"string\",\"example\":\"(1：ios，2：安卓，3：小程序，4：h5)\",\"description\":\"调用方系统类型\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"pageNo\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"分页参数-当前页码\",\"allowEmptyValue\":false},\"pageSize\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":20,\"description\":\"分页参数-分页大小\",\"allowEmptyValue\":false},\"uid\":{\"type\":\"string\",\"description\":\"设备ID\",\"allowEmptyValue\":false}},\"title\":\"MaterielPushListRequest\",\"description\":\"推送物料列表请求体\"},\"MaterielPushResponse\":{\"type\":\"object\",\"properties\":{\"catalogName\":{\"type\":\"string\",\"description\":\"标签名称\",\"allowEmptyValue\":false},\"materielList\":{\"type\":\"array\",\"description\":\"物料信息\",\"allowEmptyValue\":false,\"items\":{\"$ref\":\"#/definitions/MaterielPushResponseModule\"}}},\"title\":\"MaterielPushResponse\",\"description\":\"推送物料响应体\"},\"MaterielPushResponseModule\":{\"type\":\"object\",\"properties\":{\"addressUrl\":{\"type\":\"string\",\"description\":\"跳转url\",\"allowEmptyValue\":false},\"category\":{\"type\":\"string\",\"description\":\"物料类别\",\"allowEmptyValue\":false},\"created\":{\"type\":\"string\",\"description\":\"创建时间\",\"allowEmptyValue\":false},\"creator\":{\"type\":\"string\",\"description\":\"创建人\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"string\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"id\",\"allowEmptyValue\":false},\"orderNo\":{\"type\":\"string\",\"description\":\"排序号，仅限数字\",\"allowEmptyValue\":false},\"pushType\":{\"type\":\"string\",\"description\":\"推送类型：0-H5链接，1-视频，2-图片，3-此时此刻，4-PDF\",\"allowEmptyValue\":false},\"remark\":{\"type\":\"string\",\"description\":\"描述\",\"allowEmptyValue\":false},\"status\":{\"type\":\"string\",\"description\":\"状态1有效-1无效\",\"allowEmptyValue\":false},\"suffix\":{\"type\":\"string\",\"description\":\"格式 jpg，gif,pdf，doc，docx，xls,mp3等上传物料文件格式\",\"allowEmptyValue\":false},\"title\":{\"type\":\"string\",\"description\":\"标题\",\"allowEmptyValue\":false},\"updated\":{\"type\":\"string\",\"description\":\"修改时间\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"description\":\"修改人\",\"allowEmptyValue\":false},\"videoImageUrl\":{\"type\":\"string\",\"description\":\"图片视频url\",\"allowEmptyValue\":false}},\"title\":\"MaterielPushResponseModule\",\"description\":\"推送物料信息表实体\"},\"MaterielPushUpdateRequest\":{\"type\":\"object\",\"required\":[\"id\"],\"properties\":{\"addressUrl\":{\"type\":\"string\",\"example\":\"www.elab.com\",\"description\":\"跳转url\",\"allowEmptyValue\":false},\"category\":{\"type\":\"string\",\"description\":\"物料类别\",\"allowEmptyValue\":false},\"creator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"创建人\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"id\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"id\",\"allowEmptyValue\":false},\"orderNo\":{\"type\":\"string\",\"example\":1,\"description\":\"排序号，仅限数字\",\"allowEmptyValue\":false},\"pushType\":{\"type\":\"string\",\"example\":4,\"description\":\"推送类型：0-H5链接，1-视频，2-图片，3-此时此刻，4-PDF\",\"allowEmptyValue\":false},\"remark\":{\"type\":\"string\",\"example\":\"这是描述\",\"description\":\"描述\",\"allowEmptyValue\":false},\"status\":{\"type\":\"string\",\"example\":1,\"description\":\"状态1有效-1无效\",\"allowEmptyValue\":false},\"suffix\":{\"type\":\"string\",\"description\":\"格式 jpg，gif,pdf，doc，docx，xls,mp3等上传物料文件格式\",\"allowEmptyValue\":false},\"title\":{\"type\":\"string\",\"example\":\"这是推送物料\",\"description\":\"标题\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"修改人\",\"allowEmptyValue\":false},\"videoImageUrl\":{\"type\":\"string\",\"example\":\"sldjfoewo.png\",\"description\":\"图片视频url\",\"allowEmptyValue\":false}},\"title\":\"MaterielPushUpdateRequest\",\"description\":\"添加推送物料请求体\"},\"MaterielShareAddRequest\":{\"type\":\"object\",\"required\":[\"coverMap\",\"houseId\",\"materielRul\",\"shareIcon\",\"sortNo\",\"status\",\"title\"],\"properties\":{\"coverMap\":{\"type\":\"string\",\"example\":\"www.joi.png\",\"description\":\"物料封面图\",\"allowEmptyValue\":false},\"creator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"创建人\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"materielRul\":{\"type\":\"string\",\"example\":\"WWW.WULIAO.URL\",\"description\":\"物料地址\",\"allowEmptyValue\":false},\"remark\":{\"type\":\"string\",\"example\":\"描述\",\"description\":\"描述\",\"allowEmptyValue\":false},\"shareIcon\":{\"type\":\"string\",\"example\":\"fwewf.png\",\"description\":\"分享图标\",\"allowEmptyValue\":false},\"shareRemark\":{\"type\":\"string\",\"description\":\"分享描述\",\"allowEmptyValue\":false},\"sortNo\":{\"type\":\"string\",\"example\":1,\"description\":\"排序号\",\"allowEmptyValue\":false},\"status\":{\"type\":\"string\",\"example\":1,\"description\":\"状态1有效-1无效\",\"allowEmptyValue\":false},\"tags\":{\"type\":\"array\",\"description\":\"物料标签\",\"allowEmptyValue\":false,\"items\":{\"type\":\"string\"}},\"title\":{\"type\":\"string\",\"example\":\"这是标题\",\"description\":\"标题\",\"allowEmptyValue\":false}},\"title\":\"MaterielShareAddRequest\",\"description\":\"添加分享物料请求\"},\"MaterielShareDeleteRequest\":{\"type\":\"object\",\"required\":[\"id\"],\"properties\":{\"id\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"id\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"修改人\",\"allowEmptyValue\":false}},\"title\":\"MaterielShareDeleteRequest\",\"description\":\"删除分享物料请求体\"},\"MaterielShareDetailResponse\":{\"type\":\"object\",\"properties\":{\"coverMap\":{\"type\":\"string\",\"description\":\"物料封面图\",\"allowEmptyValue\":false},\"created\":{\"type\":\"string\",\"description\":\"创建时间\",\"allowEmptyValue\":false},\"creator\":{\"type\":\"string\",\"description\":\"创建人\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"string\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"id\",\"allowEmptyValue\":false},\"materielRul\":{\"type\":\"string\",\"description\":\"物料地址\",\"allowEmptyValue\":false},\"remark\":{\"type\":\"string\",\"description\":\"描述\",\"allowEmptyValue\":false},\"shareIcon\":{\"type\":\"string\",\"description\":\"分享图标\",\"allowEmptyValue\":false},\"shareRemark\":{\"type\":\"string\",\"description\":\"分享描述\",\"allowEmptyValue\":false},\"shareTimes\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"分享次数\",\"allowEmptyValue\":false},\"shareUrl\":{\"type\":\"string\",\"description\":\"分享链接地址\",\"allowEmptyValue\":false},\"sortNo\":{\"type\":\"string\",\"description\":\"排序号\",\"allowEmptyValue\":false},\"status\":{\"type\":\"string\",\"description\":\"状态1有效-1无效\",\"allowEmptyValue\":false},\"tagNames\":{\"type\":\"array\",\"description\":\"标签名称\",\"allowEmptyValue\":false,\"items\":{\"type\":\"string\"}},\"title\":{\"type\":\"string\",\"description\":\"标题\",\"allowEmptyValue\":false},\"updated\":{\"type\":\"string\",\"description\":\"修改时间\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"description\":\"修改人\",\"allowEmptyValue\":false},\"viewTimes\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"浏览次数\",\"allowEmptyValue\":false}},\"title\":\"MaterielShareDetailResponse\",\"description\":\"分享物料响应体\"},\"MaterielSharePageRequest\":{\"type\":\"object\",\"properties\":{\"appVersion\":{\"type\":\"string\",\"description\":\"版本号\",\"allowEmptyValue\":false},\"authToken\":{\"type\":\"string\",\"description\":\"token\",\"allowEmptyValue\":false},\"environment\":{\"type\":\"string\",\"example\":\"(1：ios，2：安卓，3：小程序，4：h5)\",\"description\":\"调用方系统类型\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"pageNo\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"分页参数-当前页码\",\"allowEmptyValue\":false},\"pageSize\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":20,\"description\":\"分页参数-分页大小\",\"allowEmptyValue\":false},\"uid\":{\"type\":\"string\",\"description\":\"设备ID\",\"allowEmptyValue\":false}},\"title\":\"MaterielSharePageRequest\",\"description\":\"分享物料分页列表请求\"},\"MaterielShareUpdateRequest\":{\"type\":\"object\",\"required\":[\"id\"],\"properties\":{\"coverMap\":{\"type\":\"string\",\"example\":\"dfew.png\",\"description\":\"物料封面图\",\"allowEmptyValue\":false},\"houseId\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"项目id\",\"allowEmptyValue\":false},\"id\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"id\",\"allowEmptyValue\":false},\"materielRul\":{\"type\":\"string\",\"example\":\"WWW.WULIAO.URL\",\"description\":\"物料地址\",\"allowEmptyValue\":false},\"remark\":{\"type\":\"string\",\"example\":\"sdfwewef\",\"description\":\"描述\",\"allowEmptyValue\":false},\"shareIcon\":{\"type\":\"string\",\"example\":\"sfewf.png\",\"description\":\"分享图标\",\"allowEmptyValue\":false},\"shareRemark\":{\"type\":\"string\",\"example\":\"分享描述\",\"description\":\"分享描述\",\"allowEmptyValue\":false},\"sortNo\":{\"type\":\"string\",\"example\":1,\"description\":\"排序号\",\"allowEmptyValue\":false},\"status\":{\"type\":\"string\",\"example\":1,\"description\":\"状态1有效-1无效\",\"allowEmptyValue\":false},\"tags\":{\"type\":\"array\",\"description\":\"物料标签\",\"allowEmptyValue\":false,\"items\":{\"type\":\"string\"}},\"title\":{\"type\":\"string\",\"example\":\"这是标题\",\"description\":\"标题\",\"allowEmptyValue\":false},\"updator\":{\"type\":\"string\",\"example\":\"admin\",\"description\":\"修改人\",\"allowEmptyValue\":false}},\"title\":\"MaterielShareUpdateRequest\"},\"公共返回实体\":{\"type\":\"object\",\"properties\":{\"errorCode\":{\"type\":\"string\",\"description\":\"错误码\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"返回编号\",\"allowEmptyValue\":false},\"logId\":{\"type\":\"string\",\"description\":\"日志编号\",\"allowEmptyValue\":false},\"message\":{\"type\":\"string\",\"description\":\"返回消息内容\",\"allowEmptyValue\":false},\"success\":{\"type\":\"boolean\",\"example\":false,\"description\":\"是否调用成功\",\"allowEmptyValue\":false}},\"title\":\"公共返回实体\"},\"分页公共出参«MaterielPushResponseModule»\":{\"type\":\"object\",\"properties\":{\"errorCode\":{\"type\":\"string\",\"description\":\"错误码\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"返回编号\",\"allowEmptyValue\":false},\"logId\":{\"type\":\"string\",\"description\":\"日志编号\",\"allowEmptyValue\":false},\"message\":{\"type\":\"string\",\"description\":\"返回消息内容\",\"allowEmptyValue\":false},\"pageModel\":{\"description\":\"分页出参\",\"allowEmptyValue\":false,\"$ref\":\"#/definitions/分页对象«MaterielPushResponseModule»\"},\"success\":{\"type\":\"boolean\",\"example\":false,\"description\":\"是否调用成功\",\"allowEmptyValue\":false}},\"title\":\"分页公共出参«MaterielPushResponseModule»\"},\"分页公共出参«MaterielShareDetailResponse»\":{\"type\":\"object\",\"properties\":{\"errorCode\":{\"type\":\"string\",\"description\":\"错误码\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"返回编号\",\"allowEmptyValue\":false},\"logId\":{\"type\":\"string\",\"description\":\"日志编号\",\"allowEmptyValue\":false},\"message\":{\"type\":\"string\",\"description\":\"返回消息内容\",\"allowEmptyValue\":false},\"pageModel\":{\"description\":\"分页出参\",\"allowEmptyValue\":false,\"$ref\":\"#/definitions/分页对象«MaterielShareDetailResponse»\"},\"success\":{\"type\":\"boolean\",\"example\":false,\"description\":\"是否调用成功\",\"allowEmptyValue\":false}},\"title\":\"分页公共出参«MaterielShareDetailResponse»\"},\"分页对象«MaterielPushResponseModule»\":{\"type\":\"object\",\"properties\":{\"beginIndex\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"数据开始下标\",\"allowEmptyValue\":false},\"count\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"当前页码\",\"allowEmptyValue\":false},\"endIndex\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"数据结束下标\",\"allowEmptyValue\":false},\"orderby\":{\"type\":\"string\",\"description\":\"排序字段\",\"allowEmptyValue\":false},\"pageSize\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"每页数据大小\",\"allowEmptyValue\":false},\"resultSet\":{\"type\":\"array\",\"description\":\"数据结果集合\",\"allowEmptyValue\":false,\"items\":{\"$ref\":\"#/definitions/MaterielPushResponseModule\"}},\"rowTotal\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"总行数\",\"allowEmptyValue\":false},\"total\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"总大小\",\"allowEmptyValue\":false},\"totalRow\":{\"type\":\"integer\",\"format\":\"int32\"}},\"title\":\"分页对象«MaterielPushResponseModule»\"},\"分页对象«MaterielShareDetailResponse»\":{\"type\":\"object\",\"properties\":{\"beginIndex\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"数据开始下标\",\"allowEmptyValue\":false},\"count\":{\"type\":\"integer\",\"format\":\"int32\",\"example\":1,\"description\":\"当前页码\",\"allowEmptyValue\":false},\"endIndex\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"数据结束下标\",\"allowEmptyValue\":false},\"orderby\":{\"type\":\"string\",\"description\":\"排序字段\",\"allowEmptyValue\":false},\"pageSize\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"每页数据大小\",\"allowEmptyValue\":false},\"resultSet\":{\"type\":\"array\",\"description\":\"数据结果集合\",\"allowEmptyValue\":false,\"items\":{\"$ref\":\"#/definitions/MaterielShareDetailResponse\"}},\"rowTotal\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"总行数\",\"allowEmptyValue\":false},\"total\":{\"type\":\"integer\",\"format\":\"int32\",\"description\":\"总大小\",\"allowEmptyValue\":false},\"totalRow\":{\"type\":\"integer\",\"format\":\"int32\"}},\"title\":\"分页对象«MaterielShareDetailResponse»\"},\"列表公共出参«MaterielPushResponse»\":{\"type\":\"object\",\"properties\":{\"errorCode\":{\"type\":\"string\",\"description\":\"错误码\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"返回编号\",\"allowEmptyValue\":false},\"list\":{\"type\":\"array\",\"description\":\"列表出参\",\"allowEmptyValue\":false,\"items\":{\"$ref\":\"#/definitions/MaterielPushResponse\"}},\"logId\":{\"type\":\"string\",\"description\":\"日志编号\",\"allowEmptyValue\":false},\"message\":{\"type\":\"string\",\"description\":\"返回消息内容\",\"allowEmptyValue\":false},\"success\":{\"type\":\"boolean\",\"example\":false,\"description\":\"是否调用成功\",\"allowEmptyValue\":false}},\"title\":\"列表公共出参«MaterielPushResponse»\"},\"单个对象处理«MaterielPushResponseModule»\":{\"type\":\"object\",\"properties\":{\"errorCode\":{\"type\":\"string\",\"description\":\"错误码\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"返回编号\",\"allowEmptyValue\":false},\"logId\":{\"type\":\"string\",\"description\":\"日志编号\",\"allowEmptyValue\":false},\"message\":{\"type\":\"string\",\"description\":\"返回消息内容\",\"allowEmptyValue\":false},\"single\":{\"description\":\"单个对象参数\",\"allowEmptyValue\":false,\"$ref\":\"#/definitions/MaterielPushResponseModule\"},\"success\":{\"type\":\"boolean\",\"example\":false,\"description\":\"是否调用成功\",\"allowEmptyValue\":false}},\"title\":\"单个对象处理«MaterielPushResponseModule»\"},\"单个对象处理«MaterielShareDetailResponse»\":{\"type\":\"object\",\"properties\":{\"errorCode\":{\"type\":\"string\",\"description\":\"错误码\",\"allowEmptyValue\":false},\"id\":{\"type\":\"string\",\"description\":\"返回编号\",\"allowEmptyValue\":false},\"logId\":{\"type\":\"string\",\"description\":\"日志编号\",\"allowEmptyValue\":false},\"message\":{\"type\":\"string\",\"description\":\"返回消息内容\",\"allowEmptyValue\":false},\"single\":{\"description\":\"单个对象参数\",\"allowEmptyValue\":false,\"$ref\":\"#/definitions/MaterielShareDetailResponse\"},\"success\":{\"type\":\"boolean\",\"example\":false,\"description\":\"是否调用成功\",\"allowEmptyValue\":false}},\"title\":\"单个对象处理«MaterielShareDetailResponse»\"}}}";

        JSONObject jsonObject = JSON.parseObject(json);
        JSONObject paths = jsonObject.getJSONObject("paths");

        List<RouteDataResponse> routeDataResponses = new ArrayList<>();

        System.out.println(JSON.toJSONString(routeDataResponses));

    }
}
