package com.zjrs.ggfw.rlzysc.bpo.impl;

import org.mohrss.leaf.core.framework.persistens.PageResult;
import com.zjrs.ggfw.rlzysc.blo.ZphglBLO;
import com.zjrs.ggfw.rlzysc.bpo.ZphglBPO;
import com.zjrs.ggfw.rlzysc.dto.QtzphQueryDTO;
import com.zjrs.ggfw.rlzysc.dto.ZphglQueryDTO;
import com.zjrs.ggfw.rlzysc.dto.dwzp.WlZphDetailDTO;
import com.zjrs.ggfw.rlzysc.po.RsRlzyXczphPO;
import org.springframework.stereotype.Service;

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

@Service
public class ZphglBPOImpl implements ZphglBPO {
    @Resource
    private ZphglBLO zphglBLO;


    @Override
    public PageResult getZphglList(ZphglQueryDTO dto, int page, int rows) {
        return this.zphglBLO.getZphglList(dto,page,rows);

    }

    @Override
    public RsRlzyXczphPO getZphxxById(QtzphQueryDTO dto) {
        return this.zphglBLO.getZphxxById(dto);
    }

    @Override
    public List<RsRlzyXczphPO> getQtzphList(QtzphQueryDTO dto) {
        return this.zphglBLO.getQtzphList(dto);
    }

    @Override
    public List getQyxxList(QtzphQueryDTO dto) {
        return this.zphglBLO.getQyxxList(dto);
    }

    @Override
    public List getZxjrdZphList() {
        return this.zphglBLO.getZxjrdZphList();
    }

    @Override
    public List getZxjrdWlZphList() {
        //所有最新加入的企业
        List<Map<String, Object>> qylist = zphglBLO.getZxQyList();
        //参会单位具体数据
        List chdwdetail = zphglBLO.getChdwQcDetail(qylist);
        if (chdwdetail.size() > 12) {
            return chdwdetail.subList(0, 12);
        } else {
            return chdwdetail;
        }
    }

    @Override
    public int getKydxw(QtzphQueryDTO dto) {
        return zphglBLO.getKydxw(dto);
    }

    @Override
    public Map getIndexWlDetail(WlZphDetailDTO dto) {
        Map<String,Object> res = new HashMap<String,Object>();
        QtzphQueryDTO zphdto = new QtzphQueryDTO();
        zphdto.setRsrlzyzphgllsh(dto.getRsrlzyzphgllsh());

        //获取招聘会基本信息
        res.put("zphxx",zphglBLO.getZphxxById(zphdto));

        //统计数据--参展企业，招聘职位数目
        List<Map<String, Object>> qylist = zphglBLO.getQyList(dto.getRsrlzyzphgllsh());
        res.put("qycnt",qylist.size());

        Map qyzw = zphglBLO.getQyzW(dto.getRsrlzyzphgllsh());
        res.putAll(qyzw);

        int lll = zphglBLO.getLll(dto.getRsrlzyzphgllsh());
        res.put("lll",lll);

        //参会单位具体数据
        List chdwdetail = zphglBLO.getChdwDetail(qylist, zphdto.getRsrlzyzphgllsh());

        res.put("chdw",chdwdetail);
        return res;
    }




}


