package com.zcloud.modules.map.controller;

import com.zcloud.modules.map.service.MapService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.*;

/**
 * 说明：实时地图
 * 官网：www.zcloudchina.com
 */
@Controller
@RequestMapping("/map/map")
public class MapController  {

    @Autowired
    private MapService mapService;


    /**
     * 查询闸机及摄像头数
     * @return
     * @throws Exception
     */
    @RequestMapping(value="/listMapSluiceCount")
    public Object listMapSluiceCount() throws Exception{
        return mapService.listMapSluiceCount();
    }


    /**获取工单信息
     * @throws Exception
     */
    @RequestMapping(value="/getAreaDetail")
    public Object getAreaDetail(@RequestBody Map<String, Object> params) throws Exception {
        Map<String, Object> map = new HashMap<>();
        map.put("result","error");
        String pageNum = "";
        String pageSize = "";
        String str = "";
        String type = "";
        if(StringUtils.isEmpty(params.get("pageNum").toString())){
            map.put("msg","缺少必填参数pageNum");
            return map;
        }else if(StringUtils.isEmpty(params.get("pageSize").toString())){
            map.put("msg","缺少必填参数pageSize");
            return map;
        }
        pageNum = params.get("pageNum").toString();
        pageSize = params.get("pageSize").toString();
        return mapService.getAreaDetail(pageNum, pageSize, type, str);
    }

}
