| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- package jnpf.config;
- import cn.hutool.core.net.url.UrlBuilder;
- import jnpf.constant.ConfigConst;
- import jnpf.constant.TableFieldsNameConst;
- import jnpf.util.StringUtil;
- import jnpf.util.XSSEscape;
- import lombok.Data;
- import org.springframework.beans.factory.annotation.Value;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- *
- * @author JNPF开发平台组
- * @version V3.1.0
- * @copyright 引迈信息技术有限公司
- * @date 2021/3/16 8:47
- */
- @Data
- public class ConfigValueUtil {
- public static final String PREFIX = "config";
- @Value("spring.application.name:JNPF")
- private String applicationName;
- // /**
- // * 环境路径
- // */
- // @Value("${config.Path:}")
- // private String path;
- /**
- * 数据库备份文件路径
- */
- private String dataBackupFilePath;
- /**
- * 临时文件存储路径
- */
- private String temporaryFilePath;
- /**
- * 系统文件存储路径
- */
- private String systemFilePath;
- /**
- * 文件模板存储路径
- */
- private String templateFilePath;
- /**
- * 代码模板存储路径
- */
- private String templateCodePath;
- /**
- * vue3代码模板存储路径
- */
- private String templateCodePathVue3;
- /**
- * 邮件文件存储路径
- */
- private String emailFilePath;
- /**
- * 大屏图片存储目录
- */
- private String biVisualPath;
- /**
- * 文档管理存储路径
- */
- private String documentFilePath;
- /**
- * 文件在线预览存储pdf
- */
- private String documentPreviewPath;
- /**
- * 用户头像存储路径
- */
- private String userAvatarFilePath;
- /**
- * IM聊天图片+语音存储路径
- */
- private String imContentFilePath;
- /**
- * 允许上传文件类型
- */
- private String allowUploadFileType;
- /**
- * 允许图片类型
- */
- private String allowUploadImageType;
- /**
- * 允许预览类型
- */
- private String allowPreviewFileType;
- /**
- * 预览方式
- */
- private String previewType;
- /**
- * 预览方式
- */
- private String kkFileUrl;
- /**
- * 多语言json路径
- */
- private String baseLanguagePath;
- /**
- * 前端文件目录
- */
- private String serviceDirectoryPath = ConfigConst.CODE_TEMP_FOLDER;
- /**
- * 代码生成器命名空间
- */
- private String codeAreasName;
- /**
- * 前端附件文件目录
- */
- private String webAnnexFilePath;
- /**
- * ApacheShardingSphere 配置开关
- */
- private boolean shardingSphereEnabled;
- /**
- * 软件的错误报告
- */
- private String errorReport;
- /**
- * 软件的错误报告发给谁
- */
- private String errorReportTo;
- /**
- * 系统日志启用:true、false
- */
- private String recordLog;
- /**
- * 多租户启用:true、false
- */
- private boolean multiTenancy;
- /**
- * 多租户接口
- */
- private String multiTenancyUrl;
- /**
- * 多租户字段
- */
- private String multiTenantColumn = TableFieldsNameConst.F_TENANT_ID;
- /**
- * 字段多租户忽略表
- */
- private List<String> multiTenantIgnoreTable = initMultiTenantIgnoreTable();
- /**
- * 多租户登录短信验证接口
- */
- private String multiTenancyOfficialLoginCodeUrl = null;
- /**
- * 多租户重置密码短信验证接口
- */
- private String multiTenancyOfficialResetCodeUrl = null;
- /**
- * 开启逻辑删除功能
- */
- private boolean enableLogicDelete = false;
- /**
- * 身份功能功能开关
- */
- private boolean standingSwitch = false;
- /**
- * 扫码登录过期时间
- */
- private Long codeCertificateTimeout = 180L;
- /**
- * 逻辑删除字段
- */
- private String logicDeleteColumn = TableFieldsNameConst.F_DELETE_MARK;
- /**
- * 版本
- */
- private String softVersion;
- /**
- * 推送是否启动:false、true
- */
- private String igexinEnabled;
- /**
- * APPID
- */
- private String igexinAppid;
- /**
- * APPKEY
- */
- private String igexinAppkey;
- /**
- * MASTERSECRET
- */
- private String igexinMastersecret;
- private String appUpdateContent;
- private String appVersion;
- /**
- * pc端服务器域名
- */
- private String frontDomain;
- /**
- * app端服务器域名
- */
- private String appDomain;
- /**
- * 服务器域名
- */
- private String apiDomain;
- /**
- * 工作流域名
- */
- private String flowDomain;
- /**
- * 检查PDF文件安全
- */
- private boolean checkFilePdf;
- /**
- * -------------跨域配置-----------
- */
- // @Value("${config.Origins}")
- // private String origins;
- // @Value("${config.Methods}")
- // private String methods;
- /**
- * -------------是否开启测试环境,admin账户可以无限登陆,并且无法修改密码-----------
- */
- private String testVersion;
- /**
- * -------------uniPush在线-----------
- */
- private String appPushUrl;
- public String getMultiTenancyOfficialLoginCodeUrl() {
- if(multiTenancyOfficialLoginCodeUrl == null){
- if(StringUtil.isNotEmpty(multiTenancyUrl)){
- UrlBuilder urlBuilder1 = UrlBuilder.of(multiTenancyUrl);
- multiTenancyOfficialLoginCodeUrl = String.format("%s://%s:%s/api/Saas/Tenant/LoginSmsCodeCheck/", urlBuilder1.getSchemeWithDefault(), urlBuilder1.getHost(), urlBuilder1.getPortWithDefault());
- }else{
- multiTenancyOfficialLoginCodeUrl = "";
- }
- }
- return multiTenancyOfficialLoginCodeUrl;
- }
- public String getMultiTenancyOfficialResetCodeUrl() {
- if(multiTenancyOfficialResetCodeUrl == null){
- if(StringUtil.isNotEmpty(multiTenancyUrl)){
- UrlBuilder urlBuilder1 = UrlBuilder.of(multiTenancyUrl);
- multiTenancyOfficialResetCodeUrl = String.format("%s://%s:%s/api/Saas/Tenant/ResetPasswordSmsCodeCheck/", urlBuilder1.getSchemeWithDefault(), urlBuilder1.getHost(), urlBuilder1.getPortWithDefault());
- }else{
- multiTenancyOfficialResetCodeUrl = "";
- }
- }
- return multiTenancyOfficialResetCodeUrl;
- }
- public String getServiceDirectoryPath(){
- String folder = StringUtil.isNotEmpty(serviceDirectoryPath) ? serviceDirectoryPath : ConfigConst.CODE_TEMP_FOLDER;
- return getXssPath(folder +"/");
- }
- public String getDataBackupFilePath() {
- String folder = StringUtil.isNotEmpty(dataBackupFilePath) ? dataBackupFilePath : ConfigConst.DATA_BACKUP_FOLDER;
- return getXssPath(folder +"/");
- }
- public String getTemporaryFilePath() {
- String folder = StringUtil.isNotEmpty(temporaryFilePath) ? temporaryFilePath : ConfigConst.TEMPORARY_FOLDER;
- return getXssPath(folder +"/");
- }
- public String getSystemFilePath() {
- String folder = StringUtil.isNotEmpty(systemFilePath) ? systemFilePath : ConfigConst.SYSTEM_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getTemplateFilePath() {
- String folder = StringUtil.isNotEmpty(templateFilePath) ? templateFilePath : ConfigConst.TEMPLATE_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getTemplateCodePath() {
- String folder = StringUtil.isNotEmpty(templateCodePath) ? templateCodePath : ConfigConst.TEMPLATE_CODE_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getTemplateCodePathVue3() {
- String folder = StringUtil.isNotEmpty(templateCodePathVue3) ? templateCodePathVue3 : ConfigConst.TEMPLATEVUE3_CODE_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getEmailFilePath() {
- String folder = StringUtil.isNotEmpty(emailFilePath) ? emailFilePath : ConfigConst.EMAIL_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getDocumentPreviewPath() {
- String folder = StringUtil.isNotEmpty(documentPreviewPath) ? documentPreviewPath : ConfigConst.DOCUMENT_PREVIEW_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getUserAvatarFilePath() {
- String folder = StringUtil.isNotEmpty(userAvatarFilePath) ? userAvatarFilePath : ConfigConst.USER_AVATAR_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getImContentFilePath() {
- String folder = StringUtil.isNotEmpty(imContentFilePath) ? imContentFilePath : ConfigConst.IM_CONTENT_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getDocumentFilePath() {
- String folder = StringUtil.isNotEmpty(documentFilePath) ? documentFilePath : ConfigConst.DOCUMENT_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getWebAnnexFilePath() {
- String folder = StringUtil.isNotEmpty(webAnnexFilePath) ? webAnnexFilePath : ConfigConst.WEB_ANNEX_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getBiVisualPath() {
- String folder = StringUtil.isNotEmpty(biVisualPath) ? biVisualPath : ConfigConst.BI_VISUAL_FOLDER;
- return getXssPath(folder + "/");
- }
- public String getBaseLanguagePath() {
- String folder = StringUtil.isNotEmpty(baseLanguagePath) ? baseLanguagePath : ConfigConst.BASE_LANGUAGE;
- return getXssPath(folder + "/");
- }
- private String getXssPath(String path){
- String xssPath = XSSEscape.escapePath(path);
- return xssPath;
- }
- public void setMultiTenantIgnoreTable(List<String> multiTenantIgnoreTable) {
- initMultiTenantIgnoreTable();
- this.multiTenantIgnoreTable.addAll(multiTenantIgnoreTable);
- // 全部转小写, 对比时也转小写
- this.multiTenantIgnoreTable = this.multiTenantIgnoreTable.stream().map(String::toLowerCase).collect(Collectors.toList());
- }
- public List<String> getMultiTenantIgnoreTable() {
- return new ArrayList<>(this.multiTenantIgnoreTable);
- }
- private List<String> initMultiTenantIgnoreTable(){
- List<String> multiTenantIgnoreTable = this.multiTenantIgnoreTable;
- if(multiTenantIgnoreTable == null){
- multiTenantIgnoreTable = new ArrayList<>();
- }else{
- multiTenantIgnoreTable.clear();
- }
- multiTenantIgnoreTable.add("dual");
- return multiTenantIgnoreTable;
- }
- }
|