package com.kingdee.eas.custom.performancenew.handler.service;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.sql.ParserException;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.performancenew.ExamineGradePersonEntryCollection;
import com.kingdee.eas.custom.performancenew.ExamineGradePersonEntryInfo;
import com.kingdee.eas.custom.performancenew.IExamineGradePersonEntry;
import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author qingwu
 * @date 2024/5/13
 * @apiNote
 */
public interface ExamineScorePersonService {
    /**
     * @param ctx
     * @param list      通知人员集合
     * @param appName   视图名称
     * @param modelName 模块名称
     * @param modelId   随机唯一ID
     * @param subject   视图地址
     * @param link
     */
    public void assessPrass(Context ctx, List<ExamineGradePersonEntryInfo> list, String appName, String modelName, String modelId, String subject, String link) throws ShrWebBizException, BOSException, EASBizException;

    /**
     * 校验是否锁定周期
     */
    void verifyisLock(String id) throws ShrWebBizException, BOSException, EASBizException;

    /**
     * 组织过滤
     *
     * @param billID
     * @return
     */
    public String getAdminOrgFilter(String billID, boolean isSynUpLastLevelAndUpLastScore);


    /**
     * 获取当前登录人等于评分人的数据
     *
     * @param billID
     * @return
     */
    public ExamineGradePersonEntryCollection getCurrentPersonEqualsScore(String billID, String adminId,boolean isScorer) throws ParserException, BOSException;

    /**
     * 校验是否存在顺序重复或断层,和保存计算得分
     *
     * @param entrys
     * @return
     */
    public Map isSorted(ExamineGradePersonEntryCollection entrys) throws ShrWebBizException;

    /**
     * 保存计算得分
     *
     * @param map    key 部门ID 人数 和部门等级
     * @param entrys
     * @throws BOSException
     * @throws EASBizException
     */
    public void saveScore(Map<String, Object> map,
                          ExamineGradePersonEntryCollection entrys)
            throws BOSException, EASBizException, ShrWebBizException;

    /**
     * 修改保存计算得分
     *
     * @param entrys
     * @param iExamineGradePersonEntry
     * @param key
     * @param i
     * @param scoreLevelMap
     * @throws BOSException
     * @throws EASBizException
     */
    public void saveExamineScorer(ExamineGradePersonEntryCollection entrys, IExamineGradePersonEntry iExamineGradePersonEntry, String key, int i, Map<String, List<String>> scoreLevelMap) throws BOSException, EASBizException, ShrWebBizException;

    /**
     * 获取得分级别
     *
     * @param num       人数
     * @param scoreType 组织绩效得分类型 A B+ B B- C D
     */
    public Map getScoreLevelList(int num, String scoreType);

    /**
     * 获取上季度和当前季度的和 减去当前季度的等级 得到的就是当前季度等级和个人数 进行遍历出来
     *
     * @param listArray
     * @param addupScore
     */
    public void getListArrayGradeNum(List<String> listArray, Map addupScore);

    /**
     * 同步考核结果
     *
     * @param billID
     * @param isSynUpLastLevelAndUpLastScore 是否同步修正评分和等级字段
     * @throws BOSException
     * @throws EASBizException
     * @throws ShrWebBizException
     * @throws SQLException
     * @throws ParserException
     */
    public void synEvaluationResultAction(String billID, boolean isSynUpLastLevelAndUpLastScore) throws BOSException, EASBizException, ShrWebBizException, SQLException, ParserException;

    /***
     * 维护顺序
     * @param billId
     */
    public void maintainIndex(String billId) throws BOSException;
}
