package com.ym.mec.biz.service;

import com.ym.mec.biz.dal.dto.*;
import com.ym.mec.biz.dal.entity.*;
import com.ym.mec.biz.dal.page.CourseSalaryQueryInfo4Web;
import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
import com.ym.mec.biz.dal.page.ExportTeacherSalaryQueryInfo;
import com.ym.mec.biz.dal.page.TeacherIncomeQueryInfo;
import com.ym.mec.common.page.PageInfo;
import com.ym.mec.common.service.BaseService;
import org.apache.poi.ss.formula.functions.T;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface CourseScheduleTeacherSalaryService extends BaseService<Long, CourseScheduleTeacherSalary> {

    String TASK_KEY = "SETTLEMENT_TYPES";

    /**
     * @Author: Joburgess
     * @Date: 2019/10/14
     * @params [vipGroup VIP课程信息,
     * vipCourseSchedules 排课计划,
     * onlineTeacherSalary 教师线上课酬,
     * offlineTeacherSalary 教师线下课酬]
     * @return int
     * @describe 创建vip课教师课酬
     */
    void createCourseScheduleTeacherVipSalary(VipGroup vipGroup,
                                             List<CourseSchedule> vipCourseSchedules,
                                             BigDecimal onlineTeacherSalary,
                                             BigDecimal offlineTeacherSalary);

    /**
     * @describe 批量插入教师课程课酬记录
     * @author Joburgess
     * @date 2019/11/7
     * @param courseScheduleTeacherSalaries:
     * @return void
     */
    void batchInsert(List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries);

    /**
     * @Author: Joburgess
     * @Date: 2019/10/15
     * @params []
     * @return void
     * @describe 教师vip课课酬结算
     */
    void teacherSalarySettlement();

    /**
     * @Author: Joburgess
     * @Date: 2019/10/15
     * @params []
     * @return void
     * @describe 教师陪练课课酬结算
     */
    void practiceTeacherSalarySettlement();

    /**
     * @describe 教师乐团课课酬结算
     * @author Joburgess
     * @date 2019/11/3
     * @return void
     */
    void musicGroupTeacherSalarySettlement();

    /**
     * 获取教师薪酬列表
     * @param queryInfo
     * @return
     */
    PageInfo<TeacherSalaryDto> querySalaries(CourseScheduleTeacherSalaryQueryInfo queryInfo);

    /**
     * @describe 更新vip课剩余课时的课酬
     * @author Joburgess
     * @date 2019/12/14
     * @param vipGroupId: vip课程编号
     * @param oldTeacherId: 原课程组教师
     * @return void
     */
    void updateVipGroupCourseTeacherSalary(Integer vipGroupId, Integer oldTeacherId);

    /**
     * 老师课程课酬列表
     * @param queryInfo
     * @return
     */
    List<ExportTeacherSalaryDto> exportTeacherSalary(ExportTeacherSalaryQueryInfo queryInfo);

    /**
     * 获取未结算的编号
     * @param courseScheduleIds
     * @return
     */
    List<Long> querySettlementScheduleId(String courseScheduleIds);



    /**
     * @describe 确定教师指定月份的课酬
     * @author Joburgess
     * @date 2020/4/15
     * @param teacherId:
     * @param month:
     * @return void
     */
    void confirmTeacherMonthSalary(Integer teacherId, String month);

    /**
     * @describe 获取课酬记录
     * @author Joburgess
     * @date 2020/4/15
     * @param queryInfo:
     * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.TeacherCourseSalaryDetail4WebDto>
     */
    PageInfo<TeacherCourseSalaryDetail4WebDto> findIsSettlementCourseSalarys(CourseSalaryQueryInfo4Web queryInfo);

    /**
     * @describe 获取老师指定月份课酬信息
     * @author Joburgess
     * @date 2020/4/15
     * @param queryInfo4Web:
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */
    Map<String, Object> findTeacherSettlementCourseSalarys(CourseSalaryQueryInfo4Web queryInfo4Web);

    /**
     * @describe 获取教师指定年份每月的课酬
     * @author Joburgess
     * @date 2020/4/15
     * @param teacherId:
     * @param year:
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */
    Map<String, Object> findTeacherYearSalarys(Integer teacherId, String year);

    /**
     * @describe 开启课酬确认
     * @author Joburgess
     * @date 2020/4/16
     * @param month:
     * @return void
     */
    void openSalaryConfirm(String month);

    /**
     * @describe 关闭课酬确认
     * @author Joburgess
     * @date 2020/4/16
     * @param month:
     * @return void
     */
    void closeSalaryConfirm(String month);

    /**
     * @describe 创建教师课程课酬记录
     * @author Joburgess
     * @date 2020.10.22
     * @param courseSchedule: 课程计划
     * @param teacherIds: 教师编号列表
     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary>
     */
    List<CourseScheduleTeacherSalary> createTeacherCourseSalary(CourseSchedule courseSchedule, List<Integer> teacherIds);

    /**
     * @describe 计算课程课酬
     * @author Joburgess
     * @date 2021/4/12 0012
     * @param courseSchedule:
     * @param courseScheduleTeacherSalaries:
     * @return void
     */
    void updateSingleCourseTeacherSalary(CourseSchedule courseSchedule, CourseScheduleTeacherSalary courseScheduleTeacherSalaries);

    /**
     * @describe 计算乐团课教师课酬
     * @author Joburgess
     * @date 2020/12/16 0016
     * @param musicGroup:
     * @param courseSchedule:
     * @param courseScheduleTeacherSalaries:
     * @return void
     */
    void createMusicGroupCourseTeacherSalary(MusicGroup musicGroup, CourseSchedule courseSchedule, CourseScheduleTeacherSalary courseScheduleTeacherSalaries);

    /**
     * @describe 获取指定课程上的教师信息
     * @author Joburgess
     * @date 2020/11/17 0017
     * @param courseScheduleId:
     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherAttendanceDto>
     */
    List<TeacherAttendancesDto> getCourseTeachers(Long courseScheduleId);

    /**
     * @describe 工资奖金标记-新
     * @author Joburgess
     * @date 2020/12/25 0025
     * @return void
     */
    void salaryMarkNew(Date startDay);

    /**
     * @describe 工资奖金标记
     * @author Joburgess
     * @date 2020/12/25 0025
     * @return void
     */
    void salaryMark();

    /**
     * @describe 组合工资，使其最接近给定的金额
     * @author Joburgess
     * @date 2020/12/25 0025
     * @param salaries:
     * @param targetSalary:
     * @return void
     */
    List<BigDecimal> salaryComposition(List<BigDecimal> salaries, BigDecimal targetSalary);

    /**
     * @describe 计算乐团课教师实际课酬
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param courseScheduleTeacherSalary:
     * @param teacherAttendances:
     * @return void
     */
    void calMusicCourseTeacherActualSalary(CourseSchedule courseSchedule, CourseScheduleTeacherSalary courseScheduleTeacherSalary,
                                           List<TeacherAttendance> teacherAttendances, School school, Teacher teacher, double attendanceRange, Boolean updated);

    /**
     * @describe 计算VIP课教师实际课酬
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param courseScheduleTeacherSalary:
     * @param teacherAttendances:
     * @return void
     */
    void calVipCourseTeacherActualSalary(CourseSchedule courseSchedule, CourseScheduleTeacherSalary courseScheduleTeacherSalary,
                                         List<TeacherAttendance> teacherAttendances, School school, Teacher teacher, double attendanceRange, Boolean updated);

    /**
     * @describe 计算网管课教师实际课酬
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param courseScheduleTeacherSalary:
     * @param teacherAttendances:
     * @return void
     */
    void calPracticeTeacherActualSalary(CourseSchedule courseSchedule, CourseScheduleTeacherSalary courseScheduleTeacherSalary,
                                        List<TeacherAttendance> teacherAttendances, School school, Teacher teacher, Boolean updated);

    /**
     * @describe
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param teacherId: 获取教师收入总览
     * @return com.ym.mec.biz.dal.dto.TeacherIncomeReviewDto
     */
    TeacherIncomeReviewDto getTeacherSalaryOverview(TeacherIncomeQueryInfo queryInfo);

    /**
     * @describe 查询教师课酬记录
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param queryInfo:
     * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.TeacherIncomeDto>
     */
    PageInfo<TeacherIncomeDto> queryTeacherIncomeList(TeacherIncomeQueryInfo queryInfo);

    /**
     * @describe 收入统计
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param year:
     * @return java.util.Map<java.lang.String,java.math.BigDecimal>
     * 移动端全部更新后将废弃
     */
    @Deprecated
    Map<String, Object> teacherIncomeStat(Integer teacherId, Integer year, Integer month);

    /**
     * @describe 收入统计
     * @author Joburgess
     * @date 2021/4/16 0016
     * @param year:
     * @return java.util.Map<java.lang.String,java.math.BigDecimal>
     */
    Map<String, Object> teacherIncomeStatNew(Integer teacherId, Integer year, Integer month);

    /**
     * @describe 推送查看今日收入提醒
     * @author Joburgess
     * @date 2021/4/19 0019
     * @param :
     * @return void
     */
    void todayIncomeRemind();
}
