package com.mosty.yjzl.service.Impl;

import com.google.common.collect.ImmutableList;
import com.mosty.base.model.dto.yjzl.*;
import com.mosty.base.model.query.yjzl.TbYjqkQuery;
import com.mosty.base.utils.DateUtils;
import com.mosty.common.base.exception.BusinessException;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import com.mosty.common.util.PermissionsUtil;
import com.mosty.yjzl.mapper.YjzlStatisticsMapper;
import com.mosty.yjzl.remote.TbBaseAdaptRemoteService;
import com.mosty.yjzl.service.YjzlStatisticsService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

@Service
@AllArgsConstructor
public class YjzlStatisticsServiceImpl implements YjzlStatisticsService {

    private final YjzlStatisticsMapper yjzlStatisticsMapper;
    private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;

    @Override
    public List<Map<String, Object>> clyjlb(TbYjxxStatisticsDto vo) {
//        UserInfo user = UserInfoManager.get();
        vo.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(vo.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", vo);
//        map.put("useSql", PermissionsUtil.createSql("", user));
        return this.yjzlStatisticsMapper.clyjlb(map);
    }

    @Override
    public List<Map<String, Object>> queryBycCphm(TbYjxxPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.queryBycCphm(map);
    }

    @Override
    public List<Map<String, Object>> queryBycCphmlb(TbYjxxPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.queryBycCphmlb(map);
    }

    @Override
    public List<Map<String, Object>> yqueryBycCphmlb(TbYjxxYStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yqueryBycCphmlb(map);
    }

    @Override
    public List<Map<String, Object>> zqueryBycCphmlb(TbYjxxPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zqueryBycCphmlb(map);
    }

    @Override
    public List<Map<String, Object>> yjcltj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjcltj(map);
    }

    @Override
    public List<Map<String, Object>> yjbqtj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjbqtj(map);
    }

    @Override
    public List<Map<String, Object>> yjjbtj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjjbtj(map);
    }

    @Override
    public List<Map<String, Object>> yyjcltj(TbYjxxYStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yyjcltj(map);
    }

    @Override
    public List<Map<String, Object>> zyjcltj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zyjcltj(map);
    }

    @Override
    public List<Map<String, Object>> queryBySfzh(TbYjxxRyStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.queryBySfzh(map);
    }

    @Override
    public List<Map<String, Object>> queryBySfzhlb(TbYjxxRyPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.queryBySfzhlb(map);
    }

    @Override
    public List<Map<String, Object>> queryBySfzhlbsc(TbYjxxRyPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.queryBySfzhlbsc(map);
    }

    @Override
    public List<Map<String, Object>> yqueryBySfzhlb(TbYjxxRyNyStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yqueryBySfzhlb(map);
    }

    @Override
    public List<Map<String, Object>> yqueryBySfzhlbsc(TbYjxxRyNyStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yqueryBySfzhlbsc(map);
    }

    @Override
    public List<Map<String, Object>> zqueryBySfzhlb(TbYjxxRyPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zqueryBySfzhlb(map);
    }

    @Override
    public List<Map<String, Object>> zqueryBySfzhlbsc(TbYjxxRyPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("a", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zqueryBySfzhlbsc(map);
    }

    @Override
    public List<Map<String, Object>> ryyjlb(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.ryyjlb(map);
    }

    @Override
    public List<Map<String, Object>> yjjbtjRy(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjjbtjRy(map);
    }

    @Override
    public List<Map<String, Object>> jbtj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.jbtj(map);
    }

    @Override
    public List<Map<String, Object>> yjrytj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjrytj(map);
    }

    @Override
    public List<Map<String, Object>> yjrytjsc(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjrytjsc(map);
    }

    @Override
    public List<Map<String, Object>> yyjrytj(TbYjxxYyjStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yyjrytj(map);
    }

    @Override
    public List<Map<String, Object>> yyjrytjsc(TbYjxxYyjStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yyjrytjsc(map);
    }

    @Override
    public List<Map<String, Object>> zyjrytj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zyjrytj(map);
    }

    @Override
    public List<Map<String, Object>> zyjrytjsc(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zyjrytjsc(map);
    }

    @Override
    public List<Map<String, Object>> zbyjbfylb(TbYjxxRyPageStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zbyjbfylb(map);
    }

    @Override
    public List<Map<String, Object>> zbyjtj(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.zbyjtj(map);
    }

    @Override
    public List<Map<String, Object>> gzyyjpm(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.gzyyjpm(map);
    }

    @Override
    public List<Map<String, Object>> pcsyjpm(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.pcsyjpm(map);
    }

    @Override
    public List<Map<String, Object>> ryyjpm(TbYjxxStatisticsDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.ryyjpm(map);
    }

    @Override
    public List<Map<String, Object>> ycyjtj(TbYjxxStatisticsQueryDto dto) {
        dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
        Map<String, Object> map = new HashMap<>();
        map.put("dto", dto);
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.ycyjtj(map);
    }

    @Override
    public List<Map<String, Object>> yjtj() {
        String ssbmdm = this.tbBaseAdaptRemoteService.getSsbm(null, null);
//        Map<String, Object> map = new HashMap<>();
//        map.put("useSql", PermissionsUtil.createSql("", UserInfoManager.get()));
        return this.yjzlStatisticsMapper.yjtj(ssbmdm);
    }

    /**
     * 泸州态势统计-各区县预警情况
     *
     * @param dto
     * @return
     */
    @Override
    public Map<String, Object> getGqxyjqk(TbYjqkQuery dto) {
        HashMap<Object, Object> ssxgajxx = new HashMap<>();
        ssxgajxx.put("10111", "泸州机场分局");
        ssxgajxx.put("10929", "江阳区分局");
        ssxgajxx.put("11336", "龙马潭区分局");
        ssxgajxx.put("11379", "纳溪区");
        ssxgajxx.put("11382", "泸县");
        ssxgajxx.put("11436", "合江县");
        ssxgajxx.put("11503", "叙永县");
        ssxgajxx.put("11531", "古蔺县");

        if (StringUtils.isEmpty(dto.getKssj()) || StringUtils.isEmpty(dto.getJssj())) { // 为空的提示
            throw new BusinessException("请选择您要查询时间！");
        }
        Map<String, Object> map = new HashMap<>();
        // 预警数量
        List<Map<String, Object>> yjsl = this.yjzlStatisticsMapper.getYjsl(dto.getKssj(), dto.getJssj());
        // 指令数
        List<Map<String, Object>> zls = this.yjzlStatisticsMapper.getZls();
        // 执行数
        List<Map<String, Object>> zxs = this.yjzlStatisticsMapper.getZxs(dto.getKssj(), dto.getJssj());

        // re预警数量
        List<Map<String, Object>> yjslResList = new ArrayList<>();
        // re指令数
        List<Map<String, Object>> zlsResList = new ArrayList<>();
        // re执行数
        List<Map<String, Object>> zxsResList = new ArrayList<>();

        ssxgajxx.keySet().forEach(item -> { // 循环遍历  通过key获取value 过滤比较从数据库获取的值
            Map<String, Object> resMap = new HashMap<>();
            // 预警数量
            List<Map<String, Object>> yjslList = yjsl.stream().filter(it -> String.valueOf(it.get("ssxgajid")).equals(item)).collect(Collectors.toList());
            resMap.put("ssxgaj", ssxgajxx.get(item)); // value 为所属县公安局
            resMap.put("ssxgajid", item); // key 为所属县公安局id
            if (yjslList.size() == 1) { // 如果集合的长度为1 说明数据库中有，获取count
                resMap.put("count", yjslList.get(0).get("count"));
            } else { // 否则设置count为0
                resMap.put("count", 0);
            }
            yjslResList.add(resMap); // 将resMap添加进yjslResList中 最后put进map

            // 指令数
            resMap = new HashMap<>();
            List<Map<String, Object>> zlsList = zls.stream().filter(it -> String.valueOf(it.get("ssxgajid")).equals(item)).collect(Collectors.toList());
            resMap.put("ssxgaj", ssxgajxx.get(item));
            resMap.put("ssxgajid", item);
            if (zlsList.size() == 1) {
                resMap.put("count", zlsList.get(0).get("count"));
            } else {
                resMap.put("count", 0);
            }
            zlsResList.add(resMap);

            // 执行数
            resMap = new HashMap<>();
            List<Map<String, Object>> zxsList = zxs.stream().filter(it -> String.valueOf(it.get("ssxgajid")).equals(item)).collect(Collectors.toList());
            resMap.put("ssxgaj", ssxgajxx.get(item));
            resMap.put("ssxgajid", item);
            if (zxsList.size() == 1) {
                resMap.put("count", zxsList.get(0).get("count"));
            } else {
                resMap.put("count", 0);
            }
            zxsResList.add(resMap);
        });

        map.put("yjslResList", yjslResList);
        map.put("zlsResList", zlsResList);
        map.put("zxsResList", zxsResList);
        return map;
    }

    @Override
    public Map<String, Object> getJqscAndZlTj(TbYjqkQuery dto) {
        if (com.mosty.common.base.util.StringUtils.isEmpty(dto.getKssj()) || com.mosty.common.base.util.StringUtils.isEmpty(dto.getJssj())) {
            throw new BusinessException("请选择查询时间");
        }
        Map<String, Object> map = new HashMap<>();
        if (dto.getKssj().equals(dto.getJssj())) {
            // 查询警情数据
            List<Map<String, Object>> jqList = this.yjzlStatisticsMapper.getJqTj(dto.getKssj());
            // 预警数量
            List<Map<String, Object>> yjsl = this.yjzlStatisticsMapper.getYjsl1(dto.getKssj(), dto.getJssj());
            // 指令数
            List<Map<String, Object>> zls = this.yjzlStatisticsMapper.getZls1(dto.getKssj(), dto.getJssj());
            // 执行数
            List<Map<String, Object>> zxs = this.yjzlStatisticsMapper.getZxs1(dto.getKssj(), dto.getJssj());
            List<String> timeList = ImmutableList.of("00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
                    "10", "11", "12", "13", "14", "15", "16", "17",
                    "18", "19", "20", "21", "22", "23");
            timeList.forEach(item -> {
                boolean jqFlag = false;
                boolean yjFlag = false;
                boolean zlsFlag = false;
                boolean zxsFlag = false;
                for (Map<String, Object> jq : jqList) {
                    String time = String.valueOf(jq.get("time")).length() == 1 ?
                            "0" + jq.get("time") : String.valueOf(jq.get("time"));
                    if (item.equals(time)) {
                        jqFlag = true;
                    }
                }
                for (Map<String, Object> jq : yjsl) {
                    String time = String.valueOf(jq.get("time")).length() == 1 ?
                            "0" + jq.get("time") : String.valueOf(jq.get("time"));
                    if (item.equals(time)) {
                        yjFlag = true;
                    }
                }
                for (Map<String, Object> jq : zls) {
                    String time = String.valueOf(jq.get("time")).length() == 1 ?
                            "0" + jq.get("time") : String.valueOf(jq.get("time"));
                    if (item.equals(time)) {
                        zlsFlag = true;
                    }
                }
                for (Map<String, Object> jq : zxs) {
                    String time = String.valueOf(jq.get("time")).length() == 1 ?
                            "0" + jq.get("time") : String.valueOf(jq.get("time"));
                    if (item.equals(time)) {
                        zxsFlag = true;
                    }
                }
                if (!jqFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", item);
                    mp.put("count", 0);
                    jqList.add(mp);
                }
                if (!yjFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", item);
                    mp.put("count", 0);
                    yjsl.add(mp);
                }
                if (!zlsFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", item);
                    mp.put("count", 0);
                    zls.add(mp);
                }
                if (!zxsFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", item);
                    mp.put("count", 0);
                    zxs.add(mp);
                }
            });
            jqList.sort(Comparator.comparingInt(a -> Integer.parseInt(a.get("time").toString())));
            yjsl.sort(Comparator.comparingInt(a -> Integer.parseInt(a.get("time").toString())));
            zls.sort(Comparator.comparingInt(a -> Integer.parseInt(a.get("time").toString())));
            zxs.sort(Comparator.comparingInt(a -> Integer.parseInt(a.get("time").toString())));
            map.put("jqList", jqList.stream().map(item -> item.get("count")).collect(Collectors.toList()));
            map.put("yjsl", yjsl.stream().map(item -> item.get("count")).collect(Collectors.toList()));
            map.put("zls", zls.stream().map(item -> item.get("count")).collect(Collectors.toList()));
            map.put("zxs", zxs.stream().map(item -> item.get("count")).collect(Collectors.toList()));
        } else {
            // 警情
            List<Map<String, Object>> jqList = this.yjzlStatisticsMapper.getJqTjByTime(dto.getKssj(), dto.getJssj());
            // 预警数量
            List<Map<String, Object>> yjsl = this.yjzlStatisticsMapper.getYjslByTime(dto.getKssj(), dto.getJssj());
            // 指令数
            List<Map<String, Object>> zls = this.yjzlStatisticsMapper.getZlsByTime(dto.getKssj(), dto.getJssj());
            // 执行数
            List<Map<String, Object>> zxs = this.yjzlStatisticsMapper.getZxsByTime(dto.getKssj(), dto.getJssj());
            Date kssj = DateUtils.strToDate(dto.getKssj(), "01");
            Date jssj = DateUtils.strToDate(dto.getJssj(), "01");
            while (kssj.getTime() <= jssj.getTime()) {
                boolean jqFlag = false;
                boolean yjFlag = false;
                boolean zlFlag = false;
                boolean zxFlag = false;
                for (Map<String, Object> item : yjsl) {
                    if (String.valueOf(item.get("time")).equals(DateUtils.getQueryDateString(kssj, "01"))) {
                        yjFlag = true;
                    }
                }
                for (Map<String, Object> item : zls) {
                    if (String.valueOf(item.get("time")).equals(DateUtils.getQueryDateString(kssj, "01"))) {
                        zlFlag = true;
                    }
                }
                for (Map<String, Object> item : jqList) {
                    if (String.valueOf(item.get("time")).equals(DateUtils.getQueryDateString(kssj, "01"))) {
                        jqFlag = true;
                    }
                }
                for (Map<String, Object> item : zxs) {
                    if (String.valueOf(item.get("time")).equals(DateUtils.getQueryDateString(kssj, "01"))) {
                        zxFlag = true;
                    }
                }
                if (!jqFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", DateUtils.getQueryDateString(kssj, "01"));
                    mp.put("count", 0);
                    jqList.add(mp);
                }
                if (!yjFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", DateUtils.getQueryDateString(kssj, "01"));
                    mp.put("count", 0);
                    yjsl.add(mp);
                }
                if (!zlFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", DateUtils.getQueryDateString(kssj, "01"));
                    mp.put("count", 0);
                    zls.add(mp);
                }
                if (!zxFlag) {
                    Map<String, Object> mp = new HashMap<>();
                    mp.put("time", DateUtils.getQueryDateString(kssj, "01"));
                    mp.put("count", 0);
                    zxs.add(mp);
                }
                kssj = DateUtils.getNextDate(kssj, "D", 1);
            }
            jqList.sort((a, b) -> {
                Date k = DateUtils.strToDate(a.get("time").toString(), "01");
                Date j = DateUtils.strToDate(b.get("time").toString(), "01");
                return (int) (k.getTime() - j.getTime());
            });
            yjsl.sort((a, b) -> {
                Date k = DateUtils.strToDate(a.get("time").toString(), "01");
                Date j = DateUtils.strToDate(b.get("time").toString(), "01");
                return (int) (k.getTime() - j.getTime());
            });
            zls.sort((a, b) -> {
                Date k = DateUtils.strToDate(a.get("time").toString(), "01");
                Date j = DateUtils.strToDate(b.get("time").toString(), "01");
                return (int) (k.getTime() - j.getTime());
            });
            zxs.sort((a, b) -> {
                Date k = DateUtils.strToDate(a.get("time").toString(), "01");
                Date j = DateUtils.strToDate(b.get("time").toString(), "01");
                return (int) (k.getTime() - j.getTime());
            });
            map.put("jqList", jqList.stream().map(item -> item.get("count")).collect(Collectors.toList()));
            map.put("yjsl", yjsl.stream().map(item -> item.get("count")).collect(Collectors.toList()));
            map.put("zls", zls.stream().map(item -> item.get("count")).collect(Collectors.toList()));
            map.put("zxs", zxs.stream().map(item -> item.get("count")).collect(Collectors.toList()));
        }
        return map;
    }
}
