package com.tofly.xrtygis.custom.service.impl;

import com.tofly.xrtygis.custom.mapper.WaterMakingAnalysisMapper;
import com.tofly.xrtygis.custom.service.BigScreenService;
import com.tofly.xrtygis.custom.service.WaterMakingAnalysisService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 制水趋势分析
 *
 * @author 20126
 */

@Service
@AllArgsConstructor
public class WaterMakingAnalysisServiceImpl implements WaterMakingAnalysisService {

    private final BigScreenService bigScreenService;
    private final WaterMakingAnalysisMapper waterMakingAnalysisMapper;

    /**
     * 获取产销差
     *
     * @return map
     */
    @Override
    public Map<String, Object> getNrw(String years) {

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

        returnMap.put("monthNrw", waterMakingAnalysisMapper.monthNrw(years));
        returnMap.put("yearNrwPlan", waterMakingAnalysisMapper.yearNrwPlan(years));
        returnMap.put("yearNrw", waterMakingAnalysisMapper.yearNrw(years));


        return returnMap;
    }

    /**
     * 查看更多产销差信息
     *
     * @param year 年份
     * @param code 0，按月查看   1，季度查看  2 近三年查看
     * @return map
     */
    @Override
    public Map<String, Object> nrwMore(String year, Integer code) {
        return bigScreenService.nrwMore(year, code);
    }

    /**
     * 获取漏损率
     *
     * @return map
     */
    @Override
    public Map<String, Object> getLeakage(String years) {


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


        returnMap.put("monthLeakage", waterMakingAnalysisMapper.monthLeakage(years));
        returnMap.put("yearLeakage", waterMakingAnalysisMapper.yearLeakage(years));
        returnMap.put("yearLeakagePlan", waterMakingAnalysisMapper.yearLeakagePlan(years));


        return returnMap;
    }

    /**
     * 查看更多漏损率信息
     *
     * @param year 年份
     * @param code 0，按月查看   1，季度查看  2 近三年查看
     * @return map
     */
    @Override
    public Map<String, Object> leakageMore(String year, Integer code) {
        return bigScreenService.leakageMore(year, code);
    }

    /**
     * 获取供水量和售水量
     *
     * @return map
     */
    @Override
    public Map<String, Object> getSupSellWater(String years) {

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


        returnMap.put("monSupSellWater", waterMakingAnalysisMapper.monSupSellWater(years));
        returnMap.put("monSupSellWaterPlan", waterMakingAnalysisMapper.monSupSellWaterPlan(years));
        returnMap.put("yearSupSellWater", waterMakingAnalysisMapper.yearSupSellWater(years));
        returnMap.put("yearSupSellWaterPlan", waterMakingAnalysisMapper.yearSupSellWaterPlan(years));

        return returnMap;
    }

    /**
     * 查看供水量和售水量更多信息
     *
     * @param year 年份
     * @param code 0，按月查看   1，季度查看  2 近三年查看
     * @return map
     */
    @Override
    public Map<String, Object> supSellWaterMore(String year, Integer code) {
        return bigScreenService.supSellWaterMore(year, code);
    }
}
