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

import org.apache.commons.lang.StringUtils;
import com.zjrs.ggfw.rlzysc.blo.RcssqScheduleTaskBLO;
import com.zjrs.ggfw.rlzysc.entity.RsRlzyRcssqMapper;
import com.zjrs.ggfw.rlzysc.po.RsRlzyRcssqPO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;

@Service
public class RcssqScheduleTaskBLOimpl implements RcssqScheduleTaskBLO {

    private static final Logger LOG = LoggerFactory.getLogger(RcssqScheduleTaskBLOimpl.class);

    @Resource
    private RsRlzyRcssqMapper rsRlzyRcssqMapper;

    @Override
    public List<RsRlzyRcssqPO> queryRcssq() {
        return rsRlzyRcssqMapper.getRcssqDsq();
    }

    @Override
    public List<Map> getWqgkJlxx(RsRlzyRcssqPO po) {
        Map<String, Object> params = new HashMap<String, Object>();
        
        if (StringUtils.isNotBlank(po.getXzfw())){//期望薪资
            params.put("qwxz",po.getXzfw());
        }
        if (StringUtils.isNotBlank(po.getFbrq())){//发布日期
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Calendar c = Calendar.getInstance();
            c.add(Calendar.DATE, - Integer.parseInt(po.getFbrq()));
            Date monday = c.getTime();
            String preMonday = sdf.format(monday);
            params.put("fbrq",preMonday);
        }
        if (StringUtils.isNotBlank(po.getFszws())){//请求的简历个数
            params.put("fszws",po.getFszws());
        }
        LOG.info("查询条件params==========================" + params.toString());
        return  rsRlzyRcssqMapper.getWqgkJlxx(params);
    }

    @Override
    public void updatedsqzxsj(String rsrlzyrcssqlsh) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String dataString = dateFormat.format(date);
        RsRlzyRcssqPO po = new RsRlzyRcssqPO();
        po.setDsqzxsj(dataString);
        rsRlzyRcssqMapper.updateById(po);
    }
}



