更改项目模块名称,整合b站爬虫

This commit is contained in:
userA
2023-08-31 01:36:20 +08:00
parent 3334e2ec8f
commit c1010a5fb1
277 changed files with 150 additions and 98 deletions

View File

@@ -0,0 +1,90 @@
package org.example.exception;
import org.example.exception.Impl.ResultCode;
/**
* @description : [异常基类]
* @author : [Welsir]
* @createTime : [2023/5/19 20:04]
*/
public class BaseException extends RuntimeException {
private static final long serialVersionUID = 5225171867523879342L;
protected int code;
protected String msg;
protected Object[] params;
protected ResultCode resultCode;
public ResultCode getResultCode() {
return resultCode;
}
public void setResultCode(ResultCode resultCode) {
this.resultCode = resultCode;
}
public BaseException(String message, Object[] params, Throwable cause)
{
super(message, cause);
this.params = params;
}
public BaseException() {
super();
}
public BaseException(ResultCode resultCode){
this.resultCode = resultCode;
}
public BaseException(String msg) {
super(msg);
}
public BaseException(String msg, int code) {
this.code = code;
this.msg = msg;
}
public BaseException(String msg, Object[] params) {
super(msg);
this.params = params;
}
public BaseException(String msg,Throwable throwable){
super(msg,throwable);
}
public BaseException(String msg, int code, Object[] params) {
this(msg, code);
this.params = params;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object[] getParams() {
return params;
}
public void setParams(Object[] params) {
this.params = params;
}
}

View File

@@ -0,0 +1,20 @@
package org.example.exception;
import org.example.log.ChopperLogFactory;
import org.example.log.LoggerType;
import org.slf4j.Logger;
/**
* @author Genius
* @date 2023/08/02 16:52
**/
public class ChopperBotException extends BaseException{
protected Logger logger = ChopperLogFactory.getLogger(LoggerType.System);
public ChopperBotException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,19 @@
package org.example.exception;
/**
* @author Genius
* @date 2023/04/24 00:57
**/
public class FileCacheException extends Exception{
String message;
public FileCacheException(String ErrorMessage){
this.message = ErrorMessage;
}
@Override
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,46 @@
package org.example.exception.Impl;/**
* @description : [描述说明该类的功能]
* @author : [Welsir]
* @createTime : [2023/5/19 20:03]
*/
/**
* @author welsir
* @date 2023/5/19 20:03
*/
public enum ResultCode {
OK(200, "成功"),
ERROR(300,"系统异常"),
PARAMETER_ERROR(301, "参数错误"),
PLUGIN_NOT_REGISTER(114514,"插件没有注册"),
PLUGIN_DEPEND_ERROR(114515,"");
private int code;
private String msg;
public void setCode(int code) {
this.code = code;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
ResultCode(int code, String msg)
{
this.code = code;
this.msg = msg;
}
}

View File

@@ -0,0 +1,23 @@
package org.example.exception;
/**
* @author Genius
* @date 2023/07/29 14:59
**/
/**
* 初始化报错
*/
public class InitException extends RuntimeException{
private String message;
public InitException(String message) {
this.message = message;
}
@Override
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,45 @@
package org.example.exception.plugin;
import lombok.Data;
import org.example.exception.Impl.ResultCode;
/**
* @author Genius
* @date 2023/08/02 18:54
**/
public class PluginDependOnException extends PluginException{
private String fatherName;
private String sonName;
public PluginDependOnException(String msg,String fatherName,String sonName) {
super(msg);
this.fatherName = fatherName;
this.sonName = sonName;
}
public static PluginDependOnException MissingFatherPlugin(String fatherName, String sonName){
PluginDependOnException pluginDependOnException = new PluginDependOnException(
String.format("Error! [%s] plugin missing [%s] plugin ! Please Check~",sonName,fatherName),fatherName,sonName);
ResultCode code = ResultCode.PLUGIN_DEPEND_ERROR;
code.setMsg(pluginDependOnException.msg);
pluginDependOnException.setResultCode(code);
return pluginDependOnException;
}
public static PluginDependOnException DependOnPlugin(String fatherName,String sonName){
PluginDependOnException pluginDependOnException = new PluginDependOnException(
String.format("Error! [%s] plugin depend on [%s] plugin !",sonName,fatherName),fatherName,sonName);
ResultCode code = ResultCode.PLUGIN_DEPEND_ERROR;
code.setMsg(pluginDependOnException.msg);
pluginDependOnException.setResultCode(code);
return pluginDependOnException;
}
public String getFatherName() {
return fatherName;
}
public String getSonName() {
return sonName;
}
}

View File

@@ -0,0 +1,22 @@
package org.example.exception.plugin;
import org.example.exception.ChopperBotException;
/**
* @author Genius
* @date 2023/08/02 16:50
**/
public class PluginException extends ChopperBotException {
public PluginException(String message) {
super(message);
}
@Override
public String getMessage() {
return super.getMessage();
}
}

View File

@@ -0,0 +1,15 @@
package org.example.exception.plugin;
import org.example.exception.Impl.ResultCode;
/**
* @author Genius
* @date 2023/08/02 16:59
**/
public class PluginNotRegisterException extends PluginException{
public PluginNotRegisterException() {
super("Error! Plugin Not Register!");
resultCode = ResultCode.PLUGIN_NOT_REGISTER;
}
}