package com.chinaweal.aiccs.aiccs.seriousillegal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaweal.aiccs.aiccs.auditing.entity.TSOpinion;
import com.chinaweal.aiccs.aiccs.business.entity.TSTaskList;
import com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegal;
import com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegalReas;
import com.chinaweal.aiccs.outside.vo.Personnel;
import com.chinaweal.aicorg.model.AICUser;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseService;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.page.PageRequestDto;
import com.chinaweal.youfool.framework.springboot.rest.RestResult;

import java.util.List;

/**
 * <p>
 * 列入严重违法企业名单业务表 服务类
 * </p>
 *
 * @author <a href="https://blog.lroyia.top">lroyia</a>
 * @since 2021-01-26
 */
public interface TSBizSerIllegalService extends BaseService<TSBizSerIllegal> {

    List<TSBizSerIllegal> selectBizSerIllegalModels(TSBizSerIllegal tsBizSerIllegalModel);

    //列入严重违法失信 启动
    TSTaskList saveSerIllegalAccept(AICUser aicUser, TSTaskList taskListModel, List<TSBizSerIllegal> bizSerList);


    IPage<TSBizSerIllegal> selectSerIllegalByPageList(int rows, int page,
                                                      TSBizSerIllegal tsBizSerIllegalModel);

    //严重违法失信 审核流程
    TSTaskList saveSerIllegalAuditProcess(AICUser user, TSTaskList taskListModel,
                                          List<TSBizSerIllegal> tsBizSerIllegalModels,
                                          TSOpinion opinionModel, String nextNodeID,
                                          String[] nextPerformerids, String[] nextPerformerNames, String type, String forillOperaOrSerillega);

    //获取列入严重违法失信 原因：异常名录期限届满、严重违法行为&协助执行 两种类型
    List<TSBizSerIllegalReas> getSerillreas(String type);

    //获取所有 列入严重违法失信原因（1--11项）
    List<TSBizSerIllegalReas> findSerIllegalReas();

    //根据列入严重违法失信原因code 查询
    TSBizSerIllegalReas findSerIllegalReaByCode(String reaCode);

    /**
     * 判断企业的法人是否符合
     *
     * @return 等于null不符合
     */
    RestResult isLegalCorrect(String uscc, String name, String cerType, String certNo, String type);

    /**
     * 启动严重违法列入-进入经办环节（经营异常类型和行政处罚类型）
     *
     * @return
     */
    TSTaskList startIncludeIllegal(TSBizSerIllegal tsBizSerIllegal);

    /**
     * 严重违法-下一步环节流转（主要有：办结作废、发送审核、发送审批、审批通过、审批不通过、退回）
     * currentLink 当前页面的环节：经办、审核、审查
     * nextNodeId 流转的节点  FlowUtil.ILLEGAL_*
     * nextHandleId 下一个处理人userId
     *
     * @return
     */
    boolean nextProcessInclude(String currentLink, String nextNodeId, String nextHandleId, TSBizSerIllegal tsBizSerIllegal);

    /**
     * 严重违法列入审批不通过通过
     */
    void examineFailInclude(TSBizSerIllegal tsBizSerIllegal);

    /**
     * 严重违法列入审批通过，并生成对应的文书
     */
    void examineSuccessInclude(TSBizSerIllegal tsBizSerIllegal);

    /**
     * 严重违法列入审批
     */
    void examineInclude(TSBizSerIllegal tsBizSerIllegal);

    /**
     * 严重违法列入审核
     */
    void reviewInclude(TSBizSerIllegal tsBizSerIllegal, String node);

    /**
     * 严重违法列入作废
     */
    void nullifyInclude(TSBizSerIllegal tsBizSerIllegal);

    /**
     * 严重违法列入行政处罚，区局的审批通过
     */
    void bureauExamineSuccessInclude(TSBizSerIllegal tsBizSerIllegal);

    RestResult<?> querySerllegaHistoryInfo (String sapprovecode);

    RestResult<?> querySerllegaHistoryEnt (PageRequestDto pageRequestDto);
}
