|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.task; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.task.core.AsrsException; | 
|---|
|  |  |  | import com.zy.asrs.task.core.ReturnT; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.MessageFormat; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Created by vincent on 2020/7/4 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public abstract class AbstractHandler { | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public abstract class AbstractHandler<T> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public final ReturnT<T> SUCCESS = new ReturnT<>(200, null); | 
|---|
|  |  |  | public final ReturnT<T> FAIL = new ReturnT<>(500, null); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    protected abstract ReturnT<T> start(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected void exceptionHandle(String errorMsg){ | 
|---|
|  |  |  | throw new CoolException("231"); | 
|---|
|  |  |  | log.error(errorMsg); | 
|---|
|  |  |  | exceptionHandle(errorMsg, (Object) null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected void exceptionHandle(String errorMsg, Object... args){ | 
|---|
|  |  |  | log.error(errorMsg); | 
|---|
|  |  |  | throw new CoolException(MessageFormat.format(errorMsg, args)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|