From 9d64d8c6d8108e3c42dcc5a7d64a9098db2838ac Mon Sep 17 00:00:00 2001
From: jinxx <313383180@qq.com>
Date: Wed, 1 Jul 2020 17:35:38 +0800
Subject: [PATCH 1/9] common
---
.../src/main/java/org/icec/common/web/BaseController.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java b/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java
index 2468d24..c532931 100644
--- a/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java
+++ b/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java
@@ -27,6 +27,9 @@ public class BaseController {
public SuccessTip succ(String msg) {
return new SuccessTip(msg);
+ }
+ public ErrorTip fail(int code ,String msg) {
+ return new ErrorTip(code,msg);
}
public ErrorTip fail(String msg) {
return new ErrorTip(msg);
--
Gitee
From aeafb7fdd59fab40008e804182fd80cf4ddec27a Mon Sep 17 00:00:00 2001
From: jinxx <313383180@qq.com>
Date: Wed, 9 Dec 2020 17:09:58 +0800
Subject: [PATCH 2/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mybatis=E6=A1=86=E6=9E=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/application.properties | 7 ++
platform/icec-parent/pom.xml | 7 ++
platform/icec-sys/pom.xml | 5 +
.../icec/web/core/config/MyBatisConfig.java | 110 ++++++++++++++++++
.../main/resources/mybatis/mybatis-config.xml | 15 +++
5 files changed, 144 insertions(+)
create mode 100755 platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
create mode 100755 platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
diff --git a/application/icec-admin/src/main/resources/application.properties b/application/icec-admin/src/main/resources/application.properties
index 43f1940..6b748a4 100644
--- a/application/icec-admin/src/main/resources/application.properties
+++ b/application/icec-admin/src/main/resources/application.properties
@@ -13,6 +13,13 @@ server.tomcat.uri-encoding=UTF-8
#datasource.username=icec
#datasource.password=icec
#}
+# MyBatis
+mybatis.typeAliasesPackage=org.icec.**.domain
+ # 搜索指定包别名
+ # 配置mapper的扫描,找到所有的mapper.xml映射文件
+mybatis.mapperLocations=classpath*:mapper/**/*Mapper.xml
+ # 加载全局的配置文件
+mybatis.configLocation=classpath:mybatis/mybatis-config.xml
#upload max file size
spring.http.multipart.maxFileSize=10Mb
diff --git a/platform/icec-parent/pom.xml b/platform/icec-parent/pom.xml
index 6809252..6339758 100644
--- a/platform/icec-parent/pom.xml
+++ b/platform/icec-parent/pom.xml
@@ -21,6 +21,7 @@
1.2.70
2.3.0.RELEASE
2.8.1
+ 1.2.5
@@ -51,6 +52,12 @@
druid
1.1.22
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+ ${pagehelper.boot.version}
+
org.thymeleaf
thymeleaf-spring5
diff --git a/platform/icec-sys/pom.xml b/platform/icec-sys/pom.xml
index bd8c2b0..e72c896 100644
--- a/platform/icec-sys/pom.xml
+++ b/platform/icec-sys/pom.xml
@@ -117,6 +117,11 @@
com.alibaba
druid
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+
org.apache.shiro
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
new file mode 100755
index 0000000..e73a7a7
--- /dev/null
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
@@ -0,0 +1,110 @@
+package org.icec.web.core.config;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import javax.sql.DataSource;
+import org.apache.ibatis.io.VFS;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.util.ClassUtils;
+
+/**
+ * Mybatis支持*匹配扫描包
+ *
+ * @author ruoyi
+ */
+@Configuration
+@MapperScan(basePackages ={"org.icec.**.mapper"})
+public class MyBatisConfig
+{
+ @Autowired
+ private Environment env;
+
+ static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
+
+ public static String setTypeAliasesPackage(String typeAliasesPackage)
+ {
+ ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
+ MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
+ List allResult = new ArrayList();
+ try
+ {
+ for (String aliasesPackage : typeAliasesPackage.split(","))
+ {
+ List result = new ArrayList();
+ aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
+ Resource[] resources = resolver.getResources(aliasesPackage);
+ if (resources != null && resources.length > 0)
+ {
+ MetadataReader metadataReader = null;
+ for (Resource resource : resources)
+ {
+ if (resource.isReadable())
+ {
+ metadataReader = metadataReaderFactory.getMetadataReader(resource);
+ try
+ {
+ result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ if (result.size() > 0)
+ {
+ HashSet hashResult = new HashSet(result);
+ allResult.addAll(hashResult);
+ }
+ }
+ if (allResult.size() > 0)
+ {
+ typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
+ }
+ else
+ {
+ throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return typeAliasesPackage;
+ }
+
+ @Bean
+ public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
+ {
+ String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
+ String mapperLocations = env.getProperty("mybatis.mapperLocations");
+ String configLocation = env.getProperty("mybatis.configLocation");
+ typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
+ VFS.addImplClass(SpringBootVFS.class);
+
+ final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+ sessionFactory.setDataSource(dataSource);
+ sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
+ sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
+ sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
+
+ return sessionFactory.getObject();
+ }
+}
\ No newline at end of file
diff --git a/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml b/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
new file mode 100755
index 0000000..4a81dee
--- /dev/null
+++ b/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
--
Gitee
From 69bc8b619953d4cf27ffca9d5be430bc45297113 Mon Sep 17 00:00:00 2001
From: jinxx <313383180@qq.com>
Date: Wed, 9 Dec 2020 17:34:46 +0800
Subject: [PATCH 3/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mybatis=E4=BE=9D=E8=B5=96?=
=?UTF-8?q?=E5=8C=85=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
platform/icec-parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/platform/icec-parent/pom.xml b/platform/icec-parent/pom.xml
index 6339758..cb438f9 100644
--- a/platform/icec-parent/pom.xml
+++ b/platform/icec-parent/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.icec
- 2.1
+ 2.1.1
icec-parent
pom
--
Gitee
From 1630391052c412c2ab736becda42e05d84f52dd9 Mon Sep 17 00:00:00 2001
From: jinxiaoxian
Date: Thu, 10 Dec 2020 10:22:33 +0800
Subject: [PATCH 4/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mybatis=20config?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
application/icec-admin/pom.xml | 3 +-
.../main/resources/application-dev.properties | 2 +-
module/icec-fileManager/pom.xml | 4 +-
module/icec-schedule/pom.xml | 2 +-
module/icec-sms/pom.xml | 2 +-
module/icec-workflow/pom.xml | 2 +-
platform/icec-parent/pom.xml | 2 +-
platform/icec-static/pom.xml | 2 +-
platform/icec-sys/pom.xml | 12 +-
.../icec/web/core/config/MyBatisConfig.java | 226 +++++++++---------
.../org/icec/web/core/config/WebMvcConf.java | 2 +-
.../main/resources/mybatis/mybatis-config.xml | 30 +--
.../java/org/iece/tools/sys/UserTool.java | 2 +
.../jasperreports_extension.properties | 4 +-
14 files changed, 155 insertions(+), 140 deletions(-)
diff --git a/application/icec-admin/pom.xml b/application/icec-admin/pom.xml
index 6868c64..d671d33 100644
--- a/application/icec-admin/pom.xml
+++ b/application/icec-admin/pom.xml
@@ -5,7 +5,7 @@
org.icec
icec-parent
- 2.1
+ 2.1.1
icec-admin
@@ -28,6 +28,7 @@
org.projectlombok
lombok
+
org.icec
icec-sys
diff --git a/application/icec-admin/src/main/resources/application-dev.properties b/application/icec-admin/src/main/resources/application-dev.properties
index 31290e8..39e8dd0 100644
--- a/application/icec-admin/src/main/resources/application-dev.properties
+++ b/application/icec-admin/src/main/resources/application-dev.properties
@@ -4,7 +4,7 @@ spring.thymeleaf.cache=false
spring.thymeleaf.mode =HTML
#:replace(dbIp,dbName,dbPassword,driver){
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://127.0.0.1:3306/icec?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false
+spring.datasource.url=jdbc:mysql://192.168.222.128:3306/icec?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false
spring.datasource.username=icec
spring.datasource.password=icec
spring.datasource.druid.initial-size=1
diff --git a/module/icec-fileManager/pom.xml b/module/icec-fileManager/pom.xml
index e053e59..6af7718 100644
--- a/module/icec-fileManager/pom.xml
+++ b/module/icec-fileManager/pom.xml
@@ -7,7 +7,7 @@
org.icec
icec-parent
- 2.0
+ 2.1.1
@@ -87,7 +87,7 @@
org.icec
icec-sys
- 2.0
+ 2.1.1
diff --git a/module/icec-schedule/pom.xml b/module/icec-schedule/pom.xml
index 9ec8d4c..66bf6d9 100644
--- a/module/icec-schedule/pom.xml
+++ b/module/icec-schedule/pom.xml
@@ -33,7 +33,7 @@
org.icec
icec-common
- 2.0
+ 2.1
org.apache.shiro
diff --git a/module/icec-sms/pom.xml b/module/icec-sms/pom.xml
index b1ec506..5826564 100644
--- a/module/icec-sms/pom.xml
+++ b/module/icec-sms/pom.xml
@@ -25,7 +25,7 @@
org.icec
icec-sys
- 2.0
+ 2.1.1
org.projectlombok
diff --git a/module/icec-workflow/pom.xml b/module/icec-workflow/pom.xml
index c5bb305..6df62a1 100644
--- a/module/icec-workflow/pom.xml
+++ b/module/icec-workflow/pom.xml
@@ -106,7 +106,7 @@
org.icec
icec-sys
- ${icec.version}
+ 2.1.1
com.google.guava
diff --git a/platform/icec-parent/pom.xml b/platform/icec-parent/pom.xml
index cb438f9..ef0e005 100644
--- a/platform/icec-parent/pom.xml
+++ b/platform/icec-parent/pom.xml
@@ -7,7 +7,7 @@
icec-parent
pom
- 2.1
+ 2.1.1
UTF-8
UTF-8
11
diff --git a/platform/icec-static/pom.xml b/platform/icec-static/pom.xml
index 8a16f06..ca2f724 100644
--- a/platform/icec-static/pom.xml
+++ b/platform/icec-static/pom.xml
@@ -5,7 +5,7 @@
org.icec
icec-parent
- 2.1
+ 2.1.1
icec-static
diff --git a/platform/icec-sys/pom.xml b/platform/icec-sys/pom.xml
index e72c896..0d5ea50 100644
--- a/platform/icec-sys/pom.xml
+++ b/platform/icec-sys/pom.xml
@@ -5,8 +5,8 @@
org.icec
icec-parent
- 2.1
-
+ 2.1.1
+
icec-sys
@@ -117,10 +117,10 @@
com.alibaba
druid
-
com.github.pagehelper
pagehelper-spring-boot-starter
+ true
@@ -138,7 +138,7 @@
shiro-ehcache
${shiro.version}
-
+
com.github.whvcse
easy-captcha
@@ -171,5 +171,9 @@
icec-common
2.1
+
+ org.projectlombok
+ lombok
+
\ No newline at end of file
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
index e73a7a7..5ddd100 100755
--- a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
@@ -1,110 +1,118 @@
-package org.icec.web.core.config;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import javax.sql.DataSource;
-import org.apache.ibatis.io.VFS;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionFactoryBean;
-import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
-import org.springframework.core.type.classreading.MetadataReader;
-import org.springframework.core.type.classreading.MetadataReaderFactory;
-import org.springframework.util.ClassUtils;
-
-/**
- * Mybatis支持*匹配扫描包
- *
- * @author ruoyi
- */
-@Configuration
-@MapperScan(basePackages ={"org.icec.**.mapper"})
-public class MyBatisConfig
-{
- @Autowired
- private Environment env;
-
- static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
-
- public static String setTypeAliasesPackage(String typeAliasesPackage)
- {
- ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
- MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
- List allResult = new ArrayList();
- try
- {
- for (String aliasesPackage : typeAliasesPackage.split(","))
- {
- List result = new ArrayList();
- aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
- + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
- Resource[] resources = resolver.getResources(aliasesPackage);
- if (resources != null && resources.length > 0)
- {
- MetadataReader metadataReader = null;
- for (Resource resource : resources)
- {
- if (resource.isReadable())
- {
- metadataReader = metadataReaderFactory.getMetadataReader(resource);
- try
- {
- result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
- }
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- if (result.size() > 0)
- {
- HashSet hashResult = new HashSet(result);
- allResult.addAll(hashResult);
- }
- }
- if (allResult.size() > 0)
- {
- typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
- }
- else
- {
- throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
- }
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- return typeAliasesPackage;
- }
-
- @Bean
- public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
- {
- String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
- String mapperLocations = env.getProperty("mybatis.mapperLocations");
- String configLocation = env.getProperty("mybatis.configLocation");
- typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
- VFS.addImplClass(SpringBootVFS.class);
-
- final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
- sessionFactory.setDataSource(dataSource);
- sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
- sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
- sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
-
- return sessionFactory.getObject();
- }
+package org.icec.web.core.config;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import javax.sql.DataSource;
+import org.apache.ibatis.io.VFS;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.annotation.MapperScan;
+import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.util.ClassUtils;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+/**
+ * Mybatis支持*匹配扫描包
+ *
+ * @author ruoyi
+ */
+@ConditionalOnClass(value=SqlSessionFactory.class)
+@Configuration
+@MapperScan(basePackages ={"org.icec.**.mapper"})
+@Slf4j
+public class MyBatisConfig
+{
+ @Autowired
+ private Environment env;
+
+ static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
+
+ public static String setTypeAliasesPackage(String typeAliasesPackage)
+ {
+ ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
+ MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
+ List allResult = new ArrayList();
+ try
+ {
+ for (String aliasesPackage : typeAliasesPackage.split(","))
+ {
+ List result = new ArrayList();
+ aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
+ Resource[] resources = resolver.getResources(aliasesPackage);
+ if (resources != null && resources.length > 0)
+ {
+ MetadataReader metadataReader = null;
+ for (Resource resource : resources)
+ {
+ if (resource.isReadable())
+ {
+ metadataReader = metadataReaderFactory.getMetadataReader(resource);
+ try
+ {
+ result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ if (result.size() > 0)
+ {
+ HashSet hashResult = new HashSet(result);
+ allResult.addAll(hashResult);
+ }
+ }
+ if (allResult.size() > 0)
+ {
+ typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
+ }
+ else
+ {
+ log.warn("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
+ //throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return typeAliasesPackage;
+ }
+
+ @Bean
+ public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
+ {
+ String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
+ String mapperLocations = env.getProperty("mybatis.mapperLocations");
+ String configLocation = env.getProperty("mybatis.configLocation");
+ typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
+ VFS.addImplClass(SpringBootVFS.class);
+
+ final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+ sessionFactory.setDataSource(dataSource);
+ sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
+ sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
+ sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
+
+ return sessionFactory.getObject();
+ }
}
\ No newline at end of file
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java
index 0c20d6d..7f7fa30 100644
--- a/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java
@@ -23,7 +23,7 @@ public class WebMvcConf implements WebMvcConfigurer {
return new CurrentUserMethodArgumentResolver();
}
- @Bean
+ //@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
/*factory.setMaxFileSize("10MB");
diff --git a/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml b/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
index 4a81dee..2b18113 100755
--- a/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
+++ b/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
@@ -1,15 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java b/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java
index 5162d97..668ec5c 100644
--- a/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java
+++ b/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java
@@ -12,6 +12,8 @@ public class UserTool {
System.out.println(encryptPassword);
boolean flag=BCrypt.checkpw(passwd, encryptPassword);
System.out.println(flag);
+ String pwd = BCrypt.hashpw(passwd, BCrypt.gensalt());
+ System.out.println(pwd);
}
}
diff --git a/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties b/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties
index 180fccc..0b2a148 100755
--- a/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties
+++ b/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties
@@ -1,2 +1,2 @@
-net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
-net.sf.jasperreports.extension.simple.font.families.ireportfamily1539755606309=fonts/fontsfamily1539755606309.xml
+net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
+net.sf.jasperreports.extension.simple.font.families.ireportfamily1539755606309=fonts/fontsfamily1539755606309.xml
--
Gitee
From 9f6f4532462d2df7cd738a4068f790bf53bb20c3 Mon Sep 17 00:00:00 2001
From: jinxiaoxian <313383180@qq.com>
Date: Thu, 10 Dec 2020 10:22:33 +0800
Subject: [PATCH 5/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mybatis=20config?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
application/icec-admin/pom.xml | 3 +-
.../main/resources/application-dev.properties | 2 +-
module/icec-fileManager/pom.xml | 4 +-
module/icec-schedule/pom.xml | 2 +-
module/icec-sms/pom.xml | 2 +-
module/icec-workflow/pom.xml | 2 +-
platform/icec-parent/pom.xml | 2 +-
platform/icec-static/pom.xml | 2 +-
platform/icec-sys/pom.xml | 12 +-
.../icec/web/core/config/MyBatisConfig.java | 226 +++++++++---------
.../org/icec/web/core/config/WebMvcConf.java | 2 +-
.../main/resources/mybatis/mybatis-config.xml | 30 +--
.../java/org/iece/tools/sys/UserTool.java | 2 +
.../jasperreports_extension.properties | 4 +-
14 files changed, 155 insertions(+), 140 deletions(-)
diff --git a/application/icec-admin/pom.xml b/application/icec-admin/pom.xml
index 6868c64..d671d33 100644
--- a/application/icec-admin/pom.xml
+++ b/application/icec-admin/pom.xml
@@ -5,7 +5,7 @@
org.icec
icec-parent
- 2.1
+ 2.1.1
icec-admin
@@ -28,6 +28,7 @@
org.projectlombok
lombok
+
org.icec
icec-sys
diff --git a/application/icec-admin/src/main/resources/application-dev.properties b/application/icec-admin/src/main/resources/application-dev.properties
index 31290e8..39e8dd0 100644
--- a/application/icec-admin/src/main/resources/application-dev.properties
+++ b/application/icec-admin/src/main/resources/application-dev.properties
@@ -4,7 +4,7 @@ spring.thymeleaf.cache=false
spring.thymeleaf.mode =HTML
#:replace(dbIp,dbName,dbPassword,driver){
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://127.0.0.1:3306/icec?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false
+spring.datasource.url=jdbc:mysql://192.168.222.128:3306/icec?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false
spring.datasource.username=icec
spring.datasource.password=icec
spring.datasource.druid.initial-size=1
diff --git a/module/icec-fileManager/pom.xml b/module/icec-fileManager/pom.xml
index e053e59..6af7718 100644
--- a/module/icec-fileManager/pom.xml
+++ b/module/icec-fileManager/pom.xml
@@ -7,7 +7,7 @@
org.icec
icec-parent
- 2.0
+ 2.1.1
@@ -87,7 +87,7 @@
org.icec
icec-sys
- 2.0
+ 2.1.1
diff --git a/module/icec-schedule/pom.xml b/module/icec-schedule/pom.xml
index 9ec8d4c..66bf6d9 100644
--- a/module/icec-schedule/pom.xml
+++ b/module/icec-schedule/pom.xml
@@ -33,7 +33,7 @@
org.icec
icec-common
- 2.0
+ 2.1
org.apache.shiro
diff --git a/module/icec-sms/pom.xml b/module/icec-sms/pom.xml
index b1ec506..5826564 100644
--- a/module/icec-sms/pom.xml
+++ b/module/icec-sms/pom.xml
@@ -25,7 +25,7 @@
org.icec
icec-sys
- 2.0
+ 2.1.1
org.projectlombok
diff --git a/module/icec-workflow/pom.xml b/module/icec-workflow/pom.xml
index c5bb305..6df62a1 100644
--- a/module/icec-workflow/pom.xml
+++ b/module/icec-workflow/pom.xml
@@ -106,7 +106,7 @@
org.icec
icec-sys
- ${icec.version}
+ 2.1.1
com.google.guava
diff --git a/platform/icec-parent/pom.xml b/platform/icec-parent/pom.xml
index cb438f9..ef0e005 100644
--- a/platform/icec-parent/pom.xml
+++ b/platform/icec-parent/pom.xml
@@ -7,7 +7,7 @@
icec-parent
pom
- 2.1
+ 2.1.1
UTF-8
UTF-8
11
diff --git a/platform/icec-static/pom.xml b/platform/icec-static/pom.xml
index 8a16f06..ca2f724 100644
--- a/platform/icec-static/pom.xml
+++ b/platform/icec-static/pom.xml
@@ -5,7 +5,7 @@
org.icec
icec-parent
- 2.1
+ 2.1.1
icec-static
diff --git a/platform/icec-sys/pom.xml b/platform/icec-sys/pom.xml
index e72c896..0d5ea50 100644
--- a/platform/icec-sys/pom.xml
+++ b/platform/icec-sys/pom.xml
@@ -5,8 +5,8 @@
org.icec
icec-parent
- 2.1
-
+ 2.1.1
+
icec-sys
@@ -117,10 +117,10 @@
com.alibaba
druid
-
com.github.pagehelper
pagehelper-spring-boot-starter
+ true
@@ -138,7 +138,7 @@
shiro-ehcache
${shiro.version}
-
+
com.github.whvcse
easy-captcha
@@ -171,5 +171,9 @@
icec-common
2.1
+
+ org.projectlombok
+ lombok
+
\ No newline at end of file
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
index e73a7a7..5ddd100 100755
--- a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
@@ -1,110 +1,118 @@
-package org.icec.web.core.config;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import javax.sql.DataSource;
-import org.apache.ibatis.io.VFS;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionFactoryBean;
-import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
-import org.springframework.core.type.classreading.MetadataReader;
-import org.springframework.core.type.classreading.MetadataReaderFactory;
-import org.springframework.util.ClassUtils;
-
-/**
- * Mybatis支持*匹配扫描包
- *
- * @author ruoyi
- */
-@Configuration
-@MapperScan(basePackages ={"org.icec.**.mapper"})
-public class MyBatisConfig
-{
- @Autowired
- private Environment env;
-
- static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
-
- public static String setTypeAliasesPackage(String typeAliasesPackage)
- {
- ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
- MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
- List allResult = new ArrayList();
- try
- {
- for (String aliasesPackage : typeAliasesPackage.split(","))
- {
- List result = new ArrayList();
- aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
- + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
- Resource[] resources = resolver.getResources(aliasesPackage);
- if (resources != null && resources.length > 0)
- {
- MetadataReader metadataReader = null;
- for (Resource resource : resources)
- {
- if (resource.isReadable())
- {
- metadataReader = metadataReaderFactory.getMetadataReader(resource);
- try
- {
- result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
- }
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- if (result.size() > 0)
- {
- HashSet hashResult = new HashSet(result);
- allResult.addAll(hashResult);
- }
- }
- if (allResult.size() > 0)
- {
- typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
- }
- else
- {
- throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
- }
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- return typeAliasesPackage;
- }
-
- @Bean
- public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
- {
- String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
- String mapperLocations = env.getProperty("mybatis.mapperLocations");
- String configLocation = env.getProperty("mybatis.configLocation");
- typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
- VFS.addImplClass(SpringBootVFS.class);
-
- final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
- sessionFactory.setDataSource(dataSource);
- sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
- sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
- sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
-
- return sessionFactory.getObject();
- }
+package org.icec.web.core.config;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import javax.sql.DataSource;
+import org.apache.ibatis.io.VFS;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.annotation.MapperScan;
+import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.util.ClassUtils;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+/**
+ * Mybatis支持*匹配扫描包
+ *
+ * @author ruoyi
+ */
+@ConditionalOnClass(value=SqlSessionFactory.class)
+@Configuration
+@MapperScan(basePackages ={"org.icec.**.mapper"})
+@Slf4j
+public class MyBatisConfig
+{
+ @Autowired
+ private Environment env;
+
+ static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
+
+ public static String setTypeAliasesPackage(String typeAliasesPackage)
+ {
+ ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
+ MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
+ List allResult = new ArrayList();
+ try
+ {
+ for (String aliasesPackage : typeAliasesPackage.split(","))
+ {
+ List result = new ArrayList();
+ aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
+ Resource[] resources = resolver.getResources(aliasesPackage);
+ if (resources != null && resources.length > 0)
+ {
+ MetadataReader metadataReader = null;
+ for (Resource resource : resources)
+ {
+ if (resource.isReadable())
+ {
+ metadataReader = metadataReaderFactory.getMetadataReader(resource);
+ try
+ {
+ result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ if (result.size() > 0)
+ {
+ HashSet hashResult = new HashSet(result);
+ allResult.addAll(hashResult);
+ }
+ }
+ if (allResult.size() > 0)
+ {
+ typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
+ }
+ else
+ {
+ log.warn("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
+ //throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return typeAliasesPackage;
+ }
+
+ @Bean
+ public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
+ {
+ String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
+ String mapperLocations = env.getProperty("mybatis.mapperLocations");
+ String configLocation = env.getProperty("mybatis.configLocation");
+ typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
+ VFS.addImplClass(SpringBootVFS.class);
+
+ final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+ sessionFactory.setDataSource(dataSource);
+ sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
+ sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
+ sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
+
+ return sessionFactory.getObject();
+ }
}
\ No newline at end of file
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java
index 0c20d6d..7f7fa30 100644
--- a/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/WebMvcConf.java
@@ -23,7 +23,7 @@ public class WebMvcConf implements WebMvcConfigurer {
return new CurrentUserMethodArgumentResolver();
}
- @Bean
+ //@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
/*factory.setMaxFileSize("10MB");
diff --git a/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml b/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
index 4a81dee..2b18113 100755
--- a/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
+++ b/platform/icec-sys/src/main/resources/mybatis/mybatis-config.xml
@@ -1,15 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java b/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java
index 5162d97..668ec5c 100644
--- a/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java
+++ b/platform/icec-sys/src/test/java/org/iece/tools/sys/UserTool.java
@@ -12,6 +12,8 @@ public class UserTool {
System.out.println(encryptPassword);
boolean flag=BCrypt.checkpw(passwd, encryptPassword);
System.out.println(flag);
+ String pwd = BCrypt.hashpw(passwd, BCrypt.gensalt());
+ System.out.println(pwd);
}
}
diff --git a/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties b/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties
index 180fccc..0b2a148 100755
--- a/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties
+++ b/tools/icec-japserfont-msyh/src/main/resources/jasperreports_extension.properties
@@ -1,2 +1,2 @@
-net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
-net.sf.jasperreports.extension.simple.font.families.ireportfamily1539755606309=fonts/fontsfamily1539755606309.xml
+net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
+net.sf.jasperreports.extension.simple.font.families.ireportfamily1539755606309=fonts/fontsfamily1539755606309.xml
--
Gitee
From 8a4f2f1f34c3c699d0018f32f81a82e908801c9e Mon Sep 17 00:00:00 2001
From: xxjin <313383180@qq.com>
Date: Thu, 10 Dec 2020 13:04:56 +0800
Subject: [PATCH 6/9] =?UTF-8?q?=E6=95=B4=E5=90=88mybatis=E6=A1=86=E6=9E=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
application/icec-admin/pom.xml | 7 +
module/icec-mybatis-demo/pom.xml | 35 +
.../controller/SmsRecordController.java | 58 +
.../org/icec/mybatis/domain/SmsRecord.java | 199 ++++
.../icec/mybatis/mapper/SmsRecordMapper.java | 70 ++
.../mybatis/service/ISmsRecordService.java | 63 ++
.../service/impl/SmsRecordServiceImpl.java | 94 ++
.../main/resources/mapper/SmsRecordMapper.xml | 115 ++
platform/icec-common/pom.xml | 2 +-
.../org/icec/common/annotation/DataScope.java | 28 +
.../org/icec/common/annotation/Excel.java | 123 +++
.../org/icec/common/constants/Constants.java | 94 ++
.../org/icec/common/utils/ServletUtils.java | 136 +++
.../org/icec/common/utils/StringUtils.java | 405 +++++++
.../icec/common/utils/text/CharsetKit.java | 85 ++
.../org/icec/common/utils/text/Convert.java | 998 ++++++++++++++++++
.../icec/common/utils/text/StrFormatter.java | 92 ++
platform/pom.xml | 2 +-
18 files changed, 2604 insertions(+), 2 deletions(-)
create mode 100644 module/icec-mybatis-demo/pom.xml
create mode 100644 module/icec-mybatis-demo/src/main/java/org/icec/mybatis/controller/SmsRecordController.java
create mode 100644 module/icec-mybatis-demo/src/main/java/org/icec/mybatis/domain/SmsRecord.java
create mode 100644 module/icec-mybatis-demo/src/main/java/org/icec/mybatis/mapper/SmsRecordMapper.java
create mode 100644 module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/ISmsRecordService.java
create mode 100644 module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/impl/SmsRecordServiceImpl.java
create mode 100644 module/icec-mybatis-demo/src/main/resources/mapper/SmsRecordMapper.xml
create mode 100644 platform/icec-common/src/main/java/org/icec/common/annotation/DataScope.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/annotation/Excel.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/constants/Constants.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/utils/ServletUtils.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/utils/StringUtils.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/utils/text/CharsetKit.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/utils/text/Convert.java
create mode 100644 platform/icec-common/src/main/java/org/icec/common/utils/text/StrFormatter.java
diff --git a/application/icec-admin/pom.xml b/application/icec-admin/pom.xml
index d671d33..9b47eab 100644
--- a/application/icec-admin/pom.xml
+++ b/application/icec-admin/pom.xml
@@ -44,6 +44,13 @@
icec-static
${icec.version}
+
+
+
diff --git a/module/icec-mybatis-demo/pom.xml b/module/icec-mybatis-demo/pom.xml
new file mode 100644
index 0000000..bb9a1a1
--- /dev/null
+++ b/module/icec-mybatis-demo/pom.xml
@@ -0,0 +1,35 @@
+
+ 4.0.0
+
+ org.icec
+ icec-parent
+ 2.1.1
+
+
+ icec-mybatis-demo
+
+
+ mysql
+ mysql-connector-java
+
+
+ com.alibaba
+ druid
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+
+
+ org.icec
+ icec-common
+ 2.1.1
+
+
+ org.projectlombok
+ lombok
+
+
+
\ No newline at end of file
diff --git a/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/controller/SmsRecordController.java b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/controller/SmsRecordController.java
new file mode 100644
index 0000000..6e6cb9a
--- /dev/null
+++ b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/controller/SmsRecordController.java
@@ -0,0 +1,58 @@
+package org.icec.mybatis.controller;
+
+import java.util.List;
+
+import org.icec.common.base.tips.Tip;
+import org.icec.common.web.BaseController;
+import org.icec.mybatis.domain.SmsRecord;
+import org.icec.mybatis.service.ISmsRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+/**
+ * 短信记录Controller
+ *
+ * @author jinxx
+ * @date 2020-09-14
+ */
+@Controller
+@RequestMapping("/sms/smsRecord")
+@Slf4j
+public class SmsRecordController extends BaseController
+{
+ private String prefix = "sms/smsRecord";
+
+ @Autowired
+ private ISmsRecordService smsRecordService;
+
+ @GetMapping()
+ public String smsRecord()
+ {
+ return prefix + "/smsRecord";
+ }
+
+ /**
+ * 查询短信记录列表
+ */
+ @GetMapping("/list")
+ @ResponseBody
+ public Tip list(SmsRecord smsRecord)
+ {
+ List list = smsRecordService.selectSmsRecordList(smsRecord);
+ log.info(list.size()+"");
+ return null;
+ }
+
+
+
+
+
+
+}
diff --git a/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/domain/SmsRecord.java b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/domain/SmsRecord.java
new file mode 100644
index 0000000..d7bb40f
--- /dev/null
+++ b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/domain/SmsRecord.java
@@ -0,0 +1,199 @@
+package org.icec.mybatis.domain;
+
+import java.util.Date;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.icec.common.annotation.Excel;
+
+
+/**
+ * 短信记录对象 sms_record
+ *
+ * @author jinxx
+ * @date 2020-09-14
+ */
+public class SmsRecord
+{
+ private static final long serialVersionUID = 1L;
+ public static final String STATE_NO = "0";
+ public static final String STATE_YES = "1";
+ public static final String STATE_ERR = "2";
+
+ public static final String TYPE_NOTICE = "1"; // 通知类型
+ public static final String TYPE_VERIFY = "2"; // 验证码类型
+
+ public static final String DEL_FLAG_NORMAL="0";
+ public static final String DEL_FLAG_DELETE="1";
+ /** null */
+ private Long id;
+
+ /** 如登录,催单,提醒 */
+ @Excel(name = "如登录,催单,提醒")
+ private String templateName;
+
+ /** 手机号码 */
+ @Excel(name = "手机号码")
+ private String phone;
+
+ /** 短信模板编码 */
+ @Excel(name = "短信模板编码")
+ private String templateCode;
+
+ /** 短信模板参数json格式 */
+ @Excel(name = "短信模板参数json格式")
+ private String param;
+
+ /** 0未发送,1已发送 */
+ @Excel(name = "0未发送,1已发送")
+ private String state;
+
+ /** null */
+ @Excel(name = "null")
+ private Long sendby;
+
+ /** null */
+ @Excel(name = "null", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date sendtime;
+
+ /** null */
+ @Excel(name = "null")
+ private String note;
+
+ /** null */
+ private String delFlag;
+
+ /** null */
+ @Excel(name = "null")
+ private String code;
+
+ /** 短信类型 */
+ @Excel(name = "短信类型")
+ private String type;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTemplateName(String templateName)
+ {
+ this.templateName = templateName;
+ }
+
+ public String getTemplateName()
+ {
+ return templateName;
+ }
+ public void setPhone(String phone)
+ {
+ this.phone = phone;
+ }
+
+ public String getPhone()
+ {
+ return phone;
+ }
+ public void setTemplateCode(String templateCode)
+ {
+ this.templateCode = templateCode;
+ }
+
+ public String getTemplateCode()
+ {
+ return templateCode;
+ }
+ public void setParam(String param)
+ {
+ this.param = param;
+ }
+
+ public String getParam()
+ {
+ return param;
+ }
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+
+ public String getState()
+ {
+ return state;
+ }
+ public void setSendby(Long sendby)
+ {
+ this.sendby = sendby;
+ }
+
+ public Long getSendby()
+ {
+ return sendby;
+ }
+ public void setSendtime(Date sendtime)
+ {
+ this.sendtime = sendtime;
+ }
+
+ public Date getSendtime()
+ {
+ return sendtime;
+ }
+ public void setNote(String note)
+ {
+ this.note = note;
+ }
+
+ public String getNote()
+ {
+ return note;
+ }
+ public void setDelFlag(String delFlag)
+ {
+ this.delFlag = delFlag;
+ }
+
+ public String getDelFlag()
+ {
+ return delFlag;
+ }
+ public void setCode(String code)
+ {
+ this.code = code;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("templateName", getTemplateName())
+ .append("phone", getPhone())
+ .append("templateCode", getTemplateCode())
+ .append("param", getParam())
+ .append("state", getState())
+ .append("sendby", getSendby())
+ .append("sendtime", getSendtime())
+ .append("note", getNote())
+ .append("delFlag", getDelFlag())
+ .append("code", getCode())
+ .append("type", getType())
+ .toString();
+ }
+}
diff --git a/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/mapper/SmsRecordMapper.java b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/mapper/SmsRecordMapper.java
new file mode 100644
index 0000000..d37d8eb
--- /dev/null
+++ b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/mapper/SmsRecordMapper.java
@@ -0,0 +1,70 @@
+package org.icec.mybatis.mapper;
+
+import java.util.List;
+
+import org.icec.mybatis.domain.SmsRecord;
+
+
+/**
+ * 短信记录Mapper接口
+ *
+ * @author jinxx
+ * @date 2020-09-14
+ */
+public interface SmsRecordMapper
+{
+ /**
+ * 查询短信记录
+ *
+ * @param id 短信记录ID
+ * @return 短信记录
+ */
+ public SmsRecord selectSmsRecordById(Long id);
+
+ /**
+ * 查询短信记录列表
+ *
+ * @param smsRecord 短信记录
+ * @return 短信记录集合
+ */
+ public List selectSmsRecordList(SmsRecord smsRecord);
+
+ /**
+ * 新增短信记录
+ *
+ * @param smsRecord 短信记录
+ * @return 结果
+ */
+ public int insertSmsRecord(SmsRecord smsRecord);
+
+ /**
+ * 修改短信记录
+ *
+ * @param smsRecord 短信记录
+ * @return 结果
+ */
+ public int updateSmsRecord(SmsRecord smsRecord);
+
+ /**
+ * 删除短信记录
+ *
+ * @param id 短信记录ID
+ * @return 结果
+ */
+ public int deleteSmsRecordById(Long id);
+
+ /**
+ * 批量删除短信记录
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteSmsRecordByIds(String[] ids);
+ /**
+ * 根据发送状态查询
+ *
+ * @param state
+ * @return
+ */
+ public List getRecordByState(String state);
+}
diff --git a/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/ISmsRecordService.java b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/ISmsRecordService.java
new file mode 100644
index 0000000..18182c7
--- /dev/null
+++ b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/ISmsRecordService.java
@@ -0,0 +1,63 @@
+package org.icec.mybatis.service;
+
+import java.util.List;
+
+import org.icec.mybatis.domain.SmsRecord;
+
+
+/**
+ * 短信记录Service接口
+ *
+ * @author jinxx
+ * @date 2020-09-14
+ */
+public interface ISmsRecordService
+{
+ /**
+ * 查询短信记录
+ *
+ * @param id 短信记录ID
+ * @return 短信记录
+ */
+ public SmsRecord selectSmsRecordById(Long id);
+
+ /**
+ * 查询短信记录列表
+ *
+ * @param smsRecord 短信记录
+ * @return 短信记录集合
+ */
+ public List selectSmsRecordList(SmsRecord smsRecord);
+
+ /**
+ * 新增短信记录
+ *
+ * @param smsRecord 短信记录
+ * @return 结果
+ */
+ public int insertSmsRecord(SmsRecord smsRecord);
+
+ /**
+ * 修改短信记录
+ *
+ * @param smsRecord 短信记录
+ * @return 结果
+ */
+ public int updateSmsRecord(SmsRecord smsRecord);
+
+ /**
+ * 批量删除短信记录
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteSmsRecordByIds(String ids);
+
+ /**
+ * 删除短信记录信息
+ *
+ * @param id 短信记录ID
+ * @return 结果
+ */
+ public int deleteSmsRecordById(Long id);
+}
diff --git a/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/impl/SmsRecordServiceImpl.java b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/impl/SmsRecordServiceImpl.java
new file mode 100644
index 0000000..619f33f
--- /dev/null
+++ b/module/icec-mybatis-demo/src/main/java/org/icec/mybatis/service/impl/SmsRecordServiceImpl.java
@@ -0,0 +1,94 @@
+package org.icec.mybatis.service.impl;
+
+import java.util.List;
+
+import org.icec.mybatis.domain.SmsRecord;
+import org.icec.mybatis.mapper.SmsRecordMapper;
+import org.icec.mybatis.service.ISmsRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 短信记录Service业务层处理
+ *
+ * @author jinxx
+ * @date 2020-09-14
+ */
+@Service
+public class SmsRecordServiceImpl implements ISmsRecordService
+{
+ @Autowired
+ private SmsRecordMapper smsRecordMapper;
+
+ /**
+ * 查询短信记录
+ *
+ * @param id 短信记录ID
+ * @return 短信记录
+ */
+ @Override
+ public SmsRecord selectSmsRecordById(Long id)
+ {
+ return smsRecordMapper.selectSmsRecordById(id);
+ }
+
+ /**
+ * 查询短信记录列表
+ *
+ * @param smsRecord 短信记录
+ * @return 短信记录
+ */
+ @Override
+ public List selectSmsRecordList(SmsRecord smsRecord)
+ {
+ return smsRecordMapper.selectSmsRecordList(smsRecord);
+ }
+
+ /**
+ * 新增短信记录
+ *
+ * @param smsRecord 短信记录
+ * @return 结果
+ */
+ @Override
+ public int insertSmsRecord(SmsRecord smsRecord)
+ {
+ return smsRecordMapper.insertSmsRecord(smsRecord);
+ }
+
+ /**
+ * 修改短信记录
+ *
+ * @param smsRecord 短信记录
+ * @return 结果
+ */
+ @Override
+ public int updateSmsRecord(SmsRecord smsRecord)
+ {
+ return smsRecordMapper.updateSmsRecord(smsRecord);
+ }
+
+ /**
+ * 删除短信记录对象
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ @Override
+ public int deleteSmsRecordByIds(String ids)
+ {
+ return 0;
+ }
+
+ /**
+ * 删除短信记录信息
+ *
+ * @param id 短信记录ID
+ * @return 结果
+ */
+ @Override
+ public int deleteSmsRecordById(Long id)
+ {
+ return smsRecordMapper.deleteSmsRecordById(id);
+ }
+}
diff --git a/module/icec-mybatis-demo/src/main/resources/mapper/SmsRecordMapper.xml b/module/icec-mybatis-demo/src/main/resources/mapper/SmsRecordMapper.xml
new file mode 100644
index 0000000..9587b7b
--- /dev/null
+++ b/module/icec-mybatis-demo/src/main/resources/mapper/SmsRecordMapper.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, template_name, phone, template_code, param, state, sendby, create_time, sendtime, note, del_flag, code, type from sms_record
+
+
+
+
+
+
+
+ insert into sms_record
+
+ template_name,
+ phone,
+ template_code,
+ param,
+ state,
+ sendby,
+ create_time,
+ sendtime,
+ note,
+ del_flag,
+ code,
+ type,
+
+
+ #{templateName},
+ #{phone},
+ #{templateCode},
+ #{param},
+ #{state},
+ #{sendby},
+ #{createTime},
+ #{sendtime},
+ #{note},
+ #{delFlag},
+ #{code},
+ #{type},
+
+
+
+
+ update sms_record
+
+ template_name = #{templateName},
+ phone = #{phone},
+ template_code = #{templateCode},
+ param = #{param},
+ state = #{state},
+ sendby = #{sendby},
+ create_time = #{createTime},
+ sendtime = #{sendtime},
+ note = #{note},
+ del_flag = #{delFlag},
+ code = #{code},
+ type = #{type},
+
+ where id = #{id}
+
+
+
+ delete from sms_record where id = #{id}
+
+
+
+ delete from sms_record where id in
+
+ #{id}
+
+
+
+
+
\ No newline at end of file
diff --git a/platform/icec-common/pom.xml b/platform/icec-common/pom.xml
index 662e121..aa70bd7 100644
--- a/platform/icec-common/pom.xml
+++ b/platform/icec-common/pom.xml
@@ -5,7 +5,7 @@
org.icec
icec-parent
- 2.1
+ 2.1.1
icec-common
diff --git a/platform/icec-common/src/main/java/org/icec/common/annotation/DataScope.java b/platform/icec-common/src/main/java/org/icec/common/annotation/DataScope.java
new file mode 100644
index 0000000..dff619d
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/annotation/DataScope.java
@@ -0,0 +1,28 @@
+package org.icec.common.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 数据权限过滤注解
+ *
+ *
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface DataScope
+{
+ /**
+ * 部门表的别名
+ */
+ public String deptAlias() default "";
+
+ /**
+ * 用户表的别名
+ */
+ public String userAlias() default "";
+}
diff --git a/platform/icec-common/src/main/java/org/icec/common/annotation/Excel.java b/platform/icec-common/src/main/java/org/icec/common/annotation/Excel.java
new file mode 100644
index 0000000..ba5855c
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/annotation/Excel.java
@@ -0,0 +1,123 @@
+package org.icec.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 自定义导出Excel数据注解
+ *
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Excel
+{
+ /**
+ * 导出到Excel中的名字.
+ */
+ public String name() default "";
+
+ /**
+ * 日期格式, 如: yyyy-MM-dd
+ */
+ public String dateFormat() default "";
+
+ /**
+ * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
+ */
+ public String dictType() default "";
+
+ /**
+ * 读取内容转表达式 (如: 0=男,1=女,2=未知)
+ */
+ public String readConverterExp() default "";
+
+ /**
+ * 分隔符,读取字符串组内容
+ */
+ public String separator() default ",";
+
+ /**
+ * 导出类型(0数字 1字符串)
+ */
+ public ColumnType cellType() default ColumnType.STRING;
+
+ /**
+ * 导出时在excel中每个列的高度 单位为字符
+ */
+ public double height() default 14;
+
+ /**
+ * 导出时在excel中每个列的宽 单位为字符
+ */
+ public double width() default 16;
+
+ /**
+ * 文字后缀,如% 90 变成90%
+ */
+ public String suffix() default "";
+
+ /**
+ * 当值为空时,字段的默认值
+ */
+ public String defaultValue() default "";
+
+ /**
+ * 提示信息
+ */
+ public String prompt() default "";
+
+ /**
+ * 设置只能选择不能输入的列内容.
+ */
+ public String[] combo() default {};
+
+ /**
+ * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
+ */
+ public boolean isExport() default true;
+
+ /**
+ * 另一个类中的属性名称,支持多级获取,以小数点隔开
+ */
+ public String targetAttr() default "";
+
+ /**
+ * 字段类型(0:导出导入;1:仅导出;2:仅导入)
+ */
+ Type type() default Type.ALL;
+
+ public enum Type
+ {
+ ALL(0), EXPORT(1), IMPORT(2);
+ private final int value;
+
+ Type(int value)
+ {
+ this.value = value;
+ }
+
+ public int value()
+ {
+ return this.value;
+ }
+ }
+
+ public enum ColumnType
+ {
+ NUMERIC(0), STRING(1);
+ private final int value;
+
+ ColumnType(int value)
+ {
+ this.value = value;
+ }
+
+ public int value()
+ {
+ return this.value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/platform/icec-common/src/main/java/org/icec/common/constants/Constants.java b/platform/icec-common/src/main/java/org/icec/common/constants/Constants.java
new file mode 100644
index 0000000..c6bb0b4
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/constants/Constants.java
@@ -0,0 +1,94 @@
+package org.icec.common.constants;
+
+/**
+ * 通用常量信息
+ *
+ *
+ */
+public class Constants
+{
+ /**
+ * UTF-8 字符集
+ */
+ public static final String UTF8 = "UTF-8";
+
+ /**
+ * GBK 字符集
+ */
+ public static final String GBK = "GBK";
+
+ /**
+ * 通用成功标识
+ */
+ public static final String SUCCESS = "0";
+
+ /**
+ * 通用失败标识
+ */
+ public static final String FAIL = "1";
+
+ /**
+ * 登录成功
+ */
+ public static final String LOGIN_SUCCESS = "Success";
+
+ /**
+ * 注销
+ */
+ public static final String LOGOUT = "Logout";
+
+ /**
+ * 注册
+ */
+ public static final String REGISTER = "Register";
+
+ /**
+ * 登录失败
+ */
+ public static final String LOGIN_FAIL = "Error";
+
+ /**
+ * 当前记录起始索引
+ */
+ public static final String PAGE_NUM = "pageNum";
+
+ /**
+ * 每页显示记录数
+ */
+ public static final String PAGE_SIZE = "pageSize";
+
+ /**
+ * 排序列
+ */
+ public static final String ORDER_BY_COLUMN = "orderByColumn";
+
+ /**
+ * 排序的方向 "desc" 或者 "asc".
+ */
+ public static final String IS_ASC = "isAsc";
+
+ /**
+ * 参数管理 cache name
+ */
+ public static final String SYS_CONFIG_CACHE = "sys-config";
+
+ /**
+ * 参数管理 cache key
+ */
+ public static final String SYS_CONFIG_KEY = "sys_config:";
+
+ /**
+ * 字典管理 cache name
+ */
+ public static final String SYS_DICT_CACHE = "sys-dict";
+
+ /**
+ * 字典管理 cache key
+ */
+ public static final String SYS_DICT_KEY = "sys_dict:";
+
+ /**
+ * 资源映射路径 前缀
+ */
+ public static final String RESOURCE_PREFIX = "/profile";
+}
diff --git a/platform/icec-common/src/main/java/org/icec/common/utils/ServletUtils.java b/platform/icec-common/src/main/java/org/icec/common/utils/ServletUtils.java
new file mode 100644
index 0000000..7a50e42
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/utils/ServletUtils.java
@@ -0,0 +1,136 @@
+package org.icec.common.utils;
+
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.icec.common.utils.text.Convert;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+/**
+ * 客户端工具类
+ *
+ *
+ */
+public class ServletUtils
+{
+ /**
+ * 获取String参数
+ */
+ public static String getParameter(String name)
+ {
+ return getRequest().getParameter(name);
+ }
+
+ /**
+ * 获取String参数
+ */
+ public static String getParameter(String name, String defaultValue)
+ {
+ return Convert.toStr(getRequest().getParameter(name), defaultValue);
+ }
+
+ /**
+ * 获取Integer参数
+ */
+ public static Integer getParameterToInt(String name)
+ {
+ return Convert.toInt(getRequest().getParameter(name));
+ }
+
+ /**
+ * 获取Integer参数
+ */
+ public static Integer getParameterToInt(String name, Integer defaultValue)
+ {
+ return Convert.toInt(getRequest().getParameter(name), defaultValue);
+ }
+
+ /**
+ * 获取request
+ */
+ public static HttpServletRequest getRequest()
+ {
+ return getRequestAttributes().getRequest();
+ }
+
+ /**
+ * 获取response
+ */
+ public static HttpServletResponse getResponse()
+ {
+ return getRequestAttributes().getResponse();
+ }
+
+ /**
+ * 获取session
+ */
+ public static HttpSession getSession()
+ {
+ return getRequest().getSession();
+ }
+
+ public static ServletRequestAttributes getRequestAttributes()
+ {
+ RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
+ return (ServletRequestAttributes) attributes;
+ }
+
+ /**
+ * 将字符串渲染到客户端
+ *
+ * @param response 渲染对象
+ * @param string 待渲染的字符串
+ * @return null
+ */
+ public static String renderString(HttpServletResponse response, String string)
+ {
+ try
+ {
+ response.setContentType("application/json");
+ response.setCharacterEncoding("utf-8");
+ response.getWriter().print(string);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 是否是Ajax异步请求
+ *
+ * @param request
+ */
+ public static boolean isAjaxRequest(HttpServletRequest request)
+ {
+ String accept = request.getHeader("accept");
+ if (accept != null && accept.indexOf("application/json") != -1)
+ {
+ return true;
+ }
+
+ String xRequestedWith = request.getHeader("X-Requested-With");
+ if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
+ {
+ return true;
+ }
+
+ String uri = request.getRequestURI();
+ if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
+ {
+ return true;
+ }
+
+ String ajax = request.getParameter("__ajax");
+ if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
+ {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/platform/icec-common/src/main/java/org/icec/common/utils/StringUtils.java b/platform/icec-common/src/main/java/org/icec/common/utils/StringUtils.java
new file mode 100644
index 0000000..adf28a0
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/utils/StringUtils.java
@@ -0,0 +1,405 @@
+package org.icec.common.utils;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.icec.common.utils.text.StrFormatter;
+
+/**
+ * 字符串工具类
+ *
+ * @author ruoyi
+ */
+public class StringUtils extends org.apache.commons.lang3.StringUtils
+{
+ /** 空字符串 */
+ private static final String NULLSTR = "";
+
+ /** 下划线 */
+ private static final char SEPARATOR = '_';
+
+ /**
+ * 获取参数不为空值
+ *
+ * @param value defaultValue 要判断的value
+ * @return value 返回值
+ */
+ public static T nvl(T value, T defaultValue)
+ {
+ return value != null ? value : defaultValue;
+ }
+
+ /**
+ * * 判断一个Collection是否为空, 包含List,Set,Queue
+ *
+ * @param coll 要判断的Collection
+ * @return true:为空 false:非空
+ */
+ public static boolean isEmpty(Collection> coll)
+ {
+ return isNull(coll) || coll.isEmpty();
+ }
+
+ /**
+ * * 判断一个Collection是否非空,包含List,Set,Queue
+ *
+ * @param coll 要判断的Collection
+ * @return true:非空 false:空
+ */
+ public static boolean isNotEmpty(Collection> coll)
+ {
+ return !isEmpty(coll);
+ }
+
+ /**
+ * * 判断一个对象数组是否为空
+ *
+ * @param objects 要判断的对象数组
+ ** @return true:为空 false:非空
+ */
+ public static boolean isEmpty(Object[] objects)
+ {
+ return isNull(objects) || (objects.length == 0);
+ }
+
+ /**
+ * * 判断一个对象数组是否非空
+ *
+ * @param objects 要判断的对象数组
+ * @return true:非空 false:空
+ */
+ public static boolean isNotEmpty(Object[] objects)
+ {
+ return !isEmpty(objects);
+ }
+
+ /**
+ * * 判断一个Map是否为空
+ *
+ * @param map 要判断的Map
+ * @return true:为空 false:非空
+ */
+ public static boolean isEmpty(Map, ?> map)
+ {
+ return isNull(map) || map.isEmpty();
+ }
+
+ /**
+ * * 判断一个Map是否为空
+ *
+ * @param map 要判断的Map
+ * @return true:非空 false:空
+ */
+ public static boolean isNotEmpty(Map, ?> map)
+ {
+ return !isEmpty(map);
+ }
+
+ /**
+ * * 判断一个字符串是否为空串
+ *
+ * @param str String
+ * @return true:为空 false:非空
+ */
+ public static boolean isEmpty(String str)
+ {
+ return isNull(str) || NULLSTR.equals(str.trim());
+ }
+
+ /**
+ * * 判断一个字符串是否为非空串
+ *
+ * @param str String
+ * @return true:非空串 false:空串
+ */
+ public static boolean isNotEmpty(String str)
+ {
+ return !isEmpty(str);
+ }
+
+ /**
+ * * 判断一个对象是否为空
+ *
+ * @param object Object
+ * @return true:为空 false:非空
+ */
+ public static boolean isNull(Object object)
+ {
+ return object == null;
+ }
+
+ /**
+ * * 判断一个对象是否非空
+ *
+ * @param object Object
+ * @return true:非空 false:空
+ */
+ public static boolean isNotNull(Object object)
+ {
+ return !isNull(object);
+ }
+
+ /**
+ * * 判断一个对象是否是数组类型(Java基本型别的数组)
+ *
+ * @param object 对象
+ * @return true:是数组 false:不是数组
+ */
+ public static boolean isArray(Object object)
+ {
+ return isNotNull(object) && object.getClass().isArray();
+ }
+
+ /**
+ * 去空格
+ */
+ public static String trim(String str)
+ {
+ return (str == null ? "" : str.trim());
+ }
+
+ /**
+ * 截取字符串
+ *
+ * @param str 字符串
+ * @param start 开始
+ * @return 结果
+ */
+ public static String substring(final String str, int start)
+ {
+ if (str == null)
+ {
+ return NULLSTR;
+ }
+
+ if (start < 0)
+ {
+ start = str.length() + start;
+ }
+
+ if (start < 0)
+ {
+ start = 0;
+ }
+ if (start > str.length())
+ {
+ return NULLSTR;
+ }
+
+ return str.substring(start);
+ }
+
+ /**
+ * 截取字符串
+ *
+ * @param str 字符串
+ * @param start 开始
+ * @param end 结束
+ * @return 结果
+ */
+ public static String substring(final String str, int start, int end)
+ {
+ if (str == null)
+ {
+ return NULLSTR;
+ }
+
+ if (end < 0)
+ {
+ end = str.length() + end;
+ }
+ if (start < 0)
+ {
+ start = str.length() + start;
+ }
+
+ if (end > str.length())
+ {
+ end = str.length();
+ }
+
+ if (start > end)
+ {
+ return NULLSTR;
+ }
+
+ if (start < 0)
+ {
+ start = 0;
+ }
+ if (end < 0)
+ {
+ end = 0;
+ }
+
+ return str.substring(start, end);
+ }
+
+ /**
+ * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ *
+ * @param template 文本模板,被替换的部分用 {} 表示
+ * @param params 参数值
+ * @return 格式化后的文本
+ */
+ public static String format(String template, Object... params)
+ {
+ if (isEmpty(params) || isEmpty(template))
+ {
+ return template;
+ }
+ return StrFormatter.format(template, params);
+ }
+
+ /**
+ * 下划线转驼峰命名
+ */
+ public static String toUnderScoreCase(String str)
+ {
+ if (str == null)
+ {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder();
+ // 前置字符是否大写
+ boolean preCharIsUpperCase = true;
+ // 当前字符是否大写
+ boolean curreCharIsUpperCase = true;
+ // 下一字符是否大写
+ boolean nexteCharIsUpperCase = true;
+ for (int i = 0; i < str.length(); i++)
+ {
+ char c = str.charAt(i);
+ if (i > 0)
+ {
+ preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
+ }
+ else
+ {
+ preCharIsUpperCase = false;
+ }
+
+ curreCharIsUpperCase = Character.isUpperCase(c);
+
+ if (i < (str.length() - 1))
+ {
+ nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
+ }
+
+ if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase)
+ {
+ sb.append(SEPARATOR);
+ }
+ else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase)
+ {
+ sb.append(SEPARATOR);
+ }
+ sb.append(Character.toLowerCase(c));
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * 是否包含字符串
+ *
+ * @param str 验证字符串
+ * @param strs 字符串组
+ * @return 包含返回true
+ */
+ public static boolean inStringIgnoreCase(String str, String... strs)
+ {
+ if (str != null && strs != null)
+ {
+ for (String s : strs)
+ {
+ if (str.equalsIgnoreCase(trim(s)))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
+ *
+ * @param name 转换前的下划线大写方式命名的字符串
+ * @return 转换后的驼峰式命名的字符串
+ */
+ public static String convertToCamelCase(String name)
+ {
+ StringBuilder result = new StringBuilder();
+ // 快速检查
+ if (name == null || name.isEmpty())
+ {
+ // 没必要转换
+ return "";
+ }
+ else if (!name.contains("_"))
+ {
+ // 不含下划线,仅将首字母大写
+ return name.substring(0, 1).toUpperCase() + name.substring(1);
+ }
+ // 用下划线将原始字符串分割
+ String[] camels = name.split("_");
+ for (String camel : camels)
+ {
+ // 跳过原始字符串中开头、结尾的下换线或双重下划线
+ if (camel.isEmpty())
+ {
+ continue;
+ }
+ // 首字母大写
+ result.append(camel.substring(0, 1).toUpperCase());
+ result.append(camel.substring(1).toLowerCase());
+ }
+ return result.toString();
+ }
+
+ /**
+ * 驼峰式命名法 例如:user_name->userName
+ */
+ public static String toCamelCase(String s)
+ {
+ if (s == null)
+ {
+ return null;
+ }
+ s = s.toLowerCase();
+ StringBuilder sb = new StringBuilder(s.length());
+ boolean upperCase = false;
+ for (int i = 0; i < s.length(); i++)
+ {
+ char c = s.charAt(i);
+
+ if (c == SEPARATOR)
+ {
+ upperCase = true;
+ }
+ else if (upperCase)
+ {
+ sb.append(Character.toUpperCase(c));
+ upperCase = false;
+ }
+ else
+ {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static T cast(Object obj)
+ {
+ return (T) obj;
+ }
+}
\ No newline at end of file
diff --git a/platform/icec-common/src/main/java/org/icec/common/utils/text/CharsetKit.java b/platform/icec-common/src/main/java/org/icec/common/utils/text/CharsetKit.java
new file mode 100644
index 0000000..f485e88
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/utils/text/CharsetKit.java
@@ -0,0 +1,85 @@
+package org.icec.common.utils.text;
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import org.icec.common.utils.StringUtils;
+/**
+ * 字符集工具类
+ *
+ *
+ */
+public class CharsetKit
+{
+ /** ISO-8859-1 */
+ public static final String ISO_8859_1 = "ISO-8859-1";
+ /** UTF-8 */
+ public static final String UTF_8 = "UTF-8";
+ /** GBK */
+ public static final String GBK = "GBK";
+
+ /** ISO-8859-1 */
+ public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
+ /** UTF-8 */
+ public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
+ /** GBK */
+ public static final Charset CHARSET_GBK = Charset.forName(GBK);
+
+ /**
+ * 转换为Charset对象
+ *
+ * @param charset 字符集,为空则返回默认字符集
+ * @return Charset
+ */
+ public static Charset charset(String charset)
+ {
+ return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
+ }
+
+ /**
+ * 转换字符串的字符集编码
+ *
+ * @param source 字符串
+ * @param srcCharset 源字符集,默认ISO-8859-1
+ * @param destCharset 目标字符集,默认UTF-8
+ * @return 转换后的字符集
+ */
+ public static String convert(String source, String srcCharset, String destCharset)
+ {
+ return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
+ }
+
+ /**
+ * 转换字符串的字符集编码
+ *
+ * @param source 字符串
+ * @param srcCharset 源字符集,默认ISO-8859-1
+ * @param destCharset 目标字符集,默认UTF-8
+ * @return 转换后的字符集
+ */
+ public static String convert(String source, Charset srcCharset, Charset destCharset)
+ {
+ if (null == srcCharset)
+ {
+ srcCharset = StandardCharsets.ISO_8859_1;
+ }
+
+ if (null == destCharset)
+ {
+ srcCharset = StandardCharsets.UTF_8;
+ }
+
+ if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
+ {
+ return source;
+ }
+ return new String(source.getBytes(srcCharset), destCharset);
+ }
+
+ /**
+ * @return 系统字符集编码
+ */
+ public static String systemCharset()
+ {
+ return Charset.defaultCharset().name();
+ }
+}
diff --git a/platform/icec-common/src/main/java/org/icec/common/utils/text/Convert.java b/platform/icec-common/src/main/java/org/icec/common/utils/text/Convert.java
new file mode 100644
index 0000000..2bbb34c
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/utils/text/Convert.java
@@ -0,0 +1,998 @@
+package org.icec.common.utils.text;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.text.NumberFormat;
+import java.util.Set;
+import org.icec.common.utils.StringUtils;
+/**
+ * 类型转换器
+ *
+ *
+ */
+public class Convert
+{
+ /**
+ * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static String toStr(Object value, String defaultValue)
+ {
+ if (null == value)
+ {
+ return defaultValue;
+ }
+ if (value instanceof String)
+ {
+ return (String) value;
+ }
+ return value.toString();
+ }
+
+ /**
+ * 转换为字符串
+ * 如果给定的值为null
,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static String toStr(Object value)
+ {
+ return toStr(value, null);
+ }
+
+ /**
+ * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Character toChar(Object value, Character defaultValue)
+ {
+ if (null == value)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Character)
+ {
+ return (Character) value;
+ }
+
+ final String valueStr = toStr(value, null);
+ return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0);
+ }
+
+ /**
+ * 转换为字符
+ * 如果给定的值为null
,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Character toChar(Object value)
+ {
+ return toChar(value, null);
+ }
+
+ /**
+ * 转换为byte
+ * 如果给定的值为null
,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Byte toByte(Object value, Byte defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Byte)
+ {
+ return (Byte) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).byteValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Byte.parseByte(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为byte
+ * 如果给定的值为null
,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Byte toByte(Object value)
+ {
+ return toByte(value, null);
+ }
+
+ /**
+ * 转换为Short
+ * 如果给定的值为null
,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Short toShort(Object value, Short defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Short)
+ {
+ return (Short) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).shortValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Short.parseShort(valueStr.trim());
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Short
+ * 如果给定的值为null
,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Short toShort(Object value)
+ {
+ return toShort(value, null);
+ }
+
+ /**
+ * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Number toNumber(Object value, Number defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Number)
+ {
+ return (Number) value;
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return NumberFormat.getInstance().parse(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Number toNumber(Object value)
+ {
+ return toNumber(value, null);
+ }
+
+ /**
+ * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Integer toInt(Object value, Integer defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Integer)
+ {
+ return (Integer) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).intValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Integer.parseInt(valueStr.trim());
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为int
+ * 如果给定的值为null
,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Integer toInt(Object value)
+ {
+ return toInt(value, null);
+ }
+
+ /**
+ * 转换为Integer数组
+ *
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static Integer[] toIntArray(String str)
+ {
+ return toIntArray(",", str);
+ }
+
+ /**
+ * 转换为Long数组
+ *
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static Long[] toLongArray(String str)
+ {
+ return toLongArray(",", str);
+ }
+
+ /**
+ * 转换为Integer数组
+ *
+ * @param split 分隔符
+ * @param split 被转换的值
+ * @return 结果
+ */
+ public static Integer[] toIntArray(String split, String str)
+ {
+ if (StringUtils.isEmpty(str))
+ {
+ return new Integer[] {};
+ }
+ String[] arr = str.split(split);
+ final Integer[] ints = new Integer[arr.length];
+ for (int i = 0; i < arr.length; i++)
+ {
+ final Integer v = toInt(arr[i], 0);
+ ints[i] = v;
+ }
+ return ints;
+ }
+
+ /**
+ * 转换为Long数组
+ *
+ * @param split 分隔符
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static Long[] toLongArray(String split, String str)
+ {
+ if (StringUtils.isEmpty(str))
+ {
+ return new Long[] {};
+ }
+ String[] arr = str.split(split);
+ final Long[] longs = new Long[arr.length];
+ for (int i = 0; i < arr.length; i++)
+ {
+ final Long v = toLong(arr[i], null);
+ longs[i] = v;
+ }
+ return longs;
+ }
+
+ /**
+ * 转换为String数组
+ *
+ * @param str 被转换的值
+ * @return 结果
+ */
+ public static String[] toStrArray(String str)
+ {
+ return toStrArray(",", str);
+ }
+
+ /**
+ * 转换为String数组
+ *
+ * @param split 分隔符
+ * @param split 被转换的值
+ * @return 结果
+ */
+ public static String[] toStrArray(String split, String str)
+ {
+ return str.split(split);
+ }
+
+ /**
+ * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Long toLong(Object value, Long defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Long)
+ {
+ return (Long) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).longValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ // 支持科学计数法
+ return new BigDecimal(valueStr.trim()).longValue();
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为long
+ * 如果给定的值为null
,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Long toLong(Object value)
+ {
+ return toLong(value, null);
+ }
+
+ /**
+ * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Double toDouble(Object value, Double defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Double)
+ {
+ return (Double) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).doubleValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ // 支持科学计数法
+ return new BigDecimal(valueStr.trim()).doubleValue();
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Double toDouble(Object value)
+ {
+ return toDouble(value, null);
+ }
+
+ /**
+ * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Float toFloat(Object value, Float defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Float)
+ {
+ return (Float) value;
+ }
+ if (value instanceof Number)
+ {
+ return ((Number) value).floatValue();
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Float.parseFloat(valueStr.trim());
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Float toFloat(Object value)
+ {
+ return toFloat(value, null);
+ }
+
+ /**
+ * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static Boolean toBool(Object value, Boolean defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof Boolean)
+ {
+ return (Boolean) value;
+ }
+ String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ valueStr = valueStr.trim().toLowerCase();
+ switch (valueStr)
+ {
+ case "true":
+ return true;
+ case "false":
+ return false;
+ case "yes":
+ return true;
+ case "ok":
+ return true;
+ case "no":
+ return false;
+ case "1":
+ return true;
+ case "0":
+ return false;
+ default:
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static Boolean toBool(Object value)
+ {
+ return toBool(value, null);
+ }
+
+ /**
+ * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ *
+ * @param clazz Enum的Class
+ * @param value 值
+ * @param defaultValue 默认值
+ * @return Enum
+ */
+ public static > E toEnum(Class clazz, Object value, E defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (clazz.isAssignableFrom(value.getClass()))
+ {
+ @SuppressWarnings("unchecked")
+ E myE = (E) value;
+ return myE;
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return Enum.valueOf(clazz, valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ *
+ * @param clazz Enum的Class
+ * @param value 值
+ * @return Enum
+ */
+ public static > E toEnum(Class clazz, Object value)
+ {
+ return toEnum(clazz, value, null);
+ }
+
+ /**
+ * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof BigInteger)
+ {
+ return (BigInteger) value;
+ }
+ if (value instanceof Long)
+ {
+ return BigInteger.valueOf((Long) value);
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return new BigInteger(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static BigInteger toBigInteger(Object value)
+ {
+ return toBigInteger(value, null);
+ }
+
+ /**
+ * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @param defaultValue 转换错误时的默认值
+ * @return 结果
+ */
+ public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
+ {
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ if (value instanceof BigDecimal)
+ {
+ return (BigDecimal) value;
+ }
+ if (value instanceof Long)
+ {
+ return new BigDecimal((Long) value);
+ }
+ if (value instanceof Double)
+ {
+ return new BigDecimal((Double) value);
+ }
+ if (value instanceof Integer)
+ {
+ return new BigDecimal((Integer) value);
+ }
+ final String valueStr = toStr(value, null);
+ if (StringUtils.isEmpty(valueStr))
+ {
+ return defaultValue;
+ }
+ try
+ {
+ return new BigDecimal(valueStr);
+ }
+ catch (Exception e)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错
+ *
+ * @param value 被转换的值
+ * @return 结果
+ */
+ public static BigDecimal toBigDecimal(Object value)
+ {
+ return toBigDecimal(value, null);
+ }
+
+ /**
+ * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
+ *
+ * @param obj 对象
+ * @return 字符串
+ */
+ public static String utf8Str(Object obj)
+ {
+ return str(obj, CharsetKit.CHARSET_UTF_8);
+ }
+
+ /**
+ * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
+ *
+ * @param obj 对象
+ * @param charsetName 字符集
+ * @return 字符串
+ */
+ public static String str(Object obj, String charsetName)
+ {
+ return str(obj, Charset.forName(charsetName));
+ }
+
+ /**
+ * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
+ *
+ * @param obj 对象
+ * @param charset 字符集
+ * @return 字符串
+ */
+ public static String str(Object obj, Charset charset)
+ {
+ if (null == obj)
+ {
+ return null;
+ }
+
+ if (obj instanceof String)
+ {
+ return (String) obj;
+ }
+ else if (obj instanceof byte[] || obj instanceof Byte[])
+ {
+ return str((Byte[]) obj, charset);
+ }
+ else if (obj instanceof ByteBuffer)
+ {
+ return str((ByteBuffer) obj, charset);
+ }
+ return obj.toString();
+ }
+
+ /**
+ * 将byte数组转为字符串
+ *
+ * @param bytes byte数组
+ * @param charset 字符集
+ * @return 字符串
+ */
+ public static String str(byte[] bytes, String charset)
+ {
+ return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
+ }
+
+ /**
+ * 解码字节码
+ *
+ * @param data 字符串
+ * @param charset 字符集,如果此字段为空,则解码的结果取决于平台
+ * @return 解码后的字符串
+ */
+ public static String str(byte[] data, Charset charset)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+
+ if (null == charset)
+ {
+ return new String(data);
+ }
+ return new String(data, charset);
+ }
+
+ /**
+ * 将编码的byteBuffer数据转换为字符串
+ *
+ * @param data 数据
+ * @param charset 字符集,如果为空使用当前系统字符集
+ * @return 字符串
+ */
+ public static String str(ByteBuffer data, String charset)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+
+ return str(data, Charset.forName(charset));
+ }
+
+ /**
+ * 将编码的byteBuffer数据转换为字符串
+ *
+ * @param data 数据
+ * @param charset 字符集,如果为空使用当前系统字符集
+ * @return 字符串
+ */
+ public static String str(ByteBuffer data, Charset charset)
+ {
+ if (null == charset)
+ {
+ charset = Charset.defaultCharset();
+ }
+ return charset.decode(data).toString();
+ }
+
+ // ----------------------------------------------------------------------- 全角半角转换
+ /**
+ * 半角转全角
+ *
+ * @param input String.
+ * @return 全角字符串.
+ */
+ public static String toSBC(String input)
+ {
+ return toSBC(input, null);
+ }
+
+ /**
+ * 半角转全角
+ *
+ * @param input String
+ * @param notConvertSet 不替换的字符集合
+ * @return 全角字符串.
+ */
+ public static String toSBC(String input, Set notConvertSet)
+ {
+ char c[] = input.toCharArray();
+ for (int i = 0; i < c.length; i++)
+ {
+ if (null != notConvertSet && notConvertSet.contains(c[i]))
+ {
+ // 跳过不替换的字符
+ continue;
+ }
+
+ if (c[i] == ' ')
+ {
+ c[i] = '\u3000';
+ }
+ else if (c[i] < '\177')
+ {
+ c[i] = (char) (c[i] + 65248);
+
+ }
+ }
+ return new String(c);
+ }
+
+ /**
+ * 全角转半角
+ *
+ * @param input String.
+ * @return 半角字符串
+ */
+ public static String toDBC(String input)
+ {
+ return toDBC(input, null);
+ }
+
+ /**
+ * 替换全角为半角
+ *
+ * @param text 文本
+ * @param notConvertSet 不替换的字符集合
+ * @return 替换后的字符
+ */
+ public static String toDBC(String text, Set notConvertSet)
+ {
+ char c[] = text.toCharArray();
+ for (int i = 0; i < c.length; i++)
+ {
+ if (null != notConvertSet && notConvertSet.contains(c[i]))
+ {
+ // 跳过不替换的字符
+ continue;
+ }
+
+ if (c[i] == '\u3000')
+ {
+ c[i] = ' ';
+ }
+ else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
+ {
+ c[i] = (char) (c[i] - 65248);
+ }
+ }
+ String returnString = new String(c);
+
+ return returnString;
+ }
+
+ /**
+ * 数字金额大写转换 先写个完整的然后将如零拾替换成零
+ *
+ * @param n 数字
+ * @return 中文大写数字
+ */
+ public static String digitUppercase(double n)
+ {
+ String[] fraction = { "角", "分" };
+ String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
+ String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
+
+ String head = n < 0 ? "负" : "";
+ n = Math.abs(n);
+
+ String s = "";
+ for (int i = 0; i < fraction.length; i++)
+ {
+ s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
+ }
+ if (s.length() < 1)
+ {
+ s = "整";
+ }
+ int integerPart = (int) Math.floor(n);
+
+ for (int i = 0; i < unit[0].length && integerPart > 0; i++)
+ {
+ String p = "";
+ for (int j = 0; j < unit[1].length && n > 0; j++)
+ {
+ p = digit[integerPart % 10] + unit[1][j] + p;
+ integerPart = integerPart / 10;
+ }
+ s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s;
+ }
+ return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
+ }
+}
diff --git a/platform/icec-common/src/main/java/org/icec/common/utils/text/StrFormatter.java b/platform/icec-common/src/main/java/org/icec/common/utils/text/StrFormatter.java
new file mode 100644
index 0000000..f39109a
--- /dev/null
+++ b/platform/icec-common/src/main/java/org/icec/common/utils/text/StrFormatter.java
@@ -0,0 +1,92 @@
+package org.icec.common.utils.text;
+
+import org.icec.common.utils.StringUtils;
+
+/**
+ * 字符串格式化
+ *
+ *
+ */
+public class StrFormatter
+{
+ public static final String EMPTY_JSON = "{}";
+ public static final char C_BACKSLASH = '\\';
+ public static final char C_DELIM_START = '{';
+ public static final char C_DELIM_END = '}';
+
+ /**
+ * 格式化字符串
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ *
+ * @param strPattern 字符串模板
+ * @param argArray 参数列表
+ * @return 结果
+ */
+ public static String format(final String strPattern, final Object... argArray)
+ {
+ if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
+ {
+ return strPattern;
+ }
+ final int strPatternLength = strPattern.length();
+
+ // 初始化定义好的长度以获得更好的性能
+ StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
+
+ int handledPosition = 0;
+ int delimIndex;// 占位符所在位置
+ for (int argIndex = 0; argIndex < argArray.length; argIndex++)
+ {
+ delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
+ if (delimIndex == -1)
+ {
+ if (handledPosition == 0)
+ {
+ return strPattern;
+ }
+ else
+ { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
+ sbuf.append(strPattern, handledPosition, strPatternLength);
+ return sbuf.toString();
+ }
+ }
+ else
+ {
+ if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
+ {
+ if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
+ {
+ // 转义符之前还有一个转义符,占位符依旧有效
+ sbuf.append(strPattern, handledPosition, delimIndex - 1);
+ sbuf.append(Convert.utf8Str(argArray[argIndex]));
+ handledPosition = delimIndex + 2;
+ }
+ else
+ {
+ // 占位符被转义
+ argIndex--;
+ sbuf.append(strPattern, handledPosition, delimIndex - 1);
+ sbuf.append(C_DELIM_START);
+ handledPosition = delimIndex + 1;
+ }
+ }
+ else
+ {
+ // 正常占位符
+ sbuf.append(strPattern, handledPosition, delimIndex);
+ sbuf.append(Convert.utf8Str(argArray[argIndex]));
+ handledPosition = delimIndex + 2;
+ }
+ }
+ }
+ // 加入最后一个占位符后所有的字符
+ sbuf.append(strPattern, handledPosition, strPattern.length());
+
+ return sbuf.toString();
+ }
+}
diff --git a/platform/pom.xml b/platform/pom.xml
index 2391fbb..a447615 100644
--- a/platform/pom.xml
+++ b/platform/pom.xml
@@ -6,7 +6,7 @@
pom
- icec-parent
+ icec-parent
icec-common
icec-sys
icec-static
--
Gitee
From 6fc504b6e6ac944affe79a1f89c989028bd42c5d Mon Sep 17 00:00:00 2001
From: xxjin <313383180@qq.com>
Date: Fri, 11 Dec 2020 15:59:01 +0800
Subject: [PATCH 7/9] =?UTF-8?q?=E6=95=B4=E5=90=88jimu?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
application/icec-admin/pom.xml | 6 +-
.../main/resources/application-dev.properties | 38 -------
.../src/main/resources/application-dev.yml | 45 ++++++++
.../src/main/resources/application.properties | 31 ------
.../src/main/resources/application.yml | 93 ++++++++++++++++
module/icec-jimureport/pom.xml | 105 ++++++++++++++++++
.../java/org/icec/jimureport/JimuConfig.java | 12 ++
.../java/org/icec/jimureport/MvcConfig.java | 45 ++++++++
.../jimureport/MyFreeMarkerViewResolver.java | 43 +++++++
.../jimureport/MyThymeleafViewResolver.java | 43 +++++++
.../service/a/JmReportMapService.java | 20 ++++
module/pom.xml | 12 ++
.../org/icec/common/web/BaseController.java | 2 +-
platform/icec-parent/pom.xml | 2 +
.../icec/web/core/config/MyBatisConfig.java | 6 +-
.../icec/web/core/config/SystemConfig.java | 30 +++--
16 files changed, 445 insertions(+), 88 deletions(-)
delete mode 100644 application/icec-admin/src/main/resources/application-dev.properties
create mode 100644 application/icec-admin/src/main/resources/application-dev.yml
delete mode 100644 application/icec-admin/src/main/resources/application.properties
create mode 100644 application/icec-admin/src/main/resources/application.yml
create mode 100644 module/icec-jimureport/pom.xml
create mode 100644 module/icec-jimureport/src/main/java/org/icec/jimureport/JimuConfig.java
create mode 100644 module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java
create mode 100644 module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java
create mode 100644 module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java
create mode 100644 module/icec-jimureport/src/main/java/org/jeecg/modules/jmreport/desreport/service/a/JmReportMapService.java
create mode 100644 module/pom.xml
diff --git a/application/icec-admin/pom.xml b/application/icec-admin/pom.xml
index 9b47eab..b4cd262 100644
--- a/application/icec-admin/pom.xml
+++ b/application/icec-admin/pom.xml
@@ -44,11 +44,11 @@
icec-static
${icec.version}
-
+
diff --git a/application/icec-admin/src/main/resources/application-dev.properties b/application/icec-admin/src/main/resources/application-dev.properties
deleted file mode 100644
index 39e8dd0..0000000
--- a/application/icec-admin/src/main/resources/application-dev.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-server.port=8080
-spring.thymeleaf.content-type=text/html
-spring.thymeleaf.cache=false
-spring.thymeleaf.mode =HTML
-#:replace(dbIp,dbName,dbPassword,driver){
-#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://192.168.222.128:3306/icec?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false
-spring.datasource.username=icec
-spring.datasource.password=icec
-spring.datasource.druid.initial-size=1
-spring.datasource.druid.max-active=20
-spring.datasource.druid.min-idle=1
-spring.datasource.druid.max-wait=60000
-#spring.datasource.druid.validation-query=select 1
-#spring.datasource.druid.validation-query-timeout=
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-#web-stat-filter
-spring.datasource.druid.web-stat-filter.enabled=false
-spring.datasource.druid.web-stat-filter.url-pattern=/*
-spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*
-#web-stat-filter
-spring.datasource.druid.stat-view-servlet.url-pattern=/druid/*
-spring.datasource.druid.stat-view-servlet.allow=
-spring.datasource.druid.stat-view-servlet.deny=
-spring.datasource.druid.stat-view-servlet.reset-enable=false
-spring.datasource.druid.stat-view-servlet.login-username=admin
-spring.datasource.druid.stat-view-servlet.login-password=123456
-#}
-beetlsql.daoPackage=
-#upload max file size
-spring.http.multipart.maxFileSize=10Mb
-spring.http.multipart.maxRequestSize=10Mb
-
-#syslog level 0,1;base :0 ,all:1
-core.sys.logLevel=0
-
diff --git a/application/icec-admin/src/main/resources/application-dev.yml b/application/icec-admin/src/main/resources/application-dev.yml
new file mode 100644
index 0000000..d3653ba
--- /dev/null
+++ b/application/icec-admin/src/main/resources/application-dev.yml
@@ -0,0 +1,45 @@
+spring:
+ datasource:
+ druid:
+ stat-view-servlet:
+ enabled: true
+ loginUsername: admin
+ loginPassword: 123456
+ allow:
+ web-stat-filter:
+ enabled: true
+ dynamic:
+ druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+ # 连接池的配置信息
+ # 初始化大小,最小,最大
+ initial-size: 5
+ min-idle: 5
+ maxActive: 20
+ # 配置获取连接等待超时的时间
+ maxWait: 60000
+ # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+ timeBetweenEvictionRunsMillis: 60000
+ # 配置一个连接在池中最小生存的时间,单位是毫秒
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ # 打开PSCache,并且指定每个连接上PSCache的大小
+ poolPreparedStatements: true
+ maxPoolPreparedStatementPerConnectionSize: 20
+ # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+ filters: stat,wall,slf4j
+
+ datasource:
+ master:
+ url: jdbc:mysql://192.168.222.128:3306/icec?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false
+ username: icec
+ password: icec
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ # 多数据源配置
+ #multi-datasource1:
+ #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+ #username: root
+ #password: root
+ #driver-class-name: com.mysql.cj.jdbc.Driver
\ No newline at end of file
diff --git a/application/icec-admin/src/main/resources/application.properties b/application/icec-admin/src/main/resources/application.properties
deleted file mode 100644
index 6b748a4..0000000
--- a/application/icec-admin/src/main/resources/application.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-spring.profiles.active=@profiles.active@
-spring.thymeleaf.content-type=text/html
-spring.thymeleaf.cache=false
-spring.thymeleaf.mode =HTML
-security.basic.enabled: false
-spring.http.encoding.force=true
-spring.http.encoding.charset=UTF-8
-spring.http.encoding.enabled=true
-server.tomcat.uri-encoding=UTF-8
-#:replace(dbIp,dbName,dbPassword,driver){
-#datasource.driver=com.mysql.jdbc.Driver
-#datasource.url=jdbc:mysql://127.0.0.1:3306/icec?useUnicode=true&characterEncoding=UTF8&useSSL=false&zeroDateTimeBehavior=convertToNull&
-#datasource.username=icec
-#datasource.password=icec
-#}
-# MyBatis
-mybatis.typeAliasesPackage=org.icec.**.domain
- # 搜索指定包别名
- # 配置mapper的扫描,找到所有的mapper.xml映射文件
-mybatis.mapperLocations=classpath*:mapper/**/*Mapper.xml
- # 加载全局的配置文件
-mybatis.configLocation=classpath:mybatis/mybatis-config.xml
-
-#upload max file size
-spring.http.multipart.maxFileSize=10Mb
-spring.http.multipart.maxRequestSize=10Mb
-
-default_page_size=10
-
-#file updad path // if blank means use project path
-icec.upload.path=
\ No newline at end of file
diff --git a/application/icec-admin/src/main/resources/application.yml b/application/icec-admin/src/main/resources/application.yml
new file mode 100644
index 0000000..71f8cbf
--- /dev/null
+++ b/application/icec-admin/src/main/resources/application.yml
@@ -0,0 +1,93 @@
+server:
+ port: 8080
+ tomcat:
+ uri-encoding: UTF-8
+ servlet:
+ encoding:
+ force: true
+ charset: UTF-8
+ enabled: true
+
+spring:
+ profiles:
+ active : @profiles.active@
+ thymeleaf:
+ cache: false
+ mode: HTML
suffix: .html
+ servlet:
+ content-type: text/html
servlet:
multipart:
max-file-size: 10MB
+ max-request-size: 10MB
autoconfigure:
+ exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+# 是否开启thymeleaf缓存,本地为false,生产建议为true
+ freemarker:
+ cache: false
+ charset: UTF-8
+ allow-request-override: false
+ check-template-location: true
+ #类型
+ content-type: text/html
+ expose-request-attributes: true
+ expose-session-attributes: true
+ prefix: jmreport
+ #文件后缀
+ suffix: .ftl
+ #路径
+ template-loader-path: classpath:/templates/
+
+icec:
+ default_page_size: 10
+ upload:
+ #file updad path // if blank means use project path
+ path:
+ #syslog level 0,1;base :0 ,all:1
+ core:
+ sys:
+ logLevel: 0
+ beetlsql:
+ dbStyle: mysql #
+ daoPackage:
+
+#mybatis plus 设置
+mybatis-plus:
+ mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
+ global-config:
+ # 关闭MP3.0自带的banner
+ banner: false
+ db-config:
+ #主键类型
+ id-type: ASSIGN_ID
+ # 默认数据库表下划线命名
+ table-underline: true
+ configuration:
+ # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
+ #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ # 返回类型为Map,显示null对应的字段
+ call-setters-on-nulls: true
+# MyBatis
+#mybatis:
+# typeAliasesPackage: org.icec.**.domain,org.jeecg.**.entity
+# mapperLocations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
+# configLocation: classpath:mybatis/mybatis-config.xml
+
+jeecg :
+ # 本地:local\Minio:minio\阿里云:alioss
+ uploadType: local
+ path :
+ #文件上传根目录 设置
+ upload: D://opt//upFiles
+ #webapp文件路径
+ webapp: D://opt//webapp
+ #阿里云oss存储配置
+ oss:
+ endpoint: oss-cn-beijing.aliyuncs.com
+ accessKey: ??
+ secretKey: ??
+ bucketName: jeecgos
+ staticDomain: ??
+
+ # minio文件上传
+ minio:
+ minio_url: http://minio.jeecg.com
+ minio_name: ??
+ minio_pass: ??
+ bucketName: otatest
\ No newline at end of file
diff --git a/module/icec-jimureport/pom.xml b/module/icec-jimureport/pom.xml
new file mode 100644
index 0000000..867faf7
--- /dev/null
+++ b/module/icec-jimureport/pom.xml
@@ -0,0 +1,105 @@
+
+ 4.0.0
+
+ org.icec
+ icec-parent
+ 2.1.1
+
+
+ icec-jimureport
+
+
+ com.jimureport
+ spring-boot-starter-jimureport
+ 1.1-beta
+
+
+ com.alibaba
+ druid-spring-boot-starter
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.4.1
+
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot-starter
+ 3.2.1
+
+
+
+ org.icec
+ icec-common
+ 2.1.1
+
+
+ org.projectlombok
+ lombok
+
+
+ cn.hutool
+ hutool-all
+ 5.5.2
+
+
+
+ org.springframework.boot
+ spring-boot-starter-freemarker
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ org.thymeleaf
+ thymeleaf-spring5
+
+
+ nz.net.ultraq.thymeleaf
+ thymeleaf-layout-dialect
+
+
+
+
+ org.thymeleaf
+ thymeleaf-spring5
+
+
+
+ io.minio
+ minio
+ ${minio.version}
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ ${aliyun.oss.version}
+
+
+
+
+
+ aliyun
+ aliyun Repository
+ http://maven.aliyun.com/nexus/content/groups/public
+
+ false
+
+
+
+ jeecg
+ jeecg Repository
+ http://maven.jeecg.org/nexus/content/repositories/jeecg
+
+ false
+
+
+
+
\ No newline at end of file
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/JimuConfig.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/JimuConfig.java
new file mode 100644
index 0000000..6449a98
--- /dev/null
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/JimuConfig.java
@@ -0,0 +1,12 @@
+package org.icec.jimureport;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ComponentScan(basePackages = "org.jeecg.modules.jmreport")
+@MapperScan(basePackages ={"org.jeecg.modules.**.mapper*"})
+public class JimuConfig {
+
+}
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java
new file mode 100644
index 0000000..3e8c24e
--- /dev/null
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java
@@ -0,0 +1,45 @@
+package org.icec.jimureport;
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
+
+@Configuration
+@EnableAutoConfiguration
+public class MvcConfig implements WebMvcConfigurer {
+ //@Bean
+ public FreeMarkerViewResolver freeMarkerViewResolver() {
+ MyFreeMarkerViewResolver resolver = new MyFreeMarkerViewResolver();
+
+ resolver.setPrefix(null);
+
+ resolver.setSuffix(".ftl");
+
+ resolver.setContentType("text/html; charset=UTF-8");
+
+ resolver.setRequestContextAttribute("request");
+
+ resolver.setExposeContextBeansAsAttributes(true);
+
+ resolver.setExposeRequestAttributes(true);
+
+ resolver.setExposeSessionAttributes(true);
+
+ resolver.setOrder(1);
+
+ return resolver;
+
+ }
+ @Bean
+ public MyThymeleafViewResolver myThymeleafViewResolver() {
+ MyThymeleafViewResolver resolver = new MyThymeleafViewResolver();
+
+ resolver.setOrder(2);
+
+ return resolver;
+
+ }
+}
\ No newline at end of file
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java
new file mode 100644
index 0000000..724121a
--- /dev/null
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java
@@ -0,0 +1,43 @@
+package org.icec.jimureport;
+
+import java.io.IOException;
+
+import java.util.Locale;
+
+import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
+
+public class MyFreeMarkerViewResolver extends FreeMarkerViewResolver {
+ // 由于我的freemarker 配置无法被加载所以我才写死的正确方法是 利用@Value注解获取
+ private String prefix = "classpath:/templates/";
+ private String suffix = ".ftl";
+
+ @Override
+ protected org.springframework.web.servlet.View loadView(final String viewName, final Locale locale)
+
+ throws Exception {
+ String resourceName = prefix + viewName + suffix;
+
+ try {
+ this.getApplicationContext().getResource(resourceName).getInputStream();
+
+ } catch (final IOException e) {
+ if (logger.isDebugEnabled()) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("视图名:" + resourceName + "不存在!");
+
+ } else {
+ logger.debug("视图名:" + resourceName + "不存在!");
+
+ }
+
+ }
+
+ return null;
+
+ }
+
+ return super.loadView(viewName, locale);
+
+ }
+
+}
\ No newline at end of file
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java
new file mode 100644
index 0000000..4e66303
--- /dev/null
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java
@@ -0,0 +1,43 @@
+package org.icec.jimureport;
+
+import java.io.IOException;
+
+import java.util.Locale;
+
+import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
+import org.thymeleaf.spring5.view.ThymeleafViewResolver;
+
+public class MyThymeleafViewResolver extends ThymeleafViewResolver {
+ // 由于我的freemarker 配置无法被加载所以我才写死的正确方法是 利用@Value注解获取
+ private String prefix = "classpath:/templates/";
+ private String suffix = ".html";
+
+ @Override
+ protected org.springframework.web.servlet.View loadView(final String viewName, final Locale locale)
+ throws Exception {
+ String resourceName = prefix + viewName + suffix;
+
+ try {
+ this.getApplicationContext().getResource(resourceName).getInputStream();
+
+ } catch (final IOException e) {
+ if (logger.isDebugEnabled()) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("视图名:" + resourceName + "不存在!");
+
+ } else {
+ logger.debug("视图名:" + resourceName + "不存在!");
+
+ }
+
+ }
+
+ return null;
+
+ }
+
+ return super.loadView(viewName, locale);
+
+ }
+
+}
\ No newline at end of file
diff --git a/module/icec-jimureport/src/main/java/org/jeecg/modules/jmreport/desreport/service/a/JmReportMapService.java b/module/icec-jimureport/src/main/java/org/jeecg/modules/jmreport/desreport/service/a/JmReportMapService.java
new file mode 100644
index 0000000..a4a3570
--- /dev/null
+++ b/module/icec-jimureport/src/main/java/org/jeecg/modules/jmreport/desreport/service/a/JmReportMapService.java
@@ -0,0 +1,20 @@
+package org.jeecg.modules.jmreport.desreport.service.a;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.jmreport.desreport.entity.JmReportMap;
+import org.jeecg.modules.jmreport.desreport.mapper.JmReportMapMapper;
+import org.jeecg.modules.jmreport.desreport.service.IJmReportMapService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+
+@Service("jmReportMapServiceImpl")
+@Primary
+public class JmReportMapService extends ServiceImpl implements IJmReportMapService {
+
+
+
+ public void saveMapSource(JmReportMap map) {
+ saveOrUpdate(map);
+ }
+}
diff --git a/module/pom.xml b/module/pom.xml
new file mode 100644
index 0000000..0524429
--- /dev/null
+++ b/module/pom.xml
@@ -0,0 +1,12 @@
+
+ 4.0.0
+ org.icec
+ module
+ 0.0.1-SNAPSHOT
+ pom
+
+
+
+ icec-jimureport
+
+
\ No newline at end of file
diff --git a/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java b/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java
index c532931..a073a6e 100644
--- a/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java
+++ b/platform/icec-common/src/main/java/org/icec/common/web/BaseController.java
@@ -19,7 +19,7 @@ import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
public class BaseController {
- @Value("${default_page_size}")
+ @Value("${icec.default_page_size}")
private int default_page_size=10;
public static final Tip SUCC=new SuccessTip();
diff --git a/platform/icec-parent/pom.xml b/platform/icec-parent/pom.xml
index ef0e005..c9406b2 100644
--- a/platform/icec-parent/pom.xml
+++ b/platform/icec-parent/pom.xml
@@ -22,6 +22,8 @@
2.3.0.RELEASE
2.8.1
1.2.5
+ 3.6.0
+ 4.0.0
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
index 5ddd100..db0c5ba 100755
--- a/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/MyBatisConfig.java
@@ -32,9 +32,9 @@ import lombok.extern.slf4j.Slf4j;
*
* @author ruoyi
*/
-@ConditionalOnClass(value=SqlSessionFactory.class)
-@Configuration
-@MapperScan(basePackages ={"org.icec.**.mapper"})
+//@ConditionalOnClass(value=SqlSessionFactory.class)
+//@Configuration
+//@MapperScan(basePackages ={"org.icec.**.mapper","org.jeecg.modules.**.mapper*"})
@Slf4j
public class MyBatisConfig
{
diff --git a/platform/icec-sys/src/main/java/org/icec/web/core/config/SystemConfig.java b/platform/icec-sys/src/main/java/org/icec/web/core/config/SystemConfig.java
index 7fa3d03..7a4aed6 100644
--- a/platform/icec-sys/src/main/java/org/icec/web/core/config/SystemConfig.java
+++ b/platform/icec-sys/src/main/java/org/icec/web/core/config/SystemConfig.java
@@ -13,24 +13,25 @@ import org.beetl.sql.ext.spring4.BeetlSqlScannerConfigurer;
import org.beetl.sql.ext.spring4.SqlManagerFactoryBean;
import org.icec.web.core.support.beetlsql.BSQLUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
+import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
-import com.alibaba.druid.util.JdbcUtils;
+import org.springframework.core.env.Environment;
@Configuration
-public class SystemConfig {
+public class SystemConfig implements EnvironmentAware{
+
+ private Environment env;
/*可省略此配置*/
- @Bean("datasource")
- //@ConfigurationProperties("spring.datasource.druid")
- public DataSource dataSource() {
- return DruidDataSourceBuilder.create().build();
- }
+ /*
+ * @Bean("datasource") //@ConfigurationProperties("spring.datasource.druid")
+ * public DataSource dataSource() { return
+ * DruidDataSourceBuilder.create().build(); }
+ */
@Bean(name = "beetlSqlScannerConfigurer")
public BeetlSqlScannerConfigurer getBeetlSqlScannerConfigurer() {
BeetlSqlScannerConfigurer conf = new BeetlSqlScannerConfigurer();
- conf.setBasePackage("org.icec.web.core.sys.dao;${beetlsql.daoPackage}");
+ conf.setBasePackage("org.icec.web.core.sys.dao;${icec.beetlsql.daoPackage}");
conf.setDaoSuffix("Dao");
conf.setSqlManagerFactoryBeanName("sqlManagerFactoryBean");
return conf;
@@ -38,7 +39,7 @@ public class SystemConfig {
@Bean(name = "sqlManagerFactoryBean")
@Autowired
- public SqlManagerFactoryBean getSqlManagerFactoryBean( DataSource datasource,DataSourceProperties basicProperties)throws SQLException {
+ public SqlManagerFactoryBean getSqlManagerFactoryBean( DataSource datasource)throws SQLException {
SqlManagerFactoryBean factory = new SqlManagerFactoryBean();
BeetlSqlDataSource source = new BeetlSqlDataSource();
source.setMasterSource(datasource);
@@ -46,12 +47,17 @@ public class SystemConfig {
factory.setInterceptors(new Interceptor[] { new DebugInterceptor() });
factory.setNc(new UnderlinedNameConversion());
//根据数据库驱动设置dbstyle
- String dbType= JdbcUtils.getDbType(basicProperties.getUrl(), null);
+ String dbType = env.getProperty("icec.beetlsql.dbStyle");
DBStyle dbStyle= BSQLUtils.getDBStyleFromDriveName(dbType);
factory.setDbStyle(dbStyle);
factory.setSqlLoader(new ClasspathLoader("/sql",dbStyle));
return factory;
}
+
+ @Override
+ public void setEnvironment(Environment environment) {
+ this.env=environment;
+ }
}
--
Gitee
From 1824fca7c236ef7870fd9cabe3ebb102c214da53 Mon Sep 17 00:00:00 2001
From: xxjin <313383180@qq.com>
Date: Mon, 14 Dec 2020 10:22:58 +0800
Subject: [PATCH 8/9] =?UTF-8?q?=E6=95=B4=E5=90=88jmreport?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/application.yml | 4 +---
.../main/java/org/icec/jimureport/MvcConfig.java | 16 ++++++++++------
.../jimureport/MyFreeMarkerViewResolver.java | 3 ++-
.../icec/jimureport/MyThymeleafViewResolver.java | 2 +-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/application/icec-admin/src/main/resources/application.yml b/application/icec-admin/src/main/resources/application.yml
index 71f8cbf..c04c096 100644
--- a/application/icec-admin/src/main/resources/application.yml
+++ b/application/icec-admin/src/main/resources/application.yml
@@ -28,12 +28,10 @@ spring:
content-type: text/html
expose-request-attributes: true
expose-session-attributes: true
- prefix: jmreport
#文件后缀
suffix: .ftl
#路径
- template-loader-path: classpath:/templates/
-
+ template-loader-path: classpath:/templates/
prefer-file-system-access: false
icec:
default_page_size: 10
upload:
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java
index 3e8c24e..ff9eb84 100644
--- a/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/MvcConfig.java
@@ -1,15 +1,20 @@
package org.icec.jimureport;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
+import org.thymeleaf.spring5.view.ThymeleafViewResolver;
@Configuration
@EnableAutoConfiguration
public class MvcConfig implements WebMvcConfigurer {
+ @Autowired
+ ThymeleafViewResolver myThymeleafViewResolver;
//@Bean
public FreeMarkerViewResolver freeMarkerViewResolver() {
MyFreeMarkerViewResolver resolver = new MyFreeMarkerViewResolver();
@@ -33,13 +38,12 @@ public class MvcConfig implements WebMvcConfigurer {
return resolver;
}
- @Bean
+ //@Bean
public MyThymeleafViewResolver myThymeleafViewResolver() {
- MyThymeleafViewResolver resolver = new MyThymeleafViewResolver();
-
- resolver.setOrder(2);
-
- return resolver;
+ MyThymeleafViewResolver resolver2 = new MyThymeleafViewResolver();
+ BeanUtils.copyProperties(myThymeleafViewResolver, resolver2);
+ resolver2.setOrder(1);
+ return resolver2;
}
}
\ No newline at end of file
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java
index 724121a..4d3c7b9 100644
--- a/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyFreeMarkerViewResolver.java
@@ -8,7 +8,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
public class MyFreeMarkerViewResolver extends FreeMarkerViewResolver {
// 由于我的freemarker 配置无法被加载所以我才写死的正确方法是 利用@Value注解获取
- private String prefix = "classpath:/templates/";
+ private String prefix = "classpath:*/templates/";
private String suffix = ".ftl";
@Override
@@ -18,6 +18,7 @@ public class MyFreeMarkerViewResolver extends FreeMarkerViewResolver {
String resourceName = prefix + viewName + suffix;
try {
+ System.out.println(this.getApplicationContext().getResource("classpath:/templates/").getURI().getPath());
this.getApplicationContext().getResource(resourceName).getInputStream();
} catch (final IOException e) {
diff --git a/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java
index 4e66303..7ad7298 100644
--- a/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java
+++ b/module/icec-jimureport/src/main/java/org/icec/jimureport/MyThymeleafViewResolver.java
@@ -9,7 +9,7 @@ import org.thymeleaf.spring5.view.ThymeleafViewResolver;
public class MyThymeleafViewResolver extends ThymeleafViewResolver {
// 由于我的freemarker 配置无法被加载所以我才写死的正确方法是 利用@Value注解获取
- private String prefix = "classpath:/templates/";
+ private String prefix = "classpath*:/templates/";
private String suffix = ".html";
@Override
--
Gitee
From 2ae13fb196bd192f2ea717cf6b2d6cb7e5608bab Mon Sep 17 00:00:00 2001
From: xxjin <313383180@qq.com>
Date: Mon, 14 Dec 2020 11:01:58 +0800
Subject: [PATCH 9/9] 11
---
.../src/main/resources/application.yml | 180 +++++++++---------
1 file changed, 90 insertions(+), 90 deletions(-)
diff --git a/application/icec-admin/src/main/resources/application.yml b/application/icec-admin/src/main/resources/application.yml
index c04c096..862f679 100644
--- a/application/icec-admin/src/main/resources/application.yml
+++ b/application/icec-admin/src/main/resources/application.yml
@@ -1,91 +1,91 @@
-server:
- port: 8080
- tomcat:
- uri-encoding: UTF-8
- servlet:
- encoding:
- force: true
- charset: UTF-8
- enabled: true
-
-spring:
- profiles:
- active : @profiles.active@
- thymeleaf:
- cache: false
- mode: HTML
suffix: .html
- servlet:
- content-type: text/html
servlet:
multipart:
max-file-size: 10MB
- max-request-size: 10MB
autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
-# 是否开启thymeleaf缓存,本地为false,生产建议为true
- freemarker:
- cache: false
- charset: UTF-8
- allow-request-override: false
- check-template-location: true
- #类型
- content-type: text/html
- expose-request-attributes: true
- expose-session-attributes: true
- #文件后缀
- suffix: .ftl
- #路径
- template-loader-path: classpath:/templates/
prefer-file-system-access: false
-icec:
- default_page_size: 10
- upload:
- #file updad path // if blank means use project path
- path:
- #syslog level 0,1;base :0 ,all:1
- core:
- sys:
- logLevel: 0
- beetlsql:
- dbStyle: mysql #
- daoPackage:
-
-#mybatis plus 设置
-mybatis-plus:
- mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
- global-config:
- # 关闭MP3.0自带的banner
- banner: false
- db-config:
- #主键类型
- id-type: ASSIGN_ID
- # 默认数据库表下划线命名
- table-underline: true
- configuration:
- # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
- #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- # 返回类型为Map,显示null对应的字段
- call-setters-on-nulls: true
-# MyBatis
-#mybatis:
-# typeAliasesPackage: org.icec.**.domain,org.jeecg.**.entity
-# mapperLocations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
-# configLocation: classpath:mybatis/mybatis-config.xml
-
-jeecg :
- # 本地:local\Minio:minio\阿里云:alioss
- uploadType: local
- path :
- #文件上传根目录 设置
- upload: D://opt//upFiles
- #webapp文件路径
- webapp: D://opt//webapp
- #阿里云oss存储配置
- oss:
- endpoint: oss-cn-beijing.aliyuncs.com
- accessKey: ??
- secretKey: ??
- bucketName: jeecgos
- staticDomain: ??
-
- # minio文件上传
- minio:
- minio_url: http://minio.jeecg.com
- minio_name: ??
- minio_pass: ??
+server:
+ port: 8080
+ tomcat:
+ uri-encoding: UTF-8
+ servlet:
+ encoding:
+ force: true
+ charset: UTF-8
+ enabled: true
+
+spring:
+ profiles:
+ active : @profiles.active@
+ thymeleaf:
+ cache: false
+ mode: HTML
suffix: .html
+ servlet:
+ content-type: text/html
servlet:
multipart:
max-file-size: 10MB
+ max-request-size: 10MB
autoconfigure:
+ exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+# 是否开启thymeleaf缓存,本地为false,生产建议为true
+ freemarker:
+ cache: false
+ charset: UTF-8
+ allow-request-override: false
+ check-template-location: true
+ #类型
+ content-type: text/html
+ expose-request-attributes: true
+ expose-session-attributes: true
+ #文件后缀
+ suffix: .ftl
+ #路径
+ template-loader-path: classpath:/templates/
prefer-file-system-access: false
+icec:
+ default_page_size: 10
+ upload:
+ #file updad path // if blank means use project path
+ path:
+ #syslog level 0,1;base :0 ,all:1
+ core:
+ sys:
+ logLevel: 0
+ beetlsql:
+ dbStyle: mysql #
+ daoPackage:
+
+#mybatis plus 设置
+mybatis-plus:
+ mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
+ global-config:
+ # 关闭MP3.0自带的banner
+ banner: false
+ db-config:
+ #主键类型
+ id-type: ASSIGN_ID
+ # 默认数据库表下划线命名
+ table-underline: true
+ configuration:
+ # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
+ #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ # 返回类型为Map,显示null对应的字段
+ call-setters-on-nulls: true
+# MyBatis
+#mybatis:
+# typeAliasesPackage: org.icec.**.domain,org.jeecg.**.entity
+# mapperLocations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
+# configLocation: classpath:mybatis/mybatis-config.xml
+
+jeecg :
+ # 本地:local\Minio:minio\阿里云:alioss
+ uploadType: local
+ path :
+ #文件上传根目录 设置
+ upload: D://opt//upFiles
+ #webapp文件路径
+ webapp: D://opt//webapp
+ #阿里云oss存储配置
+ oss:
+ endpoint: oss-cn-beijing.aliyuncs.com
+ accessKey: ??
+ secretKey: ??
+ bucketName: jeecgos
+ staticDomain: ??
+
+ # minio文件上传
+ minio:
+ minio_url: http://minio.jeecg.com
+ minio_name: ??
+ minio_pass: ??
bucketName: otatest
\ No newline at end of file
--
Gitee