package com.zjrs.zwnw.fxfk.bpo.impl;

import org.mohrss.leaf.core.framework.domain.bpo.impl.BPOImpl;
import com.zjrs.zwnw.fxfk.blo.SsywjkBLO;
import com.zjrs.zwnw.fxfk.bpo.SsywjkBPO;
import com.zjrs.zwnw.fxfk.dto.*;
import com.zjrs.zwnw.sxgl.dto.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SsywjkBPOimpl extends BPOImpl implements SsywjkBPO {
    private static final Logger LOG = LoggerFactory.getLogger(SsywjkBPOimpl.class);
    @Resource
    private SsywjkBLO ssywjkBLO;

    @Override
    //在办业务量TOP10
    public List<Zbtop10ListDTO> getZbtop10List(Zbtop10DTO dto){
        return this.ssywjkBLO.getZbtop10List(dto);
    }
    @Override
    //各县市区业务量分布趋势
    public Map<String, Object> getFbqs(FbqssllDTO dto){

        Map<String, Object> resultMap = new HashMap<String, Object>();
        List<FbqssllListDTO> fbqssllList = new ArrayList<FbqssllListDTO>();
        List<FbqssllDqListDTO> fbqsslldqList = new ArrayList<FbqssllDqListDTO>();

        if(dto.getType().equals("1")){
            fbqssllList = this.ssywjkBLO.getFbqsSllBy1Month();
            fbqsslldqList = this.ssywjkBLO.getFbqsSllDqBy1Month();
        }else if(dto.getType().equals("3")){
            fbqssllList = this.ssywjkBLO.getFbqsSllBy3Month();
            fbqsslldqList = this.ssywjkBLO.getFbqsSllDqBy3Month();
        }else if(dto.getType().equals("7")){
            fbqssllList = this.ssywjkBLO.getFbqsSllBy1Week();
            fbqsslldqList = this.ssywjkBLO.getFbqsSllDqBy1Week();
        }

        resultMap.put("fbqsdata",fbqssllList);
        resultMap.put("fbqsdqdata",fbqsslldqList);
        return resultMap;

    }
    //实时业务监控总接口
    @Override
    public Map<String,Object> getAll(){
        Map<String, Object> resultMap = new HashMap<String, Object>();
        //在办业务量TOP10
        Zbtop10DTO dto = new Zbtop10DTO();
        dto.setSsdq("440800");
        List<Zbtop10ListDTO> top10list = this.ssywjkBLO.getZbtop10List(dto);

        //各县市区业务量分布趋势
        FbqssllDTO fbqssllDTO = new FbqssllDTO();
        fbqssllDTO.setType("1");
        resultMap = this.getFbqs(fbqssllDTO);

        //全市业务监控
        List<QsywjkDTO> qsywjkList  = this.ssywjkBLO.getQsywjk();
        //全市业务监控各地区
        List<QsywjkDqDTO> qsywjkdqList  = this.ssywjkBLO.getQsywjkDq();

        resultMap.put("top10data",top10list);
        resultMap.put("qsywdata",qsywjkList);
        resultMap.put("qsywdqdata",qsywjkdqList);
        return resultMap;

    }
}
