package com.mortals.xhx.module.check.service.impl;

import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.SummaryTopTypeEnum;
import com.mortals.xhx.module.check.dao.CheckAllRecordDao;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.CheckAllRecordService;
import com.mortals.xhx.module.dept.model.vo.DeptSummaryTopQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service("checkAllRecordService")
@Slf4j
public class CheckAllRecordServiceImpl implements CheckAllRecordService {

    @Autowired
    private CheckAllRecordDao checkAllRecordDao;

    @Override
    public Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query,PageInfo pageInfo) {
/*        if(StringUtils.isEmpty(query.getCheckTimeStart())||StringUtils.isEmpty(query.getCheckTimeStart())){
            SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
            Calendar calendar=Calendar.getInstance();
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            String startTime = format.format(calendar.getTime());
            calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
            String endTime = format.format(calendar.getTime());
            //query.setCheckTimeStart(startTime);
           // query.setCheckTimeEnd(endTime);
        }*/
        return checkAllRecordDao.getAllCheckRecord(query,pageInfo);
    }

    @Override
    public CheckAllScoreSummaryVo getScoreSummary(StaffCheckSummaryQuery query) {
        return checkAllRecordDao.getScoreSummary(query);
    }
}
