package cn.com.countrygarden.bi.main.service.performance.common;

import cn.com.countrygarden.bi.main.model.performance.PerformanceRecord;
import cn.com.countrygarden.bi.main.model.performance.PerformanceScore;
import cn.com.countrygarden.bi.main.model.performance.PerformanceTarget;
import cn.com.countrygarden.bi.main.model.performance.dto.RecordPerformanceDto;

import java.util.List;

/**
 * 绩效考核-考核记录业务接口
 *
 * @Author:Wyman
 * @Date:2018/10/23
 */
public interface PerformanceRecordService {

    /**
     * 根据(指标、年、月)获取记录数目
     * @param elementId
     * @param year
     * @param quarter
     * @return
     */
   int getTotalRecord(long elementId, int year, int quarter);

    /**
     * 新增考核记录
     * @param record
     */
   void insertPerformanceRecord(PerformanceRecord record);

    /**
     * 查询空缺的area数量
     * @param elementId
     * @param year
     * @param quarter
     * @return
     */
   List<String> getVacancyAreas(long elementId, int year, int quarter, String typeNo);

    /**
     * 查询空缺的area数量(月度)
     * @param elementId
     * @param year
     * @param month
     * @param typeNo
     * @return
     */
    List<String> getMonthlyVacancyAreas(long elementId, int year, int month, String typeNo);

    /**
     *  获取考核记录的id值
     * @param elementId
     * @param year
     * @param quarter
     * @return
     */
   long getRecordId(long elementId, int year, int quarter, String hierachyId);

    /**
     * @Description:使用recordId获取PerformanceTarget对象
     * @param recordId
     * @return
     */
   PerformanceTarget getTarget(long recordId);

    /**
     * @Description:使用recordId获取PerformanceScore对象
     * @param recordId
     * @return
     */
   PerformanceScore getScore(long recordId);

    /**
     * 新增Score对象
     * @param recordId
     * @param score
     * @param complete
     * @param yearScore
     */
   void insertScoreSelective(long recordId, float score, float complete, float yearScore);

    /**
     * 更新Score对象
     * @param recordId
     * @param score
     * @param complete
     * @param yearScore
     */
   void updateScoreSelective(long recordId, float score, float complete, float yearScore);

    /**
     *  新增Target对象
     * @param recordId
     * @param threshold
     * @param atLeast
     * @param scream
     * @param howl
     */
   void insertTargetSelective(long recordId, String threshold, String atLeast, String scream, String howl);

    /**
     *  更新Target对象
     * @param recordId
     * @param threshold
     * @param atLeast
     * @param scream
     * @param howl
     */
   void updateTargetSelective(long recordId, String threshold, String atLeast, String scream, String howl);

    /**
     * 新增考核记录
     * @param hierachyId
     * @param elementId
     * @param year
     * @param quarter
     * @return recordId
     */
    void insertRecord(String hierachyId, long elementId, int year, int quarter, String rate, double weight, short isExamine);

    /**
     * 修改考核记录,只需要修改考核频率，权重，是否考核
     * @param rate
     * @param weight
     * @param isExamine
     */
    void updateRecord(long recordId, String rate, double weight, short isExamine);

    /**
     * 利润规模-更新利润规模值
     */
    void updateScope(String scope, long recordId);


    /**
     * 一个地区一次考核记录方法
     * @param recordPerformanceDto
     */
    void performanceRecord(RecordPerformanceDto recordPerformanceDto);

    /**
     *保存季度平均分和总分的（区域+城市公司）
     * @param year
     * @param quarter
     */
    void saveQuartlyAverageScoreAndSumScore(int year, int quarter);

    /**
     *重构保存季度平均分和总分的（区域+城市公司）
     * @Description:声明为事务
     * @param year
     * @param quarter
     */
    void saveQuartlyAverageScoreAndSumScore2(int year, int quarter);

    /**
     * 获取唯一的Records对象
     * @param elementId
     * @param year
     * @param quarter
     * @param hierachyId
     * @return
     */
    PerformanceRecord getRecordSelective(long elementId, int year, int quarter, String hierachyId);
}
