package com.qmth.sop.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.sop.business.entity.Sequence;
import com.qmth.sop.common.enums.SequenceEnum;
import com.qmth.sop.common.enums.TFCustomTypeEnum;

/**
 * <p>
 * 序列表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2023-08-14
 */
public interface SequenceService extends IService<Sequence> {

    /**
     * 获取序列号
     *
     * @param name
     * @return
     */
    Long selectNextVal(String name) throws InterruptedException;

    /**
     * 创建流程编号
     *
     * @param tfCustomTypeEnum
     * @return
     */
    String createFlowCode(TFCustomTypeEnum tfCustomTypeEnum) throws InterruptedException;

    /**
     * 创建CRM编号
     *
     * @param crm
     * @return
     */
    String createCrmCode(String crm) throws InterruptedException;

    String createCode(String name) throws InterruptedException;

    /**
     * 根据流水号枚举生成流水号 每日重置 （前缀 + 日期 + 流水号）
     * @param sequenceEnum 流水号枚举
     * @return 流水号
     */
    String createSerialNo(SequenceEnum sequenceEnum) throws InterruptedException;

    /**
     * 序列重置
     *
     * @return
     */
    Boolean sequenceReset();
}
