Compare commits
67 Commits
v5.13.1.sp
...
v5.14.0.sp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36242663f2 | ||
|
|
1e6b304583 | ||
|
|
63b689ecfd | ||
|
|
3afa11272f | ||
|
|
5e01b22fb9 | ||
|
|
c88a576219 | ||
|
|
a8c9b60052 | ||
|
|
e413c4ce4f | ||
|
|
1da65bcf3f | ||
|
|
46514450d6 | ||
|
|
68d6c09b94 | ||
|
|
5050c20534 | ||
|
|
80d918c3a1 | ||
|
|
b90f1252b1 | ||
|
|
e43e4f7567 | ||
|
|
17d83bdc1c | ||
|
|
53546e1527 | ||
|
|
73fe81dde6 | ||
|
|
bf969042d4 | ||
|
|
f57f7a9762 | ||
|
|
a422fd5441 | ||
|
|
fc2e5e10c2 | ||
|
|
23d9258577 | ||
|
|
9e33b5c894 | ||
|
|
6a41db0efc | ||
|
|
66f7ead680 | ||
|
|
75ed6bc847 | ||
|
|
e15227525c | ||
|
|
b936d3fba6 | ||
|
|
55000e9d6c | ||
|
|
332711969d | ||
|
|
f7d3b4cd95 | ||
|
|
2454cb8037 | ||
|
|
06e88b5bad | ||
|
|
4538ce0050 | ||
|
|
901540f9a5 | ||
|
|
3698ec07bc | ||
|
|
28e5f18c4c | ||
|
|
e4d406b864 | ||
|
|
fd328a9e9b | ||
|
|
741c1b8592 | ||
|
|
28c8c571cd | ||
|
|
26907c348e | ||
|
|
57e947e985 | ||
|
|
07b24e3685 | ||
|
|
d981e643f4 | ||
|
|
f5d1546e85 | ||
|
|
777655f09c | ||
|
|
899c477448 | ||
|
|
7e83d139c5 | ||
|
|
195d2ee06e | ||
|
|
839511b48c | ||
|
|
669bc979f8 | ||
|
|
bb490f8051 | ||
|
|
fd44134a61 | ||
|
|
4888081778 | ||
|
|
91caf04bcb | ||
|
|
f5af89bef8 | ||
|
|
0d9980e4ca | ||
|
|
b7c69ae981 | ||
|
|
6bf2550412 | ||
|
|
fbadd0960f | ||
|
|
1b5808afa1 | ||
|
|
f33f07e8fc | ||
|
|
84f42a27e5 | ||
|
|
862568c919 | ||
|
|
00b94000e1 |
91
README.md
91
README.md
@@ -42,17 +42,17 @@
|
||||
</p>
|
||||
|
||||
* 源码仓库地址:
|
||||
[Gitee](https://gitee.com/thinkgem/jeesite5)、
|
||||
[GitCode](https://gitcode.com/thinkgem/jeesite5)、
|
||||
[GitHub](https://github.com/thinkgem/jeesite5)
|
||||
[Gitee](https://gitee.com/thinkgem/jeesite5/tree/v5.springboot2)、
|
||||
[GitCode](https://gitcode.com/thinkgem/jeesite5/tree/v5.springboot2)、
|
||||
[GitHub](https://github.com/thinkgem/jeesite5/tree/v5.springboot2)
|
||||
* 分离版源码仓库地址:
|
||||
[Gitee](https://gitee.com/thinkgem/jeesite-vue)、
|
||||
[GitCode](https://gitcode.com/thinkgem/jeesite-vue)、
|
||||
[GitHub](https://github.com/thinkgem/jeesite-vue)
|
||||
* 源码合集仓库地址:
|
||||
[GVP](https://gitee.com/thinkgem/jeesite/tree/v5.springboot3)、
|
||||
[G-Star](https://gitcode.com/thinkgem/jeesite/overview?ref=v5.springboot3)、
|
||||
[GitHub](https://github.com/thinkgem/jeesite/tree/v5.springboot3)
|
||||
[GVP](https://gitee.com/thinkgem/jeesite/tree/v5.springboot2)、
|
||||
[G-Star](https://gitcode.com/thinkgem/jeesite/tree/v5.springboot2)、
|
||||
[GitHub](https://github.com/thinkgem/jeesite/tree/v5.springboot2)
|
||||
|
||||
## 平台介绍
|
||||
|
||||
@@ -70,7 +70,11 @@
|
||||
|
||||
* 2021 年终发布 Vue3 的前后分离版本,使得 JeeSite 拥有同一个后台服务 Web 来支撑分离版和全栈版两套前端技术栈。
|
||||
|
||||
* 支持国产化软硬件环境,如国产芯片、操作系统、数据库、中间件、国密算法等。
|
||||
* 对接 OpenAPI、Ollama、DeepSeek 等热门 AI 大模型,凭借检索增强生成 RAG 技术,为企业知识库打造专属智能对话。
|
||||
|
||||
* 提供大模型 Tool 本地工具调用及 MCP 服务端和客户端工具调用,助力大模型与您的业务深度融合,实现高效交互。
|
||||
|
||||
* 支持国产化软件和硬件环境,如国产芯片、操作系统、数据库、中间件、国密算法等。
|
||||
|
||||
## 核心优势
|
||||
|
||||
@@ -88,7 +92,7 @@
|
||||
|
||||
* 至今 JeeSite 平台架构已经非常稳定,我们持续升级,并不失架构的先进性。
|
||||
* JeeSite 精益求精,用心打磨每一个细节,界面 UI 操作便捷,体验性好。
|
||||
* JeeSite 是一个专业的平台,是一个可以让您使用放心的平台。
|
||||
* JeeSite 是一个专业的平台,是一个可以让您,用着省心的平台。
|
||||
* 社区版基于 Apache License 2.0 开源协议,永久免费使用。
|
||||
|
||||
### 架构特点及安全方面的优势:<https://jeesite.com/docs/feature/>
|
||||
@@ -105,7 +109,7 @@
|
||||
* 技术选型(详细)已支持数据库:<http://jeesite.com/docs/technology/>
|
||||
* JeeSite Vue 版本:<https://gitee.com/thinkgem/jeesite-vue>
|
||||
* Spring Boot 3.x 版本:<https://gitee.com/thinkgem/jeesite5/tree/v5.springboot3>
|
||||
* Spring Boot 2.x 版本:<https://gitee.com/thinkgem/jeesite5/tree/v5.springboot2/>
|
||||
* Spring Boot 2.x 版本:<https://gitee.com/thinkgem/jeesite5/tree/v5.springboot2>
|
||||
|
||||
## 更多介绍
|
||||
|
||||
@@ -114,22 +118,9 @@
|
||||
* 架构特点:<https://jeesite.com/docs/feature/>
|
||||
* 参数配置:<https://jeesite.com/docs/config/>
|
||||
* 开发规范:<https://jeesite.com/docs/standard/>
|
||||
* 数表设计:<https://jeesite.com/docs/treetable/>
|
||||
* 代码生成:<https://jeesite.com/docs/code-gen/>
|
||||
|
||||
## 生态系统
|
||||
|
||||
* 分布式微服务(Spring Cloud):<https://gitee.com/thinkgem/jeesite-cloud>
|
||||
* Flowable业务流程引擎(BPM):<http://jeesite.com/docs/bpm/>
|
||||
* 多站点内容管理模块(CMS):<https://jeesite.com/docs/cms/>
|
||||
* 手机端移动端:<https://gitee.com/thinkgem/jeesite-uniapp>
|
||||
* PC客户端程序:<https://gitee.com/thinkgem/jeesite-client>
|
||||
* Vue3分离版本:<https://gitee.com/thinkgem/jeesite-vue>
|
||||
* JeeSite统一认证:<https://jeesite.com/docs/oauth2-server>
|
||||
* JFlow工作流引擎:<https://gitee.com/thinkgem/jeesite-jflow>
|
||||
* Mybatis-Plus: <https://gitee.com/thinkgem/jeesite-mybatisplus>
|
||||
* Magic接口快速开发:<https://gitee.com/thinkgem/jeesite-magic-api>
|
||||
* 内外网中间件:<https://my.oschina.net/thinkgem/blog/4624519>
|
||||
|
||||
## 快速体验
|
||||
|
||||
### 在线演示
|
||||
@@ -141,7 +132,7 @@
|
||||
|
||||
1. 免安装数据库,使用内嵌 H2 DB、包含 Vue 和 全栈双版本
|
||||
2. 环境准备:`JDK 1.8 or 11、17`、`Maven 3.6+`、无需准备数据库
|
||||
3. 下载源码:<https://gitee.com/thinkgem/jeesite5/repository/archive/v5.9.zip> 并解压
|
||||
3. 下载源码:<https://gitee.com/thinkgem/jeesite5/repository/archive/v5.springboot2.zip> 并解压
|
||||
4. 执行脚本:`/web-fast/bin/run-tomcat.bat` 启动服务即可(自动初始化库)
|
||||
5. Vue分离版本地址:<http://127.0.0.1:8980/vue/login>
|
||||
6. 全栈版本地址:<http://127.0.0.1:8980/a/login>
|
||||
@@ -151,7 +142,7 @@
|
||||
### 本地运行
|
||||
|
||||
1. 环境准备:`JDK 1.8 or 11、17`、`Maven 3.6+`、使用 `MySQL 5.7 or 8.0` 数据库、[其它数据库](https://jeesite.com/docs/technology/#_8、已支持数据库)
|
||||
2. 下载源码:<https://gitee.com/thinkgem/jeesite5/repository/archive/v5.9.zip> 并解压
|
||||
2. 下载源码:<https://gitee.com/thinkgem/jeesite5/repository/archive/v5.springboot2.zip> 并解压
|
||||
3. 打开文件:`/web/src/main/resources/config/application.yml` 配置JDBC连接
|
||||
4. 执行脚本:`/web/bin/init-data.bat` 初始化数据库
|
||||
5. 执行脚本:`/web/bin/run-tomcat.bat` 启动服务即可
|
||||
@@ -174,7 +165,7 @@ docker run --name js5 -p 8980:8980 -d crpi-u3zm0t8trv68xpyx.cn-qingdao.personal.
|
||||
```sh
|
||||
docker logs -f js5
|
||||
```
|
||||
- 浏览器访问:<http://127.0.0.1:8980/js/> 账号 system 密码 admin
|
||||
- 浏览器访问:<http://127.0.0.1:8980/js> 账号 system 密码 admin
|
||||
|
||||
### 开发环境
|
||||
|
||||
@@ -183,9 +174,9 @@ docker logs -f js5
|
||||
3. 分离端运行文档:<https://jeesite.com/docs/vue-install-deploy/>
|
||||
4. 分离端常见问题:<https://jeesite.com/docs/vue-faq/>
|
||||
|
||||
## 技术文章
|
||||
## 学习文档
|
||||
|
||||
* 库表生成、代码生成:https://jeesite.com/docs/code-gen/>
|
||||
* 库表生成、代码生成:<https://jeesite.com/docs/code-gen/>
|
||||
* 菜单权限、按钮权限:<https://jeesite.com/docs/permi-shiro/>
|
||||
* 数据权限、库事务:<https://jeesite.com/docs/service-datascope/#数据权限>
|
||||
* 表结构、数据字典:<https://jeesite.com/docs/code-gen/#表结构数据字典>
|
||||
@@ -212,36 +203,34 @@ docker logs -f js5
|
||||
* 常用工具:<https://jeesite.com/docs/jeesite-js/>
|
||||
* 自定义主题:<https://jeesite.com/docs/custom-views/>
|
||||
|
||||
## 专题文章
|
||||
## 更多文档
|
||||
|
||||
* 系统接口文档:<https://jeesite.com/docs/mobile-rest-api/>
|
||||
* 多语言国际化:<https://jeesite.com/docs/i18n-locale/>
|
||||
* BPM工作流引擎:<https://jeesite.com/docs/bpm/>
|
||||
* CMS内容管理:<https://jeesite.com/docs/cms/>
|
||||
* AI知识库助手:<https://jeesite.com/docs/cms-ai/>
|
||||
* 用户类型:<https://jeesite.com/docs/user-type/>
|
||||
* 消息推送:<https://jeesite.com/docs/msg-push-use/>
|
||||
* 单点登录:<https://jeesite.com/docs/sso-cas/>
|
||||
* AI、CMS、RAG、Tool、MCP 人工智能助手:<https://jeesite.com/docs/ai-cms>
|
||||
* BPM 业务流程引擎(Flowable):<http://jeesite.com/docs/bpm/>
|
||||
* CMS 多站点内容管理模块:<https://jeesite.com/docs/cms/>
|
||||
|
||||
* 消息推送消息提醒:<https://jeesite.com/docs/msg-push-use/>
|
||||
* 对象存储模块:<https://jeesite.com/docs/oss-client>
|
||||
* 单点登录模块:<https://jeesite.com/docs/sso-cas>
|
||||
* 在线任务调度:<https://jeesite.com/docs/job/>
|
||||
* 对象存储:<https://jeesite.com/docs/oss-client/>
|
||||
|
||||
* 大屏设计器:<https://jeesite.com/docs/visual/>
|
||||
* 报表设计器:<https://jeesite.com/docs/ureport/>
|
||||
* 文件管理分享:<https://jeesite.com/docs/filemanager/>
|
||||
* 文件在线预览:<https://jeesite.com/docs/filepreview/>
|
||||
* 三员管理员:<https://jeesite.com/docs/manager3/>
|
||||
* 手机端框架:<https://jeesite.com/docs/uniapp/>
|
||||
* 统一认证服务:<https://jeesite.com/docs/oauth2-server/>
|
||||
* 树表结构设计:<https://jeesite.com/docs/tree-table-use/>
|
||||
|
||||
## 云服务架构
|
||||
|
||||
* 多租户、SaaS服务:<https://jeesite.com/docs/saas-corp-use/>
|
||||
* 集群、负载均衡、高可用:<https://jeesite.com/docs/cluster/>
|
||||
* Spring Cloud 微服务:<https://jeesite.com/docs/springcloud/>
|
||||
* 分布式事务 Seata:<https://jeesite.com/docs/springcloud-seata/>
|
||||
* 读写分离、分库分表:<https://jeesite.com/docs/sharding/>
|
||||
* 监控系统集成:<https://jeesite.com/docs/webadmin/>
|
||||
* 集群、高可用架构:<https://jeesite.com/docs/cluster/>
|
||||
* SaaS 多租户架构:<https://jeesite.com/docs/saas-corp-use/>
|
||||
* 读写分离分片分表:<https://jeesite.com/docs/sharding/>
|
||||
* Spring监控系统:<https://jeesite.com/docs/webadmin/>
|
||||
* 分布式跨应用事务:<https://jeesite.com/docs/seata/>
|
||||
* 追踪系统集成:<https://jeesite.com/docs/skywalking/>
|
||||
* ELK日志收集:<https://jeesite.com/docs/elk-log/>
|
||||
* ELK 日志收集:<https://jeesite.com/docs/elk-log/>
|
||||
|
||||
* MybatisPlus: <https://gitee.com/thinkgem/jeesite-mybatisplus>
|
||||
* 接口快速开发:<https://gitee.com/thinkgem/jeesite-magic-api>
|
||||
* 内外网中间件:<https://my.oschina.net/thinkgem/blog/4624519>
|
||||
* 统一认证平台:<https://jeesite.com/docs/oauth2-server>
|
||||
|
||||
## 授权协议声明
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--suppress VulnerableLibrariesLocal -->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.13.1-SNAPSHOT</version>
|
||||
<version>5.14.0-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ public class DigestUtils {
|
||||
* @param algorithm 散列算法("SHA-1"、"MD5"、"SM3")
|
||||
* @param salt 可为空
|
||||
* @param iterations 迭代次数
|
||||
* @return
|
||||
*/
|
||||
public static byte[] digest(byte[] input, String algorithm, byte[] salt, int iterations) {
|
||||
try {
|
||||
|
||||
@@ -37,7 +37,9 @@ public class PropertiesUtils {
|
||||
// 默认加载的文件,可通过继承覆盖(若有相同Key,优先加载后面的)
|
||||
public static final String[] DEFAULT_CONFIG_FILE = new String[]{
|
||||
"classpath:config/application.yml", "classpath:application.yml",
|
||||
"classpath:config/bootstrap.yml", "classpath:bootstrap.yml",
|
||||
"file:config/application.yml", "file:application.yml",
|
||||
"file:config/bootstrap.yml", "file:bootstrap.yml",
|
||||
};
|
||||
|
||||
private static final Logger logger = PropertiesUtils.initLogger();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.common.io;
|
||||
|
||||
import com.jeesite.common.codec.EncodeUtils;
|
||||
import com.jeesite.common.lang.ExceptionUtils;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -14,6 +13,7 @@ import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 资源供给类
|
||||
@@ -53,9 +53,7 @@ public class ResourceUtils extends org.springframework.util.ResourceUtils {
|
||||
|
||||
/**
|
||||
* 获取资源文件流(用后记得关闭)
|
||||
* @param location
|
||||
* @author ThinkGem
|
||||
* @throws IOException
|
||||
*/
|
||||
public static InputStream getResourceFileStream(String location) throws IOException{
|
||||
Resource resource = resourceLoader.getResource(location);
|
||||
@@ -64,12 +62,11 @@ public class ResourceUtils extends org.springframework.util.ResourceUtils {
|
||||
|
||||
/**
|
||||
* 获取资源文件内容
|
||||
* @param location
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public static String getResourceFileContent(String location){
|
||||
try(InputStream is = ResourceUtils.getResourceFileStream(location)){
|
||||
return IOUtils.toString(is, EncodeUtils.UTF_8);
|
||||
return IOUtils.toString(is, StandardCharsets.UTF_8);
|
||||
}catch (IOException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
@@ -77,13 +74,11 @@ public class ResourceUtils extends org.springframework.util.ResourceUtils {
|
||||
|
||||
/**
|
||||
* Spring 搜索资源文件
|
||||
* @param locationPattern
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public static Resource[] getResources(String locationPattern){
|
||||
try {
|
||||
Resource[] resources = resourceResolver.getResources(locationPattern);
|
||||
return resources;
|
||||
return resourceResolver.getResources(locationPattern);
|
||||
} catch (IOException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ public class ByteUtils {
|
||||
|
||||
/**
|
||||
* @param byteSize 字节
|
||||
* @return
|
||||
*/
|
||||
public static String formatByteSize(long byteSize) {
|
||||
|
||||
|
||||
@@ -84,7 +84,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
* @param pattern 格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E"
|
||||
* @param amont 数量,前为负数,后为正数
|
||||
* @param type 类型,可参考Calendar的常量(如:Calendar.HOUR、Calendar.MINUTE、Calendar.SECOND)
|
||||
* @return
|
||||
*/
|
||||
public static String getDate(String pattern, int amont, int type) {
|
||||
Calendar calendar = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
String[] ver = StringUtils.split(System.getProperty("java.version"), StringUtils.DOT);
|
||||
isJavaSerialize = ver.length > 0 && Integer.parseInt(ver[0]) > 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转换为 Double 类型
|
||||
*/
|
||||
@@ -150,8 +150,8 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
|
||||
/**
|
||||
* 拷贝一个对象(但是子对象无法拷贝)
|
||||
* @param source
|
||||
* @param ignoreProperties
|
||||
* @param source 原对象
|
||||
* @param ignoreProperties 忽略的属性
|
||||
*/
|
||||
public static Object copyBean(Object source, String... ignoreProperties){
|
||||
if (source == null){
|
||||
@@ -169,7 +169,7 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
|
||||
/**
|
||||
* 克隆一个对象(完全拷贝)
|
||||
* @param source
|
||||
* @param source 原对象
|
||||
*/
|
||||
public static Object cloneBean(Object source){
|
||||
if (source == null){
|
||||
@@ -181,8 +181,6 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
|
||||
/**
|
||||
* 序列化对象
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public static byte[] serialize(Object object) {
|
||||
try {
|
||||
@@ -199,8 +197,6 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
|
||||
/**
|
||||
* 反序列化对象
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
public static Object unserialize(byte[] bytes) {
|
||||
try {
|
||||
@@ -217,8 +213,6 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
|
||||
/**
|
||||
* 序列化对象
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public static byte[] serializeJava(Object object) {
|
||||
if (object == null){
|
||||
@@ -242,8 +236,6 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
||||
|
||||
/**
|
||||
* 反序列化对象
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
public static Object unserializeJava(byte[] bytes) {
|
||||
if (bytes == null){
|
||||
|
||||
@@ -10,9 +10,6 @@ public class WorkDayUtils {
|
||||
|
||||
/**
|
||||
* 获取日期之间的天数
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @return
|
||||
*/
|
||||
public int getDaysBetween(java.util.Calendar d1, java.util.Calendar d2) {
|
||||
if (d1.after(d2)) { // swap dates so that d1 is start and d2 is end
|
||||
@@ -35,9 +32,6 @@ public class WorkDayUtils {
|
||||
|
||||
/**
|
||||
* 获取工作日
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @return
|
||||
*/
|
||||
public int getWorkingDay(java.util.Calendar d1, java.util.Calendar d2) {
|
||||
int result = -1;
|
||||
@@ -72,8 +66,6 @@ public class WorkDayUtils {
|
||||
|
||||
/**
|
||||
* 获取中文日期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public String getChineseWeek(Calendar date) {
|
||||
final String[] dayNames = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
||||
@@ -84,8 +76,6 @@ public class WorkDayUtils {
|
||||
|
||||
/**
|
||||
* 获得日期的下一个星期一的日期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public Calendar getNextMonday(Calendar date) {
|
||||
Calendar result = null;
|
||||
@@ -99,9 +89,6 @@ public class WorkDayUtils {
|
||||
|
||||
/**
|
||||
* 获取休息日
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @return
|
||||
*/
|
||||
public int getHolidays(Calendar d1, Calendar d2) {
|
||||
return this.getDaysBetween(d1, d2) - this.getWorkingDay(d1, d2);
|
||||
|
||||
@@ -28,10 +28,7 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 封装 Jackson,实现 JSON String 与 Java Object 互转
|
||||
@@ -73,10 +70,15 @@ public class JsonMapper extends ObjectMapper {
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public JsonMapper setLocaleTimeZoneDateFormat(){
|
||||
this.setLocale(LocaleUtils.toLocale(PropertiesUtils.getInstance()
|
||||
.getProperty("lang.defaultLocale", "zh_CN")));
|
||||
this.setTimeZone(TimeZone.getTimeZone(PropertiesUtils.getInstance()
|
||||
.getProperty("lang.defaultTimeZone", "GMT+08:00")));
|
||||
PropertiesUtils props = PropertiesUtils.getInstance();
|
||||
// 设置默认语言环境
|
||||
props.getPropertyIfNotBlank("lang.defaultLocale", (defaultLocale) -> {
|
||||
this.setLocale(LocaleUtils.toLocale(defaultLocale));
|
||||
});
|
||||
// 设置默认时区
|
||||
props.getPropertyIfNotBlank("lang.defaultTimeZone", (defaultTimeZone) -> {
|
||||
this.setTimeZone(TimeZone.getTimeZone(defaultTimeZone));
|
||||
});
|
||||
this.setAnnotationIntrospector(new JacksonAnnotationIntrospector() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
package com.jeesite.common.mapper;
|
||||
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.jeesite.common.io.PropertiesUtils;
|
||||
import org.apache.commons.lang3.LocaleUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -20,7 +20,7 @@ import java.util.TimeZone;
|
||||
* @version 2016-9-2
|
||||
*/
|
||||
public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XmlMapper.class);
|
||||
@@ -36,11 +36,17 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
||||
* 构造方法
|
||||
*/
|
||||
public XmlMapper() {
|
||||
PropertiesUtils props = PropertiesUtils.getInstance();
|
||||
// 设置默认语言环境
|
||||
props.getPropertyIfNotBlank("lang.defaultLocale", (defaultLocale) -> {
|
||||
this.setLocale(LocaleUtils.toLocale(defaultLocale));
|
||||
});
|
||||
// 设置默认时区
|
||||
props.getPropertyIfNotBlank("lang.defaultTimeZone", (defaultTimeZone) -> {
|
||||
this.setTimeZone(TimeZone.getTimeZone(defaultTimeZone));
|
||||
});
|
||||
// Spring ObjectMapper 初始化配置,支持 @JsonView
|
||||
new Jackson2ObjectMapperBuilder().configure(this);
|
||||
// 设置默认时区
|
||||
this.setTimeZone(TimeZone.getTimeZone(PropertiesUtils.getInstance()
|
||||
.getProperty("lang.defaultTimeZone", "GMT+08:00")));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +56,7 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
||||
try {
|
||||
return this.writeValueAsString(object);
|
||||
} catch (IOException e) {
|
||||
logger.warn("write to xml string error:" + object, e);
|
||||
logger.warn("write to xml string error: {}", object, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -62,14 +68,14 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
||||
try {
|
||||
return this.writerWithView(jsonView).writeValueAsString(object);
|
||||
} catch (IOException e) {
|
||||
logger.warn("write to xml string error:" + object, e);
|
||||
logger.warn("write to xml string error: {}", object, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化POJO或简单Collection如List<String>.
|
||||
* @see #fromJson(String, JavaType)
|
||||
* @see #fromXml(String, Class)
|
||||
*/
|
||||
public <T> T fromXmlString(String xmlString, Class<T> clazz) {
|
||||
if (StringUtils.isEmpty(xmlString) || "<CLOB>".equals(xmlString)) {
|
||||
@@ -78,7 +84,7 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
||||
try {
|
||||
return this.readValue(xmlString, clazz);
|
||||
} catch (IOException e) {
|
||||
logger.warn("parse xml string error:" + xmlString, e);
|
||||
logger.warn("parse xml string error: {}", xmlString, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,6 @@ public class VideoUtils {
|
||||
|
||||
/**
|
||||
* 检查文件是否存在
|
||||
* @param inputFile
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean checkfile(String inputFile) {
|
||||
@@ -160,8 +159,7 @@ public class VideoUtils {
|
||||
|
||||
/**
|
||||
* ffmpeg 截取缩略图
|
||||
* @param inputFile
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean processFfmpegCutpic(String inputFile, String outputFile) {
|
||||
List<String> command = new java.util.ArrayList<String>();
|
||||
@@ -274,8 +272,7 @@ public class VideoUtils {
|
||||
|
||||
/**
|
||||
* 执行命令
|
||||
* @param command
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean process(List<String> command) {
|
||||
try {
|
||||
|
||||
@@ -21,7 +21,6 @@ public class EmailUtils {
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
* @return
|
||||
*/
|
||||
public static boolean send(String toAddress, String subject, String content) {
|
||||
PropertiesUtils props = PropertiesUtils.getInstance();
|
||||
@@ -52,7 +51,6 @@ public class EmailUtils {
|
||||
* @param toAddress 接收地址
|
||||
* @param subject 标题
|
||||
* @param content 内容
|
||||
* @return
|
||||
*/
|
||||
public static boolean send(String fromAddress, String fromPassword, String fromHostName, Integer smtpPort,
|
||||
String sslOnConnect, String sslSmtpPort, String toAddress, String subject, String content) {
|
||||
|
||||
@@ -59,7 +59,6 @@ public class IpUtils {
|
||||
* 172.16.0.0/12:172.16.0.0~172.31.255.255
|
||||
* 192.168.0.0/16:192.168.0.0~192.168.255.255
|
||||
* @param ip 地址
|
||||
* @return
|
||||
*/
|
||||
public static boolean isInternalAddr(String ip) {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ThreadUtils {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore.
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ThreadUtils {
|
||||
try {
|
||||
Thread.sleep(unit.toMillis(duration));
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore.
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,6 @@ public class ExcelImport implements Closeable {
|
||||
|
||||
/**
|
||||
* 获取行对象
|
||||
* @param rownum
|
||||
* @return 返回Row对象,如果空行返回null
|
||||
*/
|
||||
public Row getRow(int rownum){
|
||||
@@ -262,7 +261,6 @@ public class ExcelImport implements Closeable {
|
||||
|
||||
/**
|
||||
* 获取数据行号
|
||||
* @return
|
||||
*/
|
||||
public int getDataRowNum(){
|
||||
return headerNum;
|
||||
@@ -270,7 +268,6 @@ public class ExcelImport implements Closeable {
|
||||
|
||||
/**
|
||||
* 获取最后一个数据行号
|
||||
* @return
|
||||
*/
|
||||
public int getLastDataRowNum(){
|
||||
//return this.sheet.getLastRowNum() + headerNum;
|
||||
@@ -279,7 +276,6 @@ public class ExcelImport implements Closeable {
|
||||
|
||||
/**
|
||||
* 获取最后一个列号
|
||||
* @return
|
||||
*/
|
||||
public int getLastCellNum(){
|
||||
Row row = this.getRow(headerNum);
|
||||
@@ -542,15 +538,13 @@ public class ExcelImport implements Closeable {
|
||||
ReflectUtils.invokeSetter(e, ef.attrName(), val);
|
||||
}else{
|
||||
if (os[1] instanceof Field){
|
||||
//ReflectUtils.invokeSetter(e, ((Field)os[1]).getName(), val);
|
||||
((Field)os[1]).set(e, val);
|
||||
ReflectUtils.invokeSetter(e, ((Field)os[1]).getName(), val);
|
||||
}else if (os[1] instanceof Method){
|
||||
//String mthodName = ((Method)os[1]).getName();
|
||||
//if ("get".equals(mthodName.substring(0, 3))){
|
||||
// mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
|
||||
//}
|
||||
//ReflectUtils.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
|
||||
((Method)os[1]).invoke(e, val);
|
||||
String mthodName = ((Method)os[1]).getName();
|
||||
if ("get".equals(mthodName.substring(0, 3))){
|
||||
mthodName = "set"+mthodName.substring(3);
|
||||
}
|
||||
ReflectUtils.invokeMethodByAsm(e, mthodName, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@ public class BookMark {
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param ctBookmark
|
||||
* @param para
|
||||
*/
|
||||
public BookMark(CTBookmark ctBookmark, XWPFParagraph para) {
|
||||
this._ctBookmark = ctBookmark;
|
||||
@@ -72,9 +70,6 @@ public class BookMark {
|
||||
|
||||
/**
|
||||
* 构造函数,用于表格中的标签
|
||||
* @param ctBookmark
|
||||
* @param para
|
||||
* @param tableCell
|
||||
*/
|
||||
public BookMark(CTBookmark ctBookmark, XWPFParagraph para, XWPFTableCell tableCell) {
|
||||
this(ctBookmark, para);
|
||||
|
||||
@@ -15,12 +15,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public class ResultUtils {
|
||||
|
||||
private static final boolean isDefaultResult = PropertiesUtils.getInstance()
|
||||
.getPropertyToBoolean("web.isDefaultResult", "false");
|
||||
private static final String resultParamName = PropertiesUtils.getInstance()
|
||||
.getProperty("web.resultParamName", "__data");
|
||||
private static final String headerParamName = PropertiesUtils.getInstance()
|
||||
.getProperty("web.headerParamName", "x-data");
|
||||
private static final PropertiesUtils props = PropertiesUtils.getInstance();
|
||||
private static final boolean isDefaultResult = props.getPropertyToBoolean("web.isDefaultResult", "false");
|
||||
private static final String resultParamName = props.getProperty("web.resultParamName", "__data");
|
||||
private static final String headerParamName = props.getProperty("web.headerParamName", "x-data");
|
||||
|
||||
/**
|
||||
* 设置 web.isResult 参数可强制全局使用统一结果输出,否则,传递 __data=true 参数,或 x-data 请求头为 true 时启用
|
||||
|
||||
@@ -13,6 +13,8 @@ import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.mapper.JsonMapper;
|
||||
import com.jeesite.common.mapper.XmlMapper;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
@@ -32,6 +34,8 @@ import java.util.Map.Entry;
|
||||
*/
|
||||
public class ServletUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ServletUtils.class);
|
||||
|
||||
public static final String EXT_PARAMS_PREFIX = "param_"; // 扩展参数前缀
|
||||
|
||||
// 定义静态文件后缀;静态文件排除URI地址
|
||||
@@ -107,7 +111,7 @@ public class ServletUtils {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +125,7 @@ public class ServletUtils {
|
||||
throw new Exception("检测到“application.yml”中没有配置“web.staticFile”属性。配置示例:\n#静态文件后缀\nweb.staticFile=" +
|
||||
".css,.js,.map,.png,.jpg,.gif,.jpeg,.webp,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (StringUtils.containsAny(uri, STATIC_FILE_EXCLUDE_URI)) {
|
||||
@@ -363,7 +367,7 @@ public class ServletUtils {
|
||||
}
|
||||
response.getWriter().print(string);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 获取用户代理对象
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static UserAgent getUserAgent(HttpServletRequest request){
|
||||
return UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
|
||||
@@ -28,8 +26,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 获取设备类型
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static DeviceType getDeviceType(HttpServletRequest request){
|
||||
return getUserAgent(request).getOperatingSystem().getDeviceType();
|
||||
@@ -37,8 +33,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 是否是PC
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static boolean isComputer(HttpServletRequest request){
|
||||
return DeviceType.COMPUTER.equals(getDeviceType(request));
|
||||
@@ -46,8 +40,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 是否是手机
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMobile(HttpServletRequest request){
|
||||
return DeviceType.MOBILE.equals(getDeviceType(request));
|
||||
@@ -55,8 +47,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 是否是平板
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTablet(HttpServletRequest request){
|
||||
return DeviceType.TABLET.equals(getDeviceType(request));
|
||||
@@ -64,8 +54,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 是否是手机和平板
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMobileOrTablet(HttpServletRequest request){
|
||||
DeviceType deviceType = getDeviceType(request);
|
||||
@@ -74,8 +62,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 获取浏览类型
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static Browser getBrowser(HttpServletRequest request){
|
||||
return getUserAgent(request).getBrowser();
|
||||
@@ -83,8 +69,6 @@ public class UserAgentUtils {
|
||||
|
||||
/**
|
||||
* 是否IE版本是否小于等于IE8
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static boolean isLteIE8(HttpServletRequest request){
|
||||
Browser browser = getBrowser(request);
|
||||
|
||||
@@ -48,8 +48,6 @@ public class CodeStatistic {
|
||||
|
||||
/**
|
||||
* 获得目录下的文件和子目录下的文件
|
||||
* @param f
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<File> getFile(File f) {
|
||||
File[] ff = f.listFiles();
|
||||
@@ -66,7 +64,6 @@ public class CodeStatistic {
|
||||
|
||||
/**
|
||||
* 统计方法
|
||||
* @param f
|
||||
*/
|
||||
private static void count(File f) {
|
||||
FileReader fr = null;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.test.utils.excel;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出Excel文件测试类
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-21
|
||||
*/
|
||||
public class ExcelExportEntityTest {
|
||||
|
||||
/**
|
||||
* 导出测试
|
||||
*/
|
||||
public static void main(String[] args) throws Throwable {
|
||||
|
||||
List<ExcelTestEntity> list = ListUtils.newArrayList();
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
ExcelTestEntity e = new ExcelTestEntity();
|
||||
e.setField1("test"+i);
|
||||
e.setField2(123+i);
|
||||
e.setField3(BigDecimal.valueOf(12345+i));
|
||||
list.add(e);
|
||||
}
|
||||
|
||||
File classPath = new File(ExcelExportEntityTest.class.getResource("/").getFile());
|
||||
String fileName = classPath.getParentFile().getAbsoluteFile() + "/export_entity.xlsx";
|
||||
|
||||
// 创建一个Sheet表,并导入数据
|
||||
try(ExcelExport ee = new ExcelExport("表格1", ExcelTestEntity.class)){
|
||||
ee.setDataList(list).writeFile(fileName);
|
||||
}
|
||||
|
||||
System.out.println("Export success.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.test.utils.excel;
|
||||
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导入Excel文件测试类
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-21
|
||||
*/
|
||||
public class ExcelImportEntityTest {
|
||||
|
||||
/**
|
||||
* 导入测试
|
||||
*/
|
||||
public static void main(String[] args) throws Throwable {
|
||||
|
||||
File classPath = new File(ExcelExportTest.class.getResource("/").getFile());
|
||||
String fileName = classPath.getParentFile().getAbsoluteFile() + "/export_entity.xlsx";
|
||||
try(ExcelImport ei = new ExcelImport(fileName, 2, 0)){
|
||||
List<ExcelTestEntity> list = ei.getDataList(ExcelTestEntity.class);
|
||||
for (ExcelTestEntity e : list) {
|
||||
System.out.print(e.getField1()+", ");
|
||||
System.out.print(e.getField2()+", ");
|
||||
System.out.print(e.getField3()+", ");
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Import success.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,6 @@ package com.jeesite.test.utils.excel;
|
||||
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.test.utils.excel;
|
||||
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Excel 测试数据实体
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public class ExcelTestEntity {
|
||||
|
||||
// 方式1:声明在字段上
|
||||
@ExcelField(title = "字段1", align = ExcelField.Align.CENTER, sort = 10)
|
||||
private String field1;
|
||||
private Integer field2;
|
||||
private BigDecimal field3;
|
||||
|
||||
// 方式2:声明在构造上
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "字段2", attrName = "field2", align = ExcelField.Align.CENTER, sort = 20),
|
||||
})
|
||||
public ExcelTestEntity() {}
|
||||
|
||||
public String getField1() {
|
||||
return field1;
|
||||
}
|
||||
|
||||
public void setField1(String field1) {
|
||||
this.field1 = field1;
|
||||
}
|
||||
|
||||
public Integer getField2() {
|
||||
return field2;
|
||||
}
|
||||
|
||||
public void setField2(Integer field2) {
|
||||
this.field2 = field2;
|
||||
}
|
||||
|
||||
// 方式3:声明在方法上
|
||||
@ExcelField(title = "字段3", align = ExcelField.Align.CENTER, sort = 30)
|
||||
public BigDecimal getField3() {
|
||||
return field3;
|
||||
}
|
||||
|
||||
public void setField3(BigDecimal field3) {
|
||||
this.field3 = field3;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.test.utils.word;
|
||||
|
||||
import com.jeesite.common.io.FileUtils;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--suppress VulnerableLibrariesLocal -->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.13.1-SNAPSHOT</version>
|
||||
<version>5.14.0-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.app.db;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.tests.BaseInitDataTests;
|
||||
import com.jeesite.modules.app.entity.AppComment;
|
||||
@@ -17,6 +11,10 @@ import com.jeesite.modules.app.entity.AppUpgrade;
|
||||
import com.jeesite.modules.app.service.AppCommentService;
|
||||
import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 初始化APP表及数据
|
||||
@@ -27,6 +25,11 @@ import com.jeesite.modules.gen.utils.GenUtils;
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitAppData extends BaseInitDataTests {
|
||||
|
||||
public InitAppData(AppUpgradeService appUpgradeService, AppCommentService appCommentService) {
|
||||
this.appUpgradeService = appUpgradeService;
|
||||
this.appCommentService = appCommentService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists(Global.getTablePrefix() + "app_upgrade")) {
|
||||
@@ -41,8 +44,7 @@ public class InitAppData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AppUpgradeService appUpgradeService;
|
||||
private final AppUpgradeService appUpgradeService;
|
||||
public void initAppUpgrade() throws Exception{
|
||||
// clearTable(AppUpgrade.class);
|
||||
initExcelData(AppUpgrade.class, params -> {
|
||||
@@ -57,8 +59,7 @@ public class InitAppData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AppCommentService appCommentService;
|
||||
private final AppCommentService appCommentService;
|
||||
public void initAppComment() throws Exception{
|
||||
// clearTable(AppComment.class);
|
||||
initExcelData(AppComment.class, params -> {
|
||||
|
||||
@@ -23,8 +23,7 @@ public class AppCommentService extends CrudService<AppCommentDao, AppComment> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param appComment
|
||||
* @return
|
||||
* @param appComment 主键
|
||||
*/
|
||||
@Override
|
||||
public AppComment get(AppComment appComment) {
|
||||
@@ -35,7 +34,6 @@ public class AppCommentService extends CrudService<AppCommentDao, AppComment> {
|
||||
* 查询分页数据
|
||||
* @param appComment 查询条件
|
||||
* @param appComment page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<AppComment> findPage(AppComment appComment) {
|
||||
@@ -44,7 +42,7 @@ public class AppCommentService extends CrudService<AppCommentDao, AppComment> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param appComment
|
||||
* @param appComment 查询条件
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -56,7 +54,7 @@ public class AppCommentService extends CrudService<AppCommentDao, AppComment> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param appComment
|
||||
* @param appComment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -66,7 +64,7 @@ public class AppCommentService extends CrudService<AppCommentDao, AppComment> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param appComment
|
||||
* @param appComment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -22,8 +22,7 @@ public class AppUpgradeService extends CrudService<AppUpgradeDao, AppUpgrade> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param appUpgrade
|
||||
* @return
|
||||
* @param appUpgrade 主键
|
||||
*/
|
||||
@Override
|
||||
public AppUpgrade get(AppUpgrade appUpgrade) {
|
||||
@@ -34,7 +33,6 @@ public class AppUpgradeService extends CrudService<AppUpgradeDao, AppUpgrade> {
|
||||
* 查询分页数据
|
||||
* @param appUpgrade 查询条件
|
||||
* @param appUpgrade page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<AppUpgrade> findPage(AppUpgrade appUpgrade) {
|
||||
@@ -43,7 +41,7 @@ public class AppUpgradeService extends CrudService<AppUpgradeDao, AppUpgrade> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param appUpgrade
|
||||
* @param appUpgrade 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -53,7 +51,7 @@ public class AppUpgradeService extends CrudService<AppUpgradeDao, AppUpgrade> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param appUpgrade
|
||||
* @param appUpgrade 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -63,7 +61,7 @@ public class AppUpgradeService extends CrudService<AppUpgradeDao, AppUpgrade> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param appUpgrade
|
||||
* @param appUpgrade 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -9,9 +9,10 @@ import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.app.entity.AppComment;
|
||||
import com.jeesite.modules.app.service.AppCommentService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -20,8 +21,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -33,9 +32,12 @@ import java.util.Date;
|
||||
@RequestMapping(value = "${adminPath}/app/appComment")
|
||||
public class AppCommentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AppCommentService appCommentService;
|
||||
|
||||
private final AppCommentService appCommentService;
|
||||
|
||||
public AppCommentController(AppCommentService appCommentService) {
|
||||
this.appCommentService = appCommentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
|
||||
@@ -4,21 +4,19 @@
|
||||
*/
|
||||
package com.jeesite.modules.app.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.app.entity.AppComment;
|
||||
import com.jeesite.modules.app.entity.AppUpgrade;
|
||||
import com.jeesite.modules.app.service.AppCommentService;
|
||||
import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP公共服务 Controller
|
||||
@@ -29,12 +27,14 @@ import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
@RequestMapping(value = "/app")
|
||||
public class AppPublicServiceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AppUpgradeService appUpgradeService;
|
||||
private final AppUpgradeService appUpgradeService;
|
||||
private final AppCommentService appCommentService;
|
||||
|
||||
public AppPublicServiceController(AppUpgradeService appUpgradeService, AppCommentService appCommentService) {
|
||||
this.appUpgradeService = appUpgradeService;
|
||||
this.appCommentService = appCommentService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AppCommentService appCommentService;
|
||||
|
||||
/**
|
||||
* 升级检测
|
||||
*/
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.modules.app.web;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.app.entity.AppUpgrade;
|
||||
import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -17,12 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.app.entity.AppUpgrade;
|
||||
import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
|
||||
/**
|
||||
* APP版本管理Controller
|
||||
* @author ThinkGem
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
@RequestMapping(value = "${adminPath}/app/appUpgrade")
|
||||
public class AppUpgradeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AppUpgradeService appUpgradeService;
|
||||
|
||||
private final AppUpgradeService appUpgradeService;
|
||||
|
||||
public AppUpgradeController(AppUpgradeService appUpgradeService) {
|
||||
this.appUpgradeService = appUpgradeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
|
||||
@@ -30,4 +30,5 @@
|
||||
5.12.0
|
||||
5.12.1
|
||||
5.13.0
|
||||
5.13.1
|
||||
5.13.1
|
||||
5.14.0
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--suppress VulnerableLibrariesLocal -->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.13.1-SNAPSHOT</version>
|
||||
<version>5.14.0-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Article;
|
||||
|
||||
/**
|
||||
* 文章表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.ArticleData;
|
||||
|
||||
/**
|
||||
* 文章详情表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.ArticlePosid;
|
||||
|
||||
/**
|
||||
* 文章推荐位DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.ArticleTag;
|
||||
|
||||
/**
|
||||
* 文章与标签关系DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Category;
|
||||
|
||||
/**
|
||||
* 栏目表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Comment;
|
||||
|
||||
/**
|
||||
* 文章评论表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Report;
|
||||
|
||||
/**
|
||||
* 内容举报表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Site;
|
||||
|
||||
/**
|
||||
* 站点表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Tag;
|
||||
|
||||
/**
|
||||
* 内容标签DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.VisitLog;
|
||||
|
||||
/**
|
||||
* 访问日志表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -28,6 +27,14 @@ import org.springframework.stereotype.Component;
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitCmsData extends BaseInitDataTests {
|
||||
|
||||
public InitCmsData(SiteService siteService, CategoryService categoryService,
|
||||
ArticleDao articleDao, ArticleDataDao articleDataDao) {
|
||||
this.siteService = siteService;
|
||||
this.categoryService = categoryService;
|
||||
this.articleDao = articleDao;
|
||||
this.articleDataDao = articleDataDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists(Global.getTablePrefix() + "cms_article")) {
|
||||
@@ -44,8 +51,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SiteService siteService;
|
||||
private final SiteService siteService;
|
||||
public void initSite() throws Exception{
|
||||
initExcelData(Site.class, params -> {
|
||||
String action = (String)params[0];
|
||||
@@ -59,8 +65,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
private final CategoryService categoryService;
|
||||
public void initCategory() throws Exception{
|
||||
initExcelData(Category.class, params -> {
|
||||
String action = (String)params[0];
|
||||
@@ -74,8 +79,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ArticleDao articleDao;
|
||||
private final ArticleDao articleDao;
|
||||
public void initArticle() throws Exception{
|
||||
initExcelData(Article.class, params -> {
|
||||
String action = (String)params[0];
|
||||
@@ -89,8 +93,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ArticleDataDao articleDataDao;
|
||||
private final ArticleDataDao articleDataDao;
|
||||
public void initArticleData() throws Exception{
|
||||
initExcelData(ArticleData.class, params -> {
|
||||
String action = (String)params[0];
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -280,7 +281,6 @@ public class Article extends DataEntity<Article> {
|
||||
|
||||
/**
|
||||
* 是否查询文章内容
|
||||
* @return
|
||||
*/
|
||||
public Boolean getIsQueryArticleData() {
|
||||
return isQueryArticleData;
|
||||
|
||||
@@ -4,19 +4,17 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.common.entity.BaseEntity;
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章评论表Entity
|
||||
@@ -45,7 +43,7 @@ public class Comment extends DataEntity<Comment> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Category category;// 分类编号
|
||||
private Category category; // 分类编号
|
||||
|
||||
private String categoryCode; // 栏目编码
|
||||
private String articleId; // 内容编号 (Article.id、Photo.id、Download.id)
|
||||
|
||||
@@ -187,7 +187,6 @@ public class Site extends DataEntity<Site> {
|
||||
|
||||
/**
|
||||
* 获得模板方案路径。如:/WEB-INF/views/modules/cmsfront/themes/jeesite
|
||||
* @return
|
||||
*/
|
||||
public String getSolutionPath() {
|
||||
return TEMPLATE_BASE_DIRECTION + "/" + getTheme();
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -32,19 +32,24 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 文章表Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2023-4-10
|
||||
* 文章Service
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-12
|
||||
*/
|
||||
@Service
|
||||
public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
@Autowired
|
||||
private ArticleDataDao articleDataDao;
|
||||
@Autowired(required = false)
|
||||
private ArticleIndexService articleIndexService;
|
||||
@Autowired(required = false)
|
||||
private PageCacheService pageCacheService;
|
||||
private final ArticleDataDao articleDataDao;
|
||||
private final ArticleIndexService articleIndexService;
|
||||
private final PageCacheService pageCacheService;
|
||||
|
||||
public ArticleService(ArticleDataDao articleDataDao,
|
||||
ObjectProvider<ArticleIndexService> articleIndexService,
|
||||
ObjectProvider<PageCacheService> pageCacheService) {
|
||||
this.articleDataDao = articleDataDao;
|
||||
this.articleIndexService = articleIndexService.getIfAvailable();
|
||||
this.pageCacheService = pageCacheService.getIfAvailable();
|
||||
}
|
||||
|
||||
private static final ExecutorService updateExpiredWeightThreadPool = new ThreadPoolExecutor(5, 20,
|
||||
60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
|
||||
@@ -52,8 +57,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param article
|
||||
* @return
|
||||
* @param article 主键
|
||||
*/
|
||||
@Override
|
||||
public Article get(Article article) {
|
||||
@@ -84,7 +88,6 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
* 查询分页数据
|
||||
* @param article 查询条件
|
||||
* @param article page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Article> findPage(Article article) {
|
||||
@@ -94,6 +97,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 通过编号获取内容标题
|
||||
* @param ids 主键,使用逗号分隔
|
||||
* @return new Object[]{栏目Id,内容Id,内容标题}
|
||||
*/
|
||||
public List<Object[]> findByIds(String ids) {
|
||||
@@ -111,15 +115,14 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 权重更新
|
||||
* @param article
|
||||
* @param article 数据对象
|
||||
* @author ThinkGem
|
||||
*/
|
||||
@Transactional
|
||||
public void updateExpiredWeight(Article article) {
|
||||
// 更新过期的权重,间隔为“6”个小时
|
||||
Date updateExpiredWeightDate = CmsUtils.getCache("updateExpiredWeightDateByArticle");
|
||||
if (updateExpiredWeightDate == null || (updateExpiredWeightDate != null
|
||||
&& updateExpiredWeightDate.getTime() < System.currentTimeMillis())) {
|
||||
if (updateExpiredWeightDate == null || updateExpiredWeightDate.getTime() < System.currentTimeMillis()) {
|
||||
article.setWeightDate(new Date());
|
||||
dao.updateExpiredWeight(article);
|
||||
CmsUtils.putCache("updateExpiredWeightDateByArticle", DateUtils.addHours(new Date(), 6));
|
||||
@@ -128,7 +131,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param article
|
||||
* @param article 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -174,7 +177,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param article
|
||||
* @param article 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -211,7 +214,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param article
|
||||
* @param article 文章
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -10,29 +10,31 @@ import com.jeesite.modules.cms.entity.Article;
|
||||
import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 栏目表Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2023-4-10
|
||||
* 栏目Service
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-12
|
||||
*/
|
||||
@Service
|
||||
public class CategoryService extends TreeService<CategoryDao, Category> {
|
||||
|
||||
@Autowired(required = false)
|
||||
private ArticleIndexService articleIndexService;
|
||||
@Autowired(required = false)
|
||||
private PageCacheService pageCacheService;
|
||||
private final ArticleIndexService articleIndexService;
|
||||
private final PageCacheService pageCacheService;
|
||||
|
||||
public CategoryService(ObjectProvider<ArticleIndexService> articleIndexService,
|
||||
ObjectProvider<PageCacheService> pageCacheService) {
|
||||
this.articleIndexService = articleIndexService.getIfAvailable();
|
||||
this.pageCacheService = pageCacheService.getIfAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Category get(Category category) {
|
||||
@@ -50,8 +52,6 @@ public class CategoryService extends TreeService<CategoryDao, Category> {
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Category> findList(Category category) {
|
||||
@@ -60,19 +60,15 @@ public class CategoryService extends TreeService<CategoryDao, Category> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param category
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(Category category) {
|
||||
super.save(category);
|
||||
CmsUtils.removeCache("mainNavList_"+category.getSite().getId());
|
||||
// 保存上传图片
|
||||
FileUploadUtils.saveFileUpload(category, category.getId(), "category_image");
|
||||
// 清理首页、栏目和文章页面缓存
|
||||
if (pageCacheService != null) {
|
||||
pageCacheService.clearCache(category);
|
||||
}
|
||||
// 清理栏目缓存
|
||||
clearCache(category);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,27 +83,37 @@ public class CategoryService extends TreeService<CategoryDao, Category> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param category
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(Category category) {
|
||||
super.updateStatus(category);
|
||||
// 清理首页、栏目和文章页面缓存
|
||||
if (pageCacheService != null) {
|
||||
pageCacheService.clearCache(category);
|
||||
}
|
||||
// 清理栏目缓存
|
||||
clearCache(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param category
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Category category) {
|
||||
category.sqlMap().markIdDelete();
|
||||
super.delete(category);
|
||||
// 清理栏目缓存
|
||||
clearCache(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理栏目缓存
|
||||
*/
|
||||
public void clearCache(Category category) {
|
||||
// 清理栏目缓存
|
||||
CmsUtils.removeCache("category_" + category.getId());
|
||||
// 清理栏目列表缓存
|
||||
CmsUtils.removeCacheByKeyPrefix("categoryList_" + category.getSite().getId() + "_" + category.getParentCode() + "_");
|
||||
// 清理主导航缓存
|
||||
CmsUtils.removeCache("mainNavList_" + category.getSite().getId());
|
||||
// 清理首页、栏目和文章页面缓存
|
||||
if (pageCacheService != null) {
|
||||
pageCacheService.clearCache(category);
|
||||
|
||||
@@ -23,8 +23,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param comment
|
||||
* @return
|
||||
* @param comment 主键
|
||||
*/
|
||||
@Override
|
||||
public Comment get(Comment comment) {
|
||||
@@ -35,7 +34,6 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
* 查询分页数据
|
||||
* @param comment 查询条件
|
||||
* @param comment page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Comment> findPage(Comment comment) {
|
||||
@@ -44,7 +42,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param comment
|
||||
* @param comment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -58,7 +56,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param comment
|
||||
* @param comment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -68,7 +66,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param comment
|
||||
* @param comment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FileTemplateService {
|
||||
|
||||
/**
|
||||
* 获取对应视图模板列表,兼容 Select 字典
|
||||
* @param prefix
|
||||
* @param prefix 路径前缀
|
||||
*/
|
||||
public List<DictData> getTemplateContentDict(String prefix) throws IOException {
|
||||
List<DictData> listSite = ListUtils.newArrayList();
|
||||
|
||||
@@ -23,8 +23,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param report
|
||||
* @return
|
||||
* @param report 主键
|
||||
*/
|
||||
@Override
|
||||
public Report get(Report report) {
|
||||
@@ -35,7 +34,6 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
* 查询分页数据
|
||||
* @param report 查询条件
|
||||
* @param report page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Report> findPage(Report report) {
|
||||
@@ -44,7 +42,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param report
|
||||
* @param report 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -58,7 +56,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param report
|
||||
* @param report 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -68,7 +66,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param report
|
||||
* @param report 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -12,27 +12,30 @@ import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 站点表Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2023-4-10
|
||||
* 站点Service
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-12
|
||||
*/
|
||||
@Service
|
||||
public class SiteService extends CrudService<SiteDao, Site> {
|
||||
|
||||
@Autowired(required = false)
|
||||
private ArticleIndexService articleIndexService;
|
||||
@Autowired(required = false)
|
||||
private PageCacheService pageCacheService;
|
||||
private final ArticleIndexService articleIndexService;
|
||||
private final PageCacheService pageCacheService;
|
||||
|
||||
public SiteService(ObjectProvider<ArticleIndexService> articleIndexService,
|
||||
ObjectProvider<PageCacheService> pageCacheService) {
|
||||
this.articleIndexService = articleIndexService.getIfAvailable();
|
||||
this.pageCacheService = pageCacheService.getIfAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param site
|
||||
* @return
|
||||
* @param site 主键
|
||||
*/
|
||||
@Override
|
||||
public Site get(Site site) {
|
||||
@@ -43,7 +46,6 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
* 查询分页数据
|
||||
* @param site 查询条件
|
||||
* @param site page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Site> findPage(Site site) {
|
||||
@@ -52,45 +54,55 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param site
|
||||
* @param site 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(Site site) {
|
||||
super.save(site);
|
||||
CmsUtils.removeCache("siteList");
|
||||
// 保存logo
|
||||
FileUploadUtils.saveFileUpload(site, site.getId(), "site_logo");
|
||||
// 清理首页、栏目和文章页面缓存
|
||||
if (pageCacheService != null) {
|
||||
pageCacheService.clearCache(site);
|
||||
}
|
||||
// 清理站点缓存
|
||||
clearCache(site);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param site
|
||||
* @param site 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(Site site) {
|
||||
super.updateStatus(site);
|
||||
CmsUtils.removeCache("siteList");
|
||||
// 清理首页、栏目和文章页面缓存
|
||||
if (pageCacheService != null) {
|
||||
pageCacheService.clearCache(site);
|
||||
}
|
||||
// 清理站点缓存
|
||||
clearCache(site);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param site
|
||||
* @param site 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Site site) {
|
||||
site.sqlMap().markIdDelete();
|
||||
super.delete(site);
|
||||
// 清理站点缓存
|
||||
clearCache(site);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理站点缓存
|
||||
*/
|
||||
public void clearCache(Site site) {
|
||||
// 清理栏目缓存
|
||||
CmsUtils.removeCacheByKeyPrefix("category_");
|
||||
// 清理栏目列表缓存
|
||||
CmsUtils.removeCacheByKeyPrefix("categoryList_" + site.getId() + "_");
|
||||
// 清理主导航缓存
|
||||
CmsUtils.removeCache("mainNavList_" + site.getId());
|
||||
// 清理站点缓存
|
||||
CmsUtils.removeCache("site_" + site.getId());
|
||||
// 清理站点列表缓存
|
||||
CmsUtils.removeCache("siteList");
|
||||
// 清理首页、栏目和文章页面缓存
|
||||
if (pageCacheService != null) {
|
||||
@@ -98,18 +110,6 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 删除站点
|
||||
// * @param site
|
||||
// * @param isRe
|
||||
// */
|
||||
// @Transactional
|
||||
// public void delete(Site site, Boolean isRe) {
|
||||
// site.setStatus(isRe != null && isRe ? Site.STATUS_NORMAL : Site.STATUS_DELETE);
|
||||
// super.delete(site);
|
||||
// CmsUtils.removeCache("siteList");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 重建索引
|
||||
* @author ThinkGem
|
||||
|
||||
@@ -22,8 +22,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param tag
|
||||
* @return
|
||||
* @param tag 主键
|
||||
*/
|
||||
@Override
|
||||
public Tag get(Tag tag) {
|
||||
@@ -34,7 +33,6 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
* 查询分页数据
|
||||
* @param tag 查询条件
|
||||
* @param tag page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Tag> findPage(Tag tag) {
|
||||
@@ -43,7 +41,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param tag
|
||||
* @param tag 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -53,7 +51,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param tag
|
||||
* @param tag 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -63,7 +61,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param tag
|
||||
* @param tag 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -23,8 +23,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param visitLog
|
||||
* @return
|
||||
* @param visitLog 主键
|
||||
*/
|
||||
@Override
|
||||
public VisitLog get(VisitLog visitLog) {
|
||||
@@ -35,7 +34,6 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
* 查询分页数据
|
||||
* @param visitLog 查询条件
|
||||
* @param visitLog page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<VisitLog> findPage(VisitLog visitLog) {
|
||||
@@ -44,7 +42,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param visitLog
|
||||
* @param visitLog 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -58,7 +56,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param visitLog
|
||||
* @param visitLog 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -68,7 +66,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param visitLog
|
||||
* @param visitLog 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package com.jeesite.modules.cms.utils;
|
||||
|
||||
import com.jeesite.common.cache.CacheUtils;
|
||||
import com.jeesite.common.codec.Md5Utils;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
@@ -20,10 +21,10 @@ import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* CmsUtils
|
||||
@@ -52,30 +53,22 @@ public class CmsUtils {
|
||||
* @param siteCode 站点编号
|
||||
*/
|
||||
public static Site getSite(String siteCode) {
|
||||
String code = Site.MAIN_SITE_CODE;
|
||||
if (StringUtils.isNotBlank(siteCode)) {
|
||||
code = siteCode;
|
||||
}
|
||||
// 根据编码获取站点
|
||||
for (Site site : getSiteList()) {
|
||||
if (site.getSiteCode().equals(code)) {
|
||||
return site;
|
||||
String code = StringUtils.isNotBlank(siteCode) ? siteCode : Site.MAIN_SITE_CODE;
|
||||
return CmsUtils.computeIfAbsentCache("site_" + code, k -> {
|
||||
Site site = Static.siteService.get(code);
|
||||
if (site == null) {
|
||||
site = new Site(code);
|
||||
}
|
||||
}
|
||||
return new Site(code);
|
||||
return site;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得站点列表
|
||||
*/
|
||||
public static List<Site> getSiteList() {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Site> siteList = (List<Site>) getCache("siteList");
|
||||
if (siteList == null) {
|
||||
siteList = Static.siteService.findList(new Site());
|
||||
putCache("siteList", siteList);
|
||||
}
|
||||
return siteList;
|
||||
return CmsUtils.computeIfAbsentCache("siteList", k ->
|
||||
Static.siteService.findList(new Site()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,26 +76,22 @@ public class CmsUtils {
|
||||
* @param siteCode 站点编号
|
||||
*/
|
||||
public static List<Category> getMainNavList(String siteCode) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Category> mainNavList = (List<Category>) getCache("mainNavList_" + siteCode);
|
||||
if (mainNavList == null) {
|
||||
return CmsUtils.computeIfAbsentCache("mainNavList_" + siteCode, k -> {
|
||||
Category category = new Category();
|
||||
category.setSite(new Site(siteCode));
|
||||
category.setParent(new Category(Category.ROOT_CODE));
|
||||
category.setInMenu(Global.SHOW);
|
||||
mainNavList = Static.categoryService.findList(category);
|
||||
putCache("mainNavList_" + siteCode, mainNavList);
|
||||
}
|
||||
return mainNavList;
|
||||
return Static.categoryService.findList(category);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取栏目
|
||||
* @param categoryCode 栏目编号
|
||||
* @return
|
||||
*/
|
||||
public static Category getCategory(String categoryCode) {
|
||||
return Static.categoryService.get(categoryCode);
|
||||
return CmsUtils.computeIfAbsentCache("category_" + categoryCode, k ->
|
||||
Static.categoryService.get(categoryCode));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,46 +112,49 @@ public class CmsUtils {
|
||||
if (StringUtils.isBlank(siteCode) || StringUtils.isBlank(parentCode)) {
|
||||
return ListUtils.newArrayList();
|
||||
}
|
||||
Page<Category> page = new Page<>(1, number, -1);
|
||||
Category category = new Category();
|
||||
category.setSite(new Site(siteCode));
|
||||
category.setParentCode(parentCode);
|
||||
Boolean isChildList = false; // 是否进行childList转换
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
Map map = JsonMapper.fromJson("{" + params.trim() + "}", Map.class);
|
||||
String key = "categoryList_" + siteCode + "_" + parentCode + "_" + Md5Utils.md5(number + "_" + params);
|
||||
return CmsUtils.computeIfAbsentCache(key, k -> {
|
||||
Page<Category> page = new Page<>(1, number, -1);
|
||||
Category category = new Category();
|
||||
category.setSite(new Site(siteCode));
|
||||
category.setParentCode(parentCode);
|
||||
boolean isChildList = false; // 是否进行childList转换
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
Map map = JsonMapper.fromJson("{" + params.trim() + "}", Map.class);
|
||||
|
||||
// 获取的层级级别
|
||||
String sortGrades = ObjectUtils.toString(map.get("sortGrades"));
|
||||
if (StringUtils.isNotBlank(sortGrades)) {
|
||||
// 获取的层级级别
|
||||
String sortGrades = ObjectUtils.toString(map.get("sortGrades"));
|
||||
if (StringUtils.isNotBlank(sortGrades)) {
|
||||
|
||||
// 如果设置了级别,则清理ParentCode,并使用ParentCodes进行查询
|
||||
category.setParentCode(null);
|
||||
// 如果设置了级别,则清理ParentCode,并使用ParentCodes进行查询
|
||||
category.setParentCode(null);
|
||||
|
||||
// 如果是跟节点则不加入条件,代表查询全部,不是跟节点的时候获取指定节点的所有下级
|
||||
if (!Category.ROOT_CODE.equals(parentCode)) {
|
||||
category.setParentCodes("%," + parentCode + ",%");
|
||||
// 如果是跟节点则不加入条件,代表查询全部,不是跟节点的时候获取指定节点的所有下级
|
||||
if (!Category.ROOT_CODE.equals(parentCode)) {
|
||||
category.setParentCodes("%," + parentCode + ",%");
|
||||
}
|
||||
|
||||
// 增加获取层次级别条件
|
||||
List<Integer> sortGradeList = ListUtils.newArrayList();
|
||||
for (String s : StringUtils.splitComma(sortGrades)) {
|
||||
sortGradeList.add(ObjectUtils.toInteger(s));
|
||||
}
|
||||
category.setSortGradeList(sortGradeList);
|
||||
}
|
||||
|
||||
// 增加获取层次级别条件
|
||||
List<Integer> sortGradeList = ListUtils.newArrayList();
|
||||
for (String s : StringUtils.splitComma(sortGrades)) {
|
||||
sortGradeList.add(ObjectUtils.toInteger(s));
|
||||
}
|
||||
category.setSortGradeList(sortGradeList);
|
||||
// 是否进行childList转换
|
||||
isChildList = ObjectUtils.toBoolean(map.get("isChildList"));
|
||||
}
|
||||
// 是否进行childList转换
|
||||
isChildList = ObjectUtils.toBoolean(map.get("isChildList"));
|
||||
}
|
||||
category.setPage(page);
|
||||
page = Static.categoryService.findPage(category);
|
||||
// 进行childList转换
|
||||
if (isChildList) {
|
||||
List<Category> sourceList = page.getList();
|
||||
List<Category> targetList = Static.categoryService.convertTreeList(sourceList, parentCode);
|
||||
page.setList(targetList);
|
||||
}
|
||||
return page.getList();
|
||||
category.setPage(page);
|
||||
page = Static.categoryService.findPage(category);
|
||||
// 进行childList转换
|
||||
if (isChildList) {
|
||||
List<Category> sourceList = page.getList();
|
||||
List<Category> targetList = Static.categoryService.convertTreeList(sourceList, parentCode);
|
||||
page.setList(targetList);
|
||||
}
|
||||
return page.getList();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,8 +229,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 获得文章动态URL地址
|
||||
* @param article
|
||||
* @return url
|
||||
*/
|
||||
public static String getUrlDynamic(Article article) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
@@ -259,8 +249,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 获得栏目动态URL地址
|
||||
* @param category
|
||||
* @return url
|
||||
*/
|
||||
public static String getUrlDynamic(Category category) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
@@ -279,8 +267,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 获得站点动态URL地址
|
||||
* @param site
|
||||
* @return url
|
||||
*/
|
||||
public static String getUrlDynamic(Site site) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
@@ -299,8 +285,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 获得栏目动态URL地址
|
||||
* @param category
|
||||
* @return url
|
||||
*/
|
||||
public static String getAdminUrlDynamic(Category category) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
@@ -381,8 +365,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 从图片地址中去除ContextPath地址
|
||||
* @param src
|
||||
* @return
|
||||
*/
|
||||
public static String formatImageSrcToDb(String src) {
|
||||
if (StringUtils.isBlank(src)) {
|
||||
@@ -397,8 +379,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 从图片地址中加入ContextPath地址
|
||||
* @param src
|
||||
* @return
|
||||
*/
|
||||
public static String formatImageSrcToWeb(String src) {
|
||||
if (StringUtils.isBlank(src)) {
|
||||
@@ -413,8 +393,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 获取文章视图
|
||||
* @param article
|
||||
* @return
|
||||
*/
|
||||
public static String getArticleView(Article article) {
|
||||
if (StringUtils.isBlank(article.getCustomContentView())) {
|
||||
@@ -441,8 +419,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 视图配置属性设置
|
||||
* @param model
|
||||
* @param params
|
||||
*/
|
||||
public static void addViewConfigAttribute(Model model, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
@@ -458,8 +434,6 @@ public class CmsUtils {
|
||||
|
||||
/**
|
||||
* 视图配置属性设置
|
||||
* @param model
|
||||
* @param category
|
||||
*/
|
||||
public static void addViewConfigAttribute(Model model, Category category) {
|
||||
List<Category> categoryList = ListUtils.newArrayList();
|
||||
@@ -481,33 +455,77 @@ public class CmsUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点服务
|
||||
*/
|
||||
public static SiteService getSiteService() {
|
||||
return Static.siteService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取栏目服务
|
||||
*/
|
||||
public static CategoryService getCategoryService() {
|
||||
return Static.categoryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章服务
|
||||
*/
|
||||
public static ArticleService getArticleService() {
|
||||
return Static.articleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存值
|
||||
* @param key 缓存键
|
||||
*/
|
||||
public static <V> V getCache(String key) {
|
||||
return CacheUtils.get(CMS_CACHE, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存值
|
||||
* @param key 缓存键
|
||||
* @param defaultValue 默认值
|
||||
*/
|
||||
public static <V> V getCache(String key, V defaultValue) {
|
||||
V value = CacheUtils.get(CMS_CACHE, key);
|
||||
return value != null ? value : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置缓存值
|
||||
* @param key 缓存键
|
||||
* @param value 缓存值
|
||||
*/
|
||||
public static void putCache(String key, Object value) {
|
||||
CacheUtils.put(CMS_CACHE, key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存,如果不存在,则设置新值
|
||||
* @param key 缓存键
|
||||
* @param mappingFunction 新值
|
||||
*/
|
||||
public static <V> V computeIfAbsentCache(String key, Function<String, V> mappingFunction) {
|
||||
return CacheUtils.computeIfAbsent(CMS_CACHE, key, mappingFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除缓存值
|
||||
* @param key 缓存键
|
||||
*/
|
||||
public static void removeCache(String key) {
|
||||
CacheUtils.remove(CMS_CACHE, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key前缀从缓存中移除
|
||||
* @param key 缓存键
|
||||
*/
|
||||
public static void removeCacheByKeyPrefix(String key) {
|
||||
CacheUtils.removeByKeyPrefix(CMS_CACHE, key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class FileTemplateUtils {
|
||||
|
||||
/**
|
||||
* 获取模版文件
|
||||
* @param fileName
|
||||
* @param fileName 模块名称
|
||||
*/
|
||||
public static FileTemplate getFileTemplateByResource(String fileName) {
|
||||
if (!StringUtils.startsWith(fileName, "views/modules/cmsfront")) {
|
||||
|
||||
@@ -17,8 +17,9 @@ import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -27,8 +28,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,12 +40,15 @@ import java.util.List;
|
||||
@RequestMapping(value = "${adminPath}/cms/article")
|
||||
public class ArticleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
private final ArticleService articleService;
|
||||
private final CategoryService categoryService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
public ArticleController(ArticleService articleService, CategoryService categoryService, FileTemplateService fileTemplateService) {
|
||||
this.articleService = articleService;
|
||||
this.categoryService = categoryService;
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -58,7 +60,6 @@ public class ArticleController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequiresPermissions("cms:article:view")
|
||||
@RequestMapping(value = { "list", "" })
|
||||
@@ -73,7 +74,7 @@ public class ArticleController extends BaseController {
|
||||
Page<Article> page = new Page<>(1, 1, -1);
|
||||
article.setPage(page);
|
||||
page = articleService.findPage(article);
|
||||
if (page.getList().size() > 0) {
|
||||
if (!page.getList().isEmpty()) {
|
||||
article = page.getList().get(0);
|
||||
article.setArticleData(articleService.get(new ArticleData(article.getId())));
|
||||
}
|
||||
@@ -116,7 +117,6 @@ public class ArticleController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequiresPermissions("cms:article:view")
|
||||
@RequestMapping(value = "form")
|
||||
@@ -126,7 +126,7 @@ public class ArticleController extends BaseController {
|
||||
categoryParam.setSite(new Site(Site.getCurrentSiteCode()));
|
||||
categoryParam.setParentCode(article.getCategory().getCategoryCode());
|
||||
List<Category> list = categoryService.findList(categoryParam);
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
article.setCategory(null); // 不允许在父节点上添加文章
|
||||
} else {
|
||||
article.setCategory(CmsUtils.getCategory(article.getCategory().getCategoryCode()));
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.jeesite.modules.sys.utils.DictUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -42,11 +41,13 @@ import java.util.Map;
|
||||
@RequestMapping(value = "${adminPath}/cms/category")
|
||||
public class CategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
private final CategoryService categoryService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
public CategoryController(CategoryService categoryService, FileTemplateService fileTemplateService) {
|
||||
this.categoryService = categoryService;
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -108,7 +109,6 @@ public class CategoryController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequiresPermissions("cms:category:view")
|
||||
@RequestMapping(value = "form")
|
||||
@@ -121,7 +121,7 @@ public class CategoryController extends BaseController {
|
||||
Category categoryChild = new Category();
|
||||
categoryChild.setParent(new Category(category.getParentCode()));
|
||||
List<Category> list = categoryService.findList(category);
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
category.setTreeSort(list.get(list.size() - 1).getTreeSort());
|
||||
if (category.getTreeSort() != null) {
|
||||
category.setTreeSort(category.getTreeSort() + 30);
|
||||
@@ -274,7 +274,6 @@ public class CategoryController extends BaseController {
|
||||
* 获取树结构数据
|
||||
* @param excludeCode 排除的Code
|
||||
* @param isShowCode 是否显示编码(true or 1:显示在左侧;2:显示在右侧;false or null:不显示)
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions(value = {"cms:category:view", "cms:article:view"}, logical = Logical.OR)
|
||||
@RequestMapping(value = "treeData")
|
||||
|
||||
@@ -19,19 +19,28 @@ import com.jeesite.common.web.BaseController;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/cms")
|
||||
public class CmsIndexController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 管理内容页
|
||||
*/
|
||||
@RequiresPermissions("cms:view")
|
||||
@RequestMapping(value = "index")
|
||||
public String index() {
|
||||
return "modules/cms/cmsIndex";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看内容页
|
||||
*/
|
||||
@RequiresPermissions("cms:view")
|
||||
@RequestMapping(value = "view")
|
||||
public String view(Model model) {
|
||||
return "modules/cms/cmsView";
|
||||
}
|
||||
|
||||
/**
|
||||
* 空内容页面
|
||||
*/
|
||||
@RequiresPermissions("cms:view")
|
||||
@RequestMapping(value = "none")
|
||||
public String none() {
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Comment;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -17,12 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Comment;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
|
||||
/**
|
||||
* 文章评论表Controller
|
||||
* @author 长春叭哥、ThinkGem
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.cms.service.CommentService;
|
||||
@RequestMapping(value = "${adminPath}/cms/comment")
|
||||
public class CommentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
|
||||
private final CommentService commentService;
|
||||
|
||||
public CommentController(CommentService commentService) {
|
||||
this.commentService = commentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@@ -120,5 +120,5 @@ public class CommentController extends BaseController {
|
||||
commentService.delete(comment);
|
||||
return renderResult(Global.TRUE, text("删除文章评论表成功!"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import com.jeesite.modules.cms.entity.FileTemplate;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -30,15 +29,24 @@ import java.util.Map;
|
||||
@RequestMapping(value = "${adminPath}/cms/template")
|
||||
public class FileTemplateController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
public FileTemplateController(FileTemplateService fileTemplateService) {
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模版管理页
|
||||
*/
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = { "list", "" })
|
||||
public String index() {
|
||||
return "modules/cms/tplIndex";
|
||||
}
|
||||
|
||||
/**
|
||||
* 模版查看页
|
||||
*/
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(String name, Model model) throws IOException {
|
||||
@@ -75,6 +83,9 @@ public class FileTemplateController extends BaseController {
|
||||
return renderResult(Global.FALSE, "模版文件不存在!");
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 模版帮助页
|
||||
*/
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = "help")
|
||||
public String help() {
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Report;
|
||||
import com.jeesite.modules.cms.service.ReportService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -17,12 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Report;
|
||||
import com.jeesite.modules.cms.service.ReportService;
|
||||
|
||||
/**
|
||||
* 内容举报表Controller
|
||||
* @author 长春叭哥、ThinkGem
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.cms.service.ReportService;
|
||||
@RequestMapping(value = "${adminPath}/cms/report")
|
||||
public class ReportController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ReportService reportService;
|
||||
|
||||
private final ReportService reportService;
|
||||
|
||||
public ReportController(ReportService reportService) {
|
||||
this.reportService = reportService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@@ -120,5 +120,5 @@ public class ReportController extends BaseController {
|
||||
reportService.delete(report);
|
||||
return renderResult(Global.TRUE, text("删除内容举报表成功!"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -35,11 +34,13 @@ import java.io.IOException;
|
||||
@RequestMapping(value = "${adminPath}/cms/site")
|
||||
public class SiteController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SiteService siteService;
|
||||
private final SiteService siteService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
public SiteController(SiteService siteService, FileTemplateService fileTemplateService) {
|
||||
this.siteService = siteService;
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
|
||||
@@ -16,13 +16,12 @@ import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.ValidCodeUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,12 +34,15 @@ import java.util.List;
|
||||
@RequestMapping(value = "${frontPath}")
|
||||
public class FrontController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
private final CategoryService categoryService;
|
||||
private final ArticleService articleService;
|
||||
private final CommentService commentService;
|
||||
|
||||
public FrontController(CategoryService categoryService, ArticleService articleService, CommentService commentService) {
|
||||
this.categoryService = categoryService;
|
||||
this.articleService = articleService;
|
||||
this.commentService = commentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主站首页
|
||||
@@ -75,7 +77,7 @@ public class FrontController extends BaseController {
|
||||
|
||||
// 否则显示子站第一个栏目
|
||||
List<Category> mainNavList = CmsUtils.getMainNavList(siteCode);
|
||||
if (mainNavList.size() > 0) {
|
||||
if (!mainNavList.isEmpty()) {
|
||||
String firstCategoryCode = CmsUtils.getMainNavList(siteCode).get(0).getId();
|
||||
return REDIRECT + frontPath + "/list-" + firstCategoryCode + ".html";
|
||||
}
|
||||
@@ -142,7 +144,7 @@ public class FrontController extends BaseController {
|
||||
if (Category.SHOW_MODES_CENTENT_LIST.equals(category.getShowModes()) || categoryList.size() <= 1) {
|
||||
|
||||
// 有子栏目并展现方式为2,则获取第一个子栏目;无子栏目,则获取同级分类列表。
|
||||
if (categoryList.size() > 0) {
|
||||
if (!categoryList.isEmpty()) {
|
||||
category = categoryList.get(0);
|
||||
}
|
||||
|
||||
@@ -231,15 +233,15 @@ public class FrontController extends BaseController {
|
||||
// 文章模型
|
||||
if ("article".equals(category.getModuleType())) {
|
||||
|
||||
// // 获取当前级别的栏目列表
|
||||
// List<Category> categoryList = Lists.newArrayList();
|
||||
//// if (category.getIsRoot()){
|
||||
//// categoryList.add(category);
|
||||
//// }else{
|
||||
//// categoryList = categoryService.findListByParentCode(category.getParentCode(), category.getSite().getId());
|
||||
// categoryList = CmsUtils.getCategoryList(category.getSite().getSiteCode(), category.getParentCode(), -1, null);
|
||||
//// }
|
||||
// model.addAttribute("categoryList", categoryList);
|
||||
/*// 获取当前级别的栏目列表
|
||||
List<Category> categoryList = ListUtils.newArrayList();
|
||||
// if (category.getIsRoot()){
|
||||
// categoryList.add(category);
|
||||
// }else{
|
||||
// categoryList = categoryService.findListByParentCode(category.getParentCode(), category.getSite().getId());
|
||||
categoryList = CmsUtils.getCategoryList(category.getSite().getSiteCode(), category.getParentCode(), -1, null);
|
||||
// }
|
||||
model.addAttribute("categoryList", categoryList);*/
|
||||
|
||||
// 获取文章
|
||||
Article article = null;
|
||||
@@ -254,7 +256,7 @@ public class FrontController extends BaseController {
|
||||
Article entity = new Article(category);
|
||||
entity.setPage(page);
|
||||
page = articleService.findPage(entity);
|
||||
if (page.getList().size() > 0) {
|
||||
if (!page.getList().isEmpty()) {
|
||||
article = page.getList().get(0);
|
||||
article.setArticleData(articleService.get(new ArticleData(article.getId())));
|
||||
}
|
||||
|
||||
@@ -4,16 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cmsfront.web;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
@@ -22,6 +12,13 @@ import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.ArticleService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网站搜索Controller
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
@RequestMapping(value = "${frontPath}/search")
|
||||
public class FrontSearchController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
private final ArticleService articleService;
|
||||
|
||||
public FrontSearchController(ArticleService articleService) {
|
||||
this.articleService = articleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全站搜索
|
||||
* @param t 搜索类型(article、guestbook)
|
||||
|
||||
@@ -1,21 +1,7 @@
|
||||
|
||||
#设置与beetl-default.properties相同的属性将被覆盖默认设置
|
||||
#设置与 beetl-default.properties 相同的属性将被优先加载
|
||||
|
||||
#导入项目中的调用静态方法类(项目中设置,自动合并IMPORT_PACKAGE设置)
|
||||
#导入的包名(自动合并到 IMPORT_PACKAGE 设置,键名以模块编码结尾)
|
||||
IMPORT_PACKAGE_cms=\
|
||||
com.jeesite.modules.cms.utils.;\
|
||||
|
||||
## 内置的方法
|
||||
#FN.date = org.beetl.ext.fn.DateFunction
|
||||
|
||||
##内置的功能包
|
||||
#FNP.strutil = org.beetl.ext.fn.StringUtil
|
||||
|
||||
##内置的格式化函数
|
||||
#FT.dateFormat = com.jeesite.common.beetl.ext.format.DateFormat
|
||||
|
||||
##内置的默认格式化函数
|
||||
#FTC.java.util.Date = com.jeesite.common.beetl.ext.format.DateFormat
|
||||
|
||||
## 标签类
|
||||
#TAG.include= org.beetl.ext.tag.IncludeTag
|
||||
|
||||
@@ -38,4 +38,5 @@
|
||||
5.12.0
|
||||
5.12.1
|
||||
5.13.0
|
||||
5.13.1
|
||||
5.13.1
|
||||
5.14.0
|
||||
@@ -240,11 +240,13 @@ $('#inputForm').validate({
|
||||
$('#wordCount').val(contentUE.getContentTxt().length);
|
||||
js.ajaxSubmitForm($(form), function(data){
|
||||
js.showMessage(data.message);
|
||||
//# if(parameter['category.showModes'] != '3'){
|
||||
if(data.result == Global.TRUE){
|
||||
js.closeCurrentTabPage(function(contentWindow){
|
||||
contentWindow.page();
|
||||
});
|
||||
}
|
||||
//# }
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('站点域名')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="domain" maxlength="500" class="form-control" placeholder="www.jeesite.com"/>
|
||||
<#form:input path="domain" maxlength="500" class="form-control" placeholder="https://jeesite.com"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--suppress VulnerableLibrariesLocal -->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.13.1-SNAPSHOT</version>
|
||||
<version>5.14.0-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
package com.jeesite.autoconfigure.sys;
|
||||
|
||||
import com.jeesite.common.mybatis.MyBatisFactoryBean;
|
||||
import com.jeesite.modules.msg.dao.MsgInnerRecordDao;
|
||||
import com.jeesite.modules.msg.service.MsgInnerService;
|
||||
import com.jeesite.modules.msg.service.support.MsgInnerServiceSupport;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -25,8 +27,8 @@ public class MsgAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public MsgInnerService msgInnerService(){
|
||||
return new MsgInnerServiceSupport();
|
||||
public MsgInnerService msgInnerService(EmpUserService empUserService, MsgInnerRecordDao msgInnerRecordDao){
|
||||
return new MsgInnerServiceSupport(empUserService, msgInnerRecordDao);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
package com.jeesite.autoconfigure.sys;
|
||||
|
||||
import com.jeesite.common.mybatis.MyBatisFactoryBean;
|
||||
import com.jeesite.modules.sys.dao.CompanyOfficeDao;
|
||||
import com.jeesite.modules.sys.dao.EmployeeOfficeDao;
|
||||
import com.jeesite.modules.sys.dao.EmployeePostDao;
|
||||
import com.jeesite.modules.sys.dao.PostRoleDao;
|
||||
import com.jeesite.modules.sys.service.*;
|
||||
import com.jeesite.modules.sys.service.support.*;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
@@ -31,20 +35,20 @@ public class SysAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CompanyService companyService(){
|
||||
return new CompanyServiceSupport();
|
||||
public CompanyService companyService(CompanyOfficeDao companyOfficeDao, DataScopeService dataScopeService, EmpUserService empUserService){
|
||||
return new CompanyServiceSupport(companyOfficeDao, dataScopeService, empUserService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public EmployeeService employeeService(){
|
||||
return new EmployeeServiceSupport();
|
||||
public EmployeeService employeeService(EmployeePostDao employeePostDao, EmployeeOfficeDao employeeOfficeDao){
|
||||
return new EmployeeServiceSupport(employeePostDao, employeeOfficeDao);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public EmpUserService empUserService(){
|
||||
return new EmpUserServiceSupport();
|
||||
public EmpUserService empUserService(UserService userService, EmployeeService employeeService, EmployeeOfficeDao employeeOfficeDao){
|
||||
return new EmpUserServiceSupport(userService, employeeService, employeeOfficeDao);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -55,14 +59,14 @@ public class SysAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public OfficeService officeService(){
|
||||
return new OfficeServiceSupport();
|
||||
public OfficeService officeService(DataScopeService dataScopeService, EmpUserService empUserService){
|
||||
return new OfficeServiceSupport(dataScopeService, empUserService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public PostService postService(){
|
||||
return new PostServiceSupport();
|
||||
public PostService postService(PostRoleDao postRoleDao, EmpUserService empUserService){
|
||||
return new PostServiceSupport(postRoleDao, empUserService);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* CAS过滤器
|
||||
@@ -29,6 +31,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CasFilter extends CasBaseFilter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CasFilter.class);
|
||||
private BaseAuthorizingRealm authorizingRealm;
|
||||
|
||||
public CasFilter() {
|
||||
@@ -40,7 +43,7 @@ public class CasFilter extends CasBaseFilter {
|
||||
*/
|
||||
@Override
|
||||
protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
|
||||
authorizingRealm.onLoginSuccess(UserUtils.getLoginInfo(), (HttpServletRequest)request);
|
||||
authorizingRealm.onLoginSuccess(UserUtils.getLoginInfo(subject), (HttpServletRequest)request);
|
||||
ServletUtils.redirectUrl((HttpServletRequest)request, (HttpServletResponse)response, getSuccessUrl());
|
||||
return false;
|
||||
}
|
||||
@@ -65,7 +68,7 @@ public class CasFilter extends CasBaseFilter {
|
||||
WebUtils.issueRedirect(request, response, getLoginUrl());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,11 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
||||
String host = getHost(request); // 登录主机
|
||||
String captcha = getCaptcha(request); // 登录验证码
|
||||
Map<String, Object> paramMap = ServletUtils.getExtParams(request); // 登录附加参数
|
||||
// // 登录设备合法性验证(根据业务需要自行添加)
|
||||
// String deviceType = (String)paramMap.getOrDefault("deviceType", "pc");
|
||||
// if (!StringUtils.inString(deviceType, "pc", "mobileApp", "wxMa", "wxMp")) {
|
||||
// throw new AuthenticationException("msg:"+Global.getText("登录设备类型错误"));
|
||||
// }
|
||||
return new FormToken(username, password.toCharArray(), rememberMe, host, captcha, paramMap);
|
||||
}
|
||||
|
||||
@@ -264,17 +269,17 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
||||
if (Global.getPropertyToBoolean("shiro.isGenerateNewSessionAfterLogin", "false")){
|
||||
String[] keys = new String[] { ValidCodeUtils.VALID_CODE };
|
||||
Map<String, Object> attrMap = MapUtils.newHashMap();
|
||||
final Session sessionOld = UserUtils.getSession();
|
||||
final Session oldSession = UserUtils.getSession();
|
||||
for (String key : keys) {
|
||||
Object value = sessionOld.getAttribute(key);
|
||||
Object value = oldSession.getAttribute(key);
|
||||
if (value != null) {
|
||||
attrMap.put(key, value);
|
||||
}
|
||||
}
|
||||
UserUtils.getSubject().logout();
|
||||
// 恢复生成新的Session之前的Session数据
|
||||
final Session sessionNew = UserUtils.getSession();
|
||||
attrMap.forEach(sessionNew::setAttribute);
|
||||
final Session newSession = UserUtils.getSession();
|
||||
attrMap.forEach(newSession::setAttribute);
|
||||
}
|
||||
return super.executeLogin(request, response);
|
||||
}
|
||||
@@ -286,19 +291,21 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
||||
try {
|
||||
return instance.onLoginSuccess(null, null, request, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录成功调用事件
|
||||
* @param token 通过 onLoginSuccess 静态方法调用时可能为空
|
||||
* @param subject 通过 onLoginSuccess 静态方法调用时可能为空
|
||||
*/
|
||||
@Override
|
||||
protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest servletRequest, ServletResponse response) throws Exception {
|
||||
HttpServletRequest request = (HttpServletRequest)servletRequest;
|
||||
// 登录成功后初始化授权信息并处理登录后的操作
|
||||
authorizingRealm.onLoginSuccess(UserUtils.getLoginInfo(), request);
|
||||
authorizingRealm.onLoginSuccess(UserUtils.getLoginInfo(subject), request);
|
||||
// 跳转到登录成功页面,若未指定则获取默认 shiro.successUrl in application.yml
|
||||
String successUrl = (String)request.getAttribute("__url");
|
||||
if (StringUtils.isBlank(successUrl)) {
|
||||
@@ -311,16 +318,18 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
||||
/**
|
||||
* 登录失败调用事件(静态方便其他位置调用)
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public static boolean onLoginFailure(AuthenticationException e, HttpServletRequest request, HttpServletResponse response) {
|
||||
return instance.onLoginFailure(null, e, request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录失败调用事件
|
||||
* @param token 通过 onLoginFailure 静态方法调用时可能为空
|
||||
*/
|
||||
@Override
|
||||
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {
|
||||
String message = StringUtils.EMPTY;
|
||||
String message;
|
||||
if (e.getMessage() != null && StringUtils.startsWith(e.getMessage(), "msg:")) {
|
||||
message = StringUtils.replace(e.getMessage(), "msg:", "");
|
||||
} else if (e instanceof IncorrectCredentialsException || e instanceof UnknownAccountException) {
|
||||
|
||||
@@ -9,15 +9,15 @@ import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.web.http.ServletUtils;
|
||||
import com.jeesite.common.web.http.wrapper.GetHttpServletRequestWrapper;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -34,10 +34,6 @@ public class PermissionsFilter extends org.apache.shiro.web.filter.authz.Permiss
|
||||
|
||||
/**
|
||||
* 无访问权限时,跳转到403页面
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public static boolean redirectTo403Page(ServletRequest request, ServletResponse response) throws IOException {
|
||||
|
||||
@@ -9,20 +9,14 @@ import com.jeesite.common.codec.SM3Utils;
|
||||
import com.jeesite.common.codec.ShaUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.shiro.authc.FormToken;
|
||||
import com.jeesite.common.utils.SpringUtils;
|
||||
import com.jeesite.modules.sys.entity.Log;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.sys.utils.LogUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 系统认证授权实现类
|
||||
@@ -34,8 +28,6 @@ public class AuthorizingRealm extends BaseAuthorizingRealm {
|
||||
public static final int HASH_ITERATIONS = 1024;
|
||||
public static final int SALT_SIZE = 8;
|
||||
|
||||
private UserService userService;
|
||||
|
||||
public AuthorizingRealm() {
|
||||
super();
|
||||
}
|
||||
@@ -71,8 +63,8 @@ public class AuthorizingRealm extends BaseAuthorizingRealm {
|
||||
* 获取用户授权信息,默认返回类型 SimpleAuthorizationInfo
|
||||
*/
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(LoginInfo loginInfo, Subject subject, Session session, User user) {
|
||||
return super.doGetAuthorizationInfo(loginInfo, subject, session, user);
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(LoginInfo loginInfo, User user) {
|
||||
return super.doGetAuthorizationInfo(loginInfo, user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,31 +107,21 @@ public class AuthorizingRealm extends BaseAuthorizingRealm {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
super.onLoginSuccess(loginInfo, request);
|
||||
|
||||
// 更新登录IP、时间、会话ID等
|
||||
User user = UserUtils.get(loginInfo.getId());
|
||||
getUserService().updateUserLoginInfo(user);
|
||||
|
||||
public User onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
User user = super.onLoginSuccess(loginInfo, request);
|
||||
|
||||
// 记录用户登录日志
|
||||
LogUtils.saveLog(user, request, "系统登录", Log.TYPE_LOGIN_LOGOUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
super.onLogoutSuccess(loginInfo, request);
|
||||
|
||||
// 记录用户退出日志
|
||||
User user = UserUtils.get(loginInfo.getId());
|
||||
LogUtils.saveLog(user, request, "系统退出", Log.TYPE_LOGIN_LOGOUT);
|
||||
return user;
|
||||
}
|
||||
|
||||
public UserService getUserService() {
|
||||
if (userService == null){
|
||||
userService = SpringUtils.getBean(UserService.class);
|
||||
}
|
||||
return userService;
|
||||
@Override
|
||||
public User onLogoutSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
User user = super.onLogoutSuccess(loginInfo, request);
|
||||
|
||||
// 记录用户退出日志
|
||||
LogUtils.saveLog(user, request, "系统退出", Log.TYPE_LOGIN_LOGOUT);
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,10 @@ import com.jeesite.modules.sys.entity.EmpUser;
|
||||
import com.jeesite.modules.sys.entity.Log;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.sys.utils.LogUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ValidationException;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
@@ -28,10 +29,7 @@ import org.jasig.cas.client.validation.Assertion;
|
||||
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidationException;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ValidationException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -41,14 +39,13 @@ import java.util.Map;
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CasAuthorizingRealm extends BaseAuthorizingRealm {
|
||||
|
||||
private UserService userService;
|
||||
private EmpUserService empUserService;
|
||||
|
||||
private CasOutHandler casOutHandler;
|
||||
private String casServerUrl; // CAS 服务器地址
|
||||
private String casServerCallbackUrl; // CAS 服务器回调地址
|
||||
private TicketValidator ticketValidator;// CAS 令牌验证类
|
||||
|
||||
private EmpUserService empUserService;
|
||||
|
||||
public CasAuthorizingRealm() {
|
||||
super();
|
||||
@@ -154,15 +151,13 @@ public class CasAuthorizingRealm extends BaseAuthorizingRealm {
|
||||
|
||||
// 其它类型,根据项目需要自行创建
|
||||
else{
|
||||
try{
|
||||
CasCreateUser casCreateUser = SpringUtils.getBean(CasCreateUser.class);
|
||||
if(casCreateUser != null){
|
||||
casCreateUser.createUser(user, attrs);
|
||||
}
|
||||
}catch(NoSuchBeanDefinitionException e){
|
||||
User finalUser = user;
|
||||
SpringUtils.getBeanIfAvailable(CasCreateUser.class, (casCreateUser) -> {
|
||||
casCreateUser.createUser(finalUser, attrs);
|
||||
}, (e -> {
|
||||
throw new AuthenticationException("msg:用户 “" + token.getUsername()
|
||||
+ "”, 类型 “" + user.getUserType() + "” 在本系统中不存在, 请联系管理员.");
|
||||
}
|
||||
+ "”, 类型 “" + finalUser.getUserType() + "” 在本系统中不存在, 请联系管理员.");
|
||||
}));
|
||||
}
|
||||
}else{
|
||||
throw new AuthenticationException("msg:用户 “" + token.getUsername() + "” 在本系统中不存在, 请联系管理员.");
|
||||
@@ -178,28 +173,27 @@ public class CasAuthorizingRealm extends BaseAuthorizingRealm {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
public User onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
User user = super.onLoginSuccess(loginInfo, request);
|
||||
|
||||
// 单点登录登出句柄(登录时注入session),在这之前必须获取下授权信息
|
||||
String ticket = loginInfo.getParam("ticket");
|
||||
casOutHandler.recordSession(request, ticket);
|
||||
//System.out.print("__sid: "+request.getSession().getId());
|
||||
//System.out.println(" == "+UserUtils.getSession().getId());
|
||||
|
||||
// 记录用户登录日志
|
||||
LogUtils.saveLog(user, request, "系统登录", Log.TYPE_LOGIN_LOGOUT);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
super.onLogoutSuccess(loginInfo, request);
|
||||
public User onLogoutSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
User user = super.onLogoutSuccess(loginInfo, request);
|
||||
|
||||
// 记录用户退出日志
|
||||
User user = UserUtils.get(loginInfo.getId());
|
||||
LogUtils.saveLog(user, request, "系统退出", Log.TYPE_LOGIN_LOGOUT);
|
||||
}
|
||||
|
||||
public UserService getUserService() {
|
||||
if (userService == null){
|
||||
userService = SpringUtils.getBean(UserService.class);
|
||||
}
|
||||
return userService;
|
||||
return user;
|
||||
}
|
||||
|
||||
public EmpUserService getEmpUserService() {
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
*/
|
||||
package com.jeesite.common.shiro.realm;
|
||||
|
||||
import javax.naming.AuthenticationNotSupportedException;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.ldap.LdapContext;
|
||||
import com.jeesite.common.shiro.authc.FormToken;
|
||||
import com.jeesite.common.shiro.authc.LdapToken;
|
||||
import com.jeesite.common.web.http.ServletUtils;
|
||||
import com.jeesite.modules.sys.entity.Log;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.LogUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
@@ -19,22 +21,13 @@ import org.apache.shiro.realm.ldap.DefaultLdapRealm;
|
||||
import org.apache.shiro.realm.ldap.JndiLdapContextFactory;
|
||||
import org.apache.shiro.realm.ldap.LdapContextFactory;
|
||||
import org.apache.shiro.realm.ldap.LdapUtils;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.jeesite.common.shiro.authc.FormToken;
|
||||
import com.jeesite.common.shiro.authc.LdapToken;
|
||||
import com.jeesite.common.utils.SpringUtils;
|
||||
import com.jeesite.common.web.http.ServletUtils;
|
||||
import com.jeesite.modules.sys.entity.Log;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.sys.utils.LogUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import javax.naming.AuthenticationNotSupportedException;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.ldap.LdapContext;
|
||||
|
||||
/**
|
||||
* 系统认证授权实现类
|
||||
@@ -57,9 +50,6 @@ public class LdapAuthorizingRealm extends BaseAuthorizingRealm {
|
||||
*/
|
||||
private LdapContextFactory contextFactory;
|
||||
|
||||
private UserService userService;
|
||||
private EmpUserService empUserService;
|
||||
|
||||
/**
|
||||
* Default no-argument constructor that defaults the internal {@link LdapContextFactory} instance to a
|
||||
* {@link JndiLdapContextFactory}.
|
||||
@@ -124,46 +114,29 @@ public class LdapAuthorizingRealm extends BaseAuthorizingRealm {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(LoginInfo loginInfo, Subject subject, Session session, User user) {
|
||||
return super.doGetAuthorizationInfo(loginInfo, subject, session, user);
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(LoginInfo loginInfo, User user) {
|
||||
return super.doGetAuthorizationInfo(loginInfo, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
super.onLoginSuccess(loginInfo, request);
|
||||
public User onLoginSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
User user = super.onLoginSuccess(loginInfo, request);
|
||||
|
||||
//System.out.print("__sid: "+request.getSession().getId());
|
||||
//System.out.println(" == "+UserUtils.getSession().getId());
|
||||
|
||||
// 更新登录IP、时间、会话ID等
|
||||
User user = UserUtils.get(loginInfo.getId());
|
||||
getUserService().updateUserLoginInfo(user);
|
||||
|
||||
|
||||
// 记录用户登录日志
|
||||
LogUtils.saveLog(user, ServletUtils.getRequest(), "系统登录", Log.TYPE_LOGIN_LOGOUT);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
super.onLogoutSuccess(loginInfo, request);
|
||||
public User onLogoutSuccess(LoginInfo loginInfo, HttpServletRequest request) {
|
||||
User user = super.onLogoutSuccess(loginInfo, request);
|
||||
|
||||
// 记录用户退出日志
|
||||
User user = UserUtils.get(loginInfo.getId());
|
||||
LogUtils.saveLog(user, request, "系统退出", Log.TYPE_LOGIN_LOGOUT);
|
||||
}
|
||||
|
||||
public UserService getUserService() {
|
||||
if (userService == null){
|
||||
userService = SpringUtils.getBean(UserService.class);
|
||||
}
|
||||
return userService;
|
||||
}
|
||||
|
||||
public EmpUserService getEmpUserService() {
|
||||
if (empUserService == null){
|
||||
empUserService = SpringUtils.getBean(EmpUserService.class);
|
||||
}
|
||||
return empUserService;
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package com.jeesite.common.ueditor;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeesite.common.io.IOUtils;
|
||||
import com.jeesite.common.io.ResourceUtils;
|
||||
import com.jeesite.common.lang.ExceptionUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.ueditor.define.ActionMap;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 配置管理器
|
||||
@@ -18,6 +24,7 @@ import com.jeesite.common.ueditor.define.ActionMap;
|
||||
public final class ConfigManager {
|
||||
|
||||
private final String rootPath;
|
||||
private static final String defaultConfigFileName = "config/ueditor-core.json";
|
||||
private static final String configFileName = "config/ueditor.json";
|
||||
private JSONObject jsonConfig = null;
|
||||
// 涂鸦上传filename定义
|
||||
@@ -120,11 +127,27 @@ public final class ConfigManager {
|
||||
}
|
||||
|
||||
private void initEnv() {
|
||||
String configContent = ResourceUtils.getResourceFileContent(
|
||||
ConfigManager.configFileName).replaceAll("/\\*[\\s\\S]*?\\*/", "");
|
||||
String configContent = StringUtils.EMPTY;
|
||||
Resource resource = ResourceUtils.getResource(ConfigManager.configFileName);
|
||||
if (resource.exists()) {
|
||||
try(InputStream is = resource.getInputStream()){
|
||||
configContent = IOUtils.toString(is, StandardCharsets.UTF_8);
|
||||
}catch (IOException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
} else {
|
||||
resource = ResourceUtils.getResource(ConfigManager.defaultConfigFileName);
|
||||
if (resource.exists()) {
|
||||
try(InputStream is = resource.getInputStream()){
|
||||
configContent = IOUtils.toString(is, StandardCharsets.UTF_8);
|
||||
}catch (IOException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
JSONObject jsonConfig = JSONObject.parseObject(configContent);
|
||||
this.jsonConfig = jsonConfig;
|
||||
configContent = configContent.replaceAll("/\\*[\\s\\S]*?\\*/", "");
|
||||
this.jsonConfig = JSONObject.parseObject(configContent);
|
||||
} catch (Exception e) {
|
||||
this.jsonConfig = null;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ public class FileType {
|
||||
|
||||
/**
|
||||
* 根据给定的文件名,获取其后缀信息
|
||||
* @param filename
|
||||
* @return
|
||||
*/
|
||||
public static String getSuffixByFilename(String filename) {
|
||||
return filename.substring(filename.lastIndexOf(".")).toLowerCase();
|
||||
|
||||
@@ -18,37 +18,35 @@ public interface BizCategoryService extends TreeServiceApi<BizCategory> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bpmCategory
|
||||
* @return
|
||||
* @param bpmCategory 主键
|
||||
*/
|
||||
@Override
|
||||
BizCategory get(BizCategory bpmCategory);
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bpmCategory
|
||||
* @return
|
||||
* @param bpmCategory 查询条件
|
||||
*/
|
||||
@Override
|
||||
List<BizCategory> findList(BizCategory bpmCategory);
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bpmCategory
|
||||
* @param bpmCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
void save(BizCategory bpmCategory);
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bpmCategory
|
||||
* @param bpmCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
void updateStatus(BizCategory bpmCategory);
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bpmCategory
|
||||
* @param bpmCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
void delete(BizCategory bpmCategory);
|
||||
|
||||
@@ -22,8 +22,7 @@ public class BizCategoryServiceSupport extends TreeService<BizCategoryDao, BizCa
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizCategory
|
||||
* @return
|
||||
* @param bizCategory 主键编码
|
||||
*/
|
||||
@Override
|
||||
public BizCategory get(BizCategory bizCategory) {
|
||||
@@ -32,8 +31,7 @@ public class BizCategoryServiceSupport extends TreeService<BizCategoryDao, BizCa
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizCategory
|
||||
* @return
|
||||
* @param bizCategory 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizCategory> findList(BizCategory bizCategory) {
|
||||
@@ -42,7 +40,7 @@ public class BizCategoryServiceSupport extends TreeService<BizCategoryDao, BizCa
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizCategory
|
||||
* @param bizCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -56,7 +54,7 @@ public class BizCategoryServiceSupport extends TreeService<BizCategoryDao, BizCa
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizCategory
|
||||
* @param bizCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -66,7 +64,7 @@ public class BizCategoryServiceSupport extends TreeService<BizCategoryDao, BizCa
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizCategory
|
||||
* @param bizCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.jeesite.modules.biz.entity.BizCategory;
|
||||
import com.jeesite.modules.biz.service.BizCategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -37,9 +36,12 @@ import java.util.Map;
|
||||
@RequestMapping(value = "${adminPath}/biz/bizCategory")
|
||||
public class BizCategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BizCategoryService bizCategoryService;
|
||||
|
||||
private final BizCategoryService bizCategoryService;
|
||||
|
||||
public BizCategoryController(BizCategoryService bizCategoryService) {
|
||||
this.bizCategoryService = bizCategoryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@@ -191,7 +193,6 @@ public class BizCategoryController extends BaseController {
|
||||
* @param excludeCode 排除的Code
|
||||
* @param parentCode 设置父级编码返回一级
|
||||
* @param isShowCode 是否显示编码(true or 1:显示在左侧;2:显示在右侧;false or null:不显示)
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("biz:bizCategory:view")
|
||||
@RequestMapping(value = "treeData")
|
||||
|
||||
@@ -4,16 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.modules.config.interceptor;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.modules.sys.interceptor.LogInterceptor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 后台管理日志记录拦截器
|
||||
@@ -21,8 +19,7 @@ import com.jeesite.modules.sys.interceptor.LogInterceptor;
|
||||
* @version 2018年1月10日
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(name="web.interceptor.log.enabled", havingValue="true", matchIfMissing=true)
|
||||
@EnableWebMvc
|
||||
@ConditionalOnProperty(name="web.interceptor.log.enabled", havingValue="true", matchIfMissing=false)
|
||||
public class LogInterceptorConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.jeesite.modules.sys.interceptor.MobileInterceptor;
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(name="web.interceptor.mobile.enabled", havingValue="true", matchIfMissing=false)
|
||||
@EnableWebMvc
|
||||
public class MobileViewInterceptorConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.file.entity.FileUpload;
|
||||
import com.jeesite.modules.file.entity.FileUploadParams;
|
||||
import com.jeesite.modules.file.service.FileUploadService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -33,9 +32,12 @@ import java.util.Map;
|
||||
@ConditionalOnProperty(name={"file.enabled","web.core.enabled"}, havingValue="true", matchIfMissing=true)
|
||||
public class FileUploadController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
private final FileUploadService fileUploadService;
|
||||
|
||||
public FileUploadController(FileUploadService fileUploadService) {
|
||||
this.fileUploadService = fileUploadService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件参数
|
||||
*/
|
||||
@@ -43,14 +45,19 @@ public class FileUploadController extends BaseController {
|
||||
@ResponseBody
|
||||
public Map<String, Object> params() {
|
||||
Map<String, Object> model = MapUtils.newHashMap();
|
||||
model.put("maxFileSize", Global.getConfigToLong("file.maxFileSize", "500*1024*1024"));
|
||||
|
||||
model.put("imageAllowSuffixes", Global.getConfig("file.imageAllowSuffixes", FileUploadParams.DEFAULT_IMAGE_ALLOW_SUFFIXES));
|
||||
model.put("mediaAllowSuffixes", Global.getConfig("file.mediaAllowSuffixes", FileUploadParams.DEFAULT_MEDIA_ALLOW_SUFFIXES));
|
||||
model.put("fileAllowSuffixes", Global.getConfig("file.fileAllowSuffixes", FileUploadParams.DEFAULT_FILE_ALLOW_SUFFIXES));
|
||||
model.put("chunked", Global.getConfig("file.chunked", "true"));
|
||||
model.put("chunkSize", Global.getConfigToInteger("file.chunkSize", "10*1024*1024"));
|
||||
model.put("threads", Global.getConfigToInteger("file.threads", "3"));
|
||||
|
||||
model.put("imageMaxWidth", Global.getConfigToInteger("file.imageMaxWidth", "1024"));
|
||||
model.put("imageMaxHeight", Global.getConfigToInteger("file.imageMaxHeight", "768"));
|
||||
|
||||
model.put("checkmd5", Global.getConfigToBoolean("file.checkmd5", "true"));
|
||||
model.put("chunked", Global.getConfigToBoolean("file.chunked", "true"));
|
||||
model.put("chunkSize", Global.getConfigToInteger("file.chunkSize", "10*1024*1024"));
|
||||
model.put("threads", Global.getConfigToInteger("file.threads", "3"));
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.IOException;
|
||||
* @version 2022-09-27
|
||||
*/
|
||||
@Controller
|
||||
@ConditionalOnProperty(name="file.isFileStreamDown", havingValue="true", matchIfMissing=true)
|
||||
@ConditionalOnProperty(name={"file.enabled","file.isFileStreamDown"}, havingValue="true", matchIfMissing=true)
|
||||
@ApiIgnore
|
||||
public class UserfilesController extends BaseController {
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ public interface MsgInnerService extends CrudServiceApi<MsgInner> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param msgInner
|
||||
* @return
|
||||
* @param msgInner 主键
|
||||
*/
|
||||
@Override
|
||||
MsgInner get(MsgInner msgInner);
|
||||
@@ -30,7 +29,6 @@ public interface MsgInnerService extends CrudServiceApi<MsgInner> {
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param msgInner 查询条件; page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
Page<MsgInner> findPage(MsgInner msgInner);
|
||||
@@ -42,7 +40,7 @@ public interface MsgInnerService extends CrudServiceApi<MsgInner> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param msgInner
|
||||
* @param msgInner 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -56,7 +54,7 @@ public interface MsgInnerService extends CrudServiceApi<MsgInner> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param msgInner
|
||||
* @param msgInner 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -64,7 +62,7 @@ public interface MsgInnerService extends CrudServiceApi<MsgInner> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param msgInner
|
||||
* @param msgInner 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jeesite.modules.sys.entity.EmpUser;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,20 +39,22 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class MsgInnerServiceSupport extends CrudService<MsgInnerDao, MsgInner>
|
||||
implements MsgInnerService {
|
||||
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
@Autowired
|
||||
private MsgInnerRecordDao msgInnerRecordDao;
|
||||
|
||||
private static ExecutorService msgPushThreadPool = new ThreadPoolExecutor(5, 20,
|
||||
protected static final ExecutorService msgPushThreadPool = new ThreadPoolExecutor(5, 20,
|
||||
60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
|
||||
new DefaultThreadFactory("cms-update-expired-weight"));
|
||||
|
||||
|
||||
protected final EmpUserService empUserService;
|
||||
protected final MsgInnerRecordDao msgInnerRecordDao;
|
||||
|
||||
public MsgInnerServiceSupport(EmpUserService empUserService, MsgInnerRecordDao msgInnerRecordDao) {
|
||||
this.empUserService = empUserService;
|
||||
this.msgInnerRecordDao = msgInnerRecordDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param msgInner
|
||||
* @return
|
||||
* @param msgInner 主键
|
||||
*/
|
||||
@Override
|
||||
public MsgInner get(MsgInner msgInner) {
|
||||
@@ -63,7 +64,6 @@ public class MsgInnerServiceSupport extends CrudService<MsgInnerDao, MsgInner>
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param msgInner 查询条件; page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<MsgInner> findPage(MsgInner msgInner) {
|
||||
@@ -82,7 +82,7 @@ public class MsgInnerServiceSupport extends CrudService<MsgInnerDao, MsgInner>
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param msgInner
|
||||
* @param msgInner 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -225,7 +225,7 @@ public class MsgInnerServiceSupport extends CrudService<MsgInnerDao, MsgInner>
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param msgInner
|
||||
* @param msgInner 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -235,7 +235,7 @@ public class MsgInnerServiceSupport extends CrudService<MsgInnerDao, MsgInner>
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param msgInner
|
||||
* @param msgInner 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -12,8 +12,9 @@ import com.jeesite.modules.msg.entity.MsgInner;
|
||||
import com.jeesite.modules.msg.entity.MsgInnerRecord;
|
||||
import com.jeesite.modules.msg.entity.MsgPush;
|
||||
import com.jeesite.modules.msg.service.MsgInnerService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -23,9 +24,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 内部消息Controller
|
||||
* @author ThinkGem
|
||||
@@ -36,9 +34,12 @@ import javax.servlet.http.HttpServletResponse;
|
||||
@ConditionalOnProperty(name={"user.enabled","web.core.enabled"}, havingValue="true", matchIfMissing=true)
|
||||
public class MsgInnerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MsgInnerService msgInnerService;
|
||||
|
||||
private final MsgInnerService msgInnerService;
|
||||
|
||||
public MsgInnerController(MsgInnerService msgInnerService) {
|
||||
this.msgInnerService = msgInnerService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
|
||||
@@ -15,11 +15,11 @@ import com.jeesite.modules.job.entity.JobEntity;
|
||||
import com.jeesite.modules.msg.task.impl.MsgLocalMergePushTask;
|
||||
import com.jeesite.modules.msg.task.impl.MsgLocalPushTask;
|
||||
import com.jeesite.modules.sys.dao.RoleMenuDao;
|
||||
import com.jeesite.modules.sys.entity.Module;
|
||||
import com.jeesite.modules.sys.entity.*;
|
||||
import com.jeesite.modules.sys.entity.Module;
|
||||
import com.jeesite.modules.sys.service.*;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -31,7 +31,28 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitCoreData extends BaseInitDataTests {
|
||||
|
||||
|
||||
public InitCoreData(ConfigService configService, ModuleService moduleService, DictTypeService dictTypeService,
|
||||
DictDataService dictDataService, RoleService roleService, MenuService menuService,
|
||||
RoleMenuDao roleMenuDao, UserService userService, OfficeService officeService,
|
||||
CompanyService companyService, PostService postService, EmpUserService empUserService,
|
||||
ObjectProvider<JobDao> jobDao, BizCategoryService bizCategoryService) {
|
||||
this.configService = configService;
|
||||
this.moduleService = moduleService;
|
||||
this.dictTypeService = dictTypeService;
|
||||
this.dictDataService = dictDataService;
|
||||
this.roleService = roleService;
|
||||
this.menuService = menuService;
|
||||
this.roleMenuDao = roleMenuDao;
|
||||
this.userService = userService;
|
||||
this.officeService = officeService;
|
||||
this.companyService = companyService;
|
||||
this.postService = postService;
|
||||
this.empUserService = empUserService;
|
||||
this.jobDao = jobDao.getIfAvailable();
|
||||
this.bizCategoryService = bizCategoryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists(Global.getTablePrefix() + "sys_module")) {
|
||||
@@ -56,8 +77,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
// @Autowired
|
||||
// private AreaService areaService;
|
||||
// private final AreaService areaService;
|
||||
/**
|
||||
* 区域、行政区划表
|
||||
*/
|
||||
@@ -85,8 +105,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
// });
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
private final ConfigService configService;
|
||||
/**
|
||||
* 参数配置表
|
||||
*/
|
||||
@@ -105,8 +124,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
private final ModuleService moduleService;
|
||||
/**
|
||||
* 系统模块表
|
||||
*/
|
||||
@@ -124,10 +142,8 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private DictTypeService dictTypeService;
|
||||
@Autowired
|
||||
private DictDataService dictDataService;
|
||||
private final DictTypeService dictTypeService;
|
||||
private final DictDataService dictDataService;
|
||||
/**
|
||||
* 系统字典、用户字典表
|
||||
*/
|
||||
@@ -158,8 +174,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
private final RoleService roleService;
|
||||
/**
|
||||
* 角色表
|
||||
*/
|
||||
@@ -179,10 +194,8 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private RoleMenuDao roleMenuDao;
|
||||
private final MenuService menuService;
|
||||
private final RoleMenuDao roleMenuDao;
|
||||
/**
|
||||
* 菜单表
|
||||
*/
|
||||
@@ -205,8 +218,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private final UserService userService;
|
||||
/**
|
||||
* 用户表
|
||||
*/
|
||||
@@ -226,8 +238,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private OfficeService officeService;
|
||||
private final OfficeService officeService;
|
||||
/**
|
||||
* 组织机构、部门表
|
||||
*/
|
||||
@@ -245,8 +256,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
private final CompanyService companyService;
|
||||
/**
|
||||
* 公司表
|
||||
*/
|
||||
@@ -265,8 +275,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PostService postService;
|
||||
private final PostService postService;
|
||||
/**
|
||||
* 岗位表
|
||||
*/
|
||||
@@ -284,8 +293,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
private final EmpUserService empUserService;
|
||||
/**
|
||||
* 员工、用户表
|
||||
*/
|
||||
@@ -322,8 +330,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
private JobDao jobDao; // 默认情况下job是关闭状态,需要注入jobDao
|
||||
private final JobDao jobDao; // 默认情况下job是关闭状态,需要注入jobDao
|
||||
/**
|
||||
* 初始化消息推送服务
|
||||
*/
|
||||
@@ -363,8 +370,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
jobDao.insert(job);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private BizCategoryService bizCategoryService;
|
||||
private final BizCategoryService bizCategoryService;
|
||||
public void initBizCategory() throws Exception{
|
||||
// clearTable(BizCategory.class);
|
||||
initExcelData(BizCategory.class, params -> {
|
||||
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user