package com.casic.PgInterface.rs;
/**
 * Created by yxw on 2018/3/20.
 */

import com.casic.PgInterface.devTable.dto.PgDeviceTypeStatisticDto;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
import com.casic.PgInterface.devTable.manager.PipeGalleryManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
@Path("pgStatistic")
public class pgStatisticRs{

    private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class);
    @Resource
    private PipeGalleryManager pipeGalleryManager;
    @Resource
    private PgDeviceManager pgDeviceManager;

    /*
    *获取管廊仓体长度统计
    */
    @POST
    @Path("getPgStatistic")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, Object> getPgStatistic()
            throws Exception {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        String msg = "";

        try {


            msg = "获取成功";
        } catch (Exception e) {
            msg = "获取失败";
            e.printStackTrace();
        }
        resultMap.put("msg", msg);
        //resultMap.put("result", );
        return resultMap;
    }
    /*
     *获取管廊仓体长度统计
     */
    @POST
    @Path("getPipeLineStatistic")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, Object> getPipeLineStatistic()
            throws Exception {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        String msg = "";


        try {


            msg = "获取成功";
        } catch (Exception e) {
            msg = "获取失败";
            e.printStackTrace();
        }
        resultMap.put("msg", msg);
        //resultMap.put("result", );
        return resultMap;
    }

    /*
     * 按照设备类型统计设备数量
     */
    @POST
    @Path("getDeviceStatistic")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, Object> getDeviceStatistic()
            throws Exception {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        String msg = "";
        List<PgDeviceTypeStatisticDto> pgDeviceTypeStatisticDtoList=new ArrayList<PgDeviceTypeStatisticDto>();

        try {
            pgDeviceTypeStatisticDtoList=pgDeviceManager.getDeviceStatisticByDevType();

            msg = "获取成功";
        } catch (Exception e) {
            msg = "获取失败";
            e.printStackTrace();
        }
        resultMap.put("msg", msg);
        resultMap.put("result", pgDeviceTypeStatisticDtoList);
        return resultMap;
    }


}