Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
193e9680
o2oa
项目概览
weixin_42566577
/
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,发现更多精彩内容 >>
提交
193e9680
编写于
8月 07, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup 统一处理日志清除
上级
90e3f2ed
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
302 addition
and
445 deletion
+302
-445
o2server/configSample/messages.json
o2server/configSample/messages.json
+11
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java
...ava/com/x/base/core/container/EntityManagerContainer.java
+116
-104
o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java
...e/src/main/java/com/x/server/console/ResourceFactory.java
+11
-11
o2server/x_program_center/src/main/java/com/x/program/center/LogMessage.java
...center/src/main/java/com/x/program/center/LogMessage.java
+0
-35
o2server/x_program_center/src/main/java/com/x/program/center/LogQueue.java
...m_center/src/main/java/com/x/program/center/LogQueue.java
+47
-19
o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java
...r/src/main/java/com/x/program/center/ThisApplication.java
+19
-7
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/schedule/ActionReport.java
...ava/com/x/program/center/jaxrs/schedule/ActionReport.java
+19
-18
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/ActionTest1.java
...ain/java/com/x/program/center/jaxrs/test/ActionTest1.java
+0
-37
o2server/x_program_center/src/main/java/com/x/program/center/schedule/Cleanup.java
.../src/main/java/com/x/program/center/schedule/Cleanup.java
+45
-0
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupPromptErrorLog.java
.../com/x/program/center/schedule/CleanupPromptErrorLog.java
+3
-38
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupScheduleLog.java
...ava/com/x/program/center/schedule/CleanupScheduleLog.java
+0
-70
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupUnexpectedErrorLog.java
.../x/program/center/schedule/CleanupUnexpectedErrorLog.java
+3
-36
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupWarnLog.java
...in/java/com/x/program/center/schedule/CleanupWarnLog.java
+3
-37
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CollectMarket.java
...ain/java/com/x/program/center/schedule/CollectMarket.java
+10
-18
o2server/x_program_center_core_entity/src/main/java/com/x/program/center/core/entity/PersistenceProperties.java
...m/x/program/center/core/entity/PersistenceProperties.java
+15
-15
未找到文件。
o2server/configSample/messages.json
浏览文件 @
193e9680
...
...
@@ -12,6 +12,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -22,6 +23,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -32,6 +34,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -42,6 +45,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -52,6 +56,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -76,6 +81,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -92,6 +98,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -102,6 +109,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -134,6 +142,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -156,6 +165,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
@@ -170,6 +180,7 @@
"pms"
:
""
,
"zhengwuDingding"
:
""
,
"qiyeweixin"
:
""
,
"welink"
:
""
,
"ws"
:
""
,
"dingding"
:
""
}
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java
浏览文件 @
193e9680
...
...
@@ -83,70 +83,70 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
// Object object = jpa.get(field.getName());
Object
object
=
FieldUtils
.
readField
(
field
,
jpa
,
true
);
switch
(
fieldType
)
{
case
stringValue:
this
.
persistChecker
.
stringValue
.
check
(
field
,
null
==
object
?
null
:
Objects
.
toString
(
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
stringValueList:
this
.
persistChecker
.
stringValueList
.
check
(
field
,
null
==
object
?
null
:
(
List
<
String
>)
object
,
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
dateValue:
this
.
persistChecker
.
dateValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Date
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
dateValueList:
this
.
persistChecker
.
dateValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Date
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
booleanValue:
this
.
persistChecker
.
booleanValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Boolean
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
booleanValueList:
this
.
persistChecker
.
booleanValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Boolean
>)
object
)
,
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
integerValue:
this
.
persistChecker
.
integerValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Integer
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
integerValueList:
this
.
persistChecker
.
integerValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Integer
>)
object
)
,
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
doubleValue:
this
.
persistChecker
.
doubleValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Double
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
doubleValueList:
this
.
persistChecker
.
doubleValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Double
>)
object
)
,
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
longValue:
this
.
persistChecker
.
longValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Long
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
longValueList:
this
.
persistChecker
.
longValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Long
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
floatValue:
this
.
persistChecker
.
floatValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Float
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
floatValueList:
this
.
persistChecker
.
floatValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Float
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
byteValueArray:
this
.
persistChecker
.
byteValueArray
.
check
(
field
,
(
null
==
object
?
null
:
(
byte
[])
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
enumValue:
break
;
default
:
break
;
case
stringValue:
this
.
persistChecker
.
stringValue
.
check
(
field
,
null
==
object
?
null
:
Objects
.
toString
(
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
stringValueList:
this
.
persistChecker
.
stringValueList
.
check
(
field
,
null
==
object
?
null
:
(
List
<
String
>)
object
,
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
dateValue:
this
.
persistChecker
.
dateValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Date
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
dateValueList:
this
.
persistChecker
.
dateValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Date
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
booleanValue:
this
.
persistChecker
.
booleanValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Boolean
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
booleanValueList:
this
.
persistChecker
.
booleanValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Boolean
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
integerValue:
this
.
persistChecker
.
integerValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Integer
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
integerValueList:
this
.
persistChecker
.
integerValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Integer
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
doubleValue:
this
.
persistChecker
.
doubleValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Double
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
doubleValueList:
this
.
persistChecker
.
doubleValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Double
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
longValue:
this
.
persistChecker
.
longValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Long
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
longValueList:
this
.
persistChecker
.
longValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Long
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
floatValue:
this
.
persistChecker
.
floatValue
.
check
(
field
,
(
null
==
object
?
null
:
(
Float
)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
floatValueList:
this
.
persistChecker
.
floatValueList
.
check
(
field
,
(
null
==
object
?
null
:
(
List
<
Float
>)
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
byteValueArray:
this
.
persistChecker
.
byteValueArray
.
check
(
field
,
(
null
==
object
?
null
:
(
byte
[])
object
),
jpa
,
checkPersist
,
checkPersistType
);
break
;
case
enumValue:
break
;
default
:
break
;
}
}
}
...
...
@@ -161,16 +161,16 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
// Object object = jpa.get(field.getName());
Object
object
=
FieldUtils
.
readField
(
field
,
jpa
,
true
);
switch
(
fieldType
)
{
case
stringValue:
this
.
removeChecker
.
stringValue
.
check
(
field
,
null
==
object
?
null
:
Objects
.
toString
(
object
),
jpa
,
checkRemove
,
checkRemoveType
);
break
;
case
stringValueList:
this
.
removeChecker
.
stringValueList
.
check
(
field
,
null
==
object
?
null
:
(
List
<
String
>)
object
,
jpa
,
checkRemove
,
checkRemoveType
);
break
;
default
:
break
;
case
stringValue:
this
.
removeChecker
.
stringValue
.
check
(
field
,
null
==
object
?
null
:
Objects
.
toString
(
object
),
jpa
,
checkRemove
,
checkRemoveType
);
break
;
case
stringValueList:
this
.
removeChecker
.
stringValueList
.
check
(
field
,
null
==
object
?
null
:
(
List
<
String
>)
object
,
jpa
,
checkRemove
,
checkRemoveType
);
break
;
default
:
break
;
}
}
}
...
...
@@ -208,19 +208,18 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
t
=
em
.
find
(
cls
,
id
);
}
switch
(
exceptionWhen
)
{
case
not_found:
if
(
null
==
t
)
{
throw
new
Exception
(
"can not find entity id: "
+
id
+
", class: "
+
cls
.
getCanonicalName
()
+
"."
);
}
break
;
case
found:
if
(
null
!=
t
)
{
throw
new
Exception
(
"entity already existed, id: "
+
id
+
", class: "
+
cls
.
getCanonicalName
()
+
"."
);
}
break
;
default
:
break
;
case
not_found:
if
(
null
==
t
)
{
throw
new
Exception
(
"can not find entity id: "
+
id
+
", class: "
+
cls
.
getCanonicalName
()
+
"."
);
}
break
;
case
found:
if
(
null
!=
t
)
{
throw
new
Exception
(
"entity already existed, id: "
+
id
+
", class: "
+
cls
.
getCanonicalName
()
+
"."
);
}
break
;
default
:
break
;
}
return
t
;
}
...
...
@@ -245,14 +244,14 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
Predicate
p
=
cb
.
equal
(
root
.
get
(
field
.
getName
()),
flag
);
List
<
T
>
list
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
distinct
(
true
)).
setMaxResults
(
2
).
getResultList
();
switch
(
list
.
size
())
{
case
0
:
break
;
case
1
:
t
=
list
.
get
(
0
);
break
out
;
case
2
:
throw
new
Exception
(
"flag get multiple entity flag:"
+
flag
+
", class:"
+
cls
.
getName
()
+
", attribute:"
+
field
.
getName
()
+
"."
);
case
0
:
break
;
case
1
:
t
=
list
.
get
(
0
);
break
out
;
case
2
:
throw
new
Exception
(
"flag get multiple entity flag:"
+
flag
+
", class:"
+
cls
.
getName
()
+
", attribute:"
+
field
.
getName
()
+
"."
);
}
}
return
t
;
...
...
@@ -310,15 +309,15 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
cq
.
select
(
root
).
where
(
p
);
List
<
T
>
list
=
em
.
createQuery
(
cq
).
setMaxResults
(
2
).
getResultList
();
switch
(
list
.
size
())
{
case
0
:
break
;
case
1
:
t
=
list
.
get
(
0
);
break
out
;
default
:
throw
new
Exception
(
"flag get multiple entity flag:"
+
flag
+
", class:"
+
cls
.
getName
()
+
", attribute:"
+
field
.
getName
()
+
", restrict attrubte:"
+
singularAttribute
+
", restrict value:"
+
restrictValue
+
"."
);
case
0
:
break
;
case
1
:
t
=
list
.
get
(
0
);
break
out
;
default
:
throw
new
Exception
(
"flag get multiple entity flag:"
+
flag
+
", class:"
+
cls
.
getName
()
+
", attribute:"
+
field
.
getName
()
+
", restrict attrubte:"
+
singularAttribute
+
", restrict value:"
+
restrictValue
+
"."
);
}
}
return
t
;
...
...
@@ -940,6 +939,19 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return
new
ArrayList
<>(
os
);
}
public
<
T
extends
JpaObject
>
List
<
String
>
idsLessThanMax
(
Class
<
T
>
cls
,
String
attribute
,
Comparable
value
,
Integer
count
)
throws
Exception
{
EntityManager
em
=
this
.
get
(
cls
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
T
>
root
=
cq
.
from
(
cls
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
attribute
),
(
Comparable
)
value
);
List
<
String
>
os
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
JpaObject
.
id_FIELDNAME
)).
where
(
p
)).
setMaxResults
(
count
)
.
getResultList
();
List
<
String
>
list
=
new
ArrayList
<>(
os
);
return
list
;
}
public
<
T
extends
JpaObject
>
List
<
String
>
idsGreaterThan
(
Class
<
T
>
cls
,
String
attribute
,
Object
value
)
throws
Exception
{
EntityManager
em
=
this
.
get
(
cls
);
...
...
o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java
浏览文件 @
193e9680
...
...
@@ -135,9 +135,9 @@ public class ResourceFactory {
private
static
void
internal_driud_c3p0
()
throws
Exception
{
for
(
Entry
<
String
,
DataServer
>
entry
:
Config
.
nodes
().
dataServers
().
entrySet
())
{
DruidDataSourceC3P0Adapter
dataSource
=
new
DruidDataSourceC3P0Adapter
();
String
url
=
"jdbc:h2:tcp://"
+
entry
.
getKey
()
+
":"
+
entry
.
getValue
().
getTcpPort
()
+
"/X;JMX="
+
(
entry
.
getValue
().
getJmxEnable
()
?
"TRUE"
:
"FALSE"
)
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
String
url
=
"jdbc:h2:tcp://"
+
entry
.
getKey
()
+
":"
+
entry
.
getValue
().
getTcpPort
()
+
"/X;DEFAULT_LOCK_TIMEOUT=99999999;JMX="
+
(
entry
.
getValue
().
getJmxEnable
()
?
"TRUE"
:
"FALSE"
)
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
dataSource
.
setJdbcUrl
(
url
);
dataSource
.
setDriverClass
(
SlicePropertiesBuilder
.
driver_h2
);
dataSource
.
setPreferredTestQuery
(
SlicePropertiesBuilder
.
validationQueryOfUrl
(
url
));
...
...
@@ -164,9 +164,9 @@ public class ResourceFactory {
BasicDataSource
dataSource
=
new
BasicDataSource
();
String
url
=
"jdbc:h2:tcp://"
+
entry
.
getKey
()
+
":"
+
entry
.
getValue
().
getTcpPort
()
+
"/X;JMX="
+
(
entry
.
getValue
().
getJmxEnable
()
?
"TRUE"
:
"FALSE"
)
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
String
url
=
"jdbc:h2:tcp://"
+
entry
.
getKey
()
+
":"
+
entry
.
getValue
().
getTcpPort
()
+
"/X;DEFAULT_LOCK_TIMEOUT=99999999;JMX="
+
(
entry
.
getValue
().
getJmxEnable
()
?
"TRUE"
:
"FALSE"
)
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
dataSource
.
setDriverClassName
(
SlicePropertiesBuilder
.
driver_h2
);
dataSource
.
setUrl
(
url
);
dataSource
.
setInitialSize
(
0
);
...
...
@@ -188,9 +188,9 @@ public class ResourceFactory {
private
static
void
internal_driud
()
throws
Exception
{
for
(
Entry
<
String
,
DataServer
>
entry
:
Config
.
nodes
().
dataServers
().
entrySet
())
{
DruidDataSource
dataSource
=
new
DruidDataSource
();
String
url
=
"jdbc:h2:tcp://"
+
entry
.
getKey
()
+
":"
+
entry
.
getValue
().
getTcpPort
()
+
"/X;JMX="
+
(
entry
.
getValue
().
getJmxEnable
()
?
"TRUE"
:
"FALSE"
)
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
String
url
=
"jdbc:h2:tcp://"
+
entry
.
getKey
()
+
":"
+
entry
.
getValue
().
getTcpPort
()
+
"/X;DEFAULT_LOCK_TIMEOUT=99999999;JMX="
+
(
entry
.
getValue
().
getJmxEnable
()
?
"TRUE"
:
"FALSE"
)
+
";CACHE_SIZE="
+
(
entry
.
getValue
().
getCacheSize
()
*
1024
);
dataSource
.
setDriverClassName
(
SlicePropertiesBuilder
.
driver_h2
);
dataSource
.
setUrl
(
url
);
dataSource
.
setInitialSize
(
0
);
...
...
@@ -247,10 +247,10 @@ public class ResourceFactory {
private
static
void
processPlatformExecutors
()
throws
Exception
{
ExecutorService
[]
services
=
new
ExecutorService
[
Config
.
processPlatform
().
getExecutorCount
()];
for
(
int
i
=
0
;
i
<
Config
.
processPlatform
().
getExecutorCount
();
i
++)
{
//services[i] = Executors.newSingleThreadExecutor();
//
services[i] = Executors.newSingleThreadExecutor();
services
[
i
]
=
Executors
.
newFixedThreadPool
(
1
);
}
new
Resource
(
Config
.
RESOURCE_NODE_PROCESSPLATFORMEXECUTORS
,
services
);
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/LogMessage.java
已删除
100644 → 0
浏览文件 @
90e3f2ed
package
com.x.program.center
;
import
java.util.Date
;
public
class
LogMessage
{
private
String
remoteAddress
;
private
String
text
;
private
Date
dateTime
;
public
String
getRemoteAddress
()
{
return
remoteAddress
;
}
public
void
setRemoteAddress
(
String
remoteAddress
)
{
this
.
remoteAddress
=
remoteAddress
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
Date
getDateTime
()
{
return
dateTime
;
}
public
void
setDateTime
(
Date
dateTime
)
{
this
.
dateTime
=
dateTime
;
}
}
o2server/x_program_center/src/main/java/com/x/program/center/LogQueue.java
浏览文件 @
193e9680
package
com.x.program.center
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.queue.AbstractQueue
;
import
com.x.program.center.core.entity.PromptErrorLog
;
import
com.x.program.center.core.entity.ScheduleLog
;
import
com.x.program.center.core.entity.UnexpectedErrorLog
;
import
com.x.program.center.core.entity.WarnLog
;
...
...
@@ -16,39 +22,61 @@ public class LogQueue extends AbstractQueue<NameValuePair> {
protected
void
execute
(
NameValuePair
pair
)
{
try
{
if
(
StringUtils
.
equals
(
pair
.
getName
(),
PromptErrorLog
.
class
.
getName
()))
{
this
.
concretePromptErrorLog
(
pair
.
getValue
(
PromptErrorLog
.
class
));
PromptErrorLog
o
=
pair
.
getValue
(
PromptErrorLog
.
class
);
if
(
null
!=
o
)
{
this
.
concrete
(
PromptErrorLog
.
class
,
o
);
}
else
{
this
.
clean
(
PromptErrorLog
.
class
);
}
}
else
if
(
StringUtils
.
equals
(
pair
.
getName
(),
UnexpectedErrorLog
.
class
.
getName
()))
{
this
.
concreteUnexpectedErrorLog
(
pair
.
getValue
(
UnexpectedErrorLog
.
class
));
UnexpectedErrorLog
o
=
pair
.
getValue
(
UnexpectedErrorLog
.
class
);
if
(
null
!=
o
)
{
this
.
concrete
(
UnexpectedErrorLog
.
class
,
o
);
}
else
{
this
.
clean
(
UnexpectedErrorLog
.
class
);
}
}
else
if
(
StringUtils
.
equals
(
pair
.
getName
(),
WarnLog
.
class
.
getName
()))
{
this
.
concreteWarnLog
(
pair
.
getValue
(
WarnLog
.
class
));
WarnLog
o
=
pair
.
getValue
(
WarnLog
.
class
);
if
(
null
!=
o
)
{
this
.
concrete
(
WarnLog
.
class
,
o
);
}
else
{
this
.
clean
(
WarnLog
.
class
);
}
}
else
if
(
StringUtils
.
equals
(
pair
.
getName
(),
ScheduleLog
.
class
.
getName
()))
{
ScheduleLog
o
=
pair
.
getValue
(
ScheduleLog
.
class
);
if
(
null
!=
o
)
{
this
.
concrete
(
ScheduleLog
.
class
,
o
);
}
else
{
this
.
clean
(
ScheduleLog
.
class
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
concretePromptErrorLog
(
PromptErrorLog
o
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
PromptErrorLog
.
class
);
emc
.
persist
(
o
,
CheckPersistType
.
all
);
emc
.
commit
();
}
}
private
void
concreteUnexpectedErrorLog
(
UnexpectedErrorLog
o
)
throws
Exception
{
private
<
T
extends
JpaObject
>
void
concrete
(
Class
<
T
>
cls
,
T
o
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
UnexpectedErrorLog
.
clas
s
);
emc
.
beginTransaction
(
cl
s
);
emc
.
persist
(
o
,
CheckPersistType
.
all
);
emc
.
commit
();
}
}
private
void
concreteWarnLog
(
WarnLog
o
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
WarnLog
.
class
);
emc
.
persist
(
o
,
CheckPersistType
.
all
);
emc
.
commit
();
}
private
<
T
extends
JpaObject
>
void
clean
(
Class
<
T
>
cls
)
throws
Exception
{
List
<
String
>
ids
=
new
ArrayList
<>();
do
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Calendar
threshold
=
Calendar
.
getInstance
();
threshold
.
add
(
Calendar
.
DATE
,
-
5
);
ids
=
emc
.
idsLessThanMax
(
cls
,
JpaObject
.
createTime_FIELDNAME
,
threshold
.
getTime
(),
500
);
if
(!
ids
.
isEmpty
())
{
emc
.
beginTransaction
(
cls
);
emc
.
delete
(
cls
,
ids
);
emc
.
commit
();
}
}
}
while
(!
ids
.
isEmpty
());
}
}
o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java
浏览文件 @
193e9680
...
...
@@ -8,7 +8,23 @@ import java.util.concurrent.ConcurrentHashMap;
import
com.google.gson.internal.LinkedTreeMap
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.program.center.schedule.*
;
import
com.x.program.center.schedule.Area
;
import
com.x.program.center.schedule.Cleanup
;
import
com.x.program.center.schedule.CleanupCode
;
import
com.x.program.center.schedule.CollectLog
;
import
com.x.program.center.schedule.CollectMarket
;
import
com.x.program.center.schedule.CollectPerson
;
import
com.x.program.center.schedule.DingdingSyncOrganization
;
import
com.x.program.center.schedule.DingdingSyncOrganizationTrigger
;
import
com.x.program.center.schedule.FireSchedule
;
import
com.x.program.center.schedule.QiyeweixinSyncOrganization
;
import
com.x.program.center.schedule.QiyeweixinSyncOrganizationTrigger
;
import
com.x.program.center.schedule.RefreshApplications
;
import
com.x.program.center.schedule.TriggerAgent
;
import
com.x.program.center.schedule.WeLinkSyncOrganization
;
import
com.x.program.center.schedule.WeLinkSyncOrganizationTrigger
;
import
com.x.program.center.schedule.ZhengwuDingdingSyncOrganization
;
import
com.x.program.center.schedule.ZhengwuDingdingSyncOrganizationTrigger
;
public
class
ThisApplication
{
...
...
@@ -20,7 +36,7 @@ public class ThisApplication {
public
static
CenterQueue
centerQueue
=
new
CenterQueue
();
public
static
LogQueue
logQueue
;
public
static
LogQueue
logQueue
=
new
LogQueue
()
;
public
static
List
<
Object
>
dingdingSyncOrganizationCallbackRequest
=
new
ArrayList
<>();
...
...
@@ -37,7 +53,6 @@ public class ThisApplication {
LoggerFactory
.
setLevel
(
Config
.
logLevel
().
x_program_center
());
/* 20190927新报告机制 */
context
().
startQueue
(
centerQueue
);
logQueue
=
new
LogQueue
();
context
().
startQueue
(
logQueue
);
/* 政务钉钉拉入同步 */
...
...
@@ -75,11 +90,8 @@ public class ThisApplication {
CenterQueue
.
REFRESHAPPLICATIONSINTERVAL
);
// 运行间隔由300秒缩减到120秒
context
().
scheduleLocal
(
FireSchedule
.
class
,
180
,
120
);
context
().
scheduleLocal
(
CleanupScheduleLog
.
class
,
10
,
80
);
context
().
scheduleLocal
(
CleanupCode
.
class
,
10
,
60
*
30
);
context
().
scheduleLocal
(
CleanupPromptErrorLog
.
class
,
10
,
60
*
30
);
context
().
scheduleLocal
(
CleanupUnexpectedErrorLog
.
class
,
10
,
60
*
30
);
context
().
scheduleLocal
(
CleanupWarnLog
.
class
,
10
,
60
*
30
);
context
().
scheduleLocal
(
Cleanup
.
class
,
10
,
60
*
30
);
context
().
scheduleLocal
(
CollectPerson
.
class
,
10
,
60
*
30
);
context
().
scheduleLocal
(
CollectMarket
.
class
,
10
,
60
*
60
*
6
);
context
().
scheduleLocal
(
CollectLog
.
class
,
10
,
60
*
30
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/schedule/ActionReport.java
浏览文件 @
193e9680
package
com.x.program.center.jaxrs.schedule
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.
entity.annotation.CheckPersistType
;
import
com.x.base.core.
project.bean.NameValuePair
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.tools.StringTools
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.ScheduleLog
;
class
ActionReport
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
effectivePerson
.
isNotManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
emc
.
beginTransaction
(
ScheduleLog
.
class
);
ScheduleLog
log
=
Wi
.
copier
.
copy
(
wi
);
emc
.
persist
(
log
,
CheckPersistType
.
all
);
emc
.
commit
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
gson
.
fromJson
(
jsonElement
,
Wi
.
class
);
ScheduleLog
o
=
Wi
.
copier
.
copy
(
wi
);
/** 默认使用传递过来的id,如果不存在那么重新赋值 */
if
(
StringUtils
.
isEmpty
(
o
.
getId
()))
{
o
.
setId
(
StringTools
.
uniqueToken
());
}
NameValuePair
pair
=
new
NameValuePair
();
pair
.
setName
(
ScheduleLog
.
class
.
getName
());
pair
.
setValue
(
o
);
ThisApplication
.
logQueue
.
send
(
pair
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wi
extends
ScheduleLog
{
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/test/ActionTest1.java
浏览文件 @
193e9680
package
com.x.program.center.jaxrs.test
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map.Entry
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.config.CenterServer
;
import
com.x.base.core.project.config.CenterServers
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
...
...
@@ -19,38 +10,10 @@ class ActionTest1 extends BaseAction {
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(!
effectivePerson
.
isManager
())
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
Wo
wo
=
new
Wo
();
wo
.
applications
=
gson
.
fromJson
(
Config
.
resource_node_applications
(),
Applications
.
class
);
wo
.
resource_node_centersPirmaryNode
=
Config
.
resource_node_centersPirmaryNode
();
wo
.
resource_node_centersPirmaryPort
=
Config
.
resource_node_centersPirmaryPort
();
wo
.
resource_node_centersPirmarySslEnable
=
Config
.
resource_node_centersPirmarySslEnable
();
for
(
Entry
<
String
,
CenterServer
>
en
:
Config
.
nodes
().
centerServers
().
orderedEntry
())
{
wo
.
nodes_centerServers_ordered
.
add
(
en
.
getValue
());
}
wo
.
centerServers
=
Config
.
nodes
().
centerServers
();
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
GsonPropertyObject
{
private
Applications
applications
;
private
String
resource_node_centersPirmaryNode
;
private
Integer
resource_node_centersPirmaryPort
;
private
Boolean
resource_node_centersPirmarySslEnable
;
private
List
<
CenterServer
>
nodes_centerServers_ordered
=
new
ArrayList
<>();
private
CenterServers
centerServers
;
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/schedule/Cleanup.java
0 → 100644
浏览文件 @
193e9680
package
com.x.program.center.schedule
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.PromptErrorLog
;
import
com.x.program.center.core.entity.ScheduleLog
;
import
com.x.program.center.core.entity.UnexpectedErrorLog
;
import
com.x.program.center.core.entity.WarnLog
;
public
class
Cleanup
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
Cleanup
.
class
);
private
List
<
Class
<?
extends
JpaObject
>>
list
=
new
ArrayList
<>();
private
int
tag
=
0
;
public
Cleanup
()
{
list
.
add
(
ScheduleLog
.
class
);
list
.
add
(
PromptErrorLog
.
class
);
list
.
add
(
UnexpectedErrorLog
.
class
);
list
.
add
(
WarnLog
.
class
);
}
@Override
public
void
execute
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
try
{
if
(
pirmaryCenter
())
{
ThisApplication
.
logQueue
.
send
(
new
NameValuePair
(
list
.
get
((
tag
++)
%
list
.
size
()).
getName
(),
null
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
throw
new
JobExecutionException
(
e
);
}
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupPromptErrorLog.java
浏览文件 @
193e9680
package
com.x.program.center.schedule
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.PromptErrorLog
;
import
com.x.program.center.core.entity.PromptErrorLog_
;
public
class
CleanupPromptErrorLog
extends
BaseAction
{
...
...
@@ -27,36 +17,11 @@ public class CleanupPromptErrorLog extends BaseAction {
public
void
execute
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
try
{
if
(
pirmaryCenter
())
{
cleanupPromptErrorLog
(
);
ThisApplication
.
logQueue
.
send
(
new
NameValuePair
(
PromptErrorLog
.
class
.
getName
(),
null
)
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
throw
new
JobExecutionException
(
e
);
}
}
private
void
cleanupPromptErrorLog
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
EntityManager
em
=
emc
.
get
(
PromptErrorLog
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
PromptErrorLog
>
root
=
cq
.
from
(
PromptErrorLog
.
class
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
7
);
Predicate
p
=
cb
.
not
(
cb
.
greaterThan
(
root
.
get
(
PromptErrorLog_
.
createTime
),
cal
.
getTime
()));
cq
.
select
(
root
.
get
(
PromptErrorLog_
.
id
)).
where
(
p
);
List
<
String
>
list
=
em
.
createQuery
(
cq
).
getResultList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
i
%
100
==
0
)
{
emc
.
beginTransaction
(
PromptErrorLog
.
class
);
}
PromptErrorLog
o
=
emc
.
find
(
list
.
get
(
i
),
PromptErrorLog
.
class
);
emc
.
remove
(
o
);
if
((
i
%
100
==
99
)
||
(
i
==
(
list
.
size
()
-
1
)))
{
emc
.
commit
();
}
}
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupScheduleLog.java
已删除
100644 → 0
浏览文件 @
90e3f2ed
package
com.x.program.center.schedule
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
org.quartz.Job
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.program.center.Business
;
import
com.x.program.center.core.entity.ScheduleLog
;
import
com.x.program.center.core.entity.ScheduleLog_
;
public
class
CleanupScheduleLog
implements
Job
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CleanupScheduleLog
.
class
);
@Override
public
void
execute
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
try
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
this
.
clearScheduleLog
(
business
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
JobExecutionException
(
e
);
}
}
private
void
clearScheduleLog
(
Business
business
)
throws
Exception
{
List
<
ScheduleLog
>
list
=
new
ArrayList
<>();
do
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
EntityManager
em
=
emc
.
get
(
ScheduleLog
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
ScheduleLog
>
cq
=
cb
.
createQuery
(
ScheduleLog
.
class
);
Root
<
ScheduleLog
>
root
=
cq
.
from
(
ScheduleLog
.
class
);
Calendar
threshold
=
Calendar
.
getInstance
();
threshold
.
add
(
Calendar
.
DATE
,
-
7
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
ScheduleLog_
.
createTime
),
threshold
.
getTime
());
list
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
)).
setMaxResults
(
2000
).
getResultList
();
if
(!
list
.
isEmpty
())
{
emc
.
beginTransaction
(
ScheduleLog
.
class
);
list
.
stream
().
forEach
(
o
->
{
try
{
emc
.
remove
(
o
,
CheckRemoveType
.
all
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
emc
.
commit
();
}
}
while
(!
list
.
isEmpty
());
}
}
\ No newline at end of file
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupUnexpectedErrorLog.java
浏览文件 @
193e9680
package
com.x.program.center.schedule
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.UnexpectedErrorLog
;
import
com.x.program.center.core.entity.UnexpectedErrorLog_
;
public
class
CleanupUnexpectedErrorLog
extends
BaseAction
{
...
...
@@ -27,7 +17,7 @@ public class CleanupUnexpectedErrorLog extends BaseAction {
public
void
execute
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
try
{
if
(
pirmaryCenter
())
{
cleanupUnexpectedErrorLog
(
);
ThisApplication
.
logQueue
.
send
(
new
NameValuePair
(
UnexpectedErrorLog
.
class
.
getName
(),
null
)
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
...
...
@@ -35,27 +25,4 @@ public class CleanupUnexpectedErrorLog extends BaseAction {
}
}
private
void
cleanupUnexpectedErrorLog
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
EntityManager
em
=
emc
.
get
(
UnexpectedErrorLog
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
UnexpectedErrorLog
>
root
=
cq
.
from
(
UnexpectedErrorLog
.
class
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
7
);
Predicate
p
=
cb
.
not
(
cb
.
greaterThan
(
root
.
get
(
UnexpectedErrorLog_
.
createTime
),
cal
.
getTime
()));
cq
.
select
(
root
.
get
(
UnexpectedErrorLog_
.
id
)).
where
(
p
);
List
<
String
>
list
=
em
.
createQuery
(
cq
).
getResultList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
i
%
100
==
0
)
{
emc
.
beginTransaction
(
UnexpectedErrorLog
.
class
);
}
UnexpectedErrorLog
o
=
emc
.
find
(
list
.
get
(
i
),
UnexpectedErrorLog
.
class
);
emc
.
remove
(
o
);
if
((
i
%
100
==
99
)
||
(
i
==
(
list
.
size
()
-
1
)))
{
emc
.
commit
();
}
}
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CleanupWarnLog.java
浏览文件 @
193e9680
package
com.x.program.center.schedule
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.WarnLog
;
import
com.x.program.center.core.entity.WarnLog_
;
public
class
CleanupWarnLog
extends
BaseAction
{
...
...
@@ -27,35 +17,11 @@ public class CleanupWarnLog extends BaseAction {
public
void
execute
(
JobExecutionContext
arg0
)
throws
JobExecutionException
{
try
{
if
(
pirmaryCenter
())
{
cleanupWarnLog
(
);
ThisApplication
.
logQueue
.
send
(
new
NameValuePair
(
WarnLog
.
class
.
getName
(),
null
)
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
throw
new
JobExecutionException
(
e
);
}
}
private
void
cleanupWarnLog
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
EntityManager
em
=
emc
.
get
(
WarnLog
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
WarnLog
>
root
=
cq
.
from
(
WarnLog
.
class
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
7
);
Predicate
p
=
cb
.
not
(
cb
.
greaterThan
(
root
.
get
(
WarnLog_
.
createTime
),
cal
.
getTime
()));
cq
.
select
(
root
.
get
(
WarnLog_
.
id
)).
where
(
p
);
List
<
String
>
list
=
em
.
createQuery
(
cq
).
getResultList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
i
%
100
==
0
)
{
emc
.
beginTransaction
(
WarnLog
.
class
);
}
WarnLog
o
=
emc
.
find
(
list
.
get
(
i
),
WarnLog
.
class
);
emc
.
remove
(
o
);
if
((
i
%
100
==
99
)
||
(
i
==
(
list
.
size
()
-
1
)))
{
emc
.
commit
();
}
}
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/schedule/CollectMarket.java
浏览文件 @
193e9680
package
com.x.program.center.schedule
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.config.CenterServer
;
import
com.x.base.core.project.config.Collect
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ActionResponse
;
import
com.x.base.core.project.connection.ConnectionAction
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.HttpToken
;
import
com.x.base.core.project.http.WrapOutBoolean
;
import
com.x.base.core.project.jaxrs.WrapString
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.Host
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.organization.core.entity.Person
;
import
com.x.program.center.Business
;
import
com.x.program.center.core.entity.Application
;
import
com.x.program.center.core.entity.Attachment
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.eclipse.jetty.deploy.App
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
CollectMarket
extends
BaseAction
{
...
...
o2server/x_program_center_core_entity/src/main/java/com/x/program/center/core/entity/PersistenceProperties.java
浏览文件 @
193e9680
...
...
@@ -16,21 +16,21 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
public
static
final
String
table
=
"CTE_SCHEDULELOG"
;
}
public
static
class
ClockTimer
{
public
static
final
String
table
=
"CTE_CLOCKTIMER"
;
}
public
static
class
ClockTimerLog
{
public
static
final
String
table
=
"CTE_CLOCKTIMERLOG"
;
}
public
static
class
ClockSchedule
{
public
static
final
String
table
=
"CTE_CLOCKSCHEDULE"
;
}
public
static
class
ClockScheduleLog
{
public
static
final
String
table
=
"CTE_CLOCKSCHEDULELOG"
;
}
//
public static class ClockTimer {
//
public static final String table = "CTE_CLOCKTIMER";
//
}
//
//
public static class ClockTimerLog {
//
public static final String table = "CTE_CLOCKTIMERLOG";
//
}
//
//
public static class ClockSchedule {
//
public static final String table = "CTE_CLOCKSCHEDULE";
//
}
//
//
public static class ClockScheduleLog {
//
public static final String table = "CTE_CLOCKSCHEDULELOG";
//
}
public
static
class
PromptErrorLog
{
public
static
final
String
table
=
"CTE_PROMPTERRORLOG"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录