package com.ym.mec.biz.service;

import com.ym.mec.biz.dal.dto.*;
import com.ym.mec.biz.dal.entity.CourseSchedule;
import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
import com.ym.mec.biz.dal.entity.MusicGroup;
import com.ym.mec.biz.dal.entity.VipGroup;
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.common.page.PageInfo;
import com.ym.mec.common.service.BaseService;

import java.math.BigDecimal;
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 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 salaryMark();

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