package com.ruoyi.interfaces.controller;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.interfaces.core.page.Page;
import com.ruoyi.interfaces.core.page.PageParam;
import com.ruoyi.interfaces.core.page.PageUtils;
import com.ruoyi.interfaces.domain.PtMap;
import com.ruoyi.interfaces.domain.PtMapFile;
import com.ruoyi.interfaces.domain.SysCate;
import com.ruoyi.interfaces.mapper.PtMapFileMapper;
import com.ruoyi.interfaces.mapper.PtMapMapper;
import com.ruoyi.interfaces.mapper.SysCateMapper;
import com.ruoyi.interfaces.service.SysCateService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import java.io.File;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/pt/map")
public class PtMapController extends BaseController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private PtMapMapper mapMapper;

    @Autowired
    private PtMapFileMapper ptMapFileMapper;

    @Autowired
    private SysCateService sysCateService;

    @Autowired
    private SysCateMapper sysCateMapper;

    @Value("${sys.map.upload.path}")
    private String uploadFilePath;

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");

    @ApiOperation("添加数据")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public AjaxResult insert(@RequestParam(name = "file", required = false) MultipartFile file, @RequestParam(name = "image", required = false) MultipartFile image, PtMap map) {

        // 上传缩略图
        if (image != null) {
            //第一步：写入文件
            String imageName = image.getOriginalFilename();
            String suffix = imageName.substring(imageName.lastIndexOf(".") + 1);
            String uuid = IdUtils.simpleUUID();
            try {
                String tmpPath = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
                String filePath = tmpPath + "/" + uuid + "." + suffix;

                //1、判断目录。如果目录不存在，则创建目录
                File dir = new File(uploadFilePath + filePath);
                if (!dir.exists()) {
                    dir.mkdirs();
                }

                //2、写入文件
                image.transferTo(new File(uploadFilePath + filePath));
                map.setThumb(imageName);// 缩略图名称
                // map.setMapUrl(filePath);// 缩略图地址
            } catch (Exception e) {
                logger.error(e.getLocalizedMessage(), e);
                return AjaxResult.error();
            }
        }

        // 图层表入库
        String code = IdUtils.simpleUUID();
        map.setMapId(code);
        map.setPubDate(new Date());
        map.setPubUserid("测试用户ID");
        map.setPubUsername("测试用户名");
        int ret = mapMapper.insert(map);

        // 上传文件
        if (file != null) {
            //第一步：写入文件
            String fileName = file.getOriginalFilename();
            String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
            String uuid = IdUtils.simpleUUID();
            try {
                String tmpPath = sdf.format(new Date());
                String filePath = uploadFilePath + tmpPath + "/" + uuid + "." + suffix;

                //1、判断目录。如果目录不存在，则创建目录
                File dir = new File(filePath);
                if (!dir.exists()) {
                    dir.mkdirs();
                }

                //2、写入文件
                file.transferTo(new File(filePath));

                // 3、写入数据库
                PtMapFile ptMapFile = new PtMapFile();
                ptMapFile.setFileId(IdUtils.simpleUUID());
                ptMapFile.setMapId(code);
                ptMapFile.setRelId(code);
                ptMapFile.setFileType(suffix);
                ptMapFile.setFilePath(filePath);
                ptMapFile.setFileSavename(uuid);
                ptMapFile.setFileViewname(fileName);
                ptMapFile.setFileTime(new Date());
                ptMapFileMapper.insert(ptMapFile);
            } catch (Exception e) {
                //在此处调用
                logger.error(e.getLocalizedMessage(), e);
                return AjaxResult.error();
            }
        }
        return AjaxResult.success();
    }

    @ApiOperation("数据列表")
    @RequestMapping(value = "/list")
    public Page getList(@RequestParam(required = false, defaultValue = "1") int page,
                        @RequestParam(required = false, defaultValue = "100") int rows, String mapCate, String name) {
        // PageInfo<RtuMessage>
        PtMap criteria = new PtMap();
        criteria.setMapCate(mapCate);
        criteria.setMapName(!(name != null && !"".equals(name)) ? null : "%" + name.trim() + "%");
        PageHelper.startPage(page, rows);
        PageHelper.orderBy("PUB_DATE desc");
        List<PtMap> list = mapMapper.selectAll(criteria);//dao.(criteria);//查询

        // 取分页信息
        PageInfo<PtMap> pageInfo = new PageInfo<PtMap>(list);

        return PageUtils.convert(pageInfo);
    }

    @ApiOperation("根据主键获取数据")
    @RequestMapping(value = "/get")
    public ModelAndView get(@RequestParam(required = true) String key) {
        ModelAndView mav = new ModelAndView();
        PtMap ptMap = mapMapper.selectByPrimaryKey(key);
        if (ptMap != null) {
            mav.addObject("ptMap", ptMap);
            mav.setViewName("mng/pt_map_edit");
        }
        PtMapFile ptMapFile = ptMapFileMapper.selectByMapId(key);
        if (ptMapFile != null) {
            mav.addObject("fileViewname", ptMapFile.getFileViewname());
            mav.addObject("fileId", ptMapFile.getFileId()); // 用于文件修改
        }
        return mav;
    }

    @ApiOperation("根据主键更新数据")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public AjaxResult update(@RequestParam(name = "file", required = false) MultipartFile file, @RequestParam(name = "image", required = false) MultipartFile image, PtMap map, String fileId) {
        // 上传缩略图
        if (image != null) {
            //第一步：写入文件
            String imageName = image.getOriginalFilename();
            String suffix = imageName.substring(imageName.lastIndexOf(".") + 1);
            String uuid = IdUtils.simpleUUID();
            try {
                String tmpPath = sdf.format(new Date());
                String filePath = tmpPath + "/" + uuid + "." + suffix;
                //1、判断目录。如果目录不存在，则创建目录
                File dir = new File(uploadFilePath + filePath);
                if (!dir.exists()) {
                    dir.mkdirs();
                }
                //2、写入文件
                image.transferTo(new File(uploadFilePath + filePath));
                map.setThumb(imageName);// 缩略图名称
                map.setMapUrl(filePath);// 缩略图地址
            } catch (Exception e) {
                //在此处调用
                logger.error(e.getLocalizedMessage(), e);
                return AjaxResult.error();
            }
        }
        // 修改主表
        map.setPubDate(new Date());
        int ret = mapMapper.updateByPrimaryKeySelective(map);
        // 上传文件
        if (file != null) {
            //第一步：写入文件
            String fileName = file.getOriginalFilename();
            String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
            String uuid = IdUtils.simpleUUID();
            try {
                String tmpPath = sdf.format(new Date());
                String filePath = uploadFilePath + tmpPath + "/" + uuid + "." + suffix;
                //1、判断目录。如果目录不存在，则创建目录
                File dir = new File(filePath);
                if (!dir.exists()) {
                    dir.mkdirs();
                }
                //2、写入文件
                file.transferTo(new File(filePath));
                // 3、写入数据库
                PtMapFile ptMapFile = new PtMapFile();
                ptMapFile.setFileId(fileId);
                ptMapFile.setFileType(suffix);
                ptMapFile.setFilePath(filePath);
                ptMapFile.setFileSavename(uuid);
                ptMapFile.setFileViewname(fileName);
                ptMapFile.setFileTime(new Date());
                if (fileId == null || "".equals(fileId)) {
                    ptMapFile.setFileId(IdUtils.simpleUUID());
                    ptMapFile.setMapId(map.getMapId());
                    ptMapFile.setRelId(map.getMapId());
                    ptMapFileMapper.insert(ptMapFile);
                } else {
                    ptMapFileMapper.updateByPrimaryKeySelective(ptMapFile);
                }
            } catch (Exception e) {
                //在此处调用
                logger.error(e.getLocalizedMessage(), e);
                return AjaxResult.error();
            }
        }
        return AjaxResult.success();
    }

    @ApiOperation("根据主键删除数据")
    @RequestMapping(value = "/delete", method = RequestMethod.GET)
    public AjaxResult delete(@RequestParam(required = true) String id) {
        int ret0 = ptMapFileMapper.deleteByPrimaryKey(id);
        int ret = mapMapper.deleteByPrimaryKey(id);
        return AjaxResult.success();
    }


    @ApiOperation("数据列表")
    @RequestMapping(value = "/cate_list", method = RequestMethod.GET)
    public List<SysCate> list(String tabName) {
        SysCate criteria = new SysCate();
        criteria.setCateTable(tabName);
        return sysCateService.findAllO(criteria);//.selectByCriteria(criteria);//查询
    }

    @ApiOperation("树数据列表")
    @PostMapping("/pageList")
    public Page pageList(PageParam<SysCate> sysCatePageParam) {
        return PageUtils.convert(sysCateService.pageList(sysCatePageParam));
    }


    public static List<PtMap> test2() {
        String str = "{\"message\":\"信息查询成功。\",\"nodeList\":[{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/THLY/wmts-china\",\"descInfo\":\"切片-太湖流域防洪工程示意图\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8090/iserver/services/THLY/wmts-china\",\"publishDt\":\"2018-06-21 15:56:47\",\"publishSystemId\":\"44\",\"publishSystemName\":\"防汛抗旱地理空间数据库\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"2102\",\"serviceName\":\"切片-太湖流域防洪工程示意图\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P001\",\"sjtypeName\":\"底图\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_BJ_M/wmts100\",\"descInfo\":\"太湖-边界-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_BJ_M/wmts100\",\"publishDt\":\"2018-05-25 12:48:45\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"2043\",\"serviceName\":\"太湖-边界-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P001\",\"sjtypeName\":\"底图\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_BJ/wmts100\",\"descInfo\":\"太湖-边界\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_BJ/wmts100\",\"publishDt\":\"2018-05-25 12:48:47\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"2040\",\"serviceName\":\"太湖-边界\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P001\",\"sjtypeName\":\"底图\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_BJ/wmts-china\",\"descInfo\":\"太湖-边界-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_BJ/wmts-china\",\"publishDt\":\"2018-05-25 12:48:49\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"2039\",\"serviceName\":\"太湖-边界-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P001\",\"sjtypeName\":\"底图\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_QYS/wmts-china\",\"descInfo\":\"太湖局-多要素图-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.181:8091/iserver/services/map-TH06_QYS/wmts-china\",\"publishDt\":\"2017-12-06 10:17:42\",\"publishSystemId\":\"44\",\"publishSystemName\":\"防汛抗旱地理空间数据库\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1898\",\"serviceName\":\"太湖局-多要素图-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P003\",\"sjtypeName\":\"其他\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_QYS/wmts100\",\"descInfo\":\"太湖局-多要素图\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.181:8091/iserver/services/map-TH06_QYS/wmts100\",\"publishDt\":\"2017-12-06 10:17:41\",\"publishSystemId\":\"44\",\"publishSystemName\":\"防汛抗旱地理空间数据库\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1859\",\"serviceName\":\"太湖局-多要素图\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P003\",\"sjtypeName\":\"其他\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_ADM_M/wmts-china\",\"descInfo\":\"太湖局-行政区划-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_ADM_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1851\",\"serviceName\":\"太湖局-行政区划-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P003\",\"sjtypeName\":\"其他\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STEV_M/wmts-china\",\"descInfo\":\"太湖局-墒情监测站-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STEV_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1850\",\"serviceName\":\"太湖局-墒情监测站-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_7_P\",\"sjtypeName\":\"墒情监测站\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_POLDER_M/wmts-china\",\"descInfo\":\"太湖局-圩垸-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_POLDER_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1849\",\"serviceName\":\"太湖局-圩垸-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_5_R\",\"sjtypeName\":\"圩垸\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STRVPR_M/wmts-china\",\"descInfo\":\"太湖局-跨河工程-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STRVPR_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1848\",\"serviceName\":\"太湖局-跨河工程-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_2_L\",\"sjtypeName\":\"跨河工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_GATE_M/wmts-china\",\"descInfo\":\"太湖局-水闸-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_GATE_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1847\",\"serviceName\":\"太湖局-水闸-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P203_L\",\"sjtypeName\":\"水闸工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_IRR_M/wmts-china\",\"descInfo\":\"太湖局-灌区-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_IRR_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1846\",\"serviceName\":\"太湖局-灌区-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P702_R\",\"sjtypeName\":\"灌区工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_PUMP_M/wmts-china\",\"descInfo\":\"太湖局-泵站-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_PUMP_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1845\",\"serviceName\":\"太湖局-泵站-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P204_P\",\"sjtypeName\":\"泵站工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_SDIK_M/wmts-china\",\"descInfo\":\"太湖局-海堤-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_SDIK_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1844\",\"serviceName\":\"太湖局-海堤-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P206_L\",\"sjtypeName\":\"堤防工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_DIKE_M/wmts-china\",\"descInfo\":\"太湖局-堤防-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_DIKE_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1843\",\"serviceName\":\"太湖局-堤防-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P206_L\",\"sjtypeName\":\"堤防工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_OBS_M/wmts-china\",\"descInfo\":\"太湖局-控制站-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_OBS_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1842\",\"serviceName\":\"太湖局-控制站-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P103_P\",\"sjtypeName\":\"控制站\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_RSWB_M/wmts-china\",\"descInfo\":\"太湖局-水库-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_RSWB_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1841\",\"serviceName\":\"太湖局-水库-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P002_1_L\",\"sjtypeName\":\"水库工程（大坝）\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_LAKE_M/wmts-china\",\"descInfo\":\"太湖局-湖泊-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_LAKE_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1840\",\"serviceName\":\"太湖局-湖泊-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P104_R\",\"sjtypeName\":\"湖泊\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_LINE_M/wmts-china\",\"descInfo\":\"太湖局-河流-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_LINE_M/wmts-china\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1839\",\"serviceName\":\"太湖局-河流-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_L\",\"sjtypeName\":\"河流\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_ADM_M/wmts100\",\"descInfo\":\"太湖局-行政区划-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_ADM_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1838\",\"serviceName\":\"太湖局-行政区划-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P003\",\"sjtypeName\":\"其他\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STEV_M/wmts100\",\"descInfo\":\"太湖局-墒情监测站-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STEV_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1837\",\"serviceName\":\"太湖局-墒情监测站-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_7_P\",\"sjtypeName\":\"墒情监测站\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_POLDER_M/wmts100\",\"descInfo\":\"太湖局-圩垸-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_POLDER_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1836\",\"serviceName\":\"太湖局-圩垸-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_5_R\",\"sjtypeName\":\"圩垸\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STRVPR_M/wmts100\",\"descInfo\":\"太湖局-跨河工程-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STRVPR_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1835\",\"serviceName\":\"太湖局-跨河工程-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_2_L\",\"sjtypeName\":\"跨河工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_GATE_M/wmts100\",\"descInfo\":\"太湖局-水闸-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_GATE_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1834\",\"serviceName\":\"太湖局-水闸-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P203_L\",\"sjtypeName\":\"水闸工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_IRR_M/wmts100\",\"descInfo\":\"太湖局-灌区-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_IRR_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1833\",\"serviceName\":\"太湖局-灌区-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P702_R\",\"sjtypeName\":\"灌区工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_PUMP_M/wmts100\",\"descInfo\":\"太湖局-泵站-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_PUMP_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1832\",\"serviceName\":\"太湖局-泵站-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P204_P\",\"sjtypeName\":\"泵站工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_SDIK_M/wmts100\",\"descInfo\":\"太湖局-海堤-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_SDIK_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1831\",\"serviceName\":\"太湖局-海堤-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P206_L\",\"sjtypeName\":\"堤防工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_DIKE_M/wmts100\",\"descInfo\":\"太湖局-堤防-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_DIKE_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1830\",\"serviceName\":\"太湖局-堤防-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P206_L\",\"sjtypeName\":\"堤防工程\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_OBS_M/wmts100\",\"descInfo\":\"太湖局-控制站-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_OBS_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1829\",\"serviceName\":\"太湖局-控制站-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P103_P\",\"sjtypeName\":\"控制站\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_RSWB_M/wmts100\",\"descInfo\":\"太湖局-水库-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_RSWB_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1828\",\"serviceName\":\"太湖局-水库-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P002_1_L\",\"sjtypeName\":\"水库工程（大坝）\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_LAKE_M/wmts100\",\"descInfo\":\"太湖局-湖泊-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_LAKE_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1827\",\"serviceName\":\"太湖局-湖泊-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P104_R\",\"sjtypeName\":\"湖泊\",\"userId\":\"smp\"},{\"areaCode\":\"SSS\",\"areaName\":\"水利部\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_LINE_M/wmts100\",\"descInfo\":\"太湖局-河流-墨卡托\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_LINE_M/wmts100\",\"publishDt\":\"2017-10-30 23:09:10\",\"publishSystemId\":\"104\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局综合信息服务系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1826\",\"serviceName\":\"太湖局-河流-墨卡托\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_L\",\"sjtypeName\":\"河流\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"1\",\"businessTypeName\":\"基础数据\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_ADM/wmts-china\",\"descInfo\":\"太湖局-行政区划-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_ADM/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1471\",\"serviceName\":\"太湖局-行政区划-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P003\",\"sjtypeName\":\"其他\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STEV/wmts-china\",\"descInfo\":\"太湖局-墒情监测站-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STEV/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1470\",\"serviceName\":\"太湖局-墒情监测站-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_7_P\",\"sjtypeName\":\"墒情监测站\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_POLDER/wmts-china\",\"descInfo\":\"太湖局-圩垸-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_POLDER/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1469\",\"serviceName\":\"太湖局-圩垸-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_5_R\",\"sjtypeName\":\"圩垸\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STRVPR/wmts-china\",\"descInfo\":\"太湖局-跨河工程-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STRVPR/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1468\",\"serviceName\":\"太湖局-跨河工程-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_2_L\",\"sjtypeName\":\"跨河工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_GATE/wmts-china\",\"descInfo\":\"太湖局-水闸-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_GATE/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1467\",\"serviceName\":\"太湖局-水闸-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P203_L\",\"sjtypeName\":\"水闸工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_IRR/wmts-china\",\"descInfo\":\"太湖局-灌区-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_IRR/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1466\",\"serviceName\":\"太湖局-灌区-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P702_R\",\"sjtypeName\":\"灌区工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_PUMP/wmts-china\",\"descInfo\":\"太湖局-泵站-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_PUMP/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1465\",\"serviceName\":\"太湖局-泵站-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P204_P\",\"sjtypeName\":\"泵站工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_SDIK/wmts-china\",\"descInfo\":\"太湖局-海堤-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_SDIK/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1464\",\"serviceName\":\"太湖局-海堤-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P206_L\",\"sjtypeName\":\"堤防工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_DIKE/wmts-china\",\"descInfo\":\"太湖局-堤防-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_DIKE/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1463\",\"serviceName\":\"太湖局-堤防-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P206_L\",\"sjtypeName\":\"堤防工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_OBS/wmts-china\",\"descInfo\":\"太湖局-控制站-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_OBS/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1462\",\"serviceName\":\"太湖局-控制站-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P103_P\",\"sjtypeName\":\"控制站\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_RSWB/wmts-china\",\"descInfo\":\"太湖局-水库-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_RSWB/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1461\",\"serviceName\":\"太湖局-水库-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P201_R\",\"sjtypeName\":\"水库工程（水体）\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_LAKE/wmts-china\",\"descInfo\":\"太湖局-湖泊-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_LAKE/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1460\",\"serviceName\":\"太湖局-湖泊-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P104_R\",\"sjtypeName\":\"湖泊\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_LINE/wmts-china\",\"descInfo\":\"太湖局-河流-china\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_LINE/wmts-china\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1459\",\"serviceName\":\"太湖局-河流-china\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_L\",\"sjtypeName\":\"河流\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"1\",\"businessTypeName\":\"基础数据\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_ADM/wmts100\",\"descInfo\":\"太湖局-行政区划\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_ADM/wmts100\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1458\",\"serviceName\":\"太湖局-行政区划\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P003\",\"sjtypeName\":\"其他\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STEV/wmts100\",\"descInfo\":\"太湖局-墒情监测站\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STEV/wmts100\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1457\",\"serviceName\":\"太湖局-墒情监测站\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_7_P\",\"sjtypeName\":\"墒情监测站\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_POLDER/wmts100\",\"descInfo\":\"太湖局-圩垸\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_POLDER/wmts100\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1456\",\"serviceName\":\"太湖局-圩垸\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_5_R\",\"sjtypeName\":\"圩垸\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"3\",\"businessTypeName\":\"防汛抗旱\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_STRVPR/wmts100\",\"descInfo\":\"太湖局-跨河工程\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_STRVPR/wmts100\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1455\",\"serviceName\":\"太湖局-跨河工程\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P101_2_L\",\"sjtypeName\":\"跨河工程\",\"userId\":\"smp\"},{\"areaCode\":\"B\",\"areaName\":\"太湖流域管理局\",\"businessType\":\"2\",\"businessTypeName\":\"水利工程\",\"checkStatus\":\"3\",\"checkStatusName\":\"审核通过\",\"delegationUrl\":\"http://10.1.7.87/iserver/services/map-TH06_GATE/wmts100\",\"descInfo\":\"太湖局-水闸\",\"isAggregate\":\"0\",\"originUrl\":\"http://10.1.7.85:8099/iserver/services/map-TH06_GATE/wmts100\",\"publishDt\":\"2017-06-07 11:21:33\",\"publishSystemId\":\"106\",\"publishSystemName\":\"国家防汛抗旱指挥系统二期太湖局洪灾评估系统\",\"runStatus\":\"1\",\"runStatusName\":\"运行\",\"serviceId\":\"1454\",\"serviceName\":\"太湖局-水闸\",\"serviceType\":\"5\",\"serviceTypeName\":\"OGC WMTS服务\",\"sjtype\":\"P203_L\",\"sjtypeName\":\"水闸工程\",\"userId\":\"smp\"}],\"responseSts\":0,\"totalCount\":\"58\",\"totalPage\":\"2\"}";
        JSONObject jsonObject = JSONObject.parseObject(str);
        JSONArray jsonArray = JSON.parseArray(jsonObject.getString("nodeList"));
        List<PtMap> list = new ArrayList<>();
        for (int i = 0; i < jsonArray.size(); i++) {
            PtMap ptMap = new PtMap();
            JSONObject map = JSONObject.parseObject(jsonArray.get(i).toString());

            ptMap.setMapCode(map.getString("serviceId"));
            ptMap.setMapName(map.getString("serviceName"));
            ptMap.setMapUrl(map.getString("originUrl"));
            ptMap.setMapNote(map.getString("descInfo"));
            ptMap.setMapSource(map.getString("publishSystemName"));

            // 图层表入库
            String code = IdUtils.simpleUUID();
            ptMap.setMapId(code);
            ptMap.setPubDate(new Date());
            ptMap.setPubUserid("测试用户ID");
            ptMap.setPubUsername("测试用户名");
            ptMap.setMapCate("3");
            ptMap.setMapCache("1");
            ptMap.setMapFormat("格式1");
            ptMap.setMapType("WMTS");
            list.add(ptMap);

        }
        return list;
    }

    @RequestMapping(value = "/test")
    public AjaxResult test() {
        List<PtMap> list = test2();
        int in = 0;
        for (PtMap ptMap : list) {
            in += mapMapper.insert(ptMap);
        }
        return in == list.size() ? AjaxResult.success("ok" + list.size()) : AjaxResult.error();
    }

    @GetMapping("/countNum")
    public AjaxResult countNum() {
        return AjaxResult.success(sysCateMapper.countNum(null));
    }
}
