Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
ddfb1ead
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ddfb1ead
编写于
7月 16, 2021
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
内容管理文档权限刷新修改
上级
c23bf19e
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
58 addition
and
11 deletion
+58
-11
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/ThisApplication.java
...main/java/com/x/cms/assemble/control/ThisApplication.java
+2
-2
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/CmsBatchOperationFactory.java
...ms/assemble/control/factory/CmsBatchOperationFactory.java
+13
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/DocumentFactory.java
...a/com/x/cms/assemble/control/factory/DocumentFactory.java
+19
-6
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationQueryService.java
...semble/control/service/CmsBatchOperationQueryService.java
+8
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationService.java
...ms/assemble/control/service/CmsBatchOperationService.java
+8
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentInfoService.java
...m/x/cms/assemble/control/service/DocumentInfoService.java
+5
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/timertask/Timertask_BatchOperationTask.java
...emble/control/timertask/Timertask_BatchOperationTask.java
+3
-3
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/ThisApplication.java
浏览文件 @
ddfb1ead
...
...
@@ -67,8 +67,8 @@ public class ThisApplication {
// 每天凌晨2点,计算所有的文档的权限信息
context
.
schedule
(
Timertask_RefreshAllDocumentReviews
.
class
,
"0 0 2 * * ?"
);
context
.
scheduleLocal
(
Timertask_CheckDocumentReviewStatus
.
class
,
1200
);
//集群下多台会一起运行,Timertask_BatchOperationTask运行即可
//
context.scheduleLocal(Timertask_CheckDocumentReviewStatus.class, 1200);
context
.
scheduleLocal
(
Timertask_InitOperationRunning
.
class
,
150
);
}
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/CmsBatchOperationFactory.java
浏览文件 @
ddfb1ead
package
com.x.cms.assemble.control.factory
;
import
java.util.Date
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
...
...
@@ -8,10 +9,12 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.cms.assemble.control.AbstractFactory
;
import
com.x.cms.assemble.control.Business
;
import
com.x.cms.core.entity.CmsBatchOperation
;
import
com.x.cms.core.entity.CmsBatchOperation_
;
import
com.x.processplatform.core.entity.content.Task_
;
/**
* 批处理操作信息记录,比如需要级联删除大量的分类,文档等等
...
...
@@ -41,6 +44,16 @@ public class CmsBatchOperationFactory extends AbstractFactory {
return
em
.
createQuery
(
cq
).
setMaxResults
(
maxCount
).
getResultList
();
}
public
List
<
CmsBatchOperation
>
list
(
Integer
maxCount
,
Integer
minutesAgo
)
throws
Exception
{
EntityManager
em
=
this
.
entityManagerContainer
().
get
(
CmsBatchOperation
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
CmsBatchOperation
>
cq
=
cb
.
createQuery
(
CmsBatchOperation
.
class
);
Root
<
CmsBatchOperation
>
root
=
cq
.
from
(
CmsBatchOperation
.
class
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
CmsBatchOperation_
.
createTime
),
DateTools
.
getAdjustTimeDay
(
new
Date
(),
0
,
0
,
-
minutesAgo
,
0
));
cq
.
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
CmsBatchOperation_
.
createTime
)
)
);
return
em
.
createQuery
(
cq
).
setMaxResults
(
maxCount
).
getResultList
();
}
public
List
<
CmsBatchOperation
>
listNotRun
(
Integer
maxCount
)
throws
Exception
{
EntityManager
em
=
this
.
entityManagerContainer
().
get
(
CmsBatchOperation
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/DocumentFactory.java
浏览文件 @
ddfb1ead
...
...
@@ -4,14 +4,12 @@ import com.x.base.core.entity.JpaObject;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionWhen
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.cms.assemble.control.AbstractFactory
;
import
com.x.cms.assemble.control.Business
;
import
com.x.cms.assemble.control.jaxrs.document.ActionQueryListWithFilterPagingAdmin
;
import
com.x.cms.core.entity.Document
;
import
com.x.cms.core.entity.Document_
;
import
com.x.cms.core.entity.Review
;
import
com.x.cms.core.entity.Review_
;
import
com.x.cms.core.entity.*
;
import
com.x.cms.core.express.tools.CriteriaBuilderTools
;
import
com.x.cms.core.express.tools.filter.QueryFilter
;
import
org.apache.commons.beanutils.PropertyUtils
;
...
...
@@ -22,6 +20,7 @@ import javax.persistence.EntityManager;
import
javax.persistence.Tuple
;
import
javax.persistence.criteria.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 文档信息基础功能服务类
...
...
@@ -394,8 +393,6 @@ public class DocumentFactory extends AbstractFactory {
return
em
.
createQuery
(
cq
.
where
(
p
)).
setMaxResults
(
maxCount
).
getResultList
();
}
public
List
<
String
>
listUnReviewIds
(
Integer
maxCount
)
throws
Exception
{
if
(
maxCount
==
null
){
maxCount
=
500
;
...
...
@@ -410,6 +407,22 @@ public class DocumentFactory extends AbstractFactory {
return
em
.
createQuery
(
cq
.
where
(
p
)).
setMaxResults
(
maxCount
).
getResultList
();
}
public
List
<
String
>
listUnReviewIds
(
Integer
maxCount
,
Integer
minutesAgo
)
throws
Exception
{
if
(
maxCount
==
null
){
maxCount
=
500
;
}
EntityManager
em
=
this
.
entityManagerContainer
().
get
(
Document
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Document
>
root
=
cq
.
from
(
Document
.
class
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
Document_
.
createTime
),
DateTools
.
getAdjustTimeDay
(
new
Date
(),
0
,
0
,
-
minutesAgo
,
0
));
p
=
cb
.
and
(
p
,
cb
.
or
(
cb
.
isFalse
(
root
.
get
(
Document_
.
reviewed
)),
cb
.
isNull
(
root
.
get
(
Document_
.
reviewed
))));
cq
.
select
(
root
.
get
(
Document_
.
id
));
cq
.
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
CmsBatchOperation_
.
createTime
)
)
);
return
em
.
createQuery
(
cq
).
setMaxResults
(
maxCount
).
getResultList
();
}
public
Long
countWithConditionOutofPermission
(
QueryFilter
queryFilter
)
throws
Exception
{
EntityManager
em
=
this
.
entityManagerContainer
().
get
(
Document
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationQueryService.java
浏览文件 @
ddfb1ead
...
...
@@ -30,6 +30,14 @@ public class CmsBatchOperationQueryService {
}
}
public
List
<
CmsBatchOperation
>
list
(
Integer
maxCount
,
Integer
minutesAgo
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
()
)
{
return
cmsBatchOperationService
.
list
(
emc
,
maxCount
,
minutesAgo
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
List
<
CmsBatchOperation
>
listNotRun
(
Integer
maxCount
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
()
)
{
return
cmsBatchOperationService
.
listNotRun
(
emc
,
maxCount
);
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationService.java
浏览文件 @
ddfb1ead
...
...
@@ -25,6 +25,14 @@ public class CmsBatchOperationService {
return
business
.
cmsBatchOperationFactory
().
list
(
maxCount
);
}
public
List
<
CmsBatchOperation
>
list
(
EntityManagerContainer
emc
,
Integer
maxCount
,
Integer
minutesAgo
)
throws
Exception
{
if
(
maxCount
==
null
){
maxCount
=
10
;
}
Business
business
=
new
Business
(
emc
);
return
business
.
cmsBatchOperationFactory
().
list
(
maxCount
,
minutesAgo
);
}
public
List
<
CmsBatchOperation
>
listNotRun
(
EntityManagerContainer
emc
,
Integer
maxCount
)
throws
Exception
{
if
(
maxCount
==
null
){
maxCount
=
10
;
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentInfoService.java
浏览文件 @
ddfb1ead
...
...
@@ -319,6 +319,11 @@ public class DocumentInfoService {
return
business
.
getDocumentFactory
().
listUnReviewIds
(
maxCount
);
}
public
List
<
String
>
listUnReviewIds
(
EntityManagerContainer
emc
,
Integer
maxCount
,
Integer
minutesAgo
)
throws
Exception
{
Business
business
=
new
Business
(
emc
);
return
business
.
getDocumentFactory
().
listUnReviewIds
(
maxCount
,
minutesAgo
);
}
/**
* 删除指定ID的文档
* @param emc
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/timertask/Timertask_BatchOperationTask.java
浏览文件 @
ddfb1ead
...
...
@@ -31,8 +31,8 @@ public class Timertask_BatchOperationTask extends AbstractJob {
if
(
ThisApplication
.
queueBatchOperation
.
isEmpty
())
{
List
<
CmsBatchOperation
>
operations
=
null
;
try
{
logger
.
debug
(
"Timertask_BatchOperationTask -> query
2
000 cms batch operation in database......"
);
operations
=
cmsBatchOperationQueryService
.
list
(
2000
);
logger
.
debug
(
"Timertask_BatchOperationTask -> query
1
000 cms batch operation in database......"
);
operations
=
cmsBatchOperationQueryService
.
list
(
1000
,
8
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"Timertask_BatchOperationTask -> list operations got an exception."
);
logger
.
error
(
e
);
...
...
@@ -55,7 +55,7 @@ public class Timertask_BatchOperationTask extends AbstractJob {
// 如果队列里已经没有任务了,那么检查一下是否还有未revieiw的文档,添加到队列
DocumentInfoService
documentInfoService
=
new
DocumentInfoService
();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
List
<
String
>
ids
=
documentInfoService
.
listUnReviewIds
(
emc
,
5000
);
List
<
String
>
ids
=
documentInfoService
.
listUnReviewIds
(
emc
,
1000
,
5
);
if
(
ListTools
.
isNotEmpty
(
ids
))
{
CmsBatchOperationPersistService
cmsBatchOperationPersistService
=
new
CmsBatchOperationPersistService
();
for
(
String
docId
:
ids
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录