package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.UserWork;
import com.ruoyi.system.domain.dto.SeUserCountDto;
import com.ruoyi.system.domain.dto.SeUserWorkCountDto;
import com.ruoyi.system.service.IDailySysService;
import com.ruoyi.system.service.ISysUserWorkCountService;
import com.ruoyi.system.service.IUserWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;


@Service
public class SysUserWorkCountServiceImpl implements ISysUserWorkCountService {

    @Autowired
    private IUserWorkService userWorkService;

    @Autowired
    private IDailySysService dailySysService;

    @Override
    public Long getUserWorkCount() {
        Long userWorkCount = userWorkService.getUserWorkCount(null);
        return userWorkCount;
    }

    @Override
    public List<SeUserWorkCountDto> getSeUserWorkCount() {
        LocalDate now = LocalDate.now();
        LocalDate startDate = now.minusDays(8);
        LocalDate endDate = now.minusDays(1);
        List<SeUserWorkCountDto> seUserCount = dailySysService.getSeUserWorkCount(startDate, endDate);
        return seUserCount;
    }
}
