package com.bofeng.service;


import com.bofeng.dao.MsReportMapper;
import com.bofeng.dao.MsSuspectedMapper;
import com.bofeng.entity.MsReport;
import com.bofeng.entity.MsSuspected;
import com.bofeng.entity.NotifyOpen;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @Author: xielianghe
 * @Date: 2020/2/4 15:44
 */
@Service
@Transactional(readOnly = true)
public class MsReportService {

    @Autowired
    private MsSuspectedMapper msSuspectedMapper;
    @Autowired
    private MsReportMapper msReportMapper;

    public List<MsSuspected> getByDateNow() {
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String reportDate = df.format(t);
        List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate);
        List<MsSuspected> listSuspected = null;
        if (listReport != null && listReport.size() > 0) {
            listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
        }
        return listSuspected;
    }
}
