parent
99688c474f
commit
6c430e7835
Binary file not shown.
Binary file not shown.
@ -0,0 +1,108 @@
|
||||
package xyz.wbsite.action.ajax.admin;
|
||||
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import xyz.wbsite.frame.base.Error;
|
||||
import xyz.wbsite.frame.excel.WExcel;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.frame.utils.ResponseUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.frame.excel.exception.TemplateNotMatchException;
|
||||
import xyz.wbsite.module.admin.ent.Config;
|
||||
import xyz.wbsite.module.admin.mgr.ConfigManager;
|
||||
import xyz.wbsite.module.admin.req.ConfigCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigUpdateResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigAjax{
|
||||
|
||||
@Autowired
|
||||
private ConfigManager configManager;
|
||||
|
||||
public ConfigCreateResponse create(ConfigCreateRequest request) {
|
||||
return configManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ConfigDeleteResponse delete(ConfigDeleteRequest request) {
|
||||
return configManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ConfigUpdateResponse update(ConfigUpdateRequest request) {
|
||||
return configManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ConfigFindResponse find(ConfigFindRequest request) {
|
||||
return configManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WExcel<>(Config.class));
|
||||
}
|
||||
|
||||
public Object exports(ConfigFindRequest request) {
|
||||
ConfigFindResponse response = configManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WExcel<>(Config.class).addDatas(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
// 检查文件格式
|
||||
String originalFilename = file.getOriginalFilename() != null ? file.getOriginalFilename() : "";
|
||||
if (!originalFilename.matches(".+(.xlsx?|.XLSX?)$")) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件格式错误!");
|
||||
return baseResponse;
|
||||
}
|
||||
// 兼容2003以前老版本.xls
|
||||
ExcelTypeEnum excelTypeEnum = originalFilename.matches(".+(.xlsx|.XLSX)$") ? ExcelTypeEnum.XLSX : ExcelTypeEnum.XLS;
|
||||
WExcel sheet = new WExcel<>(Config.class).read(file.getBytes(), excelTypeEnum, new WExcel.Processor<Config>() {
|
||||
@Override
|
||||
public List<String> exec(Config o, int index) {
|
||||
ConfigCreateRequest request = MapperUtil.map(o, ConfigCreateRequest.class);
|
||||
List<String> validate = ValidationUtil.validate(request);
|
||||
if (validate == null || validate.size() == 0) {
|
||||
ConfigCreateResponse configCreateResponse = configManager.create(request, LocalData.getToken());
|
||||
if (configCreateResponse.hasError()) {
|
||||
for (Error error : configCreateResponse.getErrors()) {
|
||||
validate.add(error.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
});
|
||||
// 当导入出现错误时可以将存在标注错误的Excel返回给用户改正
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package xyz.wbsite.action.ajax.admin;
|
||||
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import xyz.wbsite.frame.base.Error;
|
||||
import xyz.wbsite.frame.excel.WExcel;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.frame.utils.ResponseUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.frame.excel.exception.TemplateNotMatchException;
|
||||
import xyz.wbsite.module.admin.ent.ConfigData;
|
||||
import xyz.wbsite.module.admin.mgr.ConfigDataManager;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataUpdateResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigDataAjax{
|
||||
|
||||
@Autowired
|
||||
private ConfigDataManager configDataManager;
|
||||
|
||||
public ConfigDataCreateResponse create(ConfigDataCreateRequest request) {
|
||||
return configDataManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ConfigDataDeleteResponse delete(ConfigDataDeleteRequest request) {
|
||||
return configDataManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ConfigDataUpdateResponse update(ConfigDataUpdateRequest request) {
|
||||
return configDataManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public ConfigDataFindResponse find(ConfigDataFindRequest request) {
|
||||
return configDataManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WExcel<>(ConfigData.class));
|
||||
}
|
||||
|
||||
public Object exports(ConfigDataFindRequest request) {
|
||||
ConfigDataFindResponse response = configDataManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WExcel<>(ConfigData.class).addDatas(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
// 检查文件格式
|
||||
String originalFilename = file.getOriginalFilename() != null ? file.getOriginalFilename() : "";
|
||||
if (!originalFilename.matches(".+(.xlsx?|.XLSX?)$")) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件格式错误!");
|
||||
return baseResponse;
|
||||
}
|
||||
// 兼容2003以前老版本.xls
|
||||
ExcelTypeEnum excelTypeEnum = originalFilename.matches(".+(.xlsx|.XLSX)$") ? ExcelTypeEnum.XLSX : ExcelTypeEnum.XLS;
|
||||
WExcel sheet = new WExcel<>(ConfigData.class).read(file.getBytes(), excelTypeEnum, new WExcel.Processor<ConfigData>() {
|
||||
@Override
|
||||
public List<String> exec(ConfigData o, int index) {
|
||||
ConfigDataCreateRequest request = MapperUtil.map(o, ConfigDataCreateRequest.class);
|
||||
List<String> validate = ValidationUtil.validate(request);
|
||||
if (validate == null || validate.size() == 0) {
|
||||
ConfigDataCreateResponse configDataCreateResponse = configDataManager.create(request, LocalData.getToken());
|
||||
if (configDataCreateResponse.hasError()) {
|
||||
for (Error error : configDataCreateResponse.getErrors()) {
|
||||
validate.add(error.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
});
|
||||
// 当导入出现错误时可以将存在标注错误的Excel返回给用户改正
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package xyz.wbsite.action.ajax.admin;
|
||||
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import xyz.wbsite.frame.base.Error;
|
||||
import xyz.wbsite.frame.excel.WExcel;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.frame.utils.ResponseUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.frame.excel.exception.TemplateNotMatchException;
|
||||
import xyz.wbsite.module.admin.ent.Locations;
|
||||
import xyz.wbsite.module.admin.mgr.LocationsManager;
|
||||
import xyz.wbsite.module.admin.req.LocationsCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsFindRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsUpdateResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class LocationsAjax{
|
||||
|
||||
@Autowired
|
||||
private LocationsManager locationsManager;
|
||||
|
||||
public LocationsCreateResponse create(LocationsCreateRequest request) {
|
||||
return locationsManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LocationsDeleteResponse delete(LocationsDeleteRequest request) {
|
||||
return locationsManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LocationsUpdateResponse update(LocationsUpdateRequest request) {
|
||||
return locationsManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LocationsFindResponse find(LocationsFindRequest request) {
|
||||
return locationsManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WExcel<>(Locations.class));
|
||||
}
|
||||
|
||||
public Object exports(LocationsFindRequest request) {
|
||||
LocationsFindResponse response = locationsManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WExcel<>(Locations.class).addDatas(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
// 检查文件格式
|
||||
String originalFilename = file.getOriginalFilename() != null ? file.getOriginalFilename() : "";
|
||||
if (!originalFilename.matches(".+(.xlsx?|.XLSX?)$")) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件格式错误!");
|
||||
return baseResponse;
|
||||
}
|
||||
// 兼容2003以前老版本.xls
|
||||
ExcelTypeEnum excelTypeEnum = originalFilename.matches(".+(.xlsx|.XLSX)$") ? ExcelTypeEnum.XLSX : ExcelTypeEnum.XLS;
|
||||
WExcel sheet = new WExcel<>(Locations.class).read(file.getBytes(), excelTypeEnum, new WExcel.Processor<Locations>() {
|
||||
@Override
|
||||
public List<String> exec(Locations o, int index) {
|
||||
LocationsCreateRequest request = MapperUtil.map(o, LocationsCreateRequest.class);
|
||||
List<String> validate = ValidationUtil.validate(request);
|
||||
if (validate == null || validate.size() == 0) {
|
||||
LocationsCreateResponse locationsCreateResponse = locationsManager.create(request, LocalData.getToken());
|
||||
if (locationsCreateResponse.hasError()) {
|
||||
for (Error error : locationsCreateResponse.getErrors()) {
|
||||
validate.add(error.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
});
|
||||
// 当导入出现错误时可以将存在标注错误的Excel返回给用户改正
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package xyz.wbsite.action.ajax.conf;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import xyz.wbsite.frame.auth.LocalData;
|
||||
import xyz.wbsite.module.conf.mgr.MappingManager;
|
||||
import xyz.wbsite.module.conf.req.MappingCreateRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingDeleteRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingFindRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingGetRequest;
|
||||
import xyz.wbsite.module.conf.req.MappingUpdateRequest;
|
||||
import xyz.wbsite.module.conf.req.NginxReloadRequest;
|
||||
import xyz.wbsite.module.conf.rsp.MappingCreateResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingDeleteResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingFindResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingGetResponse;
|
||||
import xyz.wbsite.module.conf.rsp.MappingUpdateResponse;
|
||||
|
||||
public class MappingAjax {
|
||||
|
||||
@Autowired
|
||||
private MappingManager mappingManager;
|
||||
|
||||
public MappingCreateResponse create(MappingCreateRequest request) {
|
||||
MappingCreateResponse response = mappingManager.create(request, LocalData.getToken());
|
||||
if (!response.hasError()) {
|
||||
NginxAjax nginxAjax = LocalData.getBean(NginxAjax.class);
|
||||
nginxAjax.flushConfig();
|
||||
nginxAjax.reload(new NginxReloadRequest());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public MappingDeleteResponse delete(MappingDeleteRequest request) {
|
||||
MappingDeleteResponse response = mappingManager.delete(request, LocalData.getToken());
|
||||
if (!response.hasError()) {
|
||||
NginxAjax nginxAjax = LocalData.getBean(NginxAjax.class);
|
||||
nginxAjax.flushConfig();
|
||||
nginxAjax.reload(new NginxReloadRequest());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public MappingUpdateResponse update(MappingUpdateRequest request) {
|
||||
MappingUpdateResponse response = mappingManager.update(request, LocalData.getToken());
|
||||
if (!response.hasError()) {
|
||||
NginxAjax nginxAjax = LocalData.getBean(NginxAjax.class);
|
||||
nginxAjax.flushConfig();
|
||||
nginxAjax.reload(new NginxReloadRequest());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public MappingFindResponse find(MappingFindRequest request) {
|
||||
return mappingManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public MappingGetResponse get(MappingGetRequest request) {
|
||||
return mappingManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
package xyz.wbsite.action.ajax.conf;
|
||||
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
import xyz.wbsite.frame.auth.LocalData;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.SortType;
|
||||
import xyz.wbsite.frame.utils.ProcessUtil;
|
||||
import xyz.wbsite.module.conf.ent.Mapping;
|
||||
import xyz.wbsite.module.conf.ent.NginxCtrl;
|
||||
import xyz.wbsite.module.conf.mgr.MappingManager;
|
||||
import xyz.wbsite.module.conf.req.MappingFindRequest;
|
||||
import xyz.wbsite.module.conf.req.NginxReloadRequest;
|
||||
import xyz.wbsite.module.conf.req.NginxStartRequest;
|
||||
import xyz.wbsite.module.conf.req.NginxStopRequest;
|
||||
import xyz.wbsite.module.conf.rsp.MappingFindResponse;
|
||||
import xyz.wbsite.module.conf.rsp.NginxReloadResponse;
|
||||
import xyz.wbsite.module.conf.rsp.NginxStartResponse;
|
||||
import xyz.wbsite.module.conf.rsp.NginxStopResponse;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NginxAjax {
|
||||
|
||||
@Autowired
|
||||
private NginxCtrl nginxCtrl;
|
||||
@Autowired
|
||||
private MappingManager mappingManager;
|
||||
@Autowired
|
||||
private FreeMarkerConfigurer freeMarkerConfigurer;
|
||||
|
||||
public NginxStartResponse start(NginxStartRequest request) {
|
||||
NginxStartResponse response = new NginxStartResponse();
|
||||
if (nginxCtrl.isRunning()) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "程序已经运行");
|
||||
return response;
|
||||
}
|
||||
ProcessUtil.execBat(nginxCtrl.getStartCmd());
|
||||
return response;
|
||||
}
|
||||
|
||||
public NginxStopResponse stop(NginxStopRequest request) {
|
||||
NginxStopResponse response = new NginxStopResponse();
|
||||
if (!nginxCtrl.isRunning()) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "程序尚未运行");
|
||||
return response;
|
||||
}
|
||||
ProcessUtil.execBat(nginxCtrl.getStopCmd());
|
||||
return response;
|
||||
}
|
||||
|
||||
public NginxReloadResponse reload(NginxReloadRequest request) {
|
||||
NginxReloadResponse response = new NginxReloadResponse();
|
||||
if (!nginxCtrl.isRunning()) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "程序尚未运行");
|
||||
return response;
|
||||
}
|
||||
// 刷新配置文件
|
||||
flushConfig();
|
||||
// 重新加载配置文件
|
||||
ProcessUtil.execBat(nginxCtrl.getReloadCmd());
|
||||
return response;
|
||||
}
|
||||
|
||||
public synchronized void flushConfig() {
|
||||
Writer wr = null;
|
||||
try {
|
||||
File config = nginxCtrl.getConfig();
|
||||
HashMap<String, Object> context = new HashMap<>();
|
||||
|
||||
MappingFindRequest mappingFindRequest = new MappingFindRequest();
|
||||
mappingFindRequest.setPageSize(0);
|
||||
mappingFindRequest.setSortKey("PORT");
|
||||
mappingFindRequest.setSortType(SortType.ASC);
|
||||
MappingFindResponse mappingFindResponse = mappingManager.find(mappingFindRequest, LocalData.getSysToken());
|
||||
|
||||
Map<String, List<Mapping>> services = new HashMap<>();
|
||||
|
||||
for (Mapping mapping : mappingFindResponse.getResult()) {
|
||||
|
||||
List<Mapping> mappings = services.get(mapping.getPort());
|
||||
|
||||
if (mappings == null) {
|
||||
mappings = new ArrayList<>();
|
||||
services.put(mapping.getPort(), mappings);
|
||||
}
|
||||
mappings.add(mapping);
|
||||
}
|
||||
|
||||
context.put("services", services);
|
||||
Template template = freeMarkerConfigurer.getConfiguration().getTemplate("nginx.conf.ftl");
|
||||
wr = new OutputStreamWriter(new FileOutputStream(config), "UTF-8");
|
||||
//写入
|
||||
template.process(context, wr);
|
||||
//关闭流
|
||||
wr.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (TemplateException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
wr.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package xyz.wbsite.action.ajax.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import xyz.wbsite.frame.auth.LocalData;
|
||||
import xyz.wbsite.frame.auth.Token;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.utils.CookieUtil;
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
import xyz.wbsite.frame.utils.MD5Util;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.module.system.req.UserLoginRequest;
|
||||
import xyz.wbsite.module.system.req.UserLogoutRequest;
|
||||
import xyz.wbsite.module.system.rsp.UserLoginResponse;
|
||||
import xyz.wbsite.module.system.rsp.UserLogoutResponse;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserAjax {
|
||||
|
||||
@Value("${web.url.auth.admin}")
|
||||
private String admin;
|
||||
@Value("${web.url.auth.pwd}")
|
||||
private String pwd;
|
||||
|
||||
public UserLoginResponse login(UserLoginRequest request, Token token, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
UserLoginResponse response = new UserLoginResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (request.getUsername().equals(admin)) {//超级管理员登录
|
||||
String generatePwd = MD5Util.generatePwd(request.getPassword());
|
||||
if (!generatePwd.equals(pwd)) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "用户名或密码错误!");
|
||||
} else {
|
||||
Date current = new Date();
|
||||
Calendar instance = Calendar.getInstance();
|
||||
instance.setTime(current);
|
||||
instance.add(Calendar.HOUR_OF_DAY, 1);//默认一个小时内有效
|
||||
|
||||
Token sysToken = LocalData.getSysToken();
|
||||
sysToken.setToken(IDgenerator.nextUUID());
|
||||
|
||||
Cookie cookie = CookieUtil.newCookie("token", sysToken.getToken());
|
||||
httpServletResponse.addCookie(cookie);
|
||||
response.setToken(sysToken.getToken());
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public UserLogoutResponse logout(UserLogoutRequest request, Token token) {
|
||||
UserLogoutResponse response = new UserLogoutResponse();
|
||||
CookieUtil.clearCookie("token");
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package xyz.wbsite.action.ajax.wframe;
|
||||
|
||||
import xyz.wbsite.frame.base.DictLoadRequest;
|
||||
import xyz.wbsite.frame.base.DictLoadResponse;
|
||||
import xyz.wbsite.frame.provider.DictProvider;
|
||||
import xyz.wbsite.frame.provider.FrameProvider;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
|
||||
public class DictAjax {
|
||||
|
||||
public DictLoadResponse load(DictLoadRequest request) {
|
||||
DictLoadResponse response = new DictLoadResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
DictProvider dictProvider = FrameProvider.getInstance().getDictProvider();
|
||||
response.setResult(dictProvider.getDict(request.getDictName()));
|
||||
return response;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package xyz.wbsite.action.api.conf;
|
||||
|
||||
import xyz.wbsite.frame.auth.LocalData;
|
||||
import xyz.wbsite.module.conf.mgr.MappingManager;
|
||||
import xyz.wbsite.module.conf.req.*;
|
||||
import xyz.wbsite.module.conf.rsp.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class MappingApi{
|
||||
|
||||
@Autowired
|
||||
private MappingManager mappingManager;
|
||||
|
||||
public MappingCreateResponse create(MappingCreateRequest request) {
|
||||
return mappingManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public MappingDeleteResponse delete(MappingDeleteRequest request) {
|
||||
return mappingManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public MappingUpdateResponse update(MappingUpdateRequest request) {
|
||||
return mappingManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public MappingFindResponse find(MappingFindRequest request) {
|
||||
return mappingManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public MappingGetResponse get(MappingGetRequest request) {
|
||||
return mappingManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package xyz.wbsite.action.control;
|
||||
|
||||
import xyz.wbsite.frame.base.Control;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class Header extends Control {
|
||||
|
||||
@Override
|
||||
public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package xyz.wbsite.action.screen;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.ui.Model;
|
||||
import xyz.wbsite.frame.base.Screen;
|
||||
import xyz.wbsite.module.conf.ent.NginxCtrl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class Home extends Screen {
|
||||
@Autowired
|
||||
private NginxCtrl nginxCtrl;
|
||||
@Value("${mapping.default.port}")
|
||||
private String serverPort;
|
||||
|
||||
@Override
|
||||
public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
model.addAttribute("run", nginxCtrl.isRunning() ? "true" : "false");
|
||||
model.addAttribute("serverPort", serverPort);
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package xyz.wbsite.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.system.ApplicationHome;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.StringUtils;
|
||||
import xyz.wbsite.frame.utils.FileUtil;
|
||||
import xyz.wbsite.frame.utils.ZipUtil;
|
||||
import xyz.wbsite.module.conf.ent.NginxCtrl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class NginxConfig {
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@Bean
|
||||
public NginxCtrl initNginx() {
|
||||
String property = environment.getProperty("nginx-path");
|
||||
File nginxHome = null;
|
||||
if (StringUtils.isEmpty(property)) {
|
||||
ApplicationHome home = new ApplicationHome(getClass());
|
||||
// 当前运行jar文件
|
||||
File jarFile = home.getSource() != null ? home.getSource() : home.getDir();
|
||||
|
||||
//jar同目录
|
||||
nginxHome = new File(jarFile.getParent(), "nginx");
|
||||
|
||||
if (!nginxHome.exists()) {
|
||||
ClassPathResource classPathResource = new ClassPathResource("nginx-1.16.1.zip");
|
||||
try {
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
File nginxDir = new File(jarFile.getParent(), "nginx");
|
||||
File nginxZip = new File(jarFile.getParent(), "nginx.zip");
|
||||
FileUtil.inputStream2File(inputStream, nginxZip);
|
||||
ZipUtil.unZip(nginxZip, nginxDir);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nginxHome = new File(property);
|
||||
}
|
||||
|
||||
if (!nginxHome.exists()) {
|
||||
throw new RuntimeException("nginx home not exists!");
|
||||
}
|
||||
|
||||
File start = new File(nginxHome, "start.bat");
|
||||
File stop = new File(nginxHome, "stop.bat");
|
||||
File reload = new File(nginxHome, "reload.bat");
|
||||
|
||||
NginxCtrl nginxCtrl = new NginxCtrl();
|
||||
nginxCtrl.setStartCmd(start.getAbsolutePath());
|
||||
nginxCtrl.setStopCmd(stop.getAbsolutePath());
|
||||
nginxCtrl.setReloadCmd(reload.getAbsolutePath());
|
||||
nginxCtrl.setVersionCmd(nginxHome.getAbsolutePath() + " -v ");
|
||||
nginxCtrl.setConfig(new File(new File(nginxHome, "conf"), "nginx.conf"));
|
||||
return nginxCtrl;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.DictEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DictLoadResponse extends BaseResponse {
|
||||
|
||||
private List<DictEntity> result = new ArrayList<>();
|
||||
|
||||
public List<DictEntity> getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(List<DictEntity> result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public void put(DictEntity entity) {
|
||||
this.result.add(entity);
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class LogTaskEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* TASK_ID - 任务主键
|
||||
*/
|
||||
private String taskId;
|
||||
/**
|
||||
* TASK_NAME - 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
/**
|
||||
* START_TIME - 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* END_TIME - 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* EXEC_TIME - 执行耗时
|
||||
*/
|
||||
private Integer execTime;
|
||||
/**
|
||||
* EXEC_STATE - 执行状态
|
||||
*/
|
||||
private String execState;
|
||||
/**
|
||||
* EXEC_RESULT - 执行结果
|
||||
*/
|
||||
private String execResult;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Integer getExecTime() {
|
||||
return execTime;
|
||||
}
|
||||
|
||||
public void setExecTime(Integer execTime) {
|
||||
this.execTime = execTime;
|
||||
}
|
||||
|
||||
public String getExecState() {
|
||||
return execState;
|
||||
}
|
||||
|
||||
public void setExecState(String execState) {
|
||||
this.execState = execState;
|
||||
}
|
||||
|
||||
public String getExecResult() {
|
||||
return execResult;
|
||||
}
|
||||
|
||||
public void setExecResult(String execResult) {
|
||||
this.execResult = execResult;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* LoginRequest - 登录
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class LoginRequest extends BaseRequest {
|
||||
|
||||
@NotBlank(message = "[username]用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@NotBlank(message = "[password]用户密码不能为空")
|
||||
private String password;
|
||||
|
||||
@NotNull(message = "[verifyCodeId]验证码ID不能为空")
|
||||
private Long verifyCodeId;
|
||||
|
||||
@NotBlank(message = "[verifyCodeCode]验证码不能为空")
|
||||
private String verifyCodeCode;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Long getVerifyCodeId() {
|
||||
return verifyCodeId;
|
||||
}
|
||||
|
||||
public void setVerifyCodeId(Long verifyCodeId) {
|
||||
this.verifyCodeId = verifyCodeId;
|
||||
}
|
||||
|
||||
public String getVerifyCodeCode() {
|
||||
return verifyCodeCode;
|
||||
}
|
||||
|
||||
public void setVerifyCodeCode(String verifyCodeCode) {
|
||||
this.verifyCodeCode = verifyCodeCode;
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package xyz.wbsite.module.system.rsp;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* UserLoginResponse - 登录响应
|
||||
* LoginResponse - 登录响应
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class UserLoginResponse extends BaseResponse {
|
||||
public class LoginResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* token
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LogoutResponse - 用户登出
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class LogoutResponse extends BaseResponse {
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SqlTaskEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* TASK_NAME - 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
/**
|
||||
* TASK_NOTE - 详细注释
|
||||
*/
|
||||
private String taskNote;
|
||||
/**
|
||||
* 任务类型.
|
||||
* Cron:Cron表达式
|
||||
* DelayRepeat:间隔重复(秒)
|
||||
* FixRepeat:绝对重复(秒)
|
||||
*/
|
||||
private String taskType;
|
||||
/**
|
||||
* TYPE_VALUE - 任务类型值
|
||||
*/
|
||||
private String typeValue;
|
||||
/**
|
||||
* TASK_SQL - 任务SQL
|
||||
*/
|
||||
private String taskSql;
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public String getTaskNote() {
|
||||
return taskNote;
|
||||
}
|
||||
|
||||
public void setTaskNote(String taskNote) {
|
||||
this.taskNote = taskNote;
|
||||
}
|
||||
|
||||
public String getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(String taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public String getTypeValue() {
|
||||
return typeValue;
|
||||
}
|
||||
|
||||
public void setTypeValue(String typeValue) {
|
||||
this.typeValue = typeValue;
|
||||
}
|
||||
|
||||
public String getTaskSql() {
|
||||
return taskSql;
|
||||
}
|
||||
|
||||
public void setTaskSql(String taskSql) {
|
||||
this.taskSql = taskSql;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
/**
|
||||
* VerifyCodeRequest - 请求验证码
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-12-24
|
||||
*/
|
||||
public class VerifyCodeRequest extends BaseRequest {
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.exception;
|
||||
|
||||
/**
|
||||
* Excel文件读取失败异常
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class ReadErrorException extends Exception {
|
||||
public ReadErrorException() {
|
||||
}
|
||||
|
||||
public ReadErrorException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.exception;
|
||||
|
||||
/**
|
||||
* 值转换异常
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class ValueConverterException extends Exception {
|
||||
|
||||
public ValueConverterException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package xyz.wbsite.frame.excel.handler;
|
||||
|
||||
import com.alibaba.excel.metadata.CellData;
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.handler.AbstractCellWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public abstract class HeadWriteHandler extends AbstractCellWriteHandler {
|
||||
|
||||
@Override
|
||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||
super.afterCellDispose(writeSheetHolder, writeTableHolder, cellDataList, cell, head, relativeRowIndex, isHead);
|
||||
if (isHead) {
|
||||
handlerHead(head);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void handlerHead(Head head);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package xyz.wbsite.frame.excel.handler;
|
||||
|
||||
import com.alibaba.excel.metadata.CellData;
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.handler.CellWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import xyz.wbsite.frame.excel.WHead;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WCellWriteHandler implements CellWriteHandler {
|
||||
private CellStyle[] styles;
|
||||
|
||||
private Map<Integer, List<String>> errMap;
|
||||
|
||||
public WCellWriteHandler(List<WHead> wHeads, CellStyle[] styles, Map<Integer, List<String>> errMap) {
|
||||
this.styles = styles;
|
||||
this.errMap = errMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> list, Cell cell, Head head, Integer rowIndex, Boolean isHead) {
|
||||
if (isHead) {
|
||||
cell.setCellStyle(styles[0]);
|
||||
} else if (errMap.get(rowIndex) != null) {
|
||||
cell.setCellStyle(styles[1]);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* Created on 2015/1/29.
|
||||
*
|
||||
* @author
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class BaseCellStyle {
|
||||
/**
|
||||
* 样式
|
||||
*/
|
||||
protected CellStyle style;
|
||||
|
||||
public BaseCellStyle(Workbook workbook) {
|
||||
style = workbook.createCellStyle();
|
||||
style.setFillPattern(CellStyle.NO_FILL);
|
||||
//下边框
|
||||
style.setBorderBottom(CellStyle.SOLID_FOREGROUND);
|
||||
//下边框颜色
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
||||
//左边框
|
||||
style.setBorderLeft(CellStyle.SOLID_FOREGROUND);
|
||||
//左边框颜色
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
||||
//右边框
|
||||
style.setBorderRight(CellStyle.SOLID_FOREGROUND);
|
||||
//右边框颜色
|
||||
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
||||
//上边框
|
||||
style.setBorderTop(CellStyle.SOLID_FOREGROUND);
|
||||
//上边框颜色
|
||||
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //上下居中
|
||||
style.setBorderBottom(CellStyle.SOLID_FOREGROUND); //下边框
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); //下边框颜色
|
||||
style.setBorderLeft(CellStyle.SOLID_FOREGROUND); //左边框
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); //左边框颜色
|
||||
style.setBorderRight(CellStyle.SOLID_FOREGROUND); //右边框
|
||||
style.setRightBorderColor(IndexedColors.BLACK.getIndex()); //右边框颜色
|
||||
style.setBorderTop(CellStyle.SOLID_FOREGROUND); //上边框
|
||||
style.setTopBorderColor(IndexedColors.BLACK.getIndex()); //上边框颜色
|
||||
}
|
||||
|
||||
public CellStyle getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(CellStyle style) {
|
||||
this.style = style;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* Created on 2015/1/29.
|
||||
*
|
||||
* @author
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class BaseFont {
|
||||
/**
|
||||
* 字体
|
||||
*/
|
||||
protected Font font;
|
||||
|
||||
public BaseFont(Workbook workbook) {
|
||||
font = workbook.createFont();
|
||||
}
|
||||
|
||||
public Font getFont() {
|
||||
return font;
|
||||
}
|
||||
|
||||
public void setFont(Font font) {
|
||||
this.font = font;
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* 普通字体.颜色黑
|
||||
* Created on 2015/1/29.
|
||||
*
|
||||
* @author
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class NormalFont extends BaseFont {
|
||||
public NormalFont(Workbook workbook) {
|
||||
super(workbook);
|
||||
font.setColor(HSSFColor.BLACK.index); //字体颜色-黑色
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package xyz.wbsite.frame.excel.style;
|
||||
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
public class SuccessCellStyle extends BaseCellStyle {
|
||||
|
||||
public SuccessCellStyle(Workbook workbook) {
|
||||
super(workbook);
|
||||
style.setFillForegroundColor(HSSFColor.GREEN.index); //背景颜色红色
|
||||
style.setFillPattern(CellStyle.SOLID_FOREGROUND); //设置单元格填充样式
|
||||
}
|
||||
|
||||
public CellStyle getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(CellStyle style) {
|
||||
this.style = style;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package xyz.wbsite.frame.listener;
|
||||
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FrameListener {
|
||||
|
||||
private static FrameListener ourInstance = new FrameListener();
|
||||
|
||||
public static FrameListener getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private FrameListener() {
|
||||
}
|
||||
|
||||
public void onRes(String res) {
|
||||
Map<String, IResListener> beansOfType = LocalData.getApplicationContext().getBeansOfType(IResListener.class);
|
||||
for (IResListener resListener : beansOfType.values()) {
|
||||
resListener.onRes(res);
|
||||
}
|
||||
}
|
||||
|
||||
public void onError(Throwable throwable) {
|
||||
Map<String, IErrorListener> beansOfType = LocalData.getApplicationContext().getBeansOfType(IErrorListener.class);
|
||||
for (IErrorListener errorListener : beansOfType.values()) {
|
||||
errorListener.error(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public void onError(String message) {
|
||||
onError(new RuntimeException(message));
|
||||
}
|
||||
|
||||
public void onTaskError(Throwable error) {
|
||||
Map<String, IErrorListener> beansOfType = LocalData.getApplicationContext().getBeansOfType(IErrorListener.class);
|
||||
for (IErrorListener errorListener : beansOfType.values()) {
|
||||
errorListener.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void onTaskError(String message) {
|
||||
onTaskError(new RuntimeException(message));
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package xyz.wbsite.frame.listener;
|
||||
|
||||
/**
|
||||
* 系统错误监听器
|
||||
*/
|
||||
public interface IErrorListener {
|
||||
|
||||
void error(Throwable error);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.DictEntity;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public interface DictProvider {
|
||||
|
||||
List<DictEntity> getDict(@NotNull String dictName);
|
||||
|
||||
boolean isExist(@NotNull String dictName);
|
||||
|
||||
boolean isExistValue(@NotNull String dictName, @NotNull String dictKey);
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class FrameProvider {
|
||||
|
||||
private static FrameProvider ourInstance = new FrameProvider();
|
||||
|
||||
public static FrameProvider getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private FrameProvider() {
|
||||
}
|
||||
|
||||
public UserProvider getUserProvider() {
|
||||
Map<String, UserProvider> beansOfType = LocalData.getApplicationContext().getBeansOfType(UserProvider.class);
|
||||
if (beansOfType.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
Iterator<String> iterator = beansOfType.keySet().iterator();
|
||||
String name = iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
name = !"simpleUserProvider".equals(next) ? next : name;
|
||||
}
|
||||
return beansOfType.get(name);
|
||||
}
|
||||
|
||||
public TokenProvider getTokenProvider() {
|
||||
Map<String, TokenProvider> beansOfType = LocalData.getApplicationContext().getBeansOfType(TokenProvider.class);
|
||||
if (beansOfType.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
Iterator<String> iterator = beansOfType.keySet().iterator();
|
||||
String name = iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
name = !"simpleTokenProvider".equals(next) ? next : name;
|
||||
}
|
||||
return beansOfType.get(name);
|
||||
}
|
||||
|
||||
public ProfileProvider getProfileProvider() {
|
||||
Map<String, ProfileProvider> beansOfType = LocalData.getApplicationContext().getBeansOfType(ProfileProvider.class);
|
||||
if (beansOfType.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
Iterator<String> iterator = beansOfType.keySet().iterator();
|
||||
String name = iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
name = !"simpleProfileProvider".equals(next) ? next : name;
|
||||
}
|
||||
return beansOfType.get(name);
|
||||
}
|
||||
|
||||
public DictProvider getDictProvider() {
|
||||
Map<String, DictProvider> beansOfType = LocalData.getApplicationContext().getBeansOfType(DictProvider.class);
|
||||
if (beansOfType.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
Iterator<String> iterator = beansOfType.keySet().iterator();
|
||||
String name = iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
name = !"simpleDictProvider".equals(next) ? next : name;
|
||||
}
|
||||
return beansOfType.get(name);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.LogTaskEntity;
|
||||
|
||||
public interface LogTaskCollector {
|
||||
void collector(LogTaskEntity entity);
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.utils.StringUtil;
|
||||
|
||||
public class SimpleProfileProvider implements ProfileProvider {
|
||||
|
||||
@Override
|
||||
public String getString(String key, String defaultValue) {
|
||||
return LocalData.getProperty(key, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(String key, int defaultValue) {
|
||||
String string = getString(key, String.valueOf(defaultValue));
|
||||
if (!StringUtil.isEmpty(string)) {
|
||||
try {
|
||||
return Integer.parseInt(string);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong(String key, long defaultValue) {
|
||||
String string = this.getString(key, String.valueOf(defaultValue));
|
||||
if (!StringUtil.isEmpty(string)) {
|
||||
try {
|
||||
return Long.parseLong(string);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(String key, boolean defaultValue) {
|
||||
String string = this.getString(key, String.valueOf(defaultValue));
|
||||
if (!StringUtil.isEmpty(string)) {
|
||||
try {
|
||||
return Boolean.parseBoolean(string);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import xyz.wbsite.config.CacheConfig;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.base.UserEntity;
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Component
|
||||
public class SimpleTokenProvider implements TokenProvider {
|
||||
|
||||
@Autowired
|
||||
private CacheConfig cacheConfig;
|
||||
|
||||
public Token build(@NotNull UserEntity userEntity) {
|
||||
Token token = new Token();
|
||||
token.setId(IDgenerator.nextId());
|
||||
token.setUserId(userEntity.getId());
|
||||
token.setToken(IDgenerator.nextUUID());
|
||||
token.setUserName(userEntity.getUserName());
|
||||
token.setUserAlias(userEntity.getUserAlias());
|
||||
token.putRes(userEntity.getResSet());
|
||||
cacheConfig.put(token.getToken(), token, 3 * 60 * 60 * 1000);
|
||||
return token;
|
||||
}
|
||||
|
||||
public Token build(@NotNull String token) {
|
||||
// 检索缓存Token
|
||||
Object o = cacheConfig.get(token);
|
||||
if (o != null && o instanceof Token) {
|
||||
return (Token) o;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.UserEntity;
|
||||
|
||||
@Component
|
||||
public class SimpleUserProvider implements UserProvider {
|
||||
|
||||
public UserEntity getUser(String username) {
|
||||
String admin = LocalData.getProperty("web.url.auth.admin", "");
|
||||
if (!username.equals(admin)) {
|
||||
return null;
|
||||
}
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setId(0L);
|
||||
userEntity.setUserName(username);
|
||||
userEntity.setUserAlias("超级管理员");
|
||||
userEntity.setPassword(LocalData.getProperty("web.url.auth.pwd", ""));
|
||||
userEntity.putRes(".*");
|
||||
return userEntity;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.SqlTaskEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SqlTaskProvider {
|
||||
List<SqlTaskEntity> getSqlTask();
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.base.UserEntity;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public interface TokenProvider {
|
||||
|
||||
Token build(@NotNull UserEntity userEntity);
|
||||
|
||||
Token build(@NotNull String token);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.UserEntity;
|
||||
|
||||
public interface UserProvider {
|
||||
|
||||
UserEntity getUser(String username);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package xyz.wbsite.frame.provider;
|
||||
|
||||
import xyz.wbsite.frame.base.VisitorEntity;
|
||||
|
||||
public interface VisitorProvider {
|
||||
|
||||
VisitorEntity getVisitor(String appKey);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package xyz.wbsite.frame.schedule;
|
||||
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import xyz.wbsite.frame.auth.LocalData;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public abstract class RunSqlTask extends RunFixRepeatTask {
|
||||
|
||||
private Connection connection;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (connection == null || connection.isClosed()) {
|
||||
SqlSessionFactory factory = LocalData.getBean(SqlSessionFactory.class);
|
||||
SqlSession sqlSession = factory.openSession(true);
|
||||
connection = sqlSession.getConnection();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.e("schedule: get connection failed!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(getSql());
|
||||
preparedStatement.execute();
|
||||
preparedStatement.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.e("RunSqlTask exec failed! SQL:[" + getSql() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String getSql();
|
||||
}
|
@ -1,21 +1,93 @@
|
||||
package xyz.wbsite.frame.schedule;
|
||||
|
||||
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
import xyz.wbsite.frame.base.LogTaskEntity;
|
||||
import xyz.wbsite.frame.provider.LogTaskCollector;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
/**
|
||||
* 抽象任务
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-01
|
||||
*/
|
||||
public abstract class RunTask implements Runnable {
|
||||
|
||||
public abstract String taskId();
|
||||
|
||||
public abstract ScheduledFuture<?> schedule(ThreadPoolTaskScheduler poolTaskScheduler);
|
||||
protected abstract void task();
|
||||
|
||||
public String taskName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void configChange(ThreadPoolTaskScheduler scheduler) {
|
||||
ScheduledFuture<?> schedule = scheduler.schedule(this, new Date());
|
||||
if (!schedule.cancel(true)) {
|
||||
public String taskNote() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LogTaskEntity logTaskEntity = new LogTaskEntity();
|
||||
logTaskEntity.setTaskId(taskId());
|
||||
logTaskEntity.setTaskName(taskName());
|
||||
logTaskEntity.setStartTime(new Date());
|
||||
try {
|
||||
boolean before = before();
|
||||
if (before) {
|
||||
task();
|
||||
}
|
||||
after();
|
||||
logTaskEntity.setExecState("1");
|
||||
logTaskEntity.setExecResult("成功");
|
||||
logTaskEntity.setEndTime(new Date());
|
||||
} catch (Exception e) {
|
||||
exception(e);
|
||||
// 保证异常信息不会超过字段长度
|
||||
String trace = LogUtil.getTrace(e);
|
||||
if (trace.length() > 496) {
|
||||
trace = trace.substring(0, 496);
|
||||
}
|
||||
logTaskEntity.setExecState("0");
|
||||
logTaskEntity.setExecResult(String.format("失败[%s]", trace));
|
||||
logTaskEntity.setEndTime(new Date());
|
||||
}
|
||||
try {
|
||||
// 任务执行结果
|
||||
logTaskEntity.setExecTime((int) (logTaskEntity.getEndTime().getTime() - logTaskEntity.getStartTime().getTime()));
|
||||
LogTaskCollector logtaskManager = LocalData.getBean(LogTaskCollector.class);
|
||||
if (logtaskManager != null) logtaskManager.collector(logTaskEntity);
|
||||
// todo 考虑是否将任务的异常归为故障
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务执行前执行
|
||||
*
|
||||
* @return 是否继续执行任务
|
||||
*/
|
||||
protected boolean before() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务执行后执行
|
||||
*/
|
||||
protected void after() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行任务异常处理
|
||||
*/
|
||||
protected void exception(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
public abstract ScheduledFuture<?> schedule(ThreadPoolTaskScheduler poolTaskScheduler);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package xyz.wbsite.frame.sse;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class Sser {
|
||||
|
||||
private static ConcurrentHashMap<String, SseEmitter> sseMap = new ConcurrentHashMap();
|
||||
|
||||
/**
|
||||
* 注册推送服务
|
||||
*/
|
||||
public static SseEmitter register(String key, SseEmitter sseEmitter) {
|
||||
if (sseMap.get(key) != null) {
|
||||
sseMap.remove(key);
|
||||
}
|
||||
sseMap.put(key, sseEmitter);
|
||||
return sseEmitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息推送
|
||||
*
|
||||
* @param key key
|
||||
* @param data 推送数据
|
||||
*/
|
||||
public static void push(String key, Object data) {
|
||||
SseEmitter sseEmitter = sseMap.get(key);
|
||||
if (sseEmitter == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
sseEmitter.send(MapperUtil.toJson(data), MediaType.APPLICATION_JSON);
|
||||
} catch (IOException e) {
|
||||
sseMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息批量推送
|
||||
*
|
||||
* @param data 推送数据
|
||||
*/
|
||||
public static void pushAll(Object data) {
|
||||
for (String s : sseMap.keySet()) {
|
||||
try {
|
||||
sseMap.get(s).send(MapperUtil.toJson(data), MediaType.APPLICATION_JSON);
|
||||
} catch (IOException e) {
|
||||
sseMap.remove(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomUtil {
|
||||
|
||||
/**
|
||||
* 获取一个最小为[min,max)范围的随机数
|
||||
* @param min 最小(包含)
|
||||
* @param max 最大(不包含)
|
||||
* @return
|
||||
*/
|
||||
public static int getInt(int min, int max) {
|
||||
Random random = new Random();
|
||||
int nextInt = random.nextInt(max - min);
|
||||
return nextInt + min;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一串指定长度、并指定随机源的字符串
|
||||
* @param dict 随机源字典
|
||||
* @param len 长度
|
||||
* @return
|
||||
*/
|
||||
public static String getString(String dict, int len) {
|
||||
Random r = new Random();
|
||||
StringBuilder rs = new StringBuilder();
|
||||
for (int j = 0; j < len; j++) {
|
||||
rs.append(dict.charAt(r.nextInt(dict.length())));
|
||||
}
|
||||
return rs.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import xyz.wbsite.frame.base.LocalData;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class SqlUtil {
|
||||
|
||||
public static void exec(String sql) {
|
||||
SqlSession sqlSession = null;
|
||||
try {
|
||||
SqlSessionFactory factory = LocalData.getBean(SqlSessionFactory.class);
|
||||
sqlSession = factory.openSession(true);
|
||||
Connection connection = sqlSession.getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
statement.execute();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(String.format("[ %s ]执行错误!", sql));
|
||||
} finally {
|
||||
if (sqlSession != null) sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static int insert(String sql) {
|
||||
return update(sql);
|
||||
}
|
||||
|
||||
public static int delete(String sql) {
|
||||
return update(sql);
|
||||
}
|
||||
|
||||
public static int update(String sql) {
|
||||
SqlSession sqlSession = null;
|
||||
int result = 0;
|
||||
try {
|
||||
SqlSessionFactory factory = LocalData.getBean(SqlSessionFactory.class);
|
||||
sqlSession = factory.openSession(true);
|
||||
Connection connection = sqlSession.getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
result = statement.executeUpdate();
|
||||
statement.close();
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(String.format("[ %s ]执行错误!", sql));
|
||||
} finally {
|
||||
if (sqlSession != null) sqlSession.close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> List<T> select(String sql, Class<T> t) {
|
||||
List<T> result = new ArrayList<>();
|
||||
try {
|
||||
SqlSessionFactory factory = LocalData.getBean(SqlSessionFactory.class);
|
||||
SqlSession sqlSession = factory.openSession(true);
|
||||
Connection connection = sqlSession.getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
T instance = t.newInstance();
|
||||
Field[] fields = t.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
Method method = ClassUtil.setMethod(field.getName(), t, field.getType());
|
||||
if (field.getType() == String.class) {
|
||||
String v = resultSet.getString(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Boolean.class || field.getType() == boolean.class) {
|
||||
boolean v = resultSet.getBoolean(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Byte.class || field.getType() == byte.class) {
|
||||
byte v = resultSet.getByte(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Short.class || field.getType() == short.class) {
|
||||
short v = resultSet.getShort(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Character.class || field.getType() == char.class) {
|
||||
short v = resultSet.getShort(field.getName());
|
||||
method.invoke(instance, (char) v);
|
||||
} else if (field.getType() == Integer.class || field.getType() == int.class) {
|
||||
int v = resultSet.getInt(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Long.class || field.getType() == long.class) {
|
||||
long v = resultSet.getLong(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Float.class || field.getType() == float.class) {
|
||||
float v = resultSet.getFloat(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Double.class || field.getType() == double.class) {
|
||||
double v = resultSet.getDouble(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Byte[].class || field.getType() == byte[].class) {
|
||||
byte[] v = resultSet.getBytes(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else if (field.getType() == Date.class) {
|
||||
Date v = resultSet.getDate(field.getName());
|
||||
method.invoke(instance, v);
|
||||
} else {
|
||||
String v = resultSet.getString(field.getName());
|
||||
method.invoke(instance, v);
|
||||
}
|
||||
}
|
||||
result.add(instance);
|
||||
}
|
||||
statement.close();
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package xyz.wbsite.module.admin.ent;
|
||||
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelNote;
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelSelect;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import xyz.wbsite.frame.excel.annotation.ExcelSheet;
|
||||
import xyz.wbsite.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* SERVICES - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@ExcelSheet("虚拟主机")
|
||||
public class Services extends BaseEntity {
|
||||
|
||||
/**
|
||||
* TITLE - 主机标题
|
||||
*/
|
||||
@ExcelProperty("主机标题")
|
||||
@ExcelNote("")
|
||||
private String title;
|
||||
/**
|
||||
* DOMAIN - 主机域名
|
||||
*/
|
||||
@ExcelProperty("主机域名")
|
||||
@ExcelNote("")
|
||||
private String domain;
|
||||
/**
|
||||
* TYPE - 服务类型
|
||||
*/
|
||||
@ExcelProperty("服务类型")
|
||||
@ExcelNote("")
|
||||
private String type;
|
||||
/**
|
||||
* PORT - 服务端口
|
||||
*/
|
||||
@ExcelProperty("服务端口")
|
||||
@ExcelNote("")
|
||||
private Integer port;
|
||||
/**
|
||||
* VALID - 是否启用
|
||||
*/
|
||||
@ExcelProperty("是否启用")
|
||||
@ExcelNote("")
|
||||
@ExcelSelect({"是","否"})
|
||||
private Boolean valid;
|
||||
/**
|
||||
* FILTER - 启用过滤
|
||||
*/
|
||||
@ExcelProperty("启用过滤")
|
||||
@ExcelNote("")
|
||||
@ExcelSelect({"是","否"})
|
||||
private Boolean filter;
|
||||
/**
|
||||
* FILTER_CONF - 过滤配置
|
||||
*/
|
||||
@ExcelProperty("过滤配置")
|
||||
@ExcelNote("")
|
||||
private String filterConf;
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public Boolean getValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public void setValid(Boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getFilterConf() {
|
||||
return this.filterConf;
|
||||
}
|
||||
|
||||
public void setFilterConf(String filterConf) {
|
||||
this.filterConf = filterConf;
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
import xyz.wbsite.frame.utils.Message;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.module.admin.ent.ConfigData;
|
||||
import xyz.wbsite.module.admin.mpr.ConfigDataMapper;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDataUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDataUpdateResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* CONFIG_DATA - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class ConfigDataManagerImpl implements ConfigDataManager {
|
||||
|
||||
@Autowired
|
||||
private ConfigDataMapper configDataMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public ConfigDataCreateResponse create(ConfigDataCreateRequest request, Token token) {
|
||||
ConfigDataCreateResponse response = new ConfigDataCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
{// 配置名称唯一检查
|
||||
ConfigDataFindRequest configDataFindRequest = new ConfigDataFindRequest();
|
||||
configDataFindRequest.setConfName(request.getConfName());
|
||||
ConfigDataFindResponse configDataFindResponse = this.find(configDataFindRequest, token);
|
||||
if (configDataFindResponse.hasError()) {
|
||||
response.addErrors(configDataFindResponse.getErrors());
|
||||
return response;
|
||||
} else if (configDataFindResponse.getTotalCount() > 0) {
|
||||
response.addError(ErrorType.UNIQUENESS_ERROR, "[confName]配置名称已存在,请检查!");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
ConfigData entity = MapperUtil.map(request, ConfigData.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = configDataMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public ConfigDataDeleteResponse delete(ConfigDataDeleteRequest request, Token token) {
|
||||
ConfigDataDeleteResponse response = new ConfigDataDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = configDataMapper.delete(request.getId(), token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public ConfigDataUpdateResponse update(ConfigDataUpdateRequest request, Token token) {
|
||||
ConfigDataUpdateResponse response = new ConfigDataUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
ConfigData entity = configDataMapper.getById(request.getId(), token);
|
||||
if (entity == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
return response;
|
||||
}
|
||||
|
||||
MapperUtil.map(request, entity);
|
||||
long result = configDataMapper.update(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public ConfigDataFindResponse find(ConfigDataFindRequest request, Token token) {
|
||||
ConfigDataFindResponse response = new ConfigDataFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (request.getPageSize() != 0) {
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<ConfigData> pageInfo = new PageInfo<>(configDataMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.module.admin.req.ConfigCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ConfigUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigUpdateResponse;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 配置预设
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public interface ConfigManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigCreateResponse create(ConfigCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigDeleteResponse delete(ConfigDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigUpdateResponse update(ConfigUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
ConfigFindResponse find(ConfigFindRequest request, Token token);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.module.admin.req.LocationsCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsFindRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsUpdateResponse;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public interface LocationsManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LocationsCreateResponse create(LocationsCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LocationsDeleteResponse delete(LocationsDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LocationsUpdateResponse update(LocationsUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LocationsFindResponse find(LocationsFindRequest request, Token token);
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
import xyz.wbsite.frame.utils.Message;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.module.admin.ent.Locations;
|
||||
import xyz.wbsite.module.admin.mpr.LocationsMapper;
|
||||
import xyz.wbsite.module.admin.req.LocationsCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsFindRequest;
|
||||
import xyz.wbsite.module.admin.req.LocationsUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.LocationsUpdateResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* LOCATIONS - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class LocationsManagerImpl implements LocationsManager {
|
||||
|
||||
@Autowired
|
||||
private LocationsMapper locationsMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public LocationsCreateResponse create(LocationsCreateRequest request, Token token) {
|
||||
LocationsCreateResponse response = new LocationsCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
{// 配置标题唯一检查
|
||||
LocationsFindRequest locationsFindRequest = new LocationsFindRequest();
|
||||
locationsFindRequest.setLocalTitle(request.getLocalTitle());
|
||||
LocationsFindResponse locationsFindResponse = this.find(locationsFindRequest, token);
|
||||
if (locationsFindResponse.hasError()) {
|
||||
response.addErrors(locationsFindResponse.getErrors());
|
||||
return response;
|
||||
} else if (locationsFindResponse.getTotalCount() > 0) {
|
||||
response.addError(ErrorType.UNIQUENESS_ERROR, "[localTitle]配置标题已存在,请检查!");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
Locations entity = MapperUtil.map(request, Locations.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = locationsMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public LocationsDeleteResponse delete(LocationsDeleteRequest request, Token token) {
|
||||
LocationsDeleteResponse response = new LocationsDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = locationsMapper.delete(request.getId(), token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public LocationsUpdateResponse update(LocationsUpdateRequest request, Token token) {
|
||||
LocationsUpdateResponse response = new LocationsUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
Locations entity = locationsMapper.getById(request.getId(), token);
|
||||
if (entity == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
return response;
|
||||
}
|
||||
|
||||
MapperUtil.map(request, entity);
|
||||
long result = locationsMapper.update(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public LocationsFindResponse find(LocationsFindRequest request, Token token) {
|
||||
LocationsFindResponse response = new LocationsFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (request.getPageSize() != 0) {
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<Locations> pageInfo = new PageInfo<>(locationsMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package xyz.wbsite.module.admin.mgr;
|
||||
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
import xyz.wbsite.frame.utils.Message;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.module.admin.ent.Services;
|
||||
import xyz.wbsite.module.admin.mpr.ServicesMapper;
|
||||
import xyz.wbsite.module.admin.req.ServicesCreateRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesDeleteRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesFindRequest;
|
||||
import xyz.wbsite.module.admin.req.ServicesUpdateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesCreateResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesDeleteResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesFindResponse;
|
||||
import xyz.wbsite.module.admin.rsp.ServicesUpdateResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* SERVICES - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class ServicesManagerImpl implements ServicesManager {
|
||||
|
||||
@Autowired
|
||||
private ServicesMapper servicesMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public ServicesCreateResponse create(ServicesCreateRequest request, Token token) {
|
||||
ServicesCreateResponse response = new ServicesCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
{// 主机标题唯一检查
|
||||
ServicesFindRequest servicesFindRequest = new ServicesFindRequest();
|
||||
servicesFindRequest.setTitle(request.getTitle());
|
||||
ServicesFindResponse servicesFindResponse = this.find(servicesFindRequest, token);
|
||||
if (servicesFindResponse.hasError()) {
|
||||
response.addErrors(servicesFindResponse.getErrors());
|
||||
return response;
|
||||
} else if (servicesFindResponse.getTotalCount() > 0) {
|
||||
response.addError(ErrorType.UNIQUENESS_ERROR, "[title]主机标题已存在,请检查!");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
{// 主机域名唯一检查
|
||||
ServicesFindRequest servicesFindRequest = new ServicesFindRequest();
|
||||
servicesFindRequest.setDomain(request.getDomain());
|
||||
ServicesFindResponse servicesFindResponse = this.find(servicesFindRequest, token);
|
||||
if (servicesFindResponse.hasError()) {
|
||||
response.addErrors(servicesFindResponse.getErrors());
|
||||
return response;
|
||||
} else if (servicesFindResponse.getTotalCount() > 0) {
|
||||
response.addError(ErrorType.UNIQUENESS_ERROR, "[domain]主机域名已存在,请检查!");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
{// 服务端口唯一检查
|
||||
ServicesFindRequest servicesFindRequest = new ServicesFindRequest();
|
||||
servicesFindRequest.setPort(request.getPort());
|
||||
ServicesFindResponse servicesFindResponse = this.find(servicesFindRequest, token);
|
||||
if (servicesFindResponse.hasError()) {
|
||||
response.addErrors(servicesFindResponse.getErrors());
|
||||
return response;
|
||||
} else if (servicesFindResponse.getTotalCount() > 0) {
|
||||
response.addError(ErrorType.UNIQUENESS_ERROR, "[port]服务端口已存在,请检查!");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
Services entity = MapperUtil.map(request, Services.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = servicesMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public ServicesDeleteResponse delete(ServicesDeleteRequest request, Token token) {
|
||||
ServicesDeleteResponse response = new ServicesDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = servicesMapper.delete(request.getId(), token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public ServicesUpdateResponse update(ServicesUpdateRequest request, Token token) {
|
||||
ServicesUpdateResponse response = new ServicesUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
Services entity = servicesMapper.getById(request.getId(), token);
|
||||
if (entity == null) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
return response;
|
||||
}
|
||||
|
||||
MapperUtil.map(request, entity);
|
||||
long result = servicesMapper.update(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public ServicesFindResponse find(ServicesFindRequest request, Token token) {
|
||||
ServicesFindResponse response = new ServicesFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (request.getPageSize() != 0) {
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<Services> pageInfo = new PageInfo<>(servicesMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,187 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="xyz.wbsite.module.admin.mpr.ConfigDataMapper">
|
||||
|
||||
<sql id="table">"NA_CONFIG_DATA"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","TARGET_ID","CONF_NAME","CONF_TYPE","CONF_VALUE","CONF_NOTE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="configData" type="xyz.wbsite.module.admin.ent.ConfigData">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="TARGET_ID" jdbcType="BIGINT" property="targetId"/>
|
||||
<result column="CONF_NAME" jdbcType="VARCHAR" property="confName"/>
|
||||
<result column="CONF_TYPE" jdbcType="VARCHAR" property="confType"/>
|
||||
<result column="CONF_VALUE" jdbcType="VARCHAR" property="confValue"/>
|
||||
<result column="CONF_NOTE" jdbcType="VARCHAR" property="confNote"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.targetId,jdbcType=BIGINT},
|
||||
#{request.confName,jdbcType=VARCHAR},
|
||||
#{request.confType,jdbcType=VARCHAR},
|
||||
#{request.confValue,jdbcType=VARCHAR},
|
||||
#{request.confNote,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.id},
|
||||
#{item.targetId,jdbcType=BIGINT},
|
||||
#{item.confName,jdbcType=VARCHAR},
|
||||
#{item.confType,jdbcType=VARCHAR},
|
||||
#{item.confValue,jdbcType=VARCHAR},
|
||||
#{item.confNote,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteBatch">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
TARGET_ID = #{request.targetId,jdbcType=BIGINT},
|
||||
CONF_NAME = #{request.confName,jdbcType=VARCHAR},
|
||||
CONF_TYPE = #{request.confType,jdbcType=VARCHAR},
|
||||
CONF_VALUE = #{request.confValue,jdbcType=VARCHAR},
|
||||
CONF_NOTE = #{request.confNote,jdbcType=VARCHAR},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="select" resultMap="configData">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.targetId != null">
|
||||
AND "TARGET_ID" = #{request.targetId}
|
||||
</if>
|
||||
<if test="request.confName != null and request.confName != ''">
|
||||
AND "CONF_NAME" = #{request.confName}
|
||||
</if>
|
||||
<if test="request.confType != null and request.confType != ''">
|
||||
AND "CONF_TYPE" = #{request.confType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="find" resultMap="configData">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.targetId != null">
|
||||
AND "TARGET_ID" = #{request.targetId}
|
||||
</if>
|
||||
<if test="request.confName != null and request.confName != ''">
|
||||
AND "CONF_NAME" = #{request.confName}
|
||||
</if>
|
||||
<if test="request.confNameLike != null and request.confNameLike != ''">
|
||||
AND "CONF_NAME" LIKE '%'||#{request.confNameLike}||'%'
|
||||
</if>
|
||||
<if test="request.confType != null and request.confType != ''">
|
||||
AND "CONF_TYPE" = #{request.confType}
|
||||
</if>
|
||||
<if test="request.confValueLike != null and request.confValueLike != ''">
|
||||
AND "CONF_VALUE" LIKE '%'||#{request.confValueLike}||'%'
|
||||
</if>
|
||||
<if test="request.confNoteLike != null and request.confNoteLike != ''">
|
||||
AND "CONF_NOTE" LIKE '%'||#{request.confNoteLike}||'%'
|
||||
</if>
|
||||
<if test="request.startDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 <= #{request.endDate}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="configData">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
</select>
|
||||
|
||||
<select id="getById" resultMap="configData">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getByIds" resultMap="configData">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="xyz.wbsite.module.admin.mpr.ConfigMapper">
|
||||
|
||||
<sql id="table">"NA_CONFIG"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","CONF_NAME","CONF_TYPE","CONF_VALUE","CONF_NOTE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="config" type="xyz.wbsite.module.admin.ent.Config">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="CONF_NAME" jdbcType="VARCHAR" property="confName"/>
|
||||
<result column="CONF_TYPE" jdbcType="VARCHAR" property="confType"/>
|
||||
<result column="CONF_VALUE" jdbcType="VARCHAR" property="confValue"/>
|
||||
<result column="CONF_NOTE" jdbcType="VARCHAR" property="confNote"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.confName,jdbcType=VARCHAR},
|
||||
#{request.confType,jdbcType=VARCHAR},
|
||||
#{request.confValue,jdbcType=VARCHAR},
|
||||
#{request.confNote,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.id},
|
||||
#{item.confName,jdbcType=VARCHAR},
|
||||
#{item.confType,jdbcType=VARCHAR},
|
||||
#{item.confValue,jdbcType=VARCHAR},
|
||||
#{item.confNote,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteBatch">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
CONF_NAME = #{request.confName,jdbcType=VARCHAR},
|
||||
CONF_TYPE = #{request.confType,jdbcType=VARCHAR},
|
||||
CONF_VALUE = #{request.confValue,jdbcType=VARCHAR},
|
||||
CONF_NOTE = #{request.confNote,jdbcType=VARCHAR},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="select" resultMap="config">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.confName != null and request.confName != ''">
|
||||
AND "CONF_NAME" = #{request.confName}
|
||||
</if>
|
||||
<if test="request.confType != null and request.confType != ''">
|
||||
AND "CONF_TYPE" = #{request.confType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="find" resultMap="config">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.confName != null and request.confName != ''">
|
||||
AND "CONF_NAME" = #{request.confName}
|
||||
</if>
|
||||
<if test="request.confNameLike != null and request.confNameLike != ''">
|
||||
AND "CONF_NAME" LIKE '%'||#{request.confNameLike}||'%'
|
||||
</if>
|
||||
<if test="request.confType != null and request.confType != ''">
|
||||
AND "CONF_TYPE" = #{request.confType}
|
||||
</if>
|
||||
<if test="request.confValueLike != null and request.confValueLike != ''">
|
||||
AND "CONF_VALUE" LIKE '%'||#{request.confValueLike}||'%'
|
||||
</if>
|
||||
<if test="request.confNoteLike != null and request.confNoteLike != ''">
|
||||
AND "CONF_NOTE" LIKE '%'||#{request.confNoteLike}||'%'
|
||||
</if>
|
||||
<if test="request.startDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 <= #{request.endDate}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="config">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
</select>
|
||||
|
||||
<select id="getById" resultMap="config">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getByIds" resultMap="config">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,100 @@
|
||||
package xyz.wbsite.module.admin.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.module.admin.ent.Locations;
|
||||
import xyz.wbsite.module.admin.req.LocationsFindRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* LOCATIONS - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface LocationsMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") Locations request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param list 对象集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<Locations> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除
|
||||
*
|
||||
* @param list 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long deleteBatch(@Param("list") List<Long> list, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") Locations request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 普通查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Locations> select(@Param("request") Locations request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 高级查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Locations> find(@Param("request") LocationsFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param id 主键
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
Locations getById(@Param("id") Long id, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Locations> getByIds(@Param("ids") Long[] ids, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="xyz.wbsite.module.admin.mpr.ServicesMapper">
|
||||
|
||||
<sql id="table">"NA_SERVICES"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","TITLE","DOMAIN","TYPE","PORT","VALID","FILTER","FILTER_CONF","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="services" type="xyz.wbsite.module.admin.ent.Services">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="TITLE" jdbcType="VARCHAR" property="title"/>
|
||||
<result column="DOMAIN" jdbcType="VARCHAR" property="domain"/>
|
||||
<result column="TYPE" jdbcType="VARCHAR" property="type"/>
|
||||
<result column="PORT" jdbcType="INTEGER" property="port"/>
|
||||
<result column="VALID" jdbcType="BIT" property="valid"/>
|
||||
<result column="FILTER" jdbcType="BIT" property="filter"/>
|
||||
<result column="FILTER_CONF" jdbcType="VARCHAR" property="filterConf"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.title,jdbcType=VARCHAR},
|
||||
#{request.domain,jdbcType=VARCHAR},
|
||||
#{request.type,jdbcType=VARCHAR},
|
||||
#{request.port,jdbcType=INTEGER},
|
||||
#{request.valid,jdbcType=BIT},
|
||||
#{request.filter,jdbcType=BIT},
|
||||
#{request.filterConf,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.id},
|
||||
#{item.title,jdbcType=VARCHAR},
|
||||
#{item.domain,jdbcType=VARCHAR},
|
||||
#{item.type,jdbcType=VARCHAR},
|
||||
#{item.port,jdbcType=INTEGER},
|
||||
#{item.valid,jdbcType=BIT},
|
||||
#{item.filter,jdbcType=BIT},
|
||||
#{item.filterConf,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteBatch">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
TITLE = #{request.title,jdbcType=VARCHAR},
|
||||
DOMAIN = #{request.domain,jdbcType=VARCHAR},
|
||||
TYPE = #{request.type,jdbcType=VARCHAR},
|
||||
PORT = #{request.port,jdbcType=INTEGER},
|
||||
VALID = #{request.valid,jdbcType=BIT},
|
||||
FILTER = #{request.filter,jdbcType=BIT},
|
||||
FILTER_CONF = #{request.filterConf,jdbcType=VARCHAR},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="select" resultMap="services">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.title != null and request.title != ''">
|
||||
AND "TITLE" = #{request.title}
|
||||
</if>
|
||||
<if test="request.domain != null and request.domain != ''">
|
||||
AND "DOMAIN" = #{request.domain}
|
||||
</if>
|
||||
<if test="request.type != null and request.type != ''">
|
||||
AND "TYPE" = #{request.type}
|
||||
</if>
|
||||
<if test="request.port != null">
|
||||
AND "PORT" = #{request.port}
|
||||
</if>
|
||||
<if test="request.valid != null">
|
||||
AND "VALID" = #{request.valid}
|
||||
</if>
|
||||
<if test="request.filter != null">
|
||||
AND "FILTER" = #{request.filter}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="find" resultMap="services">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
<if test="request.title != null and request.title != ''">
|
||||
AND "TITLE" = #{request.title}
|
||||
</if>
|
||||
<if test="request.titleLike != null and request.titleLike != ''">
|
||||
AND "TITLE" LIKE '%'||#{request.titleLike}||'%'
|
||||
</if>
|
||||
<if test="request.domain != null and request.domain != ''">
|
||||
AND "DOMAIN" = #{request.domain}
|
||||
</if>
|
||||
<if test="request.type != null and request.type != ''">
|
||||
AND "TYPE" = #{request.type}
|
||||
</if>
|
||||
<if test="request.port != null">
|
||||
AND "PORT" = #{request.port}
|
||||
</if>
|
||||
<if test="request.valid != null">
|
||||
AND "VALID" = #{request.valid}
|
||||
</if>
|
||||
<if test="request.filter != null">
|
||||
AND "FILTER" = #{request.filter}
|
||||
</if>
|
||||
<if test="request.startDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate != null">
|
||||
AND strftime('%s',"CREATE_TIME", 'utc')*1000 <= #{request.endDate}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="services">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
</select>
|
||||
|
||||
<select id="getById" resultMap="services">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getByIds" resultMap="services">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" IN
|
||||
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,93 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ConfigDataCreateRequest - 配置数据新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 目标主键.
|
||||
*/
|
||||
@NotNull(message = "[targetId]目标主键不能为NULL")
|
||||
private Long targetId;
|
||||
|
||||
/**
|
||||
* 配置名称.
|
||||
*/
|
||||
@NotBlank(message = "[confName]配置名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[confName]配置名称长度不合法(0-50)")
|
||||
private String confName;
|
||||
|
||||
/**
|
||||
* 配置类型.
|
||||
* HTTP:全局配置
|
||||
* SERVER:主机配置
|
||||
* LOCATION:路径配置
|
||||
*/
|
||||
@NotNull(message = "[confType]配置类型不能为NULL")
|
||||
@Select({"HTTP", "SERVER", "LOCATION"})
|
||||
private String confType;
|
||||
|
||||
/**
|
||||
* 配置属值.
|
||||
*/
|
||||
@NotBlank(message = "[confValue]配置属值不能为空")
|
||||
@Length(min = 0, max = 255, message = "[confValue]配置属值长度不合法(0-255)")
|
||||
private String confValue;
|
||||
|
||||
/**
|
||||
* 配置备注.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[confNote]配置备注长度不合法(0-255)")
|
||||
private String confNote;
|
||||
|
||||
public Long getTargetId() {
|
||||
return this.targetId;
|
||||
}
|
||||
|
||||
public void setTargetId(Long targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValue() {
|
||||
return this.confValue;
|
||||
}
|
||||
|
||||
public void setConfValue(String confValue) {
|
||||
this.confValue = confValue;
|
||||
}
|
||||
|
||||
public String getConfNote() {
|
||||
return this.confNote;
|
||||
}
|
||||
|
||||
public void setConfNote(String confNote) {
|
||||
this.confNote = confNote;
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||
import java.util.Date;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ConfigDataFindRequest - 配置数据查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigDataFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 目标主键.
|
||||
*/
|
||||
private Long targetId;
|
||||
|
||||
/**
|
||||
* 配置名称.
|
||||
*/
|
||||
private String confName;
|
||||
|
||||
/**
|
||||
* 配置名称模糊查询.
|
||||
*/
|
||||
private String confNameLike;
|
||||
|
||||
/**
|
||||
* 配置类型.
|
||||
* HTTP:全局配置
|
||||
* SERVER:主机配置
|
||||
* LOCATION:路径配置
|
||||
*/
|
||||
@Select({"HTTP", "SERVER", "LOCATION"})
|
||||
private String confType;
|
||||
|
||||
/**
|
||||
* 配置属值模糊查询.
|
||||
*/
|
||||
private String confValueLike;
|
||||
|
||||
/**
|
||||
* 配置备注模糊查询.
|
||||
*/
|
||||
private String confNoteLike;
|
||||
|
||||
/**
|
||||
* 开始日期.
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期.
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
public Long getTargetId() {
|
||||
return this.targetId;
|
||||
}
|
||||
|
||||
public void setTargetId(Long targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfNameLike() {
|
||||
return this.confNameLike;
|
||||
}
|
||||
|
||||
public void setConfNameLike(String confNameLike) {
|
||||
this.confNameLike = confNameLike;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValueLike() {
|
||||
return this.confValueLike;
|
||||
}
|
||||
|
||||
public void setConfValueLike(String confValueLike) {
|
||||
this.confValueLike = confValueLike;
|
||||
}
|
||||
|
||||
public String getConfNoteLike() {
|
||||
return this.confNoteLike;
|
||||
}
|
||||
|
||||
public void setConfNoteLike(String confNoteLike) {
|
||||
this.confNoteLike = confNoteLike;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||
import java.util.Date;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ConfigFindRequest - 配置预设查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 配置名称.
|
||||
*/
|
||||
private String confName;
|
||||
|
||||
/**
|
||||
* 配置名称模糊查询.
|
||||
*/
|
||||
private String confNameLike;
|
||||
|
||||
/**
|
||||
* 配置类型.
|
||||
* HTTP:全局配置
|
||||
* SERVER:主机配置
|
||||
* LOCATION:路径配置
|
||||
*/
|
||||
@Select({"HTTP", "SERVER", "LOCATION"})
|
||||
private String confType;
|
||||
|
||||
/**
|
||||
* 配置属值模糊查询.
|
||||
*/
|
||||
private String confValueLike;
|
||||
|
||||
/**
|
||||
* 配置备注模糊查询.
|
||||
*/
|
||||
private String confNoteLike;
|
||||
|
||||
/**
|
||||
* 开始日期.
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期.
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfNameLike() {
|
||||
return this.confNameLike;
|
||||
}
|
||||
|
||||
public void setConfNameLike(String confNameLike) {
|
||||
this.confNameLike = confNameLike;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValueLike() {
|
||||
return this.confValueLike;
|
||||
}
|
||||
|
||||
public void setConfValueLike(String confValueLike) {
|
||||
this.confValueLike = confValueLike;
|
||||
}
|
||||
|
||||
public String getConfNoteLike() {
|
||||
return this.confNoteLike;
|
||||
}
|
||||
|
||||
public void setConfNoteLike(String confNoteLike) {
|
||||
this.confNoteLike = confNoteLike;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ConfigUpdateRequest - 配置预设更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ConfigUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 配置名称.
|
||||
*/
|
||||
@NotBlank(message = "[confName]配置名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[confName]配置名称长度不合法(0-50)")
|
||||
private String confName;
|
||||
|
||||
/**
|
||||
* 配置类型.
|
||||
* HTTP:全局配置
|
||||
* SERVER:主机配置
|
||||
* LOCATION:路径配置
|
||||
*/
|
||||
@NotNull(message = "[confType]配置类型不能为NULL")
|
||||
@Select({"HTTP", "SERVER", "LOCATION"})
|
||||
private String confType;
|
||||
|
||||
/**
|
||||
* 配置属值.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[confValue]配置属值长度不合法(0-255)")
|
||||
private String confValue;
|
||||
|
||||
/**
|
||||
* 配置备注.
|
||||
*/
|
||||
@Length(min = 0, max = 255, message = "[confNote]配置备注长度不合法(0-255)")
|
||||
private String confNote;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getConfName() {
|
||||
return this.confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfType() {
|
||||
return this.confType;
|
||||
}
|
||||
|
||||
public void setConfType(String confType) {
|
||||
this.confType = confType;
|
||||
}
|
||||
|
||||
public String getConfValue() {
|
||||
return this.confValue;
|
||||
}
|
||||
|
||||
public void setConfValue(String confValue) {
|
||||
this.confValue = confValue;
|
||||
}
|
||||
|
||||
public String getConfNote() {
|
||||
return this.confNote;
|
||||
}
|
||||
|
||||
public void setConfNote(String confNote) {
|
||||
this.confNote = confNote;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* LocationsDeleteRequest - 路径配置删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsDeleteRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* LocationsFindRequest - 路径配置查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 服务主键.
|
||||
*/
|
||||
private Long serviceId;
|
||||
|
||||
/**
|
||||
* 配置标题.
|
||||
*/
|
||||
private String localTitle;
|
||||
|
||||
/**
|
||||
* 配置标题模糊查询.
|
||||
*/
|
||||
private String localTitleLike;
|
||||
|
||||
/**
|
||||
* 配置备注模糊查询.
|
||||
*/
|
||||
private String localNoteLike;
|
||||
|
||||
/**
|
||||
* 配置路径.
|
||||
*/
|
||||
private String localPath;
|
||||
|
||||
/**
|
||||
* 配置路径模糊查询.
|
||||
*/
|
||||
private String localPathLike;
|
||||
|
||||
/**
|
||||
* 是否启用.
|
||||
*/
|
||||
private Boolean localValid;
|
||||
|
||||
/**
|
||||
* 启用过滤.
|
||||
*/
|
||||
private Boolean filter;
|
||||
|
||||
/**
|
||||
* 开始日期.
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期.
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
public Long getServiceId() {
|
||||
return this.serviceId;
|
||||
}
|
||||
|
||||
public void setServiceId(Long serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public String getLocalTitle() {
|
||||
return this.localTitle;
|
||||
}
|
||||
|
||||
public void setLocalTitle(String localTitle) {
|
||||
this.localTitle = localTitle;
|
||||
}
|
||||
|
||||
public String getLocalTitleLike() {
|
||||
return this.localTitleLike;
|
||||
}
|
||||
|
||||
public void setLocalTitleLike(String localTitleLike) {
|
||||
this.localTitleLike = localTitleLike;
|
||||
}
|
||||
|
||||
public String getLocalNoteLike() {
|
||||
return this.localNoteLike;
|
||||
}
|
||||
|
||||
public void setLocalNoteLike(String localNoteLike) {
|
||||
this.localNoteLike = localNoteLike;
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
return this.localPath;
|
||||
}
|
||||
|
||||
public void setLocalPath(String localPath) {
|
||||
this.localPath = localPath;
|
||||
}
|
||||
|
||||
public String getLocalPathLike() {
|
||||
return this.localPathLike;
|
||||
}
|
||||
|
||||
public void setLocalPathLike(String localPathLike) {
|
||||
this.localPathLike = localPathLike;
|
||||
}
|
||||
|
||||
public Boolean getLocalValid() {
|
||||
return this.localValid;
|
||||
}
|
||||
|
||||
public void setLocalValid(Boolean localValid) {
|
||||
this.localValid = localValid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ServicesCreateRequest - 虚拟主机新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主机标题.
|
||||
*/
|
||||
@NotBlank(message = "[title]主机标题不能为空")
|
||||
@Length(min = 0, max = 50, message = "[title]主机标题长度不合法(0-50)")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 主机域名.
|
||||
*/
|
||||
@NotBlank(message = "[domain]主机域名不能为空")
|
||||
@Length(min = 0, max = 50, message = "[domain]主机域名长度不合法(0-50)")
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 服务类型.
|
||||
* 反向代理:反向代理
|
||||
* 负载均衡:负载均衡
|
||||
* 正向代理:正向代理
|
||||
* 文件代理:文件代理
|
||||
* 端口转发:端口转发
|
||||
*/
|
||||
@NotNull(message = "[type]服务类型不能为NULL")
|
||||
@Select({"反向代理", "负载均衡", "正向代理", "文件代理", "端口转发"})
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 服务端口.
|
||||
*/
|
||||
@NotNull(message = "[port]服务端口不能为NULL")
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 是否启用.
|
||||
*/
|
||||
private Boolean valid;
|
||||
|
||||
/**
|
||||
* 启用过滤.
|
||||
*/
|
||||
@NotNull(message = "[filter]启用过滤不能为NULL")
|
||||
private Boolean filter;
|
||||
|
||||
/**
|
||||
* 过滤配置.
|
||||
*/
|
||||
@Length(min = 0, max = 500, message = "[filterConf]过滤配置长度不合法(0-500)")
|
||||
private String filterConf;
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public Boolean getValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public void setValid(Boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getFilterConf() {
|
||||
return this.filterConf;
|
||||
}
|
||||
|
||||
public void setFilterConf(String filterConf) {
|
||||
this.filterConf = filterConf;
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package xyz.wbsite.module.admin.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import xyz.wbsite.frame.validation.Select;
|
||||
|
||||
/**
|
||||
* ServicesUpdateRequest - 虚拟主机更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 主机标题.
|
||||
*/
|
||||
@NotBlank(message = "[title]主机标题不能为空")
|
||||
@Length(min = 0, max = 50, message = "[title]主机标题长度不合法(0-50)")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 主机域名.
|
||||
*/
|
||||
@NotBlank(message = "[domain]主机域名不能为空")
|
||||
@Length(min = 0, max = 50, message = "[domain]主机域名长度不合法(0-50)")
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 服务类型.
|
||||
* 反向代理:反向代理
|
||||
* 负载均衡:负载均衡
|
||||
* 正向代理:正向代理
|
||||
* 文件代理:文件代理
|
||||
* 端口转发:端口转发
|
||||
*/
|
||||
@NotNull(message = "[type]服务类型不能为NULL")
|
||||
@Select({"反向代理", "负载均衡", "正向代理", "文件代理", "端口转发"})
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 服务端口.
|
||||
*/
|
||||
@NotNull(message = "[port]服务端口不能为NULL")
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 是否启用.
|
||||
*/
|
||||
private Boolean valid;
|
||||
|
||||
/**
|
||||
* 启用过滤.
|
||||
*/
|
||||
@NotNull(message = "[filter]启用过滤不能为NULL")
|
||||
private Boolean filter;
|
||||
|
||||
/**
|
||||
* 过滤配置.
|
||||
*/
|
||||
@Length(min = 0, max = 500, message = "[filterConf]过滤配置长度不合法(0-500)")
|
||||
private String filterConf;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public Boolean getValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public void setValid(Boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public Boolean getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
public void setFilter(Boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getFilterConf() {
|
||||
return this.filterConf;
|
||||
}
|
||||
|
||||
public void setFilterConf(String filterConf) {
|
||||
this.filterConf = filterConf;
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* MappingUpdateResponse - 映射
|
||||
* ConfigDataDeleteResponse - 配置数据
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class MappingUpdateResponse extends BaseResponse {
|
||||
public class ConfigDataDeleteResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
* 删除数目
|
||||
*/
|
||||
private Long result;
|
||||
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LocationsCreateResponse - 路径配置
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class LocationsCreateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* ServicesCreateResponse - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesCreateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package xyz.wbsite.module.conf.rsp;
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* MappingDeleteResponse - 映射
|
||||
* ServicesDeleteResponse - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class MappingDeleteResponse extends BaseResponse {
|
||||
public class ServicesDeleteResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 删除数目
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.module.admin.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||
import xyz.wbsite.module.admin.ent.Services;
|
||||
|
||||
/**
|
||||
* ServicesFindResponse - 虚拟主机
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2021-02-07
|
||||
*/
|
||||
public class ServicesFindResponse extends BaseFindResponse<Services> {
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package xyz.wbsite.module.conf.ent;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* MAPPING - 映射
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-03-18
|
||||
*/
|
||||
public class Mapping extends BaseEntity {
|
||||
|
||||
/**
|
||||
* NAME - 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* PORT - 端口
|
||||
*/
|
||||
private String port;
|
||||
/**
|
||||
* PATH - 路径
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* TYPE - 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* LOCATION - 代理地址
|
||||
*/
|
||||
private String location;
|
||||
/**
|
||||
* NOTE - 备注
|
||||
*/
|
||||
private String note;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return this.note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue